def oracallback(self, row):
        # Beware that V$SQL.SQL_TEXT is VARCHAR2(1000)
        sql_text = row[3]

        if sql_text == None:
            return

        # TODO: Seems that sql_fulltext not empty only if overflow of sql_text.
        if len(sql_text) == 1000:
            sql_text = str(row[4])

        sys.stderr.write("self.m_database=%s sql_text=%s\n" %
                         (self.m_database_name, sql_text))

        # Mais c est absurde car ici on connait la base de donnees et le schema, et donc
        # on sait quelle est la nature des dependances. Donc on doit generer
        # non pas des "sql/sheet" mais des "oracle/table", "oracle/view" ou "oracle/synonym".
        # Ou alors:
        # entity.py?type=sql/entity?id="select ..."&bdtype=oracle&bd=xe
        # entity.py?type=sql/entity?id="select ..."&bdtype=sqlserver&dsn=MySqlServer
        # ... ou bien pas de bdtype si ca vient d un fichier.
        # On sort donc de notre modele en ajoutant des mots-clefs libres.
        # C est a dire que quand on va cliquer sur cet URI (query + autre chose),
        # on va avoir un script commun (Les dependances, mais les tables meritent un traitement particulier),
        # et eventuellement des scripts specifiques.

        nodeSqlQuery = oracle_query.MakeUri(sql_text, self.m_database_name)

        self.m_grph.add((self.m_node_oradb, self.m_propSqlQuery, nodeSqlQuery))
Exemple #2
0
def Main():
    # cgiEnv = lib_common.CgiEnv()
    cgiEnv = lib_oracle.OracleEnv()

    grph = cgiEnv.GetGraph()

    sqlQuery = sql_query.GetEnvArgs(cgiEnv)
    dbNam = cgiEnv.m_entity_id_dict["Db"]

    # This is simply the user.
    oraSchema = cgiEnv.OracleSchema()

    nodeSqlQuery = oracle_query.MakeUri(sqlQuery, dbNam)

    propSheetToQuery = lib_common.MakeProp("Table dependency")

    list_of_table_names = lib_sql.TableDependencies(sqlQuery)

    list_of_nodes = oracle_query.QueryToNodesList(sqlQuery, {"Db": dbNam},
                                                  list_of_table_names,
                                                  oraSchema)

    for nodTab in list_of_nodes:
        grph.add((nodeSqlQuery, propSheetToQuery, nodTab))

    cgiEnv.OutCgiRdf()
Exemple #3
0
    def oracallback(self, row):
        # Beware that V$SQL.SQL_TEXT is VARCHAR2(1000)
        sql_text = row[3]

        if sql_text == None:
            return

        # TODO: Seems that sql_fulltext not empty only if overflow of sql_text.
        if len(sql_text) == 1000:
            sql_text = str(row[4])

        logging.debug("self.m_database=%s sql_text=%s", self.m_database_name,
                      sql_text)

        node_sql_query = oracle_query.MakeUri(sql_text, self.m_database_name)

        self.m_grph.add(
            (self.m_node_oradb, self.m_propSqlQuery, node_sql_query))
def Main():
    cgiEnv = lib_oracle.OracleEnv()

    grph = cgiEnv.GetGraph()

    sql_query = cgiEnv.m_entity_id_dict["Query"]
    db_nam = cgiEnv.m_entity_id_dict["Db"]

    # This is simply the user.
    ora_schema = cgiEnv.OracleSchema()

    node_sql_query = oracle_query.MakeUri(sql_query, db_nam)

    prop_sheet_to_query = lib_common.MakeProp("Table dependency")

    list_of_table_names = lib_sql.TableDependencies(sql_query)

    list_of_nodes = oracle_query.QueryToNodesList({"Db": db_nam}, list_of_table_names, ora_schema)

    for nod_tab in list_of_nodes:
        grph.add((node_sql_query, prop_sheet_to_query, nod_tab))

    cgiEnv.OutCgiRdf()