pub fn fetch(ctxt: &Context) -> Result<TablesMetadata> {
    let mut table_map: TablesMetadata = BTreeMap::new();
    let db_ctxt = ctxt.db_context();
    let mut common_create_params = db_ctxt.init_common_create_params()?;
    common_create_params.set_encoding("UTF-8")?;
    common_create_params.set_nchar_encoding("UTF-8")?;
    common_create_params.set_create_mode(flags::DPI_MODE_CREATE_EVENTS);
    let conn = Connection::create(
        db_ctxt,
        Some(ctxt.username()),
        Some(ctxt.password()),
        Some(ctxt.conn_string()),
        Some(common_create_params),
        None,
    )?;

    let user_tables = conn.prepare_stmt(Some(TABLE_NAMES), None, false)?;
    let _ = user_tables.execute(flags::DPI_MODE_EXEC_DEFAULT)?;
    let (mut found, _) = user_tables.fetch()?;

    while found {
        let (_id_type, data) = user_tables.get_query_value(1)?;
        table_map.insert(data.get_string(), Default::default());
        let (f, _) = user_tables.fetch()?;
        found = f;
    }

    for (table, rows) in &mut table_map {
        let table_desc = conn.prepare_stmt(Some(DESC), None, false)?;
        let table_name_var = conn.new_var(Varchar, Bytes, 1, 256, false, false)?;
        table_name_var.set_from_bytes(0, table)?;
        table_desc.bind_by_name(":table_name", &table_name_var)?;

        let cols = table_desc.execute(flags::DPI_MODE_EXEC_DEFAULT)?;
        let (mut found, mut buffer_row_index) = table_desc.fetch()?;

        while found {
            let mut row_data = Vec::new();
            for i in 1..=cols {
                let mut query_data_by_col: ColumnMetadata = Default::default();
                let query_info = table_desc.get_query_info(i)?;
                let (_, data) = table_desc.get_query_value(i)?;
                query_data_by_col.set_column_name(query_info.name());
                query_data_by_col.set_type_info(query_info.type_info());
                if !data.null() {
                    query_data_by_col.set_data(Some(data));
                }
                row_data.push(query_data_by_col);
            }

            rows.insert(buffer_row_index, row_data);
            let (f, b) = table_desc.fetch()?;
            found = f;
            buffer_row_index = b;
        }
    }

    user_tables.close(None)?;

    Ok(table_map)
}
/// Fetch a map of tables column metadata from the database described by the given `Context`.
Fetch a map of tables column metadata from the database described by the given `Context`.
Fetch a map of tables column metadata from the database described by the given ` Context ` .
pub fn fetch(ctxt: &Context) -> Result<TablesMetadata> {
    let mut table_map: TablesMetadata = BTreeMap::new();
    let db_ctxt = ctxt.db_context();
    let mut common_create_params = db_ctxt.init_common_create_params()?;
    common_create_params.set_encoding("UTF-8")?;
    common_create_params.set_nchar_encoding("UTF-8")?;
    common_create_params.set_create_mode(flags::DPI_MODE_CREATE_EVENTS);
    let conn = Connection::create(
        db_ctxt,
        Some(ctxt.username()),
        Some(ctxt.password()),
        Some(ctxt.conn_string()),
        Some(common_create_params),
        None,
    )?;
    let user_tables = conn.prepare_stmt(Some(TABLE_NAMES), None, false)?;
    let _ = user_tables.execute(flags::DPI_MODE_EXEC_DEFAULT)?;
    let (mut found, _) = user_tables.fetch()?;
    while found {
        let (_id_type, data) = user_tables.get_query_value(1)?;
        table_map.insert(data.get_string(), Default::default());
        let (f, _) = user_tables.fetch()?;
        found = f;
    }
    for (table, rows) in &mut table_map {
        let table_desc = conn.prepare_stmt(Some(DESC), None, false)?;
        let table_name_var = conn.new_var(Varchar, Bytes, 1, 256, false, false)?;
        table_name_var.set_from_bytes(0, table)?;
        table_desc.bind_by_name(":table_name", &table_name_var)?;
        let cols = table_desc.execute(flags::DPI_MODE_EXEC_DEFAULT)?;
        let (mut found, mut buffer_row_index) = table_desc.fetch()?;
        while found {
            let mut row_data = Vec::new();
            for i in 1..=cols {
                let mut query_data_by_col: ColumnMetadata = Default::default();
                let query_info = table_desc.get_query_info(i)?;
                let (_, data) = table_desc.get_query_value(i)?;
                query_data_by_col.set_column_name(query_info.name());
                query_data_by_col.set_type_info(query_info.type_info());
                if !data.null() {
                    query_data_by_col.set_data(Some(data));
                }
                row_data.push(query_data_by_col);
            }
            rows.insert(buffer_row_index, row_data);
            let (f, b) = table_desc.fetch()?;
            found = f;
            buffer_row_index = b;
        }
    }
    user_tables.close(None)?;
    Ok(table_map)
}
pub fn fetch ( ctxt : & Context ) -> Result < TablesMetadata > { let mut table_map : TablesMetadata = BTreeMap :: new ( ) ; let db_ctxt = ctxt . db_context ( ) ; let mut common_create_params = db_ctxt . init_common_create_params ( ) ? ; common_create_params . set_encoding ( " " ) ? ; common_create_params . set_nchar_encoding ( " " ) ? ; common_create_params . set_create_mode ( flags :: DPI_MODE_CREATE_EVENTS ) ; let conn = Connection :: create ( db_ctxt , Some ( ctxt . username ( ) ) , Some ( ctxt . password ( ) ) , Some ( ctxt . conn_string ( ) ) , Some ( common_create_params ) , None , ) ? ; let user_tables = conn . prepare_stmt ( Some ( TABLE_NAMES ) , None , false ) ? ; let _ = user_tables . execute ( flags :: DPI_MODE_EXEC_DEFAULT ) ? ; let ( mut found , _ ) = user_tables . fetch ( ) ? ; while found { let ( _id_type , data ) = user_tables . get_query_value ( 1 ) ? ; table_map . insert ( data . get_string ( ) , Default :: default ( ) ) ; let ( f , _ ) = user_tables . fetch ( ) ? ; found = f ; } for ( table , rows ) in & mut table_map { let table_desc = conn . prepare_stmt ( Some ( DESC ) , None , false ) ? ; let table_name_var = conn . new_var ( Varchar , Bytes , 1 , 256 , false , false ) ? ; table_name_var . set_from_bytes ( 0 , table ) ? ; table_desc . bind_by_name ( " " , & table_name_var ) ? ; let cols = table_desc . execute ( flags :: DPI_MODE_EXEC_DEFAULT ) ? ; let ( mut found , mut buffer_row_index ) = table_desc . fetch ( ) ? ; while found { let mut row_data = Vec :: new ( ) ; for i in 1 ..= cols { let mut query_data_by_col : ColumnMetadata = Default :: default ( ) ; let query_info = table_desc . get_query_info ( i ) ? ; let ( _ , data ) = table_desc . get_query_value ( i ) ? ; query_data_by_col . set_column_name ( query_info . name ( ) ) ; query_data_by_col . set_type_info ( query_info . type_info ( ) ) ; if ! data . null ( ) { query_data_by_col . set_data ( Some ( data ) ) ; } row_data . push ( query_data_by_col ) ; } rows . insert ( buffer_row_index , row_data ) ; let ( f , b ) = table_desc . fetch ( ) ? ; found = f ; buffer_row_index = b ; } } user_tables . close ( None ) ? ; Ok ( table_map ) }
Fetch a map of tables column metadata from the database described by the given `Context`.
Fetch a map of tables column metadata from the database described by the given ` Context ` .
ctxt
&Context