(list<string>, it, tokens) {
114 if(it != tokens.end()) {
139string::size_type offs1 = s.find_first_of(
"(");
140 if(offs1 != string::npos) {
141string::size_type offs2 = s.find_first_of(
")");
142 if(offs2 == string::npos || offs2 < offs1) {
146 const char*ls = s.c_str() + offs1;
147descr->
length= ::atoi(ls);
184 unsignedline_idx = 0;
193 string msg=
"Cannot open config file: ";
198 for( ;fi.good(); ++line_idx) {
202 const char* s = line.c_str();
203 for(;
isspace((
unsigned char)(*s)); ++s) {}
205 if(*s == 0 || *s ==
'#')
243 booldump_lob_storage);
255arg_desc->SetUsageContext(
GetArguments().GetProgramBasename(),
258arg_desc->AddPositional(
"dbname",
261arg_desc->AddPositional(
"confname",
262 "BDB database structure configuration file.\n" 263 "(Use 'blob' or 'lob' to dump LOB storage).",
266arg_desc->AddOptionalKey(
"k",
268 "File key value.(Dumps record for only this key)",
271arg_desc->AddOptionalKey(
"cs",
273 "Column separator string (default:TAB)",
276arg_desc->AddOptionalKey(
"q",
281arg_desc->AddOptionalKey(
"bfile",
283 "Dump BLOB to file (Use with -k)",
286arg_desc->AddOptionalKey(
"ofile",
288 "All records dumped into another database (append mode)",
291arg_desc->AddFlag(
"nl",
"Do NOT print field labels(names)");
292arg_desc->AddFlag(
"bt",
"Display BLOB as text (default: HEX)");
293arg_desc->AddFlag(
"bf",
"Display full BLOB");
304 booldump_lob_storage)
306 const string& db_name = args[
"dbname"].AsString();
313unique_ptr<CBDB_File> db_file;
314unique_ptr<CBDB_BLobFile> db_blob_file;
315unique_ptr<CBDB_File> db_out_file;
319 if(dump_lob_storage) {
323dump_file = db_blob_file.get();
327dump_file->
BindKey(
"id", field);
335 if(dump_lob_storage) {
337dump_file = db_blob_file.get();
342dump_file = db_file.get();
350 boolstruct_created =
false;
353struct_created =
true;
357 if(it->length == 0) {
361 if(it->is_primary_key) {
363dump_file->
BindKey(it->field_name.c_str(),
373dump_file->
BindData(it->field_name.c_str(),
381 if(!struct_created) {
421fdump.
SetQuery(args[
"q"].AsString());
424 if(args[
"bfile"]) {
428 if(args[
"ofile"]) {
429 const string& out_fname = args[
"ofile"].AsString();
433db_out_file->SetFieldOwnership(
true);
434db_out_file->DuplicateStructure(*dump_file);
442 const string& key_str = args[
"k"].AsString();
448 unsignedfield_count = key_buf->
FieldCount();
450 if(field_count > 1) {
455 ITERATE(list<string>, it, keys) {
457 if(++
cnt== field_count)
461cur.
From<< key_str;
480 const string& conf_name = args[
"confname"].AsString();
483 boolblob_store =
false;
492 Dump(args, parser, blob_store);
496 NcbiCerr<<
"Error: DBD errno exception:"<< ex.what();
501 NcbiCerr<<
"Error: DBD library exception:"<< ex.what();
509 int main(
intargc,
const char* argv[])
BDB library BLOB support.
Berkeley BDB file cursor.
int main(int argc, const char *argv[])
Exception specifications for BDB library.
BDB File covertion into text.
Berkeley DB BLOB File class.
BDB Data Field Buffer manager class.
const TFileStructure & GetStructure() const
CBDB_ConfigStructureParser()
bool ParseStructureLine(const string &line, SBDB_FieldDescription *descr)
Parse structure file line Returns TRUE if parsing is successfull.
TFileStructure & SetStructure()
bool IsKeyDuplicates() const
bool IsBlobStorage() const
void ParseConfigFile(const string &fname)
vector< SBDB_FieldDescription > TFileStructure
TFileStructure m_FileStructure
BDB errno exception class.
Class factory for BDB field types.
Base class for constructing BDB fields.
Berkeley DB file cursor class.
BDB file dumper application.
void Init(void)
Initialize the application.
void Dump(const CArgs &args, CBDB_ConfigStructureParser &parser, bool dump_lob_storage)
int Run(void)
Run the application.
Utility class to convert DBD files into text files.
The NCBI C++ standard methods for dealing with std::string.
virtual const CArgs & GetArgs(void) const
Get parsed command line arguments.
int AppMain(int argc, const char *const *argv, const char *const *envp=0, EAppDiagStream diag=eDS_Default, const char *conf=NcbiEmptyCStr, const string &name=NcbiEmptyString)
Main function (entry point) for the NCBI application.
virtual void SetupArgDescriptions(CArgDescriptions *arg_desc)
Setup the command line argument descriptions.
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
const CNcbiArguments & GetArguments(void) const
Get the application's cached unprocessed command-line arguments.
@ eNotNullable
Value cannot be null.
@ eNullable
Value can be null.
@ eString
An arbitrary string.
void SetQuery(const string &query_str)
Set query filter.
void SetValueFormatting(EValueFormatting vf)
void SetCondition(ECondition cond_from, ECondition cond_to=eNotSet)
Set search condition(type of interval)
void SetFieldOwnership(bool own_fields)
Fields deletion is managed by the class when own_fields is TRUE.
unsigned GetRecordsDumped() const
Return number of records processed by Dump.
void SetColumnNames(EPrintFieldNames print_names)
Control field names printing.
void Open(const string &filename, EOpenMode open_mode, bool support_dirty_read=false, unsigned rec_len=0)
Open file with specified access mode.
void SetColumnSeparator(const string &col_separator)
void Dump(const string &dump_file_name, CBDB_File &db)
Convert BDB file into text file.
void SetBlobDumpFile(const string &fname)
Set BLOB dump file name.
void BindKey(const char *field_name, CBDB_Field *key_field, size_t buf_size=0)
const CBDB_BufferManager * GetKeyBuffer() const
Get Buffer manager for key section of the file.
void BindData(const char *field_name, CBDB_Field *data_field, size_t buf_size=0, ENullable is_null=eNullable)
CBDB_ConditionHandle From
void SetBlobFormat(TBlobFormat bf)
void SetOutFile(CBDB_File *out_dbf)
Set reference on output file (mode when all dumped records are put into a separate database) Class do...
@ eReadWriteCreate
read-write, create if it doesn't exist
EType GetType(const string &type) const
Return type enumerator by string type (case insensitive)
unsigned int FieldCount() const
Return number of fields attached using function Bind.
CBDB_Field * Create(EType type) const
#define BDB_THROW(errcode, message)
IO_PREFIX::ifstream CNcbiIfstream
Portable alias for ifstream.
static int CompareNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive compare of a substring with another string.
static list< string > & Split(const CTempString str, const CTempString delim, list< string > &arr, TSplitFlags flags=0, vector< SIZE_TYPE > *token_pos=NULL)
Split a string using specified delimiters.
@ fSplit_MergeDelimiters
Merge adjacent delimiters.
Defines the CNcbiApplication and CAppException classes for creating NCBI applications.
Defines command line argument related classes.
Defines unified interface to application:
Process information in the NCBI Registry, including working with configuration files.
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4