DatabaseException.h

Go to the documentation of this file.
00001 /*
00002  * $Id:DatabaseException.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_DATABASE_EXCEPTION_H__
00015 #define __XVR2_SQL_DATABASE_EXCEPTION_H__
00016 #include<xvr2/xvr2config.h>
00017 #include<xvr2/CoreExceptions.h>
00018 #include<xvr2/String.h>
00019 
00020 namespace xvr2 {
00021         namespace SQL {
00022                 class ResultSet;
00024                 class DatabaseException:public Exception{
00025                         protected:
00026                                 String _err_msg;
00027                         public:
00028                                 enum ConnectionType {
00029                                         NET,
00030                                         FIFO,
00031                                         EMBEDDED
00032                                 };
00033                                 struct ConnectionParams {
00034                                         DatabaseException::ConnectionType type;
00035                                         String host;
00036                                         int port;
00037                                         String username;
00038                                         String password;
00039                                         String database;
00040                                         String path;
00041                                         ConnectionParams();
00042                                         ConnectionParams(DatabaseException::ConnectionType t,
00043                                                                         const String &h, int port, const String &db,
00044                                                                         const String &u, const String &p,
00045                                                                         const String &_path = "");
00046                                         ConnectionParams(const ConnectionParams &c);
00047                                         ConnectionParams &operator=(const ConnectionParams &c);
00048                                 };
00052                                 DatabaseException();
00053                                 DatabaseException(const String &error_message);
00054                                 DatabaseException(const String &error_message, 
00055                                                                         const ConnectionParams &__conn_p);
00056                                 DatabaseException(const ConnectionParams &__conn_p);
00064                                 const ConnectionParams &connParams();
00072                                 const String &errorMessage();
00073                         protected:
00074                                 ConnectionParams _conn_params;
00075                 };
00076                 
00079                 class DriverOperationNotSupported : public DatabaseException {
00080                         private:
00081                                 String op;
00082                         public:
00083                                 DriverOperationNotSupported();
00084                                 DriverOperationNotSupported(const String &_op);
00086                                 const String &operation();
00087                 };
00088 
00089 
00091                 class DBServerUnreachable:public DatabaseException{
00092                         public:
00096                                 DBServerUnreachable();
00097                 };
00098 
00099 
00101                 class AlreadyConnected2DB:public DatabaseException{
00102                         public:
00106                                 AlreadyConnected2DB();
00107                 };
00108 
00109 
00111                 class DBConnectFirst:public DatabaseException{
00112                         public:
00116                                 DBConnectFirst();
00117                 };
00118 
00120                 class NoDataFetch:public DatabaseException{
00121                         public:
00125                                 NoDataFetch();
00126                 };
00127 
00128 
00130                 class NoMoreRows:public DatabaseException{
00131                         public:
00135                                 NoMoreRows();
00136                 };
00137 
00138 
00142                 class DBConnectionFailed:public DatabaseException{
00143                         public:
00147                                 DBConnectionFailed();
00148                 };
00149                 
00152                 class ConnectionFailure:public DatabaseException{
00153                         private:
00154                         public:
00155                                 ConnectionFailure();
00156                                 ConnectionFailure(const ConnectionParams &__conn_p);
00157                                 ConnectionFailure(const ConnectionParams &__conn_p, 
00158                                                                         const String &__cause);
00159                 };
00160 
00161 
00163                 class ServerDisconnected:public DatabaseException{
00164                         public:
00168                                 ServerDisconnected();
00169                 };
00170 
00172                 class FieldIsNull:public  DatabaseException {
00173                         private:
00174                                 String field_name;
00175                         public:
00181                                 FieldIsNull();
00182                                 FieldIsNull(const String &fn);
00183                                 const String &fieldName();
00184                 };
00185 
00186 
00188                 class SQLQueryException:public DatabaseException{
00189                         private:
00190                                 SQL::ResultSet *result;
00191                                 String _query;
00192                         public:
00196                                 SQLQueryException();
00197                                 ~SQLQueryException();
00198                                 SQLQueryException(const char *msg);
00199                                 SQLQueryException(const char *msg, const String &__query);
00200                                 SQLQueryException(const char *msg, SQL::ResultSet *_result);
00201                                 SQLQueryException(const char *msg, SQL::ResultSet *_result, const String &__query);
00202                                 const String &query();
00203                 };
00204 
00205 
00207                 class SQLQueryRDBMSDisconnected:public SQLQueryException{
00208                         public:
00212                                 SQLQueryRDBMSDisconnected();
00213                 };
00214 
00218                 class UnableToParseQuery:public SQLQueryException{
00219                         public:
00223                                 UnableToParseQuery();
00224                 };
00225 
00226                 class BulkUploadFailed:public SQLQueryException{
00227                         public:
00231                                 BulkUploadFailed();
00232                 };
00233 
00234                 class BulkDataParse:public SQLQueryException{
00235                         public:
00239                                 BulkDataParse();
00240                 };
00241 
00242                 class BulkUploadStart:public SQLQueryException{
00243                         public:
00247                                 BulkUploadStart();
00248                 };
00249         };
00250 };
00251 
00252 #endif
00253 

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