rc_t vdb_info( Vector * schema_list, dump_format_t format, const VDBManager *mgr, const char * acc_or_path, struct num_gen * rows ) { rc_t rc = 0; VSchema * schema = NULL; vdh_parse_schema( mgr, &schema, schema_list ); if ( format == df_sql ) rc = vdb_info_print_sql_header( acc_or_path ); if ( rows != NULL && !num_gen_empty( rows ) ) { const struct num_gen_iter * iter; rc = num_gen_iterator_make( rows, &iter ); if ( rc == 0 ) { int64_t max_row; rc = num_gen_iterator_max( iter, &max_row ); if ( rc == 0 ) { int64_t id; uint8_t digits = digits_of( max_row ); while ( rc == 0 && num_gen_iterator_next( iter, &id, &rc ) ) { char acc[ 64 ]; size_t num_writ; rc_t rc1 = -1; switch ( digits ) { case 1 : rc1 = string_printf ( acc, sizeof acc, &num_writ, "%s%ld", acc_or_path, id ); break; case 2 : rc1 = string_printf ( acc, sizeof acc, &num_writ, "%s%.02ld", acc_or_path, id ); break; case 3 : rc1 = string_printf ( acc, sizeof acc, &num_writ, "%s%.03ld", acc_or_path, id ); break; case 4 : rc1 = string_printf ( acc, sizeof acc, &num_writ, "%s%.04ld", acc_or_path, id ); break; case 5 : rc1 = string_printf ( acc, sizeof acc, &num_writ, "%s%.05ld", acc_or_path, id ); break; case 6 : rc1 = string_printf ( acc, sizeof acc, &num_writ, "%s%.06ld", acc_or_path, id ); break; case 7 : rc1 = string_printf ( acc, sizeof acc, &num_writ, "%s%.07ld", acc_or_path, id ); break; case 8 : rc1 = string_printf ( acc, sizeof acc, &num_writ, "%s%.08ld", acc_or_path, id ); break; case 9 : rc1 = string_printf ( acc, sizeof acc, &num_writ, "%s%.09ld", acc_or_path, id ); break; } if ( rc1 == 0 ) rc = vdb_info_1( schema, format, mgr, acc, acc_or_path ); } } num_gen_iterator_destroy( iter ); } } else rc = vdb_info_1( schema, format, mgr, acc_or_path, acc_or_path ); if ( schema != NULL ) VSchemaRelease( schema ); return rc; }
bool check_equal_collections(I a, I b, J x, J y) { int i = 0; while(a != b) { if(x == y) { BOOST_LIGHTWEIGHT_TEST_OSTREAM << " Unexpected end of second sequence" << std::endl; return false; } if(*a != *x) { BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Error occured in position " << i << " of the collection." << std::endl; BOOST_LIGHTWEIGHT_TEST_OSTREAM << "First value was " << std::setprecision(digits_of(x)) << std::scientific << *a << std::endl; BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Second value was " << std::setprecision(digits_of(x)) << std::scientific << *x << std::endl; return false; } ++a; ++x; } return true; }