1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include "qv4sqlerrors_p.h"
5#include "private/qv4engine_p.h"
6#include "private/qv4object_p.h"
7
8QT_BEGIN_NAMESPACE
9
10using namespace QV4;
11
12void qt_add_sqlexceptions(QV4::ExecutionEngine *engine)
13{
14 Scope scope(engine);
15 ScopedObject sqlexception(scope, engine->newObject());
16 sqlexception->defineReadonlyProperty(QStringLiteral("UNKNOWN_ERR"), value: Value::fromInt32(SQLEXCEPTION_UNKNOWN_ERR));
17 sqlexception->defineReadonlyProperty(QStringLiteral("DATABASE_ERR"), value: Value::fromInt32(SQLEXCEPTION_DATABASE_ERR));
18 sqlexception->defineReadonlyProperty(QStringLiteral("VERSION_ERR"), value: Value::fromInt32(SQLEXCEPTION_VERSION_ERR));
19 sqlexception->defineReadonlyProperty(QStringLiteral("TOO_LARGE_ERR"), value: Value::fromInt32(SQLEXCEPTION_TOO_LARGE_ERR));
20 sqlexception->defineReadonlyProperty(QStringLiteral("QUOTA_ERR"), value: Value::fromInt32(SQLEXCEPTION_QUOTA_ERR));
21 sqlexception->defineReadonlyProperty(QStringLiteral("SYNTAX_ERR"), value: Value::fromInt32(SQLEXCEPTION_SYNTAX_ERR));
22 sqlexception->defineReadonlyProperty(QStringLiteral("CONSTRAINT_ERR"), value: Value::fromInt32(SQLEXCEPTION_CONSTRAINT_ERR));
23 sqlexception->defineReadonlyProperty(QStringLiteral("TIMEOUT_ERR"), value: Value::fromInt32(SQLEXCEPTION_TIMEOUT_ERR));
24 engine->globalObject->defineDefaultProperty(QStringLiteral("SQLException"), value: sqlexception);
25}
26
27QT_END_NAMESPACE
28

source code of qtdeclarative/src/qml/jsruntime/qv4sqlerrors.cpp