// Copyright (c) 1999-2001 David Muse // See the file COPYING for more information #include #include #include #include #include #include #include #include #ifdef RUDIMENTS_NAMESPACE using namespace rudiments; #endif int main(int argc, const char **argv) { #include commandline cmdline(argc,argv); sqlrconfigfile cfgfile; usercontainer *currentnode=NULL; const char *host; uint16_t port; const char *socket; const char *user; const char *password; const char *table=""; const char *config=cmdline.getValue("-config"); if (!(config && config[0])) { config=DEFAULT_CONFIG_FILE; } const char *id=cmdline.getValue("-id"); if (!(id && id[0])) { if (argc<6) { printf("usage: fields host port socket " "user password table\n" " or fields [-config configfile] " "-id id table\n"); exit(1); } host=argv[1]; port=charstring::toInteger(argv[2]); socket=argv[3]; user=argv[4]; password=argv[5]; table=argv[6]; } else { if (cfgfile.parse(config,id)) { // get the host/port/socket/username/password host="localhost"; port=cfgfile.getPort(); socket=cfgfile.getUnixPort(); // FIXME: this can return 0 cfgfile.getUserList()->getDataByIndex(0,¤tnode); user=currentnode->getUser(); password=currentnode->getPassword(); // find the query for (int i=1; i