Connection.h

Go to the documentation of this file.
00001 /*
00002  * $Id:Connection.h 540 2007-08-20 07:51:56Z mindstorm2600 $
00003  *
00004  * X-VR2 
00005  * 
00006  * Copyright (C) Juan V. Guerrero 2007
00007  * 
00008  * Juan V. Guerrero <mindstorm2600@users.sourceforge.net>
00009  * 
00010  * This program is free software, distributed under the terms of
00011  * the GNU General Public License Version 2. See the LICENSE file
00012  * at the top of the source tree.
00013  */
00014 #ifndef __XVR2_SQL_Connection_H__
00015 #define __XVR2_SQL_Connection_H__
00016 
00017 #include<xvr2/xvr2config.h>
00018 #include<xvr2/SQL/Driver.h>
00019 #include<xvr2/SQL/DatabaseException.h>
00020 #include<xvr2/StringBuffer.h>
00021 
00022 namespace xvr2{
00023         namespace SQL {
00032                 class Connection:public Object{
00033                         private:
00035                                 void *__conn;
00036                         protected:
00038                                 Driver  *driver;
00039                                 String  _server;
00040                                 String  _user;
00041                                 String  _password;
00042                                 String  _dbname;
00043                                 int             _port;
00044                                 bool    __connected;
00045                                 String  *bulk_delim;
00046                         public:
00048                                 Connection(Driver *drv);
00052                                 Connection(Driver *drv, const String &server, 
00053                                               const String &dbname,
00054                                               const String &u, const String &p, 
00055                                               int port = 0);
00057                                 ~Connection();
00058                                 Connection();
00064                                 void connect(const String &server, const String &u, 
00065                                              const String &dbname,
00066                                              const String &p, int port = 0);
00072                                 void connect(Driver *d, const String &server, const String &u, 
00073                                              const String &dbname,
00074                                              const String &p, int port = 0);
00078                                 void connect();
00087                                 void open(const String &datafile);
00090                                 void disconnect();
00100                                 ResultSet *query(const String &cmd);
00101                                 ResultSet *query(const StringBuffer &cmd);
00105                                 int execCommand(const String &cmd);
00109                                 int execCommand(const StringBuffer &cmd);
00115                                 void commit();
00116                                 void bulkUploadBegin(const String &table, const String &cols, const String &_delim);
00117                                 void bulkUploadData(const String &data);
00118                                 void bulkUploadEnd();
00119 
00120                                 String escapeString(const String &s);
00121                                 //char *escapeString(const char *);
00122                                 const char *errorMessage();
00124                                 const bool isConnected();
00125                 };
00126         };
00127 };
00128 
00129 #endif

Generated on Fri Jun 20 22:55:48 2008 for X-VR2 SDK by  doxygen 1.5.5