00001 #ifndef __DB_H_
00002 #define __DB_H_
00003
00004 #include "ocicpp.h"
00005 #include "Connection.h"
00006
00007 namespace OCICPP {
00008 using std::string;
00009
00010 class db {
00011 public:
00012 static OCIEnv *envhp;
00013 static ub4 InitMode;
00014
00015 static void init(ub4 InitMode=OCI_DEFAULT) {
00016 (void) OCIInitialize(InitMode, (dvoid *)0, (dvoid * (*)(dvoid *, size_t)) 0,
00017 (dvoid * (*)(dvoid *, dvoid *, size_t))0, (void (*)(dvoid *, dvoid *)) 0 );
00018 (void) OCIEnvInit( (OCIEnv **) &db::envhp, OCI_DEFAULT, (size_t) 0,(dvoid **) 0 );
00019 }
00020 static Connection *connect(const string &tnsname,const string &user,const string &password) {
00021 return new Connection(db::envhp,tnsname,user,password);
00022 }
00023 static void connect(const string &tnsname,
00024 const string &user,
00025 const string &password,
00026 Connection &con) {
00027 con.init(db::envhp,tnsname,user,password);
00028 }
00029 };
00030
00031 }
00032 #endif
00033