16 #include "hk_drivermanager.h"
17 #include "hk_connection.h"
18 #include "hk_database.h"
19 #include "hk_string.h"
23 #include <sys/types.h>
26 #define DEFAULTPARAMETER {"driver",'d',"DRIVERNAME",0,"Name of the database driver",0},{"list",'l',0,1,"List available database drivers",0},{"host",'h',"HOST",0,"IP-number or name of hosts",0},{"port",'r',"PORT",0,"TCP-port on host",0},{"user",'u',"USERNAME",0,"user name",0},{"password",'p',"PASSWORD",0,"user password",0},{"database",'b',"DATABASE",0,"database name",0},{"version",10,0,1,"version and author of hk_classes",0}
36 hk_string driver,host,port,user,password,database,filter;
42 inline static error_t parse_generaloptions (
int key,
char* arg,
struct argp_state* state)
50 cout <<
"Version "<<VERSION<<
"\nAuthor: Horst Knorr <hk_classes@knoda.org>\nhttp://hk-classes.sourceforge.net"<<endl;
55 vector<hk_string>* l = hk_drivermanager::driverlist();
56 vector<hk_string>::iterator it=l->begin();
66 case 'd' : arguments->driver=arg;
68 case 'h' : arguments->host=arg;
70 case 'r' : arguments->port=arg;
72 case 'u' : arguments->user=arg;
74 case 'p' : arguments->password=arg;
76 case 'f' : arguments->filter=arg;
78 case 'b' : arguments->database=arg;
80 default :
return ARGP_ERR_UNKNOWN;
88 if (arguments.driver.size()==0)
90 cerr <<
"No driver selected"<<endl;
93 if (arguments.database.size()==0)
95 cerr <<
"No database selected"<<endl;
103 bool is_localfile(
const hk_string& file)
105 return (file.find(
'/')!=hk_string::npos);
109 bool load_file(
const hk_string &name,hk_string &file)
111 if (name.size()==0)
return false;
112 ifstream ifs(name.c_str(),ios::in);
Definition: hk_utilities.h:33