Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qqmllocalstorage.cpp File Reference

(99c7fe45be00b694da4041c5a06e5484f2985dc6)

#include "qqmllocalstorage_p.h"
#include <QtQml/private/qqmlengine_p.h>
#include <QtQml/private/qv4global_p.h>
#include <QtQml/private/qv4scopedvalue_p.h>
#include <QtQml/private/qv4object_p.h>
#include <QtQml/private/qv4sqlerrors_p.h>
#include <QtQml/private/qv4jscall_p.h>
#include <QtQml/private/qv4objectiterator_p.h>
#include <QtCore/qfileinfo.h>
#include <QtCore/qdir.h>
#include <QtSql/qsqldatabase.h>
#include <QtSql/qsqlquery.h>
#include <QtSql/qsqlrecord.h>
#include <QtSql/qsqlerror.h>
#include "moc_qqmllocalstorage_p.cpp"
+ Include dependency graph for qqmllocalstorage.cpp:

Go to the source code of this file.

Classes

class  QQmlSqlDatabaseData
 
struct  QV4::Heap::QQmlSqlDatabaseWrapper
 
class  QV4::QQmlSqlDatabaseWrapper
 
struct  TransactionRollback
 

Namespaces

namespace  QV4
 
namespace  QV4::Heap
 

Macros

#define V4THROW_SQL(error, desc)
 
#define V4THROW_SQL2(error, desc)
 
#define V4THROW_REFERENCE(string)
 

Functions

 DEFINE_OBJECT_VTABLE (QV4::QQmlSqlDatabaseWrapper)
 
static ReturnedValue qmlsqldatabase_version (const FunctionObject *b, const Value *thisObject, const QV4::Value *, int)
 
static ReturnedValue qmlsqldatabase_rows_length (const FunctionObject *b, const Value *thisObject, const QV4::Value *, int)
 
static ReturnedValue qmlsqldatabase_rows_forwardOnly (const FunctionObject *b, const Value *thisObject, const QV4::Value *, int)
 
static ReturnedValue qmlsqldatabase_rows_setForwardOnly (const FunctionObject *b, const Value *thisObject, const Value *argv, int argc)
 
static ReturnedValue qmlsqldatabase_rows_index (const QQmlSqlDatabaseWrapper *r, ExecutionEngine *v4, quint32 index, bool *hasProperty=nullptr)
 
static ReturnedValue qmlsqldatabase_rows_item (const FunctionObject *b, const Value *thisObject, const Value *argv, int argc)
 
static QVariant toSqlVariant (const QV4::ScopedValue &value)
 
static ReturnedValue qmlsqldatabase_executeSql (const FunctionObject *b, const Value *thisObject, const Value *argv, int argc)
 
static ReturnedValue qmlsqldatabase_changeVersion (const FunctionObject *b, const Value *thisObject, const Value *argv, int argc)
 
static ReturnedValue qmlsqldatabase_transaction_shared (const FunctionObject *b, const Value *thisObject, const Value *argv, int argc, bool readOnly)
 
static ReturnedValue qmlsqldatabase_transaction (const FunctionObject *f, const Value *thisObject, const Value *argv, int argc)
 
static ReturnedValue qmlsqldatabase_read_transaction (const FunctionObject *f, const Value *thisObject, const Value *argv, int argc)
 

Macro Definition Documentation

◆ V4THROW_REFERENCE

#define V4THROW_REFERENCE ( string)
Value:
{ \
QV4::ScopedString v(scope, scope.engine->newString(QLatin1String(string))); \
scope.engine->throwReferenceError(v); \
RETURN_UNDEFINED(); \
}
Scoped< String > ScopedString
GLsizei const GLfloat * v
[13]

Definition at line 44 of file qqmllocalstorage.cpp.

Referenced by qmlsqldatabase_rows_forwardOnly(), qmlsqldatabase_rows_length(), qmlsqldatabase_rows_setForwardOnly(), and qmlsqldatabase_version().

◆ V4THROW_SQL

#define V4THROW_SQL ( error,
desc )
Value:
{ \
QV4::ScopedString v(scope, scope.engine->newString(desc)); \
QV4::ScopedObject ex(scope, scope.engine->newErrorObject(v)); \
ex->put(QV4::ScopedString(scope, scope.engine->newIdentifier(QStringLiteral("code"))).getPointer(), QV4::ScopedValue(scope, Value::fromInt32(error))); \
scope.engine->throwError(ex); \
RETURN_UNDEFINED(); \
}
DBusConnection const char DBusError * error
#define QStringLiteral(str)
static constexpr Value fromInt32(int i)
Definition qv4value_p.h:187

Definition at line 28 of file qqmllocalstorage.cpp.

Referenced by qmlsqldatabase_changeVersion(), qmlsqldatabase_executeSql(), and qmlsqldatabase_transaction_shared().

◆ V4THROW_SQL2

#define V4THROW_SQL2 ( error,
desc )
Value:
{ \
QV4::ScopedString v(scope, scope.engine->newString(desc)); \
QV4::ScopedObject ex(scope, scope.engine->newErrorObject(v)); \
ex->put(QV4::ScopedString(scope, scope.engine->newIdentifier(QStringLiteral("code"))).getPointer(), QV4::ScopedValue(scope, Value::fromInt32(error))); \
args->setReturnValue(scope.engine->throwError(ex)); \
return; \
}
QJSValueList args

Definition at line 36 of file qqmllocalstorage.cpp.

Referenced by QQmlLocalStorage::openDatabaseSync().

Function Documentation

◆ DEFINE_OBJECT_VTABLE()

DEFINE_OBJECT_VTABLE ( QV4::QQmlSqlDatabaseWrapper )

◆ qmlsqldatabase_changeVersion()

static ReturnedValue qmlsqldatabase_changeVersion ( const FunctionObject * b,
const Value * thisObject,
const Value * argv,
int argc )
static

Definition at line 350 of file qqmllocalstorage.cpp.

References QV4::QQmlSqlDatabaseWrapper::create(), QV4::Heap::QQmlSqlDatabaseWrapper::Database, db, QV4::Scope::engine, QQmlEnginePrivate::get(), QV4::EngineBase::globalObject, QSettings::IniFormat, QQmlEnginePrivate::offlineStorageDatabaseDirectory(), ok, QV4::ExecutionEngine::qmlEngine(), QV4::Heap::QQmlSqlDatabaseWrapper::Query, RETURN_RESULT, RETURN_UNDEFINED, SQLEXCEPTION_UNKNOWN_ERR, SQLEXCEPTION_VERSION_ERR, QV4::Value::toQString(), QV4::Value::undefinedValue(), V4THROW_REFERENCE, and V4THROW_SQL.

Referenced by QQmlSqlDatabaseData::QQmlSqlDatabaseData().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qmlsqldatabase_executeSql()

static ReturnedValue qmlsqldatabase_executeSql ( const FunctionObject * b,
const Value * thisObject,
const Value * argv,
int argc )
static

Definition at line 235 of file qqmllocalstorage.cpp.

References QV4::Value::as(), Qt::CaseInsensitive, QV4::QQmlSqlDatabaseWrapper::create(), db, QV4::Scope::engine, QV4::ObjectIterator::EnumerableOnly, QV4::Value::fromInt32(), it, QV4::ExecutionEngine::newIdentifier(), QV4::ExecutionEngine::newObject(), QV4::ExecutionEngine::newString(), Q_ASSERT, QV4::Heap::QQmlSqlDatabaseWrapper::Query, RETURN_RESULT, QV4::Heap::QQmlSqlDatabaseWrapper::Rows, SQLEXCEPTION_DATABASE_ERR, SQLEXCEPTION_SYNTAX_ERR, QString::startsWith(), QV4::Value::toQString(), toSqlVariant(), QV4::Value::undefinedValue(), V4THROW_REFERENCE, and V4THROW_SQL.

Referenced by QQmlSqlDatabaseData::QQmlSqlDatabaseData().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qmlsqldatabase_read_transaction()

static ReturnedValue qmlsqldatabase_read_transaction ( const FunctionObject * f,
const Value * thisObject,
const Value * argv,
int argc )
static

Definition at line 455 of file qqmllocalstorage.cpp.

References qmlsqldatabase_transaction_shared().

Referenced by QQmlSqlDatabaseData::QQmlSqlDatabaseData().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qmlsqldatabase_rows_forwardOnly()

static ReturnedValue qmlsqldatabase_rows_forwardOnly ( const FunctionObject * b,
const Value * thisObject,
const QV4::Value * ,
int  )
static

Definition at line 152 of file qqmllocalstorage.cpp.

References QV4::Value::as(), RETURN_RESULT, QV4::Heap::QQmlSqlDatabaseWrapper::Rows, and V4THROW_REFERENCE.

Referenced by QQmlSqlDatabaseData::QQmlSqlDatabaseData().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qmlsqldatabase_rows_index()

static ReturnedValue qmlsqldatabase_rows_index ( const QQmlSqlDatabaseWrapper * r,
ExecutionEngine * v4,
quint32 index,
bool * hasProperty = nullptr )
static

Definition at line 178 of file qqmllocalstorage.cpp.

References QV4::StaticValue::asReturnedValue(), QV4::ExecutionEngine::fromVariant(), QV4::ExecutionEngine::newIdentifier(), QV4::ExecutionEngine::newObject(), QV4::Encode::null(), record(), and QV4::Encode::undefined().

Referenced by qmlsqldatabase_rows_item(), and QV4::QQmlSqlDatabaseWrapper::virtualGet().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qmlsqldatabase_rows_item()

static ReturnedValue qmlsqldatabase_rows_item ( const FunctionObject * b,
const Value * thisObject,
const Value * argv,
int argc )
static

Definition at line 216 of file qqmllocalstorage.cpp.

References QV4::Value::as(), QV4::Scope::engine, qmlsqldatabase_rows_index(), RETURN_RESULT, QV4::Heap::QQmlSqlDatabaseWrapper::Rows, QV4::Value::toUInt32(), and V4THROW_REFERENCE.

Referenced by QQmlSqlDatabaseData::QQmlSqlDatabaseData().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qmlsqldatabase_rows_length()

static ReturnedValue qmlsqldatabase_rows_length ( const FunctionObject * b,
const Value * thisObject,
const QV4::Value * ,
int  )
static

Definition at line 133 of file qqmllocalstorage.cpp.

References QV4::Value::as(), RETURN_RESULT, QV4::Heap::QQmlSqlDatabaseWrapper::Rows, and V4THROW_REFERENCE.

Referenced by QQmlSqlDatabaseData::QQmlSqlDatabaseData().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qmlsqldatabase_rows_setForwardOnly()

static ReturnedValue qmlsqldatabase_rows_setForwardOnly ( const FunctionObject * b,
const Value * thisObject,
const Value * argv,
int argc )
static

Definition at line 161 of file qqmllocalstorage.cpp.

References QV4::Value::as(), QV4::Scope::engine, RETURN_RESULT, RETURN_UNDEFINED, QV4::Heap::QQmlSqlDatabaseWrapper::Rows, QV4::ExecutionEngine::throwTypeError(), and V4THROW_REFERENCE.

Referenced by QQmlSqlDatabaseData::QQmlSqlDatabaseData().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qmlsqldatabase_transaction()

static ReturnedValue qmlsqldatabase_transaction ( const FunctionObject * f,
const Value * thisObject,
const Value * argv,
int argc )
static

Definition at line 450 of file qqmllocalstorage.cpp.

References qmlsqldatabase_transaction_shared().

Referenced by QQmlSqlDatabaseData::QQmlSqlDatabaseData().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qmlsqldatabase_transaction_shared()

static ReturnedValue qmlsqldatabase_transaction_shared ( const FunctionObject * b,
const Value * thisObject,
const Value * argv,
int argc,
bool readOnly )
static

Definition at line 413 of file qqmllocalstorage.cpp.

References QV4::Value::as(), QV4::FunctionObject::call(), QV4::QQmlSqlDatabaseWrapper::create(), QV4::Heap::QQmlSqlDatabaseWrapper::Database, db, QV4::Scope::engine, QV4::EngineBase::globalObject, QV4::Heap::QQmlSqlDatabaseWrapper::Query, RETURN_UNDEFINED, SQLEXCEPTION_UNKNOWN_ERR, V4THROW_REFERENCE, and V4THROW_SQL.

Referenced by qmlsqldatabase_read_transaction(), and qmlsqldatabase_transaction().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qmlsqldatabase_version()

static ReturnedValue qmlsqldatabase_version ( const FunctionObject * b,
const Value * thisObject,
const QV4::Value * ,
int  )
static

Definition at line 123 of file qqmllocalstorage.cpp.

References QV4::Value::as(), QV4::Heap::QQmlSqlDatabaseWrapper::Database, QV4::Scope::engine, QV4::ExecutionEngine::newString(), RETURN_RESULT, and V4THROW_REFERENCE.

Referenced by QQmlSqlDatabaseData::QQmlSqlDatabaseData().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ toSqlVariant()

static QVariant toSqlVariant ( const QV4::ScopedValue & value)
static

Definition at line 226 of file qqmllocalstorage.cpp.

References QV4::ExecutionEngine::toVariant().

Referenced by qmlsqldatabase_executeSql().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: