Bug 483152 - Stop giving the ability to get the native sqlite3_stmt pointer

We don't really want to give this pointer out to consumers since we track some
state, and if they call SQLite functions on it, can cause our internal state to
be inaccurate.
r=asuth
This commit is contained in:
Shawn Wilsher 2009-03-20 18:41:01 -04:00
parent 29a36fcf35
commit c0d5aa90c8
6 changed files with 5 additions and 18 deletions

View File

@ -45,9 +45,7 @@ interface nsISimpleEnumerator;
interface mozIStorageStatementCallback;
interface mozIStoragePendingStatement;
[ptr] native sqlite3stmtptr(struct sqlite3_stmt);
[scriptable, uuid(4a712295-d076-4007-9c78-8c0e15373b9f)]
[scriptable, uuid(471e161a-af46-4eb3-adf6-f6b0c41fe81c)]
interface mozIStorageStatement : mozIStorageValueArray {
/**
* Finalizes a statement so you can successfully close a database connection.
@ -201,8 +199,6 @@ interface mozIStorageStatement : mozIStorageValueArray {
readonly attribute long state;
[noscript,notxpcom] sqlite3stmtptr getNativeStatementPointer();
/**
* Escape a string for SQL LIKE search.
*

View File

@ -398,7 +398,8 @@ mozStorageConnection::ExecuteAsync(mozIStorageStatement ** aStatements,
int rc = SQLITE_OK;
nsTArray<sqlite3_stmt *> stmts(aNumStatements);
for (PRUint32 i = 0; i < aNumStatements && rc == SQLITE_OK; i++) {
sqlite3_stmt *old_stmt = aStatements[i]->GetNativeStatementPointer();
sqlite3_stmt *old_stmt =
static_cast<mozStorageStatement *>(aStatements[i])->nativeStatement();
if (!old_stmt) {
rc = SQLITE_MISUSE;
break;

View File

@ -613,13 +613,6 @@ mozStorageStatement::ExecuteAsync(mozIStorageStatementCallback *aCallback,
return mDBConnection->ExecuteAsync(stmts, 1, aCallback, _stmt);
}
/* [noscript,notxpcom] sqlite3stmtptr getNativeStatementPointer(); */
sqlite3_stmt*
mozStorageStatement::GetNativeStatementPointer()
{
return mDBStatement;
}
/* readonly attribute long state; */
NS_IMETHODIMP
mozStorageStatement::GetState(PRInt32 *_retval)

View File

@ -78,7 +78,7 @@ public:
/**
* Obtains the native statement pointer.
*/
inline sqlite3_stmt *NativeStatement() { return mDBStatement; }
inline sqlite3_stmt *nativeStatement() { return mDBStatement; }
private:
~mozStorageStatement();

View File

@ -60,9 +60,6 @@ public:
// nsIXPCScriptable interface
NS_DECL_NSIXPCSCRIPTABLE
protected:
sqlite3_stmt* NativeStatement() {
return mStatement->GetNativeStatementPointer();
}
mozStorageStatement *mStatement;

View File

@ -68,7 +68,7 @@ private:
protected:
sqlite3_stmt* NativeStatement() {
return mStatement->GetNativeStatementPointer();
return mStatement->nativeStatement();
}
// note: pointer to the concrete statement