Bug 434247
☠☠ backed out by 3018ff270932 ☠ ☠
authorShawn Wilsher <sdwilsh@shawnwilsher.com>
Wed, 04 Jun 2008 11:59:43 -0400
changeset 15244 5ccc3423220f5808d21b04403827c3dafdb51b2d
parent 15243 d48909ac2fa1a5296854df982f2b03867621ba5f
child 15245 d3e1c92d01c20e56f20ab16f406c9e217b7fb8a4
child 15246 3018ff2709328ef178f33e33c6f893c76ef4338c
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;
 
 };