the long vector needs a typedef
authorMarkus Bröker <mbroeker@largo.dyndns.tv>
Sat, 13 Dec 2008 17:58:06 +0100
changeset 14 862d63715611
parent 13 2640a7fd96ca
child 15 5a0ca1f9a2f1
the long vector needs a typedef committer: Markus Bröker <mbroeker@largo.homelinux.org>
db_bridge/include/abstract_db.h
db_bridge/include/mysql_db.h
db_bridge/include/postgresql_db.h
db_bridge/main.cpp
db_bridge/mysql_db.cpp
db_bridge/postgresql_db.cpp
--- a/db_bridge/include/abstract_db.h
+++ b/db_bridge/include/abstract_db.h
@@ -17,8 +17,11 @@
     std::string server;
 
   public:
+    typedef std::vector < std::vector<std::string> > DB_RESULT;
+    typedef std::vector<std::string> DB_ROW;
+
     virtual ~ Abstract_DB () {}
     virtual bool connect () = 0;
-    virtual std::vector < std::vector<std::string> >query (std::string) = 0;
+    virtual DB_RESULT query (std::string) = 0;
 };
 #endif
--- a/db_bridge/include/mysql_db.h
+++ b/db_bridge/include/mysql_db.h
@@ -20,6 +20,6 @@
       MySQL_DB (std::string, std::string, std::string, std::string);
       virtual ~ MySQL_DB ();
       bool connect ();
-      std::vector < std::vector <std::string> >query (std::string);
+      Abstract_DB::DB_RESULT query (std::string);
 };
 #endif
--- a/db_bridge/include/postgresql_db.h
+++ b/db_bridge/include/postgresql_db.h
@@ -22,6 +22,6 @@
       PostgreSQL_DB (std::string, std::string, std::string, std::string);
       virtual ~ PostgreSQL_DB ();
       bool connect ();
-      std::vector < std::vector <std::string> >query (std::string);
+      Abstract_DB::DB_RESULT query (std::string);
 };
 #endif
--- a/db_bridge/main.cpp
+++ b/db_bridge/main.cpp
@@ -13,8 +13,8 @@
 {
     Abstract_DB *db;
 
-    std::vector <std::string> vec;
-    std::vector <std::vector <std::string> >result;
+    Abstract_DB::DB_ROW vec;
+    Abstract_DB::DB_RESULT result;
     unsigned int i, j;
 
 #ifdef WITH_POSTGRESQL
--- a/db_bridge/mysql_db.cpp
+++ b/db_bridge/mysql_db.cpp
@@ -32,10 +32,10 @@
     return true;
 }
 
-std::vector < std::vector<std::string> >MySQL_DB::query (std::string sql_string)
+Abstract_DB::DB_RESULT MySQL_DB::query (std::string sql_string)
 {
-    std::vector <std::string> vec;
-    std::vector < std::vector <std::string> >rows;
+    Abstract_DB::DB_ROW vec;
+    Abstract_DB::DB_RESULT rows;
     MYSQL_ROW row;
     int i;
 
--- a/db_bridge/postgresql_db.cpp
+++ b/db_bridge/postgresql_db.cpp
@@ -38,10 +38,10 @@
     return true;
 }
 
-std::vector < std::vector<std::string> >PostgreSQL_DB::query (std::string sql_string)
+Abstract_DB::DB_RESULT PostgreSQL_DB::query (std::string sql_string)
 {
-    std::vector <std::string> vec;
-    std::vector < std::vector <std::string> >rows;
+    Abstract_DB::DB_ROW vec;
+    Abstract_DB::DB_RESULT rows;
     PGresult *res;
     int i, j, nFields;