fn list_tables(session: *mut WtSession, verbosity: i8) -> () {

    // WT_CURSOR*
    let mut cursor: *mut WtCursor = ptr::null_mut();

    // Variables
    let table_name = CString::new("table:_mdb_catalog").unwrap();

    let mut refetched_key: i64 = 0;
    let mut refetched_value: *mut u8 = ptr::null_mut();
    let mut refetched_len: usize = 0;
    unsafe {
        wt_err(cursor_open(session,
            table_name.as_ptr(),
            ptr::null_mut(),
            ptr::null(),
            &mut cursor));
        if verbosity == 1 {
            println!("namespaces: ")
        }
        while wt_err(cursor_next(cursor)) == 0 {
            wt_err(cursor_get_key_i64(cursor, &mut refetched_key));
            wt_err(cursor_get_value_item(cursor, &mut refetched_value, &mut refetched_len));
            let slicey = slice::from_raw_parts(refetched_value, refetched_len);
            let rdoc = decode_document(&mut Cursor::new(slicey.to_vec()));
            if rdoc.is_err() {
                // TODO: Fix BSON type 19 = Decimal128 upstream too
                println!("{}", Red.paint("Could not decode a DB (e.g. Decimal128, perhaps in a document validator), skipping and continuing"));
                continue;
            }
            let doc = rdoc.unwrap();
            let file = doc.get("ident");
            if file != None {
                let ns = doc.get("ns").unwrap();
                let print_ns = format!("{}", Cyan.paint(ns.to_string().replace("\"","")));
                if verbosity > 1 {
                    println!("namespace {} is file {}",
                             print_ns,
                             Blue.paint(file.unwrap().to_string().replace("\"","")));
                    if doc.get("idxIdent") != None {
                        let idxdoc = doc.get("idxIdent").unwrap();
                        println!("indexes:");
                        for (k,v) in idxdoc.to_json().as_object().unwrap() {
                            println!("\t{} : {}", k, v);
                        }
                    }
                    println!("")
                }
                else if verbosity > 0 {
                    println!("  {}", print_ns);
                }
            }
        }
        cursor_close(cursor);
    }
}
/// Lists the namespace -> (collection, indexes) mappings of a WiredTiger db_path
Lists the namespace -> (collection, indexes) mappings of a WiredTiger db_path
Lists the namespace - > ( collection indexes ) mappings of a WiredTiger db_path
fn list_tables(session: *mut WtSession, verbosity: i8) -> () {
    // WT_CURSOR*
    let mut cursor: *mut WtCursor = ptr::null_mut();
    // Variables
    let table_name = CString::new("table:_mdb_catalog").unwrap();
    let mut refetched_key: i64 = 0;
    let mut refetched_value: *mut u8 = ptr::null_mut();
    let mut refetched_len: usize = 0;
    unsafe {
        wt_err(cursor_open(session,
            table_name.as_ptr(),
            ptr::null_mut(),
            ptr::null(),
            &mut cursor));
        if verbosity == 1 {
            println!("namespaces: ")
        }
        while wt_err(cursor_next(cursor)) == 0 {
            wt_err(cursor_get_key_i64(cursor, &mut refetched_key));
            wt_err(cursor_get_value_item(cursor, &mut refetched_value, &mut refetched_len));
            let slicey = slice::from_raw_parts(refetched_value, refetched_len);
            let rdoc = decode_document(&mut Cursor::new(slicey.to_vec()));
            if rdoc.is_err() {
                // TODO: Fix BSON type 19 = Decimal128 upstream too
                println!("{}", Red.paint("Could not decode a DB (e.g. Decimal128, perhaps in a document validator), skipping and continuing"));
                continue;
            }
            let doc = rdoc.unwrap();
            let file = doc.get("ident");
            if file != None {
                let ns = doc.get("ns").unwrap();
                let print_ns = format!("{}", Cyan.paint(ns.to_string().replace("\"","")));
                if verbosity > 1 {
                    println!("namespace {} is file {}",
                             print_ns,
                             Blue.paint(file.unwrap().to_string().replace("\"","")));
                    if doc.get("idxIdent") != None {
                        let idxdoc = doc.get("idxIdent").unwrap();
                        println!("indexes:");
                        for (k,v) in idxdoc.to_json().as_object().unwrap() {
                            println!("\t{} : {}", k, v);
                        }
                    }
                    println!("")
                }
                else if verbosity > 0 {
                    println!("  {}", print_ns);
                }
            }
        }
        cursor_close(cursor);
    }
}
fn list_tables ( session : * mut WtSession , verbosity : i8 ) -> ( ) { // WT_CURSOR* let mut cursor : * mut WtCursor = ptr :: null_mut ( ) ; // Variables let table_name = CString :: new ( " " ) . unwrap ( ) ; let mut refetched_key : i64 = 0 ; let mut refetched_value : * mut u8 = ptr :: null_mut ( ) ; let mut refetched_len : usize = 0 ; unsafe { wt_err ( cursor_open ( session , table_name . as_ptr ( ) , ptr :: null_mut ( ) , ptr :: null ( ) , & mut cursor ) ) ; if verbosity == 1 { println ! ( " " ) } while wt_err ( cursor_next ( cursor ) ) == 0 { wt_err ( cursor_get_key_i64 ( cursor , & mut refetched_key ) ) ; wt_err ( cursor_get_value_item ( cursor , & mut refetched_value , & mut refetched_len ) ) ; let slicey = slice :: from_raw_parts ( refetched_value , refetched_len ) ; let rdoc = decode_document ( & mut Cursor :: new ( slicey . to_vec ( ) ) ) ; if rdoc . is_err ( ) { // TODO: Fix BSON type 19 = Decimal128 upstream too println ! ( " " Red paint ( " " ) ) ; continue ; } let doc = rdoc . unwrap ( ) ; let file = doc . get ( " " ) ; if file != None { let ns = doc . get ( " " ) . unwrap ( ) ; let print_ns = format ! ( " " Cyan paint ( ns to_string ( ) replace ( " \" " " " ) ) ) ; if verbosity > 1 { println ! ( " " print_ns Blue paint ( file unwrap ( ) to_string ( ) replace ( " \" " " " ) ) ) ; if doc . get ( " " ) != None { let idxdoc = doc . get ( " " ) . unwrap ( ) ; println ! ( " " ) ; for ( k , v ) in idxdoc . to_json ( ) . as_object ( ) . unwrap ( ) { println ! ( " \t " k v ) ; } } println ! ( " " ) } else if verbosity > 0 { println ! ( " " print_ns ) ; } } } cursor_close ( cursor ) ; } }
Lists the namespace -> (collection, indexes) mappings of a WiredTiger db_path
Lists the namespace - > ( collection indexes ) mappings of a WiredTiger db_path
session
*mut WtSession
verbosity
i8