def _get_all_sequences(self, data_dict): debug_message('generating sequences') sequences = [] for name in data_dict.sequence_names: min_value, max_value, step, cycled, ordered, cache_size = data_dict.sequences[name] seq = OracleSequence(name, min_value, max_value, step, cycled, ordered, cache_size) sequences.append(seq) self.ddlSource.getDDLScript('SEQUENCE', name) return sequences def _get_all_jobs(self, data): debug_message('generating jobs') jobs = [] for job, log_user, priv_user, schema_user, total_time, broken, interval, failures, what in data.jobs: jobs.append(OracleJob(job, log_user, priv_user, schema_user, total_time, broken, interval, failures, what)) return jobs if __name__ == '__main__': import cx_Oracle import orasdict from osdconfig import OSDConfig #connection = cx_Oracle.connect('s0/asgaard') cfg = OSDConfig() cfg.connection = cx_Oracle.connect('s0/asgaard') cfg.dictionary = orasdict.OraSchemaDataDictionary(cfg) schema = OracleSchema(cfg)
"""Execute query end return results in array""" cur = self.cfg.connection.cursor() cur.execute(querystr) results = cur.fetchall() cur.close() return results def _prepareStatement(self, stmt): if self.cfg.useOwners == False: stmt = stmt.userSql() else: if len(self.cfg.owners) == 0: stmt = stmt.ownerSql() else: inClause = [] for i in self.cfg.owners: inClause.append("'%s'" % i.upper()) stmt = stmt.ownerSql(inClause="%s, %s" % (self.cfg.currentUser, ','.join(inClause))) return stmt if __name__ == '__main__': import cx_Oracle from osdconfig import OSDConfig c = OSDConfig() c.connection = cx_Oracle.connect('buap/p6a6u3b0@cpd_prod') s = OraSchemaDataDictionary(c) #print s.all_java_sources