Bug 434247
authorShawn Wilsher <sdwilsh@shawnwilsher.com>
Wed, 11 Jun 2008 10:25:20 -0400
changeset 15317 efec937177fd1a257c1113dfa1a13ec5069f9e2e
parent 15316 7c2306a92f89e06a16502f76ef57535bfed96f50
child 15318 a2741a49c3fa07389eadd66e3518a398f3d6b89b
push idunknown
push userunknown
push dateunknown
bugs434247
milestone1.9.1a1pre
Bug 434247 Remove mozStorageStatement's mStatementString r=vlad
storage/src/mozStorageStatement.cpp
storage/src/mozStorageStatement.h
--- a/storage/src/mozStorageStatement.cpp
+++ b/storage/src/mozStorageStatement.cpp
@@ -132,17 +132,16 @@ mozStorageStatement::Initialize(mozIStor
 
         if (srv == SQLITE_OK)
             break;
 
         nRetries++;
     }
 
     mDBConnection = aDBConnection;
-    mStatementString.Assign (aSQLStatement);
     mParamCount = sqlite3_bind_parameter_count (mDBStatement);
     mResultColumnCount = sqlite3_column_count (mDBStatement);
     mColumnNames.Clear();
 
     for (PRUint32 i = 0; i < mResultColumnCount; i++) {
         const char *name = sqlite3_column_name(mDBStatement, i);
         mColumnNames.AppendCString(nsDependentCString(name));
     }
@@ -199,17 +198,18 @@ mozStorageStatement::~mozStorageStatemen
 /* mozIStorageStatement clone (); */
 NS_IMETHODIMP
 mozStorageStatement::Clone(mozIStorageStatement **_retval)
 {
     mozStorageStatement *mss = new mozStorageStatement();
     if (!mss)
       return NS_ERROR_OUT_OF_MEMORY;
 
-    nsresult rv = mss->Initialize (mDBConnection, mStatementString);
+    nsCAutoString sql(sqlite3_sql(mDBStatement));
+    nsresult rv = mss->Initialize (mDBConnection, sql);
     NS_ENSURE_SUCCESS(rv, rv);
 
     NS_ADDREF(*_retval = mss);
     return NS_OK;
 }
 
 /* void finalize(); */
 NS_IMETHODIMP
@@ -333,17 +333,18 @@ mozStorageStatement::GetColumnIndex(cons
 
 /* void reset (); */
 NS_IMETHODIMP
 mozStorageStatement::Reset()
 {
     if (!mDBConnection || !mDBStatement)
         return NS_ERROR_NOT_INITIALIZED;
 
-    PR_LOG(gStorageLog, PR_LOG_DEBUG, ("Resetting statement: '%s'", nsPromiseFlatCString(mStatementString).get()));
+    PR_LOG(gStorageLog, PR_LOG_DEBUG, ("Resetting statement: '%s'",
+                                       sqlite3_sql(mDBStatement)));
 
     sqlite3_reset(mDBStatement);
     sqlite3_clear_bindings(mDBStatement);
 
     mExecuting = PR_FALSE;
 
     return NS_OK;
 }
--- a/storage/src/mozStorageStatement.h
+++ b/storage/src/mozStorageStatement.h
@@ -58,17 +58,16 @@ public:
     NS_DECL_ISUPPORTS
     NS_DECL_MOZISTORAGESTATEMENT
     NS_DECL_MOZISTORAGEVALUEARRAY
 
 private:
     ~mozStorageStatement();
 
 protected:
-    nsCString mStatementString;
     nsCOMPtr<mozIStorageConnection> mDBConnection;
     sqlite3_stmt *mDBStatement;
     PRUint32 mParamCount;
     PRUint32 mResultColumnCount;
     nsCStringArray mColumnNames;
     PRBool mExecuting;
 
 };