Refine code
authorPeng Huang <shawn.p.huang@gmail.com>
Thu, 8 Apr 2010 07:33:34 +0000 (15:33 +0800)
committerPeng Huang <shawn.p.huang@gmail.com>
Thu, 8 Apr 2010 07:33:34 +0000 (15:33 +0800)
src/Database.cc
src/Database.h

index 02570a7..568e451 100644 (file)
@@ -20,9 +20,9 @@ namespace PY {
 
 #define DB_PREFETCH_LEN     (6)
 
-class Conditions : public vector<string> {
+class Conditions : public std::vector<std::string> {
 public:
-    Conditions (void) : vector<string> (1) {}
+    Conditions (void) : std::vector<std::string> (1) {}
 
     void double_ (void) {
         gint i = size ();
@@ -34,7 +34,7 @@ public:
     void triple (void) {
         gint i = size ();
         do {
-            const string & value = at (--i);
+            const std::string & value = std::vector<std::string>::at (--i);
             push_back (value);
             push_back (value);
         } while (i > 0);
@@ -59,7 +59,9 @@ public:
 class SQLStmt {
 public:
     SQLStmt (sqlite3 *db)
-        : m_db (db), m_stmt (NULL) {}
+        : m_db (db), m_stmt (NULL) {
+        g_assert (m_db != NULL);
+    }
 
     ~SQLStmt () {
         if (m_stmt != NULL) {
@@ -522,7 +524,6 @@ Database::query (const PinyinArray &pinyin,
     }
 
     return stmt;
-
 }
 
 inline void
index 17448b5..0c71d92 100644 (file)
@@ -3,9 +3,6 @@
 #define __PY_DATABASE_H__
 
 #include <sqlite3.h>
-#include <string>
-#include <vector>
-#include <sstream>
 #include "String.h"
 #include "Types.h"
 #include "PinyinArray.h"
@@ -13,8 +10,6 @@
 
 namespace PY {
 
-using namespace std;
-
 class SQLStmt;
 class Database;