mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 489702 - Update mozStorageStatement.* to follow style guidelines
Consistent spacing, consistent naming, and namespaces - OH MY! r=asuth
This commit is contained in:
parent
735ad5f28b
commit
97575b6578
@ -171,7 +171,8 @@ ArgValueArray::GetString(PRUint32 aIndex,
|
||||
|
||||
NS_IMETHODIMP
|
||||
ArgValueArray::GetBlob(PRUint32 aIndex,
|
||||
PRUint32 *_size, PRUint8 **_blob)
|
||||
PRUint32 *_size,
|
||||
PRUint8 **_blob)
|
||||
{
|
||||
ENSURE_INDEX_VALUE(aIndex, mArgc);
|
||||
|
||||
|
@ -629,13 +629,13 @@ Connection::CreateStatement(const nsACString &aSQLStatement,
|
||||
NS_ENSURE_ARG_POINTER(_stmt);
|
||||
if (!mDBConn) return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
nsRefPtr<mozStorageStatement> statement(new mozStorageStatement());
|
||||
nsRefPtr<Statement> statement(new Statement());
|
||||
NS_ENSURE_TRUE(statement, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
nsresult rv = statement->Initialize(this, aSQLStatement);
|
||||
nsresult rv = statement->initialize(this, aSQLStatement);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mozStorageStatement *rawPtr;
|
||||
Statement *rawPtr;
|
||||
statement.forget(&rawPtr);
|
||||
*_stmt = rawPtr;
|
||||
return NS_OK;
|
||||
@ -661,7 +661,7 @@ Connection::ExecuteAsync(mozIStorageStatement **aStatements,
|
||||
nsTArray<sqlite3_stmt *> stmts(aNumStatements);
|
||||
for (PRUint32 i = 0; i < aNumStatements && rc == SQLITE_OK; i++) {
|
||||
sqlite3_stmt *old_stmt =
|
||||
static_cast<mozStorageStatement *>(aStatements[i])->nativeStatement();
|
||||
static_cast<Statement *>(aStatements[i])->nativeStatement();
|
||||
if (!old_stmt) {
|
||||
rc = SQLITE_MISUSE;
|
||||
break;
|
||||
@ -670,8 +670,8 @@ Connection::ExecuteAsync(mozIStorageStatement **aStatements,
|
||||
"Statement must be from this database connection!");
|
||||
|
||||
// Clone this statement. We only need a sqlite3_stmt object, so we can
|
||||
// avoid all the extra work that making a new mozStorageStatement would
|
||||
// normally involve and use the SQLite API.
|
||||
// avoid all the extra work that making a new Statement would normally
|
||||
// involve and use the SQLite API.
|
||||
sqlite3_stmt *new_stmt;
|
||||
rc = ::sqlite3_prepare_v2(mDBConn, ::sqlite3_sql(old_stmt), -1, &new_stmt,
|
||||
NULL);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,6 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
* vim: sw=2 ts=2 et lcs=trail\:.,tab\:>~ :
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
@ -36,8 +37,8 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef _MOZSTORAGESTATEMENT_H_
|
||||
#define _MOZSTORAGESTATEMENT_H_
|
||||
#ifndef _mozStorageStatement_h_
|
||||
#define _mozStorageStatement_h_
|
||||
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsString.h"
|
||||
@ -46,55 +47,50 @@
|
||||
|
||||
#include "mozIStorageStatement.h"
|
||||
|
||||
#include <sqlite3.h>
|
||||
|
||||
class nsIXPConnectJSObjectHolder;
|
||||
struct sqlite3_stmt;
|
||||
|
||||
namespace mozilla {
|
||||
namespace storage {
|
||||
class StatementJSHelper;
|
||||
class Connection;
|
||||
} // storage
|
||||
} // mozilla
|
||||
|
||||
class mozStorageStatement : public mozIStorageStatement
|
||||
class Statement : public mozIStorageStatement
|
||||
{
|
||||
public:
|
||||
mozStorageStatement();
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_MOZISTORAGESTATEMENT
|
||||
NS_DECL_MOZISTORAGEVALUEARRAY
|
||||
|
||||
// interfaces
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_MOZISTORAGESTATEMENT
|
||||
NS_DECL_MOZISTORAGEVALUEARRAY
|
||||
Statement();
|
||||
|
||||
/**
|
||||
* Initializes the object on aDBConnection by preparing the SQL statement
|
||||
* given by aSQLStatement.
|
||||
*
|
||||
* @param aDBConnection
|
||||
* The mozStorageConnection object this statement is associated with.
|
||||
* @param aSQLStatement
|
||||
* The SQL statement to prepare that this object will represent.
|
||||
*/
|
||||
nsresult Initialize(mozilla::storage::Connection *aDBConnection,
|
||||
const nsACString &aSQLStatement);
|
||||
/**
|
||||
* Initializes the object on aDBConnection by preparing the SQL statement
|
||||
* given by aSQLStatement.
|
||||
*
|
||||
* @param aDBConnection
|
||||
* The Connection object this statement is associated with.
|
||||
* @param aSQLStatement
|
||||
* The SQL statement to prepare that this object will represent.
|
||||
*/
|
||||
nsresult initialize(Connection *aDBConnection,
|
||||
const nsACString &aSQLStatement);
|
||||
|
||||
|
||||
/**
|
||||
* Obtains the native statement pointer.
|
||||
*/
|
||||
inline sqlite3_stmt *nativeStatement() { return mDBStatement; }
|
||||
/**
|
||||
* Obtains the native statement pointer.
|
||||
*/
|
||||
inline sqlite3_stmt *nativeStatement() { return mDBStatement; }
|
||||
|
||||
private:
|
||||
~mozStorageStatement();
|
||||
~Statement();
|
||||
|
||||
protected:
|
||||
nsRefPtr<mozilla::storage::Connection> mDBConnection;
|
||||
nsRefPtr<Connection> mDBConnection;
|
||||
sqlite3_stmt *mDBStatement;
|
||||
PRUint32 mParamCount;
|
||||
PRUint32 mResultColumnCount;
|
||||
nsTArray<nsCString> mColumnNames;
|
||||
PRBool mExecuting;
|
||||
bool mExecuting;
|
||||
|
||||
/**
|
||||
* The following two members are only used with the JS helper. They cache
|
||||
@ -103,7 +99,10 @@ protected:
|
||||
nsCOMPtr<nsIXPConnectJSObjectHolder> mStatementParamsHolder;
|
||||
nsCOMPtr<nsIXPConnectJSObjectHolder> mStatementRowHolder;
|
||||
|
||||
friend class mozilla::storage::StatementJSHelper;
|
||||
friend class StatementJSHelper;
|
||||
};
|
||||
|
||||
#endif /* _MOZSTORAGESTATEMENT_H_ */
|
||||
} // storage
|
||||
} // mozilla
|
||||
|
||||
#endif // _mozStorageStatement_h_
|
||||
|
@ -74,8 +74,7 @@ stepFunc(JSContext *aCtx,
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
mozStorageStatement *stmt =
|
||||
static_cast<mozStorageStatement *>(wrapper->Native());
|
||||
Statement *stmt = static_cast<Statement *>(wrapper->Native());
|
||||
|
||||
#ifdef DEBUG
|
||||
{
|
||||
@ -105,7 +104,7 @@ stepFunc(JSContext *aCtx,
|
||||
//// StatementJSHelper
|
||||
|
||||
nsresult
|
||||
StatementJSHelper::getRow(mozStorageStatement *aStatement,
|
||||
StatementJSHelper::getRow(Statement *aStatement,
|
||||
JSContext *aCtx,
|
||||
JSObject *aScopeObj,
|
||||
jsval *_row)
|
||||
@ -141,7 +140,7 @@ StatementJSHelper::getRow(mozStorageStatement *aStatement,
|
||||
}
|
||||
|
||||
nsresult
|
||||
StatementJSHelper::getParams(mozStorageStatement *aStatement,
|
||||
StatementJSHelper::getParams(Statement *aStatement,
|
||||
JSContext *aCtx,
|
||||
JSObject *aScopeObj,
|
||||
jsval *_params)
|
||||
@ -205,8 +204,7 @@ StatementJSHelper::GetProperty(nsIXPConnectWrappedNative *aWrapper,
|
||||
if (!JSVAL_IS_STRING(aId))
|
||||
return NS_OK;
|
||||
|
||||
mozStorageStatement *stmt =
|
||||
static_cast<mozStorageStatement *>(aWrapper->Native());
|
||||
Statement *stmt = static_cast<Statement *>(aWrapper->Native());
|
||||
|
||||
#ifdef DEBUG
|
||||
{
|
||||
|
@ -42,7 +42,7 @@
|
||||
|
||||
#include "nsIXPCScriptable.h"
|
||||
|
||||
class mozStorageStatement;
|
||||
class Statement;
|
||||
|
||||
namespace mozilla {
|
||||
namespace storage {
|
||||
@ -54,8 +54,8 @@ public:
|
||||
NS_DECL_NSIXPCSCRIPTABLE
|
||||
|
||||
private:
|
||||
nsresult getRow(mozStorageStatement *, JSContext *, JSObject *, jsval *);
|
||||
nsresult getParams(mozStorageStatement *, JSContext *, JSObject *, jsval *);
|
||||
nsresult getRow(Statement *, JSContext *, JSObject *, jsval *);
|
||||
nsresult getParams(Statement *, JSContext *, JSObject *, jsval *);
|
||||
};
|
||||
|
||||
} // namespace storage
|
||||
|
@ -47,11 +47,12 @@
|
||||
#include "jsdate.h"
|
||||
|
||||
class mozIStorageStatement;
|
||||
class mozStorageStatement;
|
||||
|
||||
namespace mozilla {
|
||||
namespace storage {
|
||||
|
||||
class Statement;
|
||||
|
||||
class StatementParams : public mozIStorageStatementParams
|
||||
, public nsIXPCScriptable
|
||||
{
|
||||
@ -67,7 +68,7 @@ protected:
|
||||
mozIStorageStatement *mStatement;
|
||||
PRUint32 mParamCount;
|
||||
|
||||
friend class ::mozStorageStatement;
|
||||
friend class Statement;
|
||||
};
|
||||
|
||||
static
|
||||
|
@ -53,8 +53,8 @@ namespace storage {
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//// StatementRow
|
||||
|
||||
StatementRow::StatementRow(mozStorageStatement *aStatement) :
|
||||
mStatement(aStatement)
|
||||
StatementRow::StatementRow(Statement *aStatement)
|
||||
: mStatement(aStatement)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -43,12 +43,11 @@
|
||||
#include "mozIStorageStatementWrapper.h"
|
||||
#include "nsIXPCScriptable.h"
|
||||
|
||||
class mozStorageStatement;
|
||||
|
||||
|
||||
namespace mozilla {
|
||||
namespace storage {
|
||||
|
||||
class Statement;
|
||||
|
||||
class StatementRow : public mozIStorageStatementRow
|
||||
, public nsIXPCScriptable
|
||||
{
|
||||
@ -57,12 +56,12 @@ public:
|
||||
NS_DECL_MOZISTORAGESTATEMENTROW
|
||||
NS_DECL_NSIXPCSCRIPTABLE
|
||||
|
||||
StatementRow(mozStorageStatement *aStatement);
|
||||
StatementRow(Statement *aStatement);
|
||||
protected:
|
||||
|
||||
mozStorageStatement *mStatement;
|
||||
Statement *mStatement;
|
||||
|
||||
friend class ::mozStorageStatement;
|
||||
friend class Statement;
|
||||
};
|
||||
|
||||
} // namespace storage
|
||||
|
@ -77,7 +77,7 @@ StatementWrapper::Initialize(mozIStorageStatement *aStatement)
|
||||
NS_ASSERTION(mStatement == nsnull, "StatementWrapper is already initialized");
|
||||
NS_ENSURE_ARG_POINTER(aStatement);
|
||||
|
||||
mStatement = static_cast<mozStorageStatement *>(aStatement);
|
||||
mStatement = static_cast<Statement *>(aStatement);
|
||||
|
||||
// fetch various things we care about
|
||||
(void)mStatement->GetParameterCount(&mParamCount);
|
||||
|
@ -67,7 +67,7 @@ private:
|
||||
return mStatement->nativeStatement();
|
||||
}
|
||||
|
||||
nsRefPtr<mozStorageStatement> mStatement;
|
||||
nsRefPtr<Statement> mStatement;
|
||||
PRUint32 mParamCount;
|
||||
PRUint32 mResultColumnCount;
|
||||
nsTArray<nsString> mColumnNames;
|
||||
|
Loading…
Reference in New Issue
Block a user