00001 #include "openDB.hpp"
00002 #include "../openTools/cgiExtend.h"
00003
00004 int main( int argc, char * argv[])
00005 {
00006 cout << "Creating a db" << endl;
00007
00008 openDbFactory DbMaker(MySQL, "host=localhost;uid=http_user;pwd=mydeal99;db=dealmania");
00009 openDB & db = DbMaker.db();
00010
00011 cout << "db established : provider is: " << db.getProvider() << endl;
00012
00013 if( db.isGood() )
00014 {
00015 cout << "Good Connection -- Creating an rs" << endl;
00016 openRsFactory RsMaker(db);
00017 openRS & rs = RsMaker.rs();
00018
00019 cout << "rs established - making a query" << endl << endl;
00020
00021 if( rs.open("select * from beFree_x1") )
00022 {
00023 cout << "Query made!" << endl;
00024 int i;
00025 for( i=0; i<rs.getFieldCount();i++)
00026 {
00027 cout << rs.getField(i).getName() << "\t\t";
00028 }
00029 cout << endl << "====================================================" << endl;
00030 do{
00031
00032 for( i=0; i<rs.getFieldCount();i++)
00033 {
00034 string name = rs.getField(i).getName();
00035
00036 cout << rs.getField(name.c_str()).format() << "\t\t";
00037
00038 }
00039 cout << rs.getErrors() << endl;
00040 cout << endl << "------------------------------------------------------" << endl;
00041
00042 }while( rs.isOpen() && rs.next() );
00043 }
00044 rs.close();
00045 }
00046 else
00047 {
00048 cout << "connection ain't no good" << endl;
00049
00050 }
00051
00052 }