aboutsummaryrefslogtreecommitdiffstats
path: root/SQLiteStudio3/coreSQLiteStudio
diff options
context:
space:
mode:
Diffstat (limited to 'SQLiteStudio3/coreSQLiteStudio')
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/ChangeLog.txt1269
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/TODO.txt24
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/common/bistrhash.cpp9
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/common/bistrhash.h4
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/common/column.cpp50
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/common/column.h21
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/common/compatibility.cpp2
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/common/compatibility.h40
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/common/global.h4
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/common/readwritelocker.cpp8
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/common/readwritelocker.h5
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/common/signalwait.cpp4
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/common/utils.cpp76
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/common/utils.h29
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/common/utils_sql.cpp186
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/common/utils_sql.h63
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/completioncomparer.cpp8
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/completioncomparer.h2
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/completionhelper.cpp244
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/completionhelper.h6
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/coreSQLiteStudio.pro56
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/csvserializer.cpp11
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/datatype.cpp2
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/db/abstractdb.cpp25
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/db/abstractdb.h2
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/db/abstractdb2.h925
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/db/abstractdb3.h48
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/db/chainexecutor.cpp4
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/db/db.cpp19
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/db/db.h43
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/db/dbpluginoption.h8
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/db/dbsqlite.h.autosave72
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/db/dbsqlite3.h2
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/db/invaliddb.cpp21
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/db/invaliddb.h2
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/db/queryexecutor.cpp62
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/db/queryexecutor.h32
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutoraddrowids.cpp19
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutorcolumns.cpp7
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutorcolumntype.cpp47
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutorcolumntype.h19
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutordatasources.cpp3
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutorexecute.cpp44
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutorexecute.h1
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutororder.cpp2
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutorparsequery.cpp2
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutorreplaceviews.cpp27
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutorstep.cpp1
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutorstep.h7
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/db/sqlite3.h12237
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/db/sqlquery.cpp6
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/db/sqlquery.h4
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/db/stdsqlite3driver.h8
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/dbobjectorganizer.cpp138
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/dbobjectorganizer.h9
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/dbversionconverter.cpp1263
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/dbversionconverter.h160
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/ddlhistorymodel.cpp5
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/dialect.h10
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/diff/diff_match_patch.cpp8
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/exportworker.cpp11
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/impl/dbattacherimpl.cpp7
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/impl/dbattacherimpl.h1
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/importworker.cpp30
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/importworker.h4
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitealtertable.cpp4
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitealtertable.h6
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteanalyze.cpp2
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteanalyze.h4
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitebegintrans.cpp9
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitebegintrans.h3
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecolumntype.cpp5
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecolumntype.h2
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecommittrans.cpp2
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecommittrans.h2
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteconflictalgo.cpp2
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecopy.cpp4
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecopy.h10
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreateindex.cpp80
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreateindex.h7
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreatetable.cpp101
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreatetable.h36
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreatetrigger.cpp49
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreatetrigger.h7
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreateview.cpp32
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreateview.h4
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreatevirtualtable.cpp6
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreatevirtualtable.h6
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedeferrable.cpp4
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedelete.cpp6
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedelete.h6
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedropindex.cpp2
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedropindex.h4
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedroptable.cpp2
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedroptable.h4
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedroptrigger.cpp2
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedroptrigger.h4
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedropview.cpp8
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedropview.h4
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteexpr.cpp105
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteexpr.h31
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitefilterover.cpp138
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitefilterover.h65
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteforeignkey.cpp4
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteforeignkey.h4
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteindexedcolumn.cpp4
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteindexedcolumn.h4
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteinsert.cpp10
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteinsert.h4
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitenulls.cpp26
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitenulls.h17
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteorderby.cpp65
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteorderby.h8
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitepragma.cpp8
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitepragma.h4
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitequerytype.cpp40
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitequerytype.h1
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteraise.cpp2
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteraise.h2
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitereindex.cpp2
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitereindex.h4
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliterelease.cpp2
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliterelease.h2
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliterollback.cpp2
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliterollback.h2
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitesavepoint.cpp2
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitesavepoint.h2
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteselect.cpp89
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteselect.h30
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitesortorder.cpp2
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitestatement.cpp17
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitestatement.h11
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteupdate.cpp20
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteupdate.h10
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteupsert.cpp4
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitevacuum.cpp29
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitevacuum.h6
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitewindowdefinition.cpp308
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitewindowdefinition.h129
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitewith.cpp22
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitewith.h2
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/compile_lemon.bat6
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/keywords.cpp359
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/keywords.h46
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/lempar.c3
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/lexer.cpp222
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/lexer.h43
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/lexer_low_lev.cpp111
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/lexer_low_lev.h6
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/parser.cpp86
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/parser.h34
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/parser_helper_stubs.cpp31
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/parser_helper_stubs.h30
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/parsercontext.cpp4
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/parsercontext.h9
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/parsererror.h2
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/run_lemon.bat5
-rwxr-xr-xSQLiteStudio3/coreSQLiteStudio/parser/run_lemon.sh3
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/sqlite2_parse.cpp4662
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/sqlite2_parse.h146
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/sqlite2_parse.y2077
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/sqlite3_parse.cpp6740
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/sqlite3_parse.h344
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/sqlite3_parse.y778
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/statementtokenbuilder.cpp34
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/statementtokenbuilder.h33
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/token.cpp24
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/parser/token.h8
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/plugins/dbplugin.h2
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/plugins/dbpluginsqlite3.cpp5
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/plugins/dbpluginsqlite3.h1
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/plugins/exportplugin.h4
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/plugins/genericexportplugin.cpp4
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/plugins/importplugin.h4
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/plugins/populatedictionary.cpp5
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/plugins/populateplugin.h2
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/plugins/populaterandom.cpp5
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/plugins/populaterandomtext.cpp6
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/plugins/scriptingqt.cpp2
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/plugins/sqlformatterplugin.cpp8
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/populateworker.cpp5
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/querygenerator.cpp72
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/querygenerator.h11
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/returncode.cpp2
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/rsa/BigInt.cpp28
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/schemaresolver.cpp232
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/schemaresolver.h21
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/selectresolver.cpp78
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/selectresolver.h9
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/services/codeformatter.cpp3
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/services/config.cpp6
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/services/config.h11
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/services/extralicensemanager.cpp4
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/services/functionmanager.cpp2
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/services/impl/configimpl.cpp145
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/services/impl/configimpl.h5
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/services/impl/dbmanagerimpl.cpp2
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/services/impl/pluginmanagerimpl.cpp18
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/services/importmanager.cpp6
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/services/importmanager.h2
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/services/pluginmanager.h2
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/services/updatemanager.cpp143
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/services/updatemanager.h21
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/sqlitestudio.cpp12
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/sqlitestudio.h5
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/tablemodifier.cpp53
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/tablemodifier.h3
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/translations.cpp6
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/translations/coreSQLiteStudio_ru.ts96
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/translations/coreSQLiteStudio_zh_CN.ts290
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/viewmodifier.cpp7
-rw-r--r--SQLiteStudio3/coreSQLiteStudio/viewmodifier.h1
212 files changed, 19928 insertions, 16403 deletions
diff --git a/SQLiteStudio3/coreSQLiteStudio/ChangeLog.txt b/SQLiteStudio3/coreSQLiteStudio/ChangeLog.txt
deleted file mode 100644
index 8f1df64..0000000
--- a/SQLiteStudio3/coreSQLiteStudio/ChangeLog.txt
+++ /dev/null
@@ -1,1269 +0,0 @@
-[3.2.1]
- * [BUGFIX]: #3399 Fixed start under Linux using the pre-compiled binary distributions (it used to fail due to missing xcb dependency).
- * [BUGFIX]: #3398 Fixed 'export data' checkbox in export dialog to not ignore it anymore.
- * [BUGFIX]: Binary packages now include the MultiEditorImage plugin, which introduces the picture preview for BLOB values. It was introduced in 3.2.0, but missing in binary distributions.
-
-[3.2.0]
- * [NEW]: #3188 New plugin to have images stored in database being visible as another tab in the Form View or cell's editor dialog window.
- * [NEW]: #3207 #1444 #2547 Export, Import & Populate dialog settings are remembered, even after application restart.
- * [NEW]: #3268 Query bind parameters are now supported by the query editor while execution - user will be asked for values for these parameters in a dedicated dialog.
- * [NEW]: #3267 Added Extension Manager window, where all SQLite extensions can be registered for loading into databases.
- * [NEW]: #3161 Added support for table-valued functions (https://sqlite.org/vtab.html#tabfunc2)
- * [NEW]: #3349 Added support for UPSERT syntax from SQLite 3.24.0.
- * [NEW]: #3292 Added possibility to execute huge SQL files directly from disk, without loading them to SQL Editor.
- * [NEW]: #3265 Completely new installer for SQLiteStudio is introduced. It bases on Qt Installer Framework. This addresses numerous issues with automatic updates that SQLiteStudio had. It also allows for some new features, like automatic file association under Windows (#3178). Portable (download & run, without installation) distribution continues to be available.
- * [NEW]: #2659 AutoIncrement option is now always available in PK configuration dialog. When AutoIncrement is enabled, a datatype will be enforced to INTEGER type.
- * [NEW]: #2798 Added filter inputs per column as an option.
- * [NEW]: #3224 Added context menu for SQL history tab to delete individual (or a range of selected) entries. Also a "delete" key can be used.
- * [NEW]: #2651 Only a single instance of SQLiteStudio can be running at the time. If another instance is requested, the first one will be brought to the front of windows stack. If another instance was requested due to associated file being open, then the first instance will not only be raised, but also the requested file will be added to database list as temporary, volatile database (not added permanently to configuration).
- * [NEW]: #3033 Ctrl+Shift+c copies data including headers. Also context menu entry added for the same.
- * [NEW]: #2962 Pasting single value to multiple cells results in pasting the value into all selected cells, not just to first one.
- * [NEW]: #2907 The "Open file's directory" menu item added to database list for database nodes.
- * [NEW]: #3388 Added file association entries in the plist for MacOSX
- * [NEW]: #3163 Added menubar accelerator keys.
- * [CHANGE]: #3257 #3260 #3271 Bug/Feature reports are now completely managed by GitHub. Bug report dialog is no longer present in the application, but instead the menu entry opens web browser on project's GitHub page.
- * [CHANGE]: #3285 SQLCipher and wxSQLite3 plugins can now be linked to system-provided libraries, which is especially useful under Linux. Instructions were added to the wiki page: https://github.com/pawelsalawa/sqlitestudio/wiki/Instructions_for_compilation_under_Linux#linking-with-system-provided-libraries
- * [CHANGE]: #3284 SQLite3 upgraded to version 3.24.0 (excluding SQLCipher plugin, which is still on 3.20.1).
- * [CHANGE]: API of QueryExecutor enhanced to provide custom steps at certain stages of execution. Steps can be injected by plugins.
- * [CHANGE]: #3121 Column widths are kept between data reloads.
- * [CHANGE]: #3024 Edit in editor action in cell's context menu stands now "show in viewer" if clicked on read-only cell. Also "set null" and "erase" are not displayed if none of selected cells is editable.
- * [CHANGE]: #3142 Horizontal scroll position is now preserved between sort request on a data view.
- * [CHANGE]: #2971 Column width is now mostly based on data width, not header width, but if there is little columns to be displayed, the header width is also considered.
- * [CHANGE]: #3323 Disabled automatic line wrapping in SQL editor and all other code edition fields in the application.
- * [BUGFIX]: #3259 #3215 #3327 Stop interpreting "+3" or "0010" as numeric types if entered to TEXT column (or any other column not declared as numeric-ish).
- * [BUGFIX]: #3191 CSV import speed improved. It's 1400 times faster. It's not a joke. The bug used to cause the import to be terribly slow. Also other importing plugins gained around 400% of speed.
- * [BUGFIX]: #3119 Fixed extra "empty" row of data when importing from CSV with a new, empty line at the end.
- * [BUGFIX]: #3235 Crash when opening DB dialog, but file was moved.
- * [BUGFIX]: #3185 Fixed creation of new tables/views if "Data" tab is configured as first.
- * [BUGFIX]: #3279 Fixed reporting rows affected with DELETE statement for SQLite2.
- * [BUGFIX]: #3023 Optimized SQL editor widget to work with huge contents.
- * [BUGFIX]: Fixed random crashes at application close (when saving session). Most frequend on Windows platform.
- * [BUGFIX]: #3252 Fixed first character input when starting to edit FK column data.
- * [BUGFIX]: #3251 Fixed DEFAULT constraint dialog to work wit "literal values in double-quotes"
- * [BUGFIX]: #3084 #3085 Fixed beeps under MacOSX when editing FK cell.
- * [BUGFIX]: #3293 Fixed deault shortcut for code assistant under MacOSX from Cmd-Space to Ctrl-Space, so it does not conflict with Spotlight
- * [BUGFIX]: #3190 Fixed handling WITHOUT ROWID and unusual column name.
- * [BUGFIX]: #3177 Fixed tab indentations when selecting even part of a line.
- * [BUGFIX]: #3171 Pasting object to same database is prevented.
- * [BUGFIX]: #3176 Fixed exporting with Common Table Expression (the WITH statement).
- * [BUGFIX]: #3162 Fixed order of column headers in Index Dialog
- * [BUGFIX]: #3159 Fixed dictionary populating plugin to recognize different new-line characters.
- * [BUGFIX]: #3156 Fixed recognition of double-quoted values.
- * [BUGFIX]: #3093 Columns with AUTOINCREMENT statement are defaulted to null for new rows in Form View, so they get committed this way (unless manually changed) and they become an auto generated values.
- * [BUGFIX]: #3086 #3187 Fixed internal task ordering when drag&dropping tasks on the taskbar, so switching between tasks with keyboard shortcut reflects order of tasks on the taskbar.
- * [BUGFIX]: #3173 Added support for detecting and trimming whitespace in pasted text (thanks to nishanthkarthik for contributing this)
- * [BUGFIX]: #2922 Fixed CTE execution by QueryExecutor, so it understands columns from CTE (not editable columns for now, maybe will become editable in future).
- * [BUGFIX]: #2964 SQL history tab shows now local time of execution, not UTC.
- * [BUGFIX]: #3290 Fixed querying data for FK dropdown from tables/columns with unusual characters in name. Also fixed name-wrapping for objects that have unescaped wrapper character inside of their name.
- * [BUGFIX]: #3305 Introduced dynamic limit for number of rows per page - based on number of columns, so it's less likely to hit the memory limit.
- * [BUGFIX]: #3311 Fixed floating point numbers handling.
- * [BUGFIX]: #3383 Fixed JSON export plugin for quoted names.
- * [BUGFIX]: #3347 #3351 Fixed QCheckBox in several places, so text() of it is not used as a valid data. This is to address issues with automatic accelerator keys.
- * [BUGFIX]: Addressed some concurrency erorrs in SQLite 2 plugin
- * [BUGFIX]: #3139 #3116 #3326 #3341 Various code compiling issues addressed.
- * [BUGFIX]: #3145 #3165 #3179 Fixed various typos in messages/interface.
- * [BUGFIX]: #3333 Fixed unit test to honor new features of TableModifier, but also fixed few bugs in TableModifier.
- * [BUGFIX]: #3277 Open Source license issues addressed (specific exceptions for OpenSSL and icons)
- * [BUGFIX]: #2966 Application icon added to package.
- * [BUGFIX]: Few other bugfixes made on the fly, while working on other issues.
-
-[3.1.1]
- * [ADDED]: WxSQLite3 plugin (with encryption support).
- * [ADDED]: System.Data.SQLite plugin (ADO.NET, includes encryption support).
- * [ADDED]: Support for "Row Value" introduced in SQLite 3.15.0.
- * [ADDED]: New option in configuration dialog to decide whether you want to keep NULL values when entering empty strings in cells (new, more intuitive behavior), or overwrite NULLs with empty string values (as it used to be so far).
- * [ADDED]: Editor window has now "Find" and "Replace" toolbar buttons for those functions (which were already there, available under shortcuts).
- * [ADDED]: New built-in functions: import(), import_formats(), import_options() and charset(). All described on SQLiteStudio's wiki (at User Manual page).
- * [ADDED]: #3106 ScriptingTcl has now "tcl_init" command to invoke full interpreter initialization, which creates [clock] commands and some others. It's not invoked automatically to avoid performane issues.
- * [ADDED]: #3136 Added "--master-config" command line option to have a settings file (regular SQLiteStudio config file) that all running SQLiteStudio instances import settings from. More details in manual on wiki page.
- * [ADDED]: #3127 Added 'select all' and 'deselect all' buttons in tigger's UPDATE OF columns dialog.
- * [CHANGE]: #3135 Re-enabled possibility to close database list panel (and reopen it from the View menu entry).
- * [CHANGE]: #2901 Automatically generated database name includes full file name, except for the file extension only (unlike before, when it took only a file name up to the first dot).
- * [CHANGE]: #3140 The "generate name automatically" checkbox has been removed. Now the name is generated automatically by default, unless user starts to edit the name manually.
- * [BUGFIX]: #3118 #3124 #2943 Fixed double precision numbers formatting.
- * [BUGFIX]: DbAndroid plugin: Fixed 'adb' automatic detection under Linux.
- * [BUGFIX]: #3126 #3092 Fixed problem with database versions in Android plugin.
- * [BUGFIX]: #3155 Fixed crash when confiriming custom FK value with Enter key.
- * [BUGFIX]: #3094 #3095 Fixed default FK value preselection when tabbing through cells.
- * [BUGFIX]: #3154 Fixed crash when mass replacing token to another token containing initial token.
- * [BUGFIX]: Fixed query generation for "UPDATE" and "DELETE" when invoking it from Database List context menu for the table.
- * [BUGFIX]: Fixed Ctrl+click (Cmd+click on MacOSX) handling of object names that require name wrapping (such as names with spaces in it).
- * [BUGFIX]: #3133 Fixed resolving tables with unusual (like cyrillic) characters in their names.
- * [BUGFIX]: #3096 Restored data editing by Return key hit, that got broken in 3.1.0 for MacOSX.
- * [BUGFIX]: #3122 Several tweaks to Android shell mode connection.
- * [BUGFIX]: #3093 Fixed memory leak in Android plugin.
- * [BUGFIX]: #3132 Fixed column resolving in a View that uses same alias for two different columns.
- * [BUGFIX]: Fixed importing Windows and Macintosh end-line format CSV files (handling \r\n and \r properly).
- * [BUGFIX]: #3134 Fixed recognizing CREATE TRIGGER statements properly when CASE-WHEN-END is used inside.
- * [BUGFIX]: #3112 Fixed Foreign Key editing when the foreign table was modified (for example renamed) and the local column was already presented in the data view.
- * [BUGFIX]: #3113 DEFAULT value is now automatically inserted only when committing NULL for NOT NULL column. Also new option is introduced to use DEFAULT always for NULL values, regardles of NOT NULL constraint.
- * [BUGFIX]: Fixed refreshing database list view when changing labels display settings in configuration dialog.
- * [BUGFIX]: Fixed FormView row navigation shortcuts.
- * [BUGFIX]: #3097 Fixed alphabetical ordering when exporting entire database.
- * [BUGFIX]: Fixed "UPDATE OF" column list formatting (indentation) in Enterprise Formater plugin.
- * [BUGFIX]: Fixed SqlSimpleFormatter plugin to add ";" at the end of CREATE TABLE statements while exporting database schema to SQL format.
- * [BUGFIX]: Data view fonts now apply to other tabs in the table window and view window.
- * [BUGFIX]: #3005 Fixed performance issue with lots of big values loaded into the grid. Also fixed editing those values using the inline cell editor.
- * [BUGFIX]: #2938 Fixed query executor to idenfity properly tables in named subselects, to the ROWID is handled correctly.
- * [BUGFIX]: #3168 Fixed data filter field in data view, so it handles the single quote character.
- * [BUGFIX]: #2942 Erasing table data context menu option now honors multiple table selection.
- * [BUGFIX]: #2900 Optimized execution of thousands of queries at once in SQL editor window.
- * [BUGFIX]: #2934 Table foreign key dialog can now refer to the same table. So far only column dialog constraint for FK could do it.
- * [BUGFIX]: #3120 Performance of SQL editor window greatly increased when working with huge sets if queries (like thousands).
- * [BUGFIX]: #3028 Fixed formatter for "NOT EXISTS" expression.
- * [BUGFIX]: #2990 Fixed handling scientific numbers notation.
- * [BUGFIX]: #2987 Fixed "go to referenced row" function when using multi word object names.
- * [BUGFIX]: #3173 Fixed numerous typos in messages and names.
- * [BUGFIX]: #3178 Fixed pagination for query simple execution method.
- * [BUGFIX]: #3177 Fixed ORDER BY with column numbers, instead of names.
- * [BUGFIX]: #3125 Fixed trigger UPDATE OF columns popup dialog positioning.
- * [BUGFIX]: #3166 Fixed crash when trying to print data.
- * [BUGFIX]: Fixed reading long values of not-editable result columns (like expressions or functions that return long values). They used to be truncated.
- * [BUGFIX]: Compilation fixes.
-
-[3.1.0]
- * [ADDED]: SQLCipher plugin is now free, open source and distributed together with other standard plugins.
- * [ADDED]: #2963 Indexed expressions for CREATE INDEX statements (introduced in SQLite 3.9) are now supported and can be edited in Index Dialog.
- * [ADDED]: View window now supports explicit column names for the view (introduced in SQLite 3.9).
- * [ADDED]: #3056 #3063 Implemented index column ordering in index dialog.
- * [ADDED]: Added shortcut (Ctrl+/ by default) to toggle comment of current line or selected block of code (if any) in SQL editor.
- * [ADDED]: #3040 Added new entry in context menu of data grid to generate SELECT/INSERT/UPDATE/DELETE statement together with WHERE clause containing IN conditions for selected cells.
- * [ADDED]: Added new entry in context menu of database list to generate queries like in #3040 for selected table.
- * [ADDED]: #2975 Information message after successful table/view change.
- * [ADDED]: Introduced "loadByDefault" property for plugin descriptor files.
- * [ADDED]: Added options to have "Data" tab placed as a first tab for Table windows and for View windows. By default option is disabled, so by default nothing changes.
- * [ADDED]: Added option in configuration dialog to avoid reopening status panel for each message printed there.
- * [ADDED]: Added option in configuration dialog to prevent displaying tooltips over data view when user holds mouse over it.
- * [ADDED]: #3070 Added option in configuration dialog to have new databases marked as not permanent by default.
- * [ADDED]: #3070 Added option in configuration dialog to bypass database dialog completely when dropping file from file manager onto database list.
- * [ADDED]: #3013 When double clicking on empty space in list of indexes or tables (in table or view window) the action is not ignored, but a dialog opens for adding new item.
- * [CHANGE]: DbAndroid plugin has now JAR file embedded and you can get it from Tools menu.
- * [CHANGE]: SQLite version updated to 3.13.0.
- * [CHANGE]: Qt version updated to 5.6.0. Should still compile with 5.3, but binary distributions on homepage will be made with 5.6.
- * [CHANGE]: Foreign key dropdown (when editing FK cell) uses now more readable set of columns and column headers can be resized.
- * [CHANGE]: Column dialog validates scale and precision fields (against INTEGER PRIMARY KEY and against each other).
- * [CHANGE]: Structure tab in table window has now fully named headers in column list.
- * [CHANGE]: Table and View window options moved from Look & Feel configuration page to Data Browsing page.
- * [CHANGE]: All database list options moved to a separate Database List configuration page.
- * [CHANGE]: Window list in main menu -> "View" -> "Window list" is not sorted alphabetically.
- * [BUGFIX]: Not loading Android plugin by default (needs manual load from configuration dialog), which stops the "ADB" error for people not using the plugin.
- * [BUGFIX]: #2927 Several critical bugs fixed and enhancements to table modification algorithm related to foreign keys.
- * [BUGFIX]: #2954 #2803 #2937 Fixed incorrect recreation of foreign keys chain.
- * [BUGFIX]: #3008 Editing foreign key cell with more than 10 000 possible values will now use simple text editor, not dropdown. It also loads values asynchronously.
- * [BUGFIX]: Fixed importing from CSV with some of lines containing less fields than defined in header (or in first data row).
- * [BUGFIX]: #2989 Fixed multiline value handling in CSV import plugin.
- * [BUGFIX]: #2921 Fixed empty values as NULL handling in CSV import plugin.
- * [BUGFIX]: #3034 Fixed handling empty string as value for DEFAULT constraint.
- * [BUGFIX]: #3064 Fixed locking database executions when counting rows in huge tables.
- * [BUGFIX]: DbAndroid plugin has fix for null pointer in the JAR when client has disconnected
- * [BUGFIX]: Error message details were missing in some cases (when smart execution method failed at parsing stage). This is fixed now.
- * [BUGFIX]: #3026 #3027 #3043 Fixed RAISE() function formatting in enterprise formatter (used to produce invalid SQL).
- * [BUGFIX]: #3015 Fixed error with DEFAULT constraint containing datetime('now', 'localtime').
- * [BUGFIX]: #3000 Fixed compilation errors for Qt >= 5.5.
- * [BUGFIX]: #2956 Fixed unexpected data refresh when clicking in the right side of value filter field in table window.
- * [BUGFIX]: #2991 #2928 #2929 #2941 #2960 Fixed executing "garbage" query, causing application crash.
- * [BUGFIX]: #2920 Fixed removing several databases.
- * [BUGFIX]: #3068 #3066 Fixed database removal confirmation dialog so the message asks about removing it from the list, not deleting it.
- * [BUGFIX]: #3073 Fixed crash when unloading plugin with its own configuration subpage and saving config dialog.
- * [BUGFIX]: #2931 #2962 Fixed incorrect results when executing 2-level queries with an expression and an alias combination as a result column definition.
- * [BUGFIX]: #2942 Fixed deleting multiple tables/indexes/... when selected them and picked "Delete table/index/..." from context menu.
- * [BUGFIX]: #2945 Fixed manual reordering of database objects with Drag&Drop.
- * [BUGFIX]: #3055 Fixed crash when exporting on MacOS using plugin that requires column value length information (such as PDF export plugin).
- * [BUGFIX]: #3047 Fixed copying/moving tables together with indexes or triggers with Drag&Drop across same SQLite version databases.
- * [BUGFIX]: #3012 SQL simple formatter plugin does not load by default from now on. It is still available, but won't load until manually loaded.
- * [BUGFIX]: Table window for new table (just created) will now properly close when that table gets deleted immediately by the user.
- * [BUGFIX]: #2998 Fixed reading decimal values from database when using simple execution method (a fallback in case of some problems).
- * [BUGFIX]: #2999 Fixed working on objects from database that on the list is named "main".
- * [BUGFIX]: Fixed error detection when selecting column from incorrect table alias (http://forum.sqlitestudio.pl/viewtopic.php?f=11&t=1051).
- * [BUGFIX]: #3046 Fixed scale & precision fields in column dialog so it's possible to delete their values from the column.
- * [BUGFIX]: Vacuum invoked from context menu on database list is now executed in SQL editor and is asynchronous.
- * [BUGFIX]: #3001 Order of objects exported by Export Dialog is now alphabetical (in object type groups).
- * [BUGFIX]: #3022 Fixed parsing of some expressions, resulting in this particular bug report in being unable to browse view results.
- * [BUGFIX]: Enhanced floating point numbers handling.
- * [BUGFIX]: Fixed formatting of INSERT and UPDATE statements.
- * [BUGFIX]: Enterprise formatter no longer puts new lines when formating list of elements in "IN" clause.
-
-[3.0.7]
- * [ADDED]: #2951 Implemented dropdown value picking for foreign key columns in grid view.
- * [ADDED]: Context menu entry to go to row in referenced table by current foreign key cell value.
- * [BUGFIX]: #2875 Fixed font misconfiguration after Qt update.
- * [BUGFIX]: #2879 Fixed View updating after table modification, when view uses SELECT with table alias same as table name.
- * [BUGFIX]: #2885 Fixed tokens parsing, causing random problems, such as incorrect formatting performed by the simple formatter.
- * [BUGFIX]: Fixed preventing of setting null or empty value on query results that don't come directly from table.
- * [BUGFIX]: Fixed duplicates while copying mupltiple lines from status field.
-
-[3.0.6]
- * [ADDED]: #2740 Option to configure whether bottom dock area (with status field) should extend to left border, or should it leave space for database list.
- * [ADDED]: #2819 Introduced "compact layout" as an option (enabled by default) to minimize all margins on the interface.
- * [ADDED]: CSS console for SQLiteStudio (under F11 key) to allow customizing all aspects UI look and feel at a low level.
- * [ADDED]: #2805 The 'Save SQL' action in SQL editor now uses the same file if repeated, unless user picks 'select file to save' from drop-down menu.
- * [ADDED]: #2801 Added option to select where to position the new inserted row - above/below selected row, or at the end of data view.
- * [CHANGE]: Database list is by default from top to bottom, making the status field placed next to the database list, instead of being below it.
- * [BUGFIX]: Fixed 'rows affected' counter when using transactions and executing everything at once.
- * [BUGFIX]: Fixed importing from CSV with empty (NULL) values in last column of last data row.
- * [BUGFIX]: #2853 Allow '$' character as a part of an identifier.
- * [BUGFIX]: #2846 Fixed crash when executing query on a database after just removed other database from the list.
- * [BUGFIX]: #2856 Fixed not working updates manual checking if automatic checking was disabled.
- * [BUGFIX]: #2863 Fixed config dialog to honor DbTree presentation options (sorting, labels) immediately, no manual refreshing required.
- * [BUGFIX]: #2862 Fixed loading SQL scripts into editor when using Chinese language.
- * [BUGFIX]: #2855 Automatic updates are now enabled only for portable build and are disabled by default for other builds.
- * [BUGFIX]: #2867 Fixed support for "ISNULL" in query execution.
- * [BUGFIX]: Fixed synchronization bug in DbSqlite2 plugin causing random crashes.
- * [BUGFIX]: Views are recreated after table modification only if they really need to be updated according to the table change.
- * [BUGFIX]: Fixed querying selects with numerous subselects with '*' operators for result columns.
- * [BUGFIX]: #2868 Global configuration directory is not created (even empty) when using portable configuration.
- * [BUGFIX]: #2866 Fixed Search dialog in SQL editor to honor changes of the searched value during the single session of searching.
- * [BUGFIX]: Fixed importing from data source that provides columns with special characters - they are no longer splitted to column name and datatype.
- * [BUGFIX]: Fixed problem with keyboard focus for syntax completer under Gnome 3.
- * [BUGFIX]: #2872 'Enter' key in table name of import dialog now triggers 'Next' action, not clearing the table name.
- * [BUGFIX]: #2864 & #2791 Fixed synchronouse execution in QueryExecutor, which also fixes the misterious bug in export dialog, causing empty files being exported.
- * [BUGFIX]: Fixed encoding detection and connection testing for SQLite2.
-
-[3.0.5]
- * [ADDED]: #2831 Ported 'Erase table data' feature (in table's context menu) from version 2.1.5.
- * [CHANGE]: Data view has now a 'cover' with progress bar when committing more changes at once. This eliminates weird GUI freeze when committing lots of new/deleted rows.
- * [CHANGE]: Populate dialog has now progress bar when working.
- * [CHANGE]: Enhanced SQL formatter to format CREATE TRIGGER statements in a bit more readable way.
- * [BUGFIX]: #2838 Fixed outstanding bug causing database file to be deleted if a user tried "Test connection" on the database under Windows.
- * [BUGFIX]: Fixed crash when closing Populate Dialog while populating was in progress.
- * [BUGFIX]: Fixed warning messages when there was a problem with restoring windows from last session. A message contains now window name that caused problem.
- * [BUGFIX]: #2830 Closing database list made impossible.
- * [BUGFIX]: #2829 Fixed support for DEFERRABLE (and related) keywords in foreign keys.
- * [BUGFIX]: #2827 Release a file after import.
- * [BUGFIX]: #2826 Fixed bug in SQL formatter causing 'expr ISNULL' expressions to disappear.
- * [BUGFIX]: #2834 Removed './lib' form rpath for linux non-portable compilation.
- * [BUGFIX]: #2836 Removed termcap dependency, as it was deprecated and no longer required.
-
-[3.0.4]
- * [ADDED]: Import dialog has now "Ignore errors" option, to skip rows that causes problems (constraint violation, wrong column count, etc).
- * [CHANGE]: Enhanced Copy&Paste capabilities of data grid, so copying and pasting internally in SQLiteStudio will not be limited by TSV format (NULL values will be distinguished, tab characters will be allowed in values), only pasting from outside will be affected by TSV limitations.
- * [CHANGE]: "Invalid database" icon changed, so it's no longer confusing with "Connected" database.
- * [CHANGE]: "Databases" panel cannot be closed/hidden anymore.
- * [CHANGE]: Database dialog reorganized to look a bit nicer, db type moved to top, URL browse button for file is now separated to 2 buttons.
- * [BUGFIX]: #2795 XmlExport plugin: Fixed crash that happend in most exports.
- * [BUGFIX]: XmlExport plugin: Fixed column number attribute incrementing for data rows.
- * [BUGFIX]: #2793 SqlEnterpriseFormatter plugin: Fixed formatting queries starting with EXPLAIN and EXPLAIN QUERY PLAN.
- * [BUGFIX]: #2786 Fixed double plugin names in config dialog for built-in plugins.
- * [BUGFIX]: Fixed dead-lock when fixing path for a database that pointed to inexisting file.
- * [BUGFIX]: Fixed data editing for SQL queries joining the same table several times.
- * [BUGFIX]: Fixed "Ctrl+W"/"Cmd+W" shortcut to work every time, not only every second time.
- * [BUGFIX]: Fixed order of window focusing when closing with "Ctrl+W"/"Cmd+W" shortcut.
- * [BUGFIX]: #2797 Database type is no longer disabled when adding existing database file.
- * [BUGFIX]: SqlExport appends Foreign Key (re)enabling pragma at the end.
- * [BUGFIX]: "Maximized" MDI window state is no longer lost after closing last MDI window.
- * [BUGFIX]: #2812 TableModifier is now much smarter about when to recreate triggers and how to do it.
- * [BUGFIX]: TriggerDialog no longer loses "When" field when editing existing trigger.
- * [BUGFIX]: Columns of Indexes and Triggers tabs in Table Window don't shring after refresh anymore.
- * [BUGFIX]: NumPad Enter key also accepts the Code Assistant choice.
- * [BUGFIX]: Fixed drawing items in SQL code assistant, so they no longer are "black on dark blue" when using classic Windows theme.
- * [BUGFIX]: #2790 Fixed hexadecimal literals evaluation in SQL queries.
- * [BUGFIX]: #2804 Fixed querying SQLite 2 database.
- * [BUGFIX]: Fixed executing query like: SELECT * FROM (SELECT * FROM table); - it used to crash.
- * [BUGFIX]: #2798 Fixed crash when restoring DbList group for inexisting database.
- * [BUGFIX]: #2808 Sorting indicators in data grid fixed to point the right direction and got a little bit larger.
- * [BUGFIX]: #2807 Fixed SQL export plugin when exporting whole database without formatting SQL, so the missing semicolons are appended to each DDL.
- * [BUGFIX]: #2806 Fixed table sorting in Export Dialog.
- * [BUGFIX]: #2809 Fixed crash when trying to paste data into data grid with no rows in it.
- * [BUGFIX]: Fixed rolling back of row marked to deletion, if it was previously already marked as edited.
- * [BUGFIX]: #2814 Fixed executing custom SQL function with same bind parameter used multiple times.
- * [BUGFIX]: #2815 Fixed refreshing data pages after adding/deleting rows in grid view.
- * [BUGFIX]: #2820 Fixed parsing 'IN table.column' expression (used to incorrectly assume a 'NOT' keyword to be present, even it wasn't).
-
-[3.0.3]
- * [ADDED]: Added visual validation indicators to DbDialog, so user is informed why the "Ok" button is disabled at the moment.
- * [ADDED]: Russian translation.
- * [ADDED]: French translation.
- * [ADDED]: #2770 Added SQLite 3 version used by application in the Environment tab of the About dialog.
- * [CHANGE]: Language translations located in a separate directory have now higher precedense, than translations compiled in, so it's possible to test updated translations "on the fly".
- * [BUGFIX]: Fixed support for "function(DISTINCT args)" in Enterprise formatter.
- * [BUGFIX]: #2753 Fixed parsing TEMP and IF NOT EXISTS in CREATE TABLE statement.
- * [BUGFIX]: #2755 Fixed error checking for recurrent expression with LIKE/GLOB operator in it.
- * [BUGFIX]: Switched error message from simple method error to smart method error in QueryExecutor to avoid misleading messages.
- * [BUGFIX]: #2760 Fixed marking "unique" in index dialog when opening existing unique index.
- * [BUGFIX]: #2757 Fixed int64 rounding problem.
- * [BUGFIX]: #2767 Fixed NOT NULL dialog in column dialog, so it doesn't convert to UNIQUE.
- * [BUGFIX]: #2763 Fixed possibility of adding 2 same databases to the list.
- * [BUGFIX]: Fixed copying values from Environment tab of the About dialog.
- * [BUGFIX]: #2774 Fixed handling triggers (when modifying table) in foreign tables, triggers referencing table in its subqueries, etc.
- * [BUGFIX]: Fixed executing SELECT in SQLite2 for columns that need wrapping.
- * [BUGFIX]: Fixed editing data for tables transparently attached in the SQL query.
- * [BUGFIX]: Fixed Shortcut titles translation in configuration dialog.
- * [BUGFIX]: Fixed aggregate functions, so initial and final codes are executed, not only the per-step code.
- * [BUGFIX]: #2781 Portable configuration directory can now be either in the running directory, or in applications directory. It's auto-detected.
- * [BUGFIX]: Optimized loading huge data sets into data grid. It's faster and the progress bar acts more smoothly.
- * [BUGFIX]: Shortcut for closing current window is now displayed in the context menu for taskbar.
- * [BUGFIX]: "Skip first line" option in CSV import renamed to "First line represents CSV columns". Maybe this time it won't confused anyone.
- * [BUGFIX]: #2790 Fixed hexadecimal literals evaluation in SQL queries.
-
-[3.0.2]
- * [ADDED]: Full support for the interface translations.
- * [ADDED]: Polish translation.
- * [ADDED]: #219, #2711 Reset autoincrement feature to context menu of table and to structure toolbar in table window.
- * [ADDED]: #2715 Added "rows affected" to the execution result message for INSERT/DELETE/UPDATE queries.
- * [BUGFIX]: Fixed deleting column from table that is the only column covered by an index or an "UPDATE OF" trigger.
- * [BUGFIX]: #2703 Fixed compilation errors on GCC 4.9.
- * [BUGFIX]: #2707 Fixed crash when importing CSV file with empty value for last column.
- * [BUGFIX]: Valid objects in SQL editor are now highlighted and are Ctrl+clickable (the feature was there, but was broken and it didn't work).
- * [BUGFIX]: Fixed invalid 'modified' status when focusing out NumberMultiEditor in FormView, resulting in uncommitted change on FormView, even there was no change.
- * [BUGFIX]: #2698 Fixed double precision numbers displaying in the Grid View.
- * [BUGFIX]: #2696 Fixed handling foreign keys when the main table was not renamed, just columns changed.
- * [BUGFIX]: #2713 Fixed foreign key actions in Foreign Key dialog, so they are no longer the same for ON UPDATE and ON DELETE, even they were configured differently.
- * [BUGFIX]: #2715 Fixed storing rows affected/selected in SQL Editor history (bug since version 3.0.0 caused "rows" column in SQL history to be always 0).
- * [BUGFIX]: Main window toolbar is updated after creating/deleting database objects (it was not).
- * [BUGFIX]: #2722 Fixed crash when exporting database without data.
- * [BUGFIX]: #2727 Fixed error message when calling SELECT with table from (transparently) attached database and selecting invalid column - message was misleading.
- * [BUGFIX]: #2728, #2729 Fixed DEFAULT constraint dialog, so 1) it works when creating first column for new table, 2) it allows a single word as a default value, even the word is not an explicit string.
- * [BUGFIX]: #2697 Fixed data populate dialog.
- * [BUGFIX]: #2731 Fixed problem with attached databases not detaching after transparent attach in cross-database queries.
- * [BUGFIX]: #2734 Fixed code assistant crash in Trigger Dialog.
- * [BUGFIX]: #2721 Fixed initial selection of database in SQL Editor window, so it's set to the database currently selected in databases list on the left.
- * [BUGFIX]: #2721 Added database name to error message when the SQL query execution failed.
- * [BUGFIX]: #2718 Checkbox in CSV import plugin renamed to "Skip first row of data".
- * [BUGFIX]: Fixed staring edition of data in grid by pressing Enter key.
- * [BUGFIX]: #2745 Fixed crash when ctrl+right_clicking in SQL editor.
- * [BUGFIX]: #2733 Fixed handling of foreign keys when changing table structure.
- * [BUGFIX]: #2749 Fixed handling of function(distinct arg), resulting in incorrect results when executed.
- * [BUGFIX]: Fixed logging SQL queries when --debug-sql is enabled. Queries from query executor were not logged.
-
-[3.0.1]
- * [ADDED]: When the data is being read into the Gird View, columns width gets automatically adjusted, so for small values they are shrinked and for bigger values they're enlarged, but never above the configured limit (a new option in config dialog).
- * [ADDED]: Implemented support for immediate editing of rows just added to the WITHOUT ROWID tables (previously the manual refresh of data view was required).
- * [BUGFIX]: Fixed support for expressions as DEFAULT value in table.
- * [BUGFIX]: Fixed support under Windows for running portable distribution, while having different version of Qt installed in the system (added the qt.conf file).
-
-[3.0.0]
- * [ADDED]: Application has been rewritten from scratch in C++ and Qt (was previously written in Tcl/Tk). This means improvements in all areas, especially in application performance, good looking interface, more friendly interface and more stability.
- * [ADDED]: Database list can now group databases in named groups (groups can be embedded in each other).
- * [ADDED]: Changes made to database schema (modifying/adding/dropping tables, indexes, etc) are now confirmed with user by a DDL dialog (can be disabled).
- * [ADDED]: Form View for data is now configurable and extensible (with plugins). You can configure which editors you want to make available for which data type.
- * [ADDED]: Custom collation editor window, so you can implement custom collations using any scripting language available in SQLiteStudio
- * [ADDED]: Changes made to database schema can now always be tracked down by a DDL history window, which keeps track of all changes you do to the database.
- * [ADDED]: Database conversion utility now previews changes to be made to the database.
- * [ADDED]: Drag&drop of objects between databases will preview changes that need to be made to objects before they can be created in the target database.
- * [ADDED]: Most of the dialogs/forms is validated on-the-fly and user is notified about any problems immediately with a small red icons over the problematic field.
- * [ADDED]: Scripting languages are now provided by plugins. With this version there is support for QtScript (built in), SQL (built in) and Tcl (as a plugin).
- * [ADDED]: Support for sorting data by multiple columns by right-clicking on the data grid header.
- * [ADDED]: Support for "WITHOUT ROWID" tables and "WITH" clause in queries.
- * [ADDED]: If there are any uncommitted changes (in data or schema), user will be asked for confirmation before closing application or MDI window.
- * [ADDED]: Printing (for data, schema and query) support.
- * [ADDED]: Much, much more, it's just hard to put every single detail in the changelog. After all, the entire application was written from the very beginning.
- * [CHANGE]: Table is now edited in the table window directly, not in any special dialog.
- * [CHANGE]: SQL syntax validator now underlines errors, instead of changing background color.
- * [CHANGE]: SQL parsing is done in separate threads, making the UI smooth and responsive.
- * [CHANGE]: Executing queries is done in separate threads, making the UI smooth and responsive.
- * [CHANGE]: Custom SQL functions editor is now a MDI window with more powerful editing capabilities.
- * [CHANGE]: Import and export dialogs are now a "Wizard" dialogs and they become more organized.
- * [CHANGE]: SQLite3 version updated to 3.8.7.4.
- * [BUGFIX]: The new version deals much better with huge databases than the old version did.
- * [BUGFIX]: The MacOS X port doesn't crash all the time, like it was for version 2.1.x. It's just as stable as for any other operating system.
- * [BUGFIX]: SQL syntax assistant got smarter and it deals much better with complex queries.
- * [BUGFIX]: Enterprise SQL formatter deals better with complex queries.
-
-[2.1.5]
- * [BUGFIX]: Fixed conversion dialog: http://bugs.sqlitestudio.pl/?id=2515
- * [BUGFIX]: Fixed conversion dialog: http://bugs.sqlitestudio.pl/?id=2513
-
-[2.1.4]
- * [BUGFIX]: Fixed conversion dialog: http://bugs.sqlitestudio.pl/?id=2021
-
-[2.1.3]
- * [ADDED]: Shortcut for editing cell value in BLOB editor dialog (default is Shift-Return, but can be configured).
- * [ADDED]: Configuration option (on Misc config tab) to define how wide (maximum) can grid column be.
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1879
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1878
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1883
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1893
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1907
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1921
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1916
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=2062
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=2093
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=2095
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=2141
- * [BUGFIX]: Fixed few exporting bugs (errors raised, no data exported, ...).
- * [BUGFIX]: Fixed "Vacuum" in database context menu.
-
-[2.1.2]
- * [ADDED]: When dropping a table, SQLiteStudio checks if it's used in any view and if it is, then asks user for confirmation.
- * [CHANGE]: Database convering dialog now proposes database file basing on typed name.
- * [CHANGE]: Database convering works in background, not blocking the UI.
- * [CHANGE]: Main menu reorganized. Now it's also interactive according to what's to what's selected in the databases list.
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1711
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1738
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1713
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1699
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1709
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1734
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1703
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1555
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1707
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1760
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1784
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1774
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1817
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1804
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1743
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1700
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1763
- * [BUGFIX]: When editing a cell from query results and committing changes, then all cells representing the same database cell will be updated with new value as well.
- * [BUGFIX]: Fonts initialization optimized. SQL editor widgets should open slightly faster, especially under Windows.
- * [BUGFIX]: Transparent attach/detach mechanism fixed to avoid multiple attaches of the same database.
- * [BUGFIX]: Fixed column edition dialog to not hide under Windows after being open with "double click".
- * [BUGFIX]: When renaming task the old name is typed by in the entry field, instead of "0".
- * [BUGFIX]: Fixed saving custom toolbar order.
-
-[2.1.1]
- * [ADDED]: Setting (on "Fonts" tab) for configuring whether you want keywords to be displayed with bold font or not.
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1474
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1518
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1517
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1520
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1361
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1540
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1475
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1622
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1597
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1598
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1479
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1483
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1563
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1532
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1649
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1650
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1533
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1514
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1489
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1485
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1482
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1473
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1627
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1480
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1655
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1680
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1584
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1561
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1683
- * [BUGFIX]: Optimized executing huge SQL directly from a file.
- * [BUGFIX]: Other minor speed optimizations.
-
-[2.1.0]
- * [ADDED]: Support for NULL values in form view, blob edit dialog and query parameters dialog.
- * [ADDED]: Importing engine based on plugins. Currently SQLiteStudio can import from CSV, Clipboard (same as CSV, but from clipboard), DBF (dBase) and from any text files using Regular Expression (RegExp plugin).
- * [ADDED]: Full Foreign Keys altering support - when modifying table, foreign keys will follow table changes.
- * [ADDED]: Support for system tables in table window -> they can be viewed but cannot be modified (SQLite itself prevents that).
- * [ADDED]: Completion hints can suggest columns from Views now.
- * [ADDED]: Option in configuration to define what to do when user opens a view - show edition dialog or data from view (http://bugs.sqlitestudio.pl/?id=386).
- * [ADDED]: Button for adding custom number of rows to table data grid at once.
- * [ADDED]: If application is started first time, it asks for language to use before showing main window.
- * [ADDED]: Support for "BEGIN", "COMMIT" and "ROLLBACK" statements to be executed from SQL editor.
- * [ADDED]: Smart "home" key in SQL editor, which goes either to begining of line or to begining of actual text in the line.
- * [ADDED]: 'Return' key opens selected element from databases tree.
- * [ADDED]: Context menu option to edit selected cell using BLOB editor, even the cell data size is small.
- * [ADDED]: Databases tree filter, so user can easly find any database (in long list) or any table/index/trigger/view in any open database by entering any piece of its name.
- * [ADDED]: Form view of data has now resizable fields (but only for TEXT, BLOB and similar datatypes), so you can see more data at once instead of scrolling a lot.
- * [ADDED]: Grid row (table data grid or query results grid) can select whole row at once by clicking on ROWNUM column or by Control-click on any cell. (http://bugs.sqlitestudio.pl/?id=208)
- * [ADDED]: An entry in "View" menu to restore last closed window (and one before that and so on), also a configurable keyboard shortcut and entry in taskbar context menu to do the same.
- * [ADDED]: Database list tooltips for databases, so you can quickly view what's the path to database file, what's its size, etc.
- * [ADDED]: Tooltips for tables and views to get quick informations about the object.
- * [ADDED]: Tooltips for taskbar to display full button title (even long one), database associated with the window and table (in case of table window).
- * [ADDED]: SQL editor - matching parenthesis pairs highlighting when insertion cursor positioned at the one from the pair.
- * [ADDED]: Context menu entry to reset AUTOINCREMENT sequence for selected table.
- * [ADDED]: Option to make indexes linked to (under) tables in databases tree. This is enabled by default and can be disabled in configuration dialog.
- * [ADDED]: Option to show columns linked to (under) tables in databases tree.
- * [ADDED]: Portable mode for configuration. If there's a "sqlitestudio-cfg" directory next to the SQLiteStudio binary, then it is used to read and store configuration.
- * [ADDED]: Option to display ROWIDs in table data as default (after each table window is open).
- * [ADDED]: Defining order of databases in the list by Drag&Drop of databases.
- * [ADDED]: Drag&Drop of databases and objects between databases. Now you can copy/move tables (also indexes, triggers and views) between databases simply by D&D. It's possible even between SQLite3 and SQLite2 databases!
- * [ADDED]: When modifying a table, all views that reference the table are adjusted to the new form of table (new name, column changes, etc), just like indexes and triggers were adjusted so far.
- * [ADDED]: Help hint about parameters to SQL function in Custom SQL Functions dialog.
- * [ADDED]: Support for multiple value sets in INSERT statements (introduced in SQLite 3.7.11).
- * [ADDED]: When editing the table cell, all the contents of that cell are selected by default. This can be disabled in configuration dialog.
- * [ADDED]: Context menu command to generate SELECT statement for selected cells (in both data grid and results grid).
- * [ADDED]: Now it's possible to export data from view, just like from a table.
- * [ADDED]: Positional parameters (@, ?, $, :, ...) are now remebered and recalled when used again in same or similar query (with same parameters).
- * [ADDED]: Positional parameters dialog has button to copy the value to other parameters in the dialog that are named exactly the same. The button is displayed only if there are more than one parameter with a certain name.
- * [ADDED]: Context menu for table to erase all data from table (after confirmation).
- * [ADDED]: Bug report dialog can now use an account from http://bugs.sqlitestudio.pl to report bugs.
- * [ADDED]: Two new data populating plugins: SQL and Tcl.
- * [ADDED]: New exporting plugins: DBF (dBase), PDF, JSON, Clipboard, XLS (MS Excel).
- * [ADDED]: The "ON CONFLICT" algorithm exposed to user when using Populating Dialog. Now any duplicates, can be ignored (http://bugs.sqlitestudio.pl/?id=576).
- * [CHANGE]: Table window opening speed up. Loading related triggers and indexes postponed to moment of displaying proper tab.
- * [CHANGE]: Displaying and editing huge data volumes (both in table window and SQL editor) is now supported much better and faster.
- * [CHANGE]: Memory usage for exporting minimized. Now it's possible to export any amount of data at once.
- * [CHANGE]: Enabled exporting for cross-database queries.
- * [CHANGE]: Interrupting query execution now actually works! You can cancel query at any moment.
- * [CHANGE]: Dropped "PRAGMA full_column_names" usage, as it is deprecated SQLite3 interface.
- * [CHANGE]: Editing query results now supports editing results from cross-database queries! The only condition is that columns are selected directly, without expression modifiers, such as math operations, etc.
- * [CHANGE]: Introduced support for custom number of table constraints (not column constraints), so for example two or more primary keys defined as separated table constraints is now possible from table dialog. (http://bugs.sqlitestudio.pl/?id=200)
- * [CHANGE]: Trigger DDL support enhanced. Now it supports "UPDATE OF <columns>" statements.
- * [CHANGE]: Supported languages are now displayed in human readable form, by names, not by strange locale symbols.
- * [CHANGE]: Session management improoved. It's easier to write session-aware classes now.
- * [CHANGE]: Using thread pools instead of individual threads wherever it's possible. This made SQL editor windows to open a little quicker and to work more smoothly.
- * [CHANGE]: SQL Editor completion hints display "busy" animated icon if parsing some huge SQL takes a little longer.
- * [CHANGE]: Platform detecting code unified.
- * [CHANGE]: Parser and lexer classes enclosed in UniversalParser and UniversalLexer, preventing many potential memory leaks.
- * [CHANGE]: Switched from BEGIN to SAVEPOINT in most cases (only in SQLite3, in SQLite2 BEGIN usage remains).
- * [CHANGE]: Table grid view menu context reorganized to be more readable.
- * [CHANGE]: Changed icons for "Export table" and "Export database" to fit general schema of icons.
- * [CHANGE]: Enhanced layout of context hints for tables (table data and results data).
- * [CHANGE]: Auto-update checks directory permissions, so it allows automatic update only if privileges are sufficient.
- * [CHANGE]: Session saving now stores the full image of what objects were expanded or collapsed, so it gets fully restored.
- * [CHANGE]: Added shadows for hints under Windows.
- * [CHANGE]: Simplified bug reporting dialog.
- * [REMOVED]: Solaris binaries. Nobody seems to use them. Users still can run SQLiteStudio from sources with some Tcl distribution.
- * [BUGFIX]: Again improved performance for huge table data and huge query results.
- * [BUGFIX]: Column context information in table window fixed to display constraints correctly.
- * [BUGFIX]: Fixed virtual table exporting (http://bugs.sqlitestudio.pl/?id=201).
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1199
-
-[2.0.28]
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1086
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1091
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1128
- * [BUGFIX]: Fixed "maximized" window state, so it's correctly restored on Unixes.
- * [BUGFIX]: Fixed font picker dialog to use proper theming engine.
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1110
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1115
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=977
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1198
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1144
-
-[2.0.27]
- * [ADDED]: http://bugs.sqlitestudio.pl/?id=967
- * [ADDED]: http://bugs.sqlitestudio.pl/?id=934
- * [BUGFIX]: Fix for white icons on disabled toolbar buttons on MacOSX.
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=815
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=818
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=828
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=829
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=844
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=852
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=913
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=973
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=947
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=983
- * [BUGFIX]: Fixed error when completion hint was invoked for alias name that is also a proper table name.
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=984
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1029
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=607
- * [BUGFIX]: Fixed invalid focus when clicked on "data" tab. In result the user was unable to use keyboard shortcut to switch between subtabs.
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=959
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=921
- * [BUGFIX]: Added debug details for http://bugs.sqlitestudio.pl/?id=921
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1000
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1071
- * [BUGFIX]: Fixed http://forum.sqlitestudio.pl/viewtopic.php?f=11&t=93
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=834
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=949
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=971
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=981
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=1083
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=965
-
-[2.0.26]
- * [BUGFIX]: SQL editor in Trigger Dialog uses now configured keyboard shortcut for SQL formatting, instead of hardcoded ctrl-f.
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=768
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=759 (thanks to Kevin Walzer)
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=771
- * [BUGFIX]: Fixed context menu on MacOSX, so it's now invoked by right-click, not the middle-click.
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=784
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=798
-
-[2.0.25]
- * [ADDED]: "Donate" in "Help" menu. Voluntary donations help maintain the hosting server and keep me motivated.
- * [BUGFIX]: Fixed sorting of completion hint for "INSERT INTO table (". Now columns from "table" are first.
- * [BUGFIX]: Tooltips fixed to display in intelligent spot, so it won't go out of screen edge.
- * [BUGFIX]: Fixed formatting of "x BETWEEN y AND z" so there's a whitespace after "AND".
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=715
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=721
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=722
- * [BUGFIX]: Binary distribution for Mac OS X is now deployed with a little different menthod which should result in less critical crashes. Also resolved problem with starting on some OSX machines. Big thanks to Michal Janiak for helping with this!
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=725
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=728
- * [BUGFIX]: Fixed parsing and formatting of CREATE TRIGGER with "CASE ... END" in it.
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=747
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=755
-
-[2.0.24]
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=702
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=707
-
-[2.0.23]
- * [CHANGE]: SQLite updated to 3.0.9 in binary distributions. Also a binary for Mac OS X got recompiled with SQLITE_ENABLE_LOCKING_STYLE, so it works with network file systems well.
- * [BUGFIX]: Fixed error checking, that was not running when used "Enter" or "Backspace" or at application startup.
- * [BUGFIX]: Fixed Enterprise Formatter to put whitespace after "BETWEEN" keyword.
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=587
- * [BUGFIX]: Fixed AUTOINCREMENT column constraint in Enterprise Formatter (it missed the keyword while formatting).
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=664
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=666
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=583
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=614
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=685
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=676
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=673
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=601
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=680
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=701
-
-[2.0.22]
- * [NEW]: Implemented http://bugs.sqlitestudio.pl/?id=490
- * [BUGFIX]: Completion hint (in SQL Editor) will not disappear if users hits "completion key shortcut" again accidentally.
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=479
- * [BUGFIX]: Fixed very slow execution SQL custom functions implemented in Tcl. Discussion: http://forum.sqlitestudio.pl/viewtopic.php?f=11&t=31
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=474
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=486
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=243
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=498
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=499
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=501
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=519
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=522
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=566
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=526
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=508
- * [BUGFIX]: E-mail field in Bug Report dialog is now validated, so only valid or empty value is accepted.
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=573
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=523
-
-[2.0.21]
- * [ADDED]: Bug report dialog have new field "e-mail". It is optional and it's only for SQLiteStudio developer to contact reporter about some details of error report. It will never be shared to anyone or used for any other purpose. It won't be published anywhere.
- * [BUGFIX]: Fixed enterprise SQL formatter to not wrap "ALL" in "UNION ALL" with "[]".
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=454
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=461
- * [BUGFIX]: Export dialog and database dialog handles manually typed file names (not picked with file dialog) correctly.
- * [BUGFIX]: Export dialog title changed to 'Output file' to avoid any misunderstands.
-
-[2.0.20]
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=447
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=452
-
-[2.0.19]
- * [BUGFIX]: Fixed help tip text in CSV export plugin configuration.
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=432
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=430
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=434
-
-[2.0.18]
- * [CHANGE]: In table and column dialogs the insertion cursor in name field is initially placed at the end of value.
- * [CHANGE]: Added more debug information regarding http://bugs.sqlitestudio.pl/?id=411
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=408
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=416
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=419
-
-[2.0.17]
- * [BUGFIX]: Fixed completion hints for vies, triggers and indexes in case of "DROP" statement.
- * [BUGFIX]: Enabled encoding configuration for SQL export format for entire database.
- * [BUGFIX]: Fixed some problems with switching MDI windows (especially when used Control+click on table name in SQL editor).
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=403
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=402
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=405
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=406
-
-[2.0.16]
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=391
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=397
- * [BUGFIX]: Fixed copying DDL code from DDL tab in various dialog windows.
- * [BUGFIX]: Fixed button names in trigger, index and view dialogs in case of editing existing object.
-
-[2.0.15]
- * [BUGFIX]: Fixed file() SQL function to handle binary files.
- * [BUGFIX]: Fixed "identity encoding" issue while exporting data.
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=385
- * [BUGFIX]: Fixed parser support for primary key table constraint with single column in it.
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=389
-
-[2.0.14]
- * [CHANGE]: Updated to SQLite 3.7.8 (http://bugs.sqlitestudio.pl/?id=247)
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=241
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=242
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=268
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=285
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=256
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=266
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=250
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=240
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=245
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=248
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=251
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=253
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=269
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=271
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=323
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=363
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=302
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=304
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=365
- * [BUGFIX]: Fixed completion hint not working when used with alias for table name typed with different case.
- * [BUGFIX]: Fixed deleting any object from database (in database objects tree) with Delete key. It always tried to delete database, instead of selected object.
-
-[2.0.13]
- * [NEW]: Introduced Chinese translation, thanks to Yu Longzhen! It's not yet complete, but already more than a half is done.
- * [NEW]: Home page added to help menu, also manual link updated (http://bugs.sqlitestudio.pl/?id=193)
- * [NEW]: Added Google Chrome to list of predefined browsers under unix systems.
- * [CHANGE]: Datatypes in column edition dialog are now autocompleted while typing, so it's enough to type "t" to get "TEXT" type.
- * [CHANGE]: Datatype list in column edition can now be fast navigated using keys, so if you drop down the list, you can press "i" to select "INT" type fast. (http://bugs.sqlitestudio.pl/?id=190)
- * [BUGFIX]: Fixed bug related to "_toCommit".
- * [BUGFIX]: Fixed bug, when user was able to edit deleted but uncommitted row (even the edition was ignored).
- * [BUGFIX]: Fixed insertion of numeric values in data view - they're now treated as numeric if column type says so (they used to be treated as string and CHECK constraint was not satisfied very often).
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=168
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=172
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=173
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=175
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=176
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=177
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=178
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=179
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=182
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=184
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=185
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=188
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=189
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=191
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=193
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=194
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=195
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=196
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=197
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=198
- * [BUGFIX]: Fixed http://bugs.sqlitestudio.pl/?id=203
- * [BUGFIX]: Fixed several issues related to inserting new rows from Form View of table data.
- * [BUGFIX]: Fixed issue related to table and column names with strange characters in name.
- * [BUGFIX]: Enterprise SQL formatter indents sub-selected datasources better.
- * [BUGFIX]: Some other, minor bugs fixed.
-
-[2.0.12]
- * [BUGFIX]: Fixed error for SQLite2 DDL that uses "REFERENCES" keyword, even it's unsupported by SQLite2.
- * [BUGFIX]: Binary compatibility for MacOS X restored from 2.0.9.
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=4632
-
-[2.0.11]
- * [BUGFIX]: Removed SQL debug messages enabled in 2.0.10, causing "stdout" related error under Windows.
-
-[2.0.10]
- * [CHANGE]: If query could not be executed by Smart Query Executor, then simple executor adds its signature to eventual error message in status.
- * [CHANGE]: Added <Delete> key shortcut to delete selected database from list.
- * [CHANGE]: Various MacOS X appearance improovements.
- * [BUGFIX]: Significat configuration saving speedup.
- * [BUGFIX]: Fixed nasty bug related to character encoding for SQLite2 under Windows: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3860
- * [BUGFIX]: Column Drag&Drop in table dialog works again.
- * [BUGFIX]: TreeCtrl extension updated to 2.3.1, which fixes 2 major bugs in data grid header.
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=4495
- * [BUGFIX]: 'removeComments' routine fixed (by maovrn).
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=4500
- * [BUGFIX]: Fixed minor SQL formatting error for SQlite 2.
- * [BUGFIX]: Message about "ATTACH DATABASE" limit exceed is now wrapped in nice readable message dialog.
- * [BUGFIX]: Fixed "unknown execution error" in case of problem with transparent attaching database.
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=4579
- * [BUGFIX]: Removed "-force" from all [focus] calls.
- * [BUGFIX]: Added additional debug routines for some bugs. Hope to fix them with next release.
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=4553
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=4586
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=4550
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=4510 (UNION SELECTs forbids to edit results data, for now).
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=4583
- * [BUGFIX]: Fixed grid to form synchronization when adding new row in grid.
-
-[2.0.9]
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=4484
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=4485
- * [BUGFIX]: Entering edition mode in grid works now for international characters too.
- * [BUGFIX]: Added all missing encoding systems to binary distributions.
-
-[2.0.8]
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=4476
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=4465 (unknown option "0")
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=4473
- * [BUGFIX]: If updating process doesn't have right to write to disk, then human readable message is displayed.
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=4479
-
-[2.0.7]
- * [BUGFIX]: Fixed nasty bug with "-notnull1": http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=4455
- * [BUGFIX]: Fixed another nasty bug with "-tableAlias": http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=4456
- * [BUGFIX]: Added more debug information for bug "row(sql)": http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=4458
-
-[2.0.6]
- * [ADDED]: Context menu (with copy/cut/paste) in text fields.
- * [CHANGE]: Removed "autoCommit". Now all changes have to be committed.
- * [CHANGE]: Database add/edit dialog modified for Mac OS X. Now it uses two dialogs to pick file - native OSX dialogs!
- * [BUGFIX]: Commit/Rollback buttons activates when editing starts by typing value.
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3972
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3974
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3973
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3977
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3979
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=2&t=4020
- * [BUGFIX]: Fixed error for SQLite2 with "unknown command total_cahnges".
- * [BUGFIX]: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=4184
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=4163
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=4160
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=4159
- * [BUGFIX]: Fixed support for "CREATE TRIGGER" defined on "database.table".
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=4261
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=4155
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=4161
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3980
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=4009
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=4042
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=4068
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=4023
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3987
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=4388
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=4059
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=4284
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=4339
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=4372
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3990
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=4078
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=4238
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=2&t=4019
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=4016
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=4086
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=4273
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3966
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=4407
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=4070
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=2&t=4106
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=4243
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3874
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=2&t=4139
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=4166
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=4223
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=4280
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=4357
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=4245
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=4298
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=4067
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=4124
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=4083
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=4152
- * [BUGFIX]: Fixed SQL syntax error marking in SQLEditor under Windows.
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=4429
-
-[2.0.5]
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3943
- * [BUGFIX]: Plain text export fixed.
- * [BUGFIX]: Fixed crash when exporting database with virtual table.
- * [BUGFIX]: Foreign keys enforcing is now enabled by default and can be disabled by proper PRAGMA call.
- * [BUGFIX]: Fixed counting "affected rows".
-
-[2.0.4]
- * [CHANGE]: Trigger dialog is now resizable.
- * [CHANGE]: Enterprise formatter enforced to be selected for this one time. It still can be changed in configuration. Many people don't even realize there's such formatter.
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3831
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3832
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3847
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3837
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3836
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3838
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3850
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3882
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3894
- * [BUGFIX]: Fixed opening database passed in command line.
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3863
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3890
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3875
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3872
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3891
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3873
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3927
- * [BUGFIX]: Fixed recreating of indexes and triggers while table structure is modified.
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3899
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3901
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3937
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3893
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3929
-
-[2.0.3]
- * [CHANGE]: Enabled additional keys to enter edit mode in data grid.
- * [CHANGE]: Added transactions tracing for better transaction-related problems debugging in bug reports.
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3668
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3768
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3767
- * [BUGFIX]: Various form view key binding fixes.
- * [BUGFIX]: Trying to edit system index caused critical error.
- * [BUGFIX]: Added upper-case file name extensions for database file selector.
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3772
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3774
- * [BUGFIX]: Undo mechanism fixed for SQL code formatting - doesn't need to call Ctrl+z twice anymore.
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3785
- * [BUGFIX]: Again improved performance for huge table data and huge query results.
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=9&t=3780
- * [BUGFIX]: Fixed index dialog for SQLite 2.
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=3&t=3798
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3810
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3817
- * [BUGFIX]: Fixed EXPLAIN results displaying.
- * [BUGFIX]: Fixed MDI windows closing in custom order.
-
-[2.0.2]
- * [ADDED]: Character encoding for exporting data can be selected now.
- * [CHANGE]: SQLiteStudio version included in bug reports and feature request reports.
- * [CHANGE]: Various MacOSX user interface improvements.
- * [CHANGE]: Various liftings of user interface.
- * [CHANGE]: Index dialog has now database in a list separated from table list.
- * [CHANGE]: Trigger dialog supports "FOR EACH ROW" and "FOR EACH STATEMENT" (the second one for SQLite 2 only).
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3716
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3718
- * [BUGFIX]: Fixed indentation for 2 or more column constraints for CREATE TABLE in Enterprise formatter.
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3724
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3687
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3723
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3726
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3730
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3729
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3734
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3731
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=3&t=3733
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3744
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3722
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3751
-
-[2.0.1]
- * [ADDED]: Support to vacuum databases with custom collation sequences.
- * [ADDED]: Databases list sorting in databases context menu.
- * [CHANGE]: Bug reporting dialog includes OS version in its report.
- * [CHANGE]: "SQLiteStudio" menu renamed to "Help".
- * [CHANGE]: Database adding/editing dialog reorganization. The "file" field is now the most important. Name (alias) is auto-generated, or manually entered (as an option).
- * [BUGFIX]: Fixed updates-checking and auto-update functions. They didn't work in 2.0.0.
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3651
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3654
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3668
- * [BUGFIX]: Bug reporting dialog allows using Return key in its fields, instead of sending unfinished report immediately.
- * [BUGFIX]: SQL code in View Dialog is now stored in SQLite as it's written and displayed just like read from SQLite - no formatting changes are applied.
- * [BUGFIX]: Fixed wrong results from queries with custom collation sequences.
- * [BUGFIX]: Performance improved significantly for huge table data and huge query results.
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3656
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3660
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3676
- * [BUGFIX]: Fixed switching between pages of query results.
- * [BUGFIX]: Fixed opening tables from SQL editor links (control+click) with different case size.
- * [BUGFIX]: Fixed error with "_colItem(query)" reported on comp.lang.tcl group.
- * [BUGFIX]: Fixed problem with inserting first row to empty table using Form View.
- * [BUGFIX]: The progressbar dialog won't stay any longer after critical error occured, so user was unable to report the bug.
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3659
- * [BUGFIX]: Fixed viewing data from View in SQlite 2.
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3662
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3679
- * [BUGFIX]: Initial size of application window on Mac OS X is now reasonable.
- * [BUGFIX]: Fixed support for loadable SQLite extensions. Now you can load them with load_extension() in query and use extension as you would expect it.
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3701
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3706
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3708
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3695
- * [BUGFIX]: Fixed: http://forum.sqlitestudio.pl/viewtopic.php?f=4&t=3712
-
-[2.0.0]
- * [ADDED]: Updates checking on startup.
- * [ADDED]: Real SQL parser based on lexer&parser pair! It provides many, many possibilities. Few of them are already implemented and listed in changelog below.
- * [ADDED]: (SQL parser stuff) SQL syntax validation on the fly with error markers.
- * [ADDED]: (SQL parser stuff) Enterprise SQL code formatter. It's very powerful and configurable, but works only on valid code, so if the SQL is marked to be incorrect (see paragraph above) then formatter won't format such SQL.
- * [ADDED]: Table columns can be edited directly from table window by double-clicking on them.
- * [ADDED]: Columns order in TableDialog can be now be managed by drag&drop.
- * [ADDED]: Possibility to display ROWID in table data view. Just right-click and pick it from context menu.
- * [ADDED]: Internal stuff: [final] procedure, so important internal variables are secured.
- * [ADDED]: Internal stuff: Introduced threads. GUI acts more shmoothly.
- * [ADDED]: Possibility to add database only for current session (it won't be on the list after application restart).
- * [ADDED]: Window/task can be renamed now from taskbar context menu.
- * [ADDED]: Tasks order in taskbar at the bottom can now be managed using drag&drop.
- * [ADDED]: Progress bar for export dialog, populate dalog and table dialog (good to keep track on tasks done on tables with lots of data) with possibility to interrupt the process.
- * [ADDED]: Long query executions can be interrupted.
- * [ADDED]: Pending commits (with autocommit as option in configuration). User can modify some data (add, edit or delete rows) and commit them all togather at the end.
- * [ADDED]: Filter entry in form view of table data tab.
- * [ADDED]: Added "(filtered)" information next to "Total rows" in case of filtered table data view.
- * [ADDED]: Edit trigger and edit index buttons added in table triggers and indexes tabs.
- * [ADDED]: "Execute SQL from file" button in SQL editor window.
- * [ADDED]: Context menu for SQL editor window.
- * [ADDED]: SQL functions available while managing databases in SQLiteStudio: md5(), base64_encode(), base64_decode(), file(), sha1(), hmac().
- * [ADDED]: "Create similar table" option.
- * [ADDED]: Quick opening of tables typed in SQL editor. Press Control key and click on table name to open it.
- * [ADDED]: Database integrity checking pragma added to database context menu.
- * [ADDED]: Full informations about installed plugins and used Tcl packages available in About dialog.
- * [ADDED]: Option to open items from database tree by single-click.
- * [ADDED]: While creating an unique index: if there are duplicates in table, then SQLiteStudio proposes to create SQL to select all duplicated rows.
- * [ADDED]: Button in SQL editor to create a view from query typed in the editor.
- * [ADDED]: Support for parameters (?, ?NNN, :VVV, @VVV, $VVV) in queries typed in SQL editor.
- * [ADDED]: Option to place SQL editor results below the query, not in separated tab.
- * [ADDED]: When holding mouse over data grid or results grid, the hint pops up with some context information about cell under mouse cursor.
- * [ADDED]: DDL tab in all Table/Index/Trigger/View dialog windows to see objects DDL before it's actualy created.
- * [ADDED]: New versions checking at startup or on demand and auto-upadte support for binary distributions.
- * [ADDED]: MacOS X port.
- * [ADDED]: Binaries for linux (ix86_64), freebsd (ix86_64) and macosx (ix86_64) platforms.
- * [CHANGE]: Exporting was rewritten from scratch. It was the ugliest code in whole application. Now it's based on plugins, so it's much easier to add new exporting engines.
- * [CHANGE]: (SQL parser stuff) Smart completion hints - now SQLiteStudio knows better if next argument should be a keyword, or a table name, or index, name, etc. Moreover - object names (tables, indexes, etc) already used somewhere in the SQL query appear higher in completion hint, since user seems to be interested in them. It really kicks ass! Try it out!
- * [CHANGE]: Internal stuff: 'Array' class has been completly replaced by Tcl Dicts from Tcl 8.5.
- * [CHANGE]: Small unification in layout of database edit dialog and convert database dialog.
- * [CHANGE]: Configuration settings saving enclosed in transaction - major speed improvement of this action.
- * [CHANGE]: Bug reporting engine completly rewritten. Know it is very simple to report a bug.
- * [CHANGE]: Numerous scrollbars are now shown/hidden dynamically when needed.
- * [CHANGE]: Query execution status field shows icon (info, warning, error) for all messages to identify type of message easier.
- * [CHANGE]: Results as plain text moved to separated tab.
- * [CHANGE]: Context menu in databases list reorganized.
- * [CHANGE]: Refreshing database schema doesn't collapse its branches.
- * [CHANGE]: Executing queries in SQL editor refreshes schema in databases tree, so all new, changed or deleted objects are noticed immediately.
- * [CHANGE]: Balloon hints appears now faster and allows to browse help hints for many widgets placed close to each other very quickly.
- * [CHANGE]: New icons.
- * [CHANGE]: Table window now displays all constraints in "Columns" tab as icons. Therefore "constraints" tab has been removed from table window.
- * [CHANGE]: More intuitive inserting data in form view.
- * [CHANGE]: Plain text results are now configurable (NULL representation, column width).
- * [CHANGE]: Pressing key Right/Left while editing cell and being on the begin/end of the edited value moves keyboard focus to cell on the left/right side.
- * [BUGFIX]: Fixed highlighting of comment which starts in the middle of contents with '/*' and never ends.
- * [BUGFIX]: Closing configuration window in other way than "cancel" or "ok" makes it close as for "cancel".
- * [BUGFIX]: (SQL parser stuff) Detecting symbolic database names (databases from objects tree) in SQL editor has been fixed, so table name same as database name won't be a problem anymore.
- * [BUGFIX]: (SQL parser stuff) All dialog windows for editing SQLite objets (tables, indexes, ...) use now built-in SQL parser, so they read all object definitions correctly.
- * [BUGFIX]: Triggers created for table are recreated after table is edited.
- * [BUGFIX]: File choosing dialog fixes under Unix (filters updating and <escape> key binding).
- * [BUGFIX]: Database adding/editing dialog under Windows unified to Unix version, so now there's only one button for file picking. No more confusion here.
- * [BUGFIX]: Many, many, many other bug fixes not listed here, because I didn't write them down during fixing.
- * [BUGFIX]: Scrolling grids horizontally is now smooth.
- * [BUGFIX]: Added *(*autoindex*)* indexes of SQLite2 to list of system indexes, so they can be filtered out.
- * [BUGFIX]: Many, many other minor and major bugfixes not mentioned here.
-
-[1.1.3]
- * [ADDED]: Port to FreeBSD!
- * [ADDED]: Support for lang/ subdirectory in starting directory, so testing new translations is now very simple.
- * [ADDED]: Ctrl+c shortcut now works for databases tree - you can copy label of any element from the tree.
- * [ADDED]: New translation: Espanol (Spanish).
- * [ADDED]: New translation: German.
- * [CHANGE]: Internal change: [foreach] replaced with [lassign] to adjust code to Tcl 8.5.
- * [CHANGE]: Export dialog suggests same directory for output file as exported database is in.
- * [CHANGE]: Tcl/Tk updated to 8.5.7, SQLite3 updated to 3.6.16, TreeCtrl updated to 2.2.9 - for binary packages.
- * [BUGFIX]: Fixed dialogs: About, ChangeLog and Roadmap.
- * [BUGFIX]: Minor fixes in messages and translations.
- * [BUGFIX]: Toolbar doesn't display undefined (empty) tooltips anymore.
- * [BUGFIX]: Fixed support of some constraints. Caused numerous problems.
- * [BUGFIX]: Indexes for incorrect/not existing columns are now handled properly when user opens index edit dialog.
- * [BUGFIX]: Fixed issue with Ctrl+c (and similar) shortcuts on Windows while having enabled CapsLock.
- * [BUGFIX]: Blob edit widget fixed for Form View to display current row value correctly.
- * [BUGFIX]: Duplicated themes fixed.
- * [BUGFIX]: Fixed error while trying to enter new value of cell in grid while there was no cell selected.
-
-[1.1.2]
- * [ADDED]: SQLite3 engine version used by application in the About dialog.
- * [CHANGE]: MDI windows remembers their position and dimensions in session.
- * [CHANGE]: Renamed "Open editor" to "Open SQL editor" in configuration "Shortcuts" tab.
- * [CHANGE]: SQLite system tables (if enabled to display) are now marked so user can recognize them easly.
- * [BUGFIX]: Copying&pasting cells with NULLs handled properly.
- * [BUGFIX]: Columns with strange names are now handled correctly.
- * [BUGFIX]: Fixed editing table data using form view for SQLite 2.
- * [BUGFIX]: Populating dialog won't allow to enter negative number of rows to insert.
- * [BUGFIX]: Critical error occuring when clicking fast in Unix file choosing dialog.
- * [BUGFIX]: Font choosing dialog doesn't crash anymore if invoked twice without closing first one.
- * [BUGFIX]: Exporting results to some formats was crashing every time. Not anymore.
- * [BUGFIX]: Resizing windows without proper cursor fixed.
- * [BUGFIX]: Fixed changing index table.
- * [BUGFIX]: Fixed support in table edit dialog for column names with dots and commas.
- * [BUGFIX]: Fixed renaming tables in SQLite2 database.
- * [BUGFIX]: Better handling of advanced tables DDL.
- * [BUGFIX]: Rolling back transactions won't cause problems anymore.
- * [BUGFIX]: Fixed current directory of binary distribution.
- * [BUGFIX]: Several fixes of drawing for dark themes of operating system interface.
- * [BUGFIX]: Fixed many problems with Foreign Keys.
- * [BUGFIX]: SrolledFrame widget fixed for uncommon localizations.
- * [BUGFIX]: Exporting database to HTML format fixed.
- * [BUGFIX]: Fixed error occuring sometimes while trying to commit edited value.
- * [BUGFIX]: Tab-key order in Form View fixed.
- * [BUGFIX]: Allow to open read-only database files.
- * [BUGFIX]: Form View shortcuts, additional toolbar buttons.
- * [BUGFIX]: Result grid editing for table name with whitespace fixed.
- * [BUGFIX]: Fixed control-a shortcut for some edit fields.
- * [BUGFIX]: Keyboard/mouse input focus grabbing for some of modal dialogs fixed.
- * [BUGFIX]: Handling of uncommitted grid editions while closing MDI window.
- * [BUGFIX]: Handling of NOT NULL constraint used and no DEFAULT specified in table column editing dialog in case when table already contains some data filled in.
- * [BUGFIX]: Small grammar fixes in tips dialog.
- * [BUGFIX]: Font handling rewritten. Should not cause problems anymore, but if it does, then fixing will be now much easier.
- * [BUGFIX]: Fixed 100% CPU usage for sequence: open 2 table windows, edit data cell in one window, then focus the other one window without committing edition before.
- * [BUGFIX]: Fixed MDI window placement, so they won't appear at exactly same position while creating anymore.
- * [BUGFIX]: Added DATETIME data type support.
- * [BUGFIX]: DEFAULT values handled properly. Now you can use functions and other expressions, as well as literal values.
- * [BUGFIX]: Fixed chosing other database in 'new table' dialog.
- * [BUGFIX]: Fixed crashing when changing configuration while image-type cell in grid is selected.
- * [BUGFIX]: Prevention against duplicated column names in table edition dialog.
- * [BUGFIX]: New trigger dialog doesn't allow to use 'INSTEAD OF' for table triggers.
- * [BUGFIX]: Fixed FK window visibility under Windows.
- * [BUGFIX]: Grid navigation to right/left scrolls a view.
-
-[1.1.1]
- * [CHANGE]: "Export table data" button moved from table structure toolbar to table data toolbar.
- * [CHANGE]: Results in plain text are now formatted so they're more readable.
- * [CHANGE]: Nasty behaviour when trying to edit data cell and commit invalid value (like alpha-characters in INTEGER-PK column) has been modified so application asks user what would he like to do.
- * [BUGFIX]: Windows default font size for few text fields (i.e. "did you know that..." dialog) has been increased, so it's readable now.
- * [BUGFIX]: Taskbar button "more" is now hidden correctly (its frame was visible even when it supposed to be hidden).
- * [BUGFIX]: Formatter plugin is now set up correctly after closing configuration window.
- * [BUGFIX]: Custom SQL function results handled better when they're null.
- * [BUGFIX]: Fixed support for using symbolic database names in SQL editor (it was causing problems sometimes).
- * [BUGFIX]: Fixed switching tasks back to previously active one when executed "Show view data" in some cases.
- * [BUGFIX]: Fixed bug when reading triggers with unusual names.
- * [BUGFIX]: Index dialog uses Grid widget to display columns proposition. Now there's no problem with adjusting header and widgets.
-
-[1.1.0]
- * [ADDED]: Full support for SQLite 2 databases! Binary distribution includes SQLite 2.8.17.
- * [ADDED]: Solaris port.
- * [ADDED]: Selecting multiple cells/rows/columns in data grids is now possible. It enables user to delete multiple rows at once.
- * [ADDED]: Advanced copy-paste routines: copying multiple rows/columns results in clipboard format applicable for pasting into many famous spreadsheets. It's also easy to read when pasted into regular text file. It also can be pasted into other SQLiteStudio grid. User also can copy from spreadsheet and paste into SQLiteStudio grid!
- * [ADDED]: Custom SQL functions can be defined by user, so they're registered in all opened databases.
- * [ADDED]: Support for usage many databases in single SQL query using symbolic names of databases that are displayed in the databases tree.
- * [ADDED]: Support for editing cell values in Results grid, including pasting to it! Even for combined SELECT with JOINs!
- * [ADDED]: Table data filtering. Just type the word you're looking for in filter entry.
- * [ADDED]: sqlite_* objects can be displayed in databases tree as an option (in configuration dialog).
- * [ADDED]: Find&Replace dialog for SQL editor widget.
- * [ADDED]: Populating tables. It's first feature in SQLiteStudio that is based on plugins. Plugins will be described in documentation.
- * [ADDED]: Keramik and Plastik image-based themes (multi-platform).
- * [ADDED]: Database name in DB tree is now labeled with identification of database handler, so you'll know if the database is SQLite 2 or SQLite 3.
- * [ADDED]: String class highlighting for SQL editor.
- * [ADDED]: Execution of SQL directly from file. Available from database context menu or SQL function sqlfile().
- * [ADDED]: Importing schema (not data!) from one database to another. To copy schema and data use "copy file" feature in your operating system.
- * [ADDED]: Configuration of "hint baloon" is now possible (colors, font).
- * [ADDED]: Added sorting of data in table window by custom columns.
- * [ADDED]: Handler of common database errors (such as 'database is locked') to display such errors in dialog window that is less scary than default critical error dialog.
- * [ADDED]: Command line parameters. Database file can be passed as parameter to application so it will be managed with SQLiteStudio.
- * [ADDED]: Duplicating table data row feature.
- * [ADDED]: Navigation buttons for Form View of table data, so user can walk through all rows in grid without switching to grid.
- * [ADDED]: Option to open Data tab in table window when that window was just opened, instead of Structure tab.
- * [ADDED]: GTK and QT themes in linux binary distribution.
- * [ADDED]: Results of query execution as plain text.
- * [CHANGE]: Moved to Tcl/Tk 8.5.
- * [CHANGE]: SQLite3 updated to newest - 3.6.7.
- * [CHANGE]: Foreign Key support upgraded to join it with table editor dialog. Any foreign key-related changes in table editor will also affect FK triggers. Separate creating FK is no more needed, just set it in table definition. It means SQLiteStudio emulates Foreign Keys transparently!
- * [CHANGE]: Optimization of HEX editor. Huge performance gain!
- * [CHANGE]: Added support for img::png package as alternation to tkpng (img::png is still more popular on some platforms).
- * [CHANGE]: printStackTract procedure modified a little to produce more readable stack traces.
- * [CHANGE]: API documentation updated. More classess documented.
- * [CHANGE]: Shortcut edit widget takes Escape key as a way to cancel edition, instead of binding a shortcut with it.
- * [CHANGE]: New rows which user adds to table data appears below currently selected row, instead of end of grid.
- * [CHANGE]: SQL formatter externalized to plugin. Now anyone can write his own SQL formatter as plugin.
- * [CHANGE]: SQL errors are no longer connected with full Tcl stack trace in error/warning dialogs, so they are more readable to user.
- * [BUGFIX]: NULL handling fixed (for SQLite3). Note that setting NULL in SQLite2 databases works, but it cannot be read as NULL, so for NULLs in SQLite2 you'll see just empty cells.
- * [BUGFIX]: Exporting results of query with number of rows greater than 1000 was exporting only 1000 - the ones currently visible in results table.
- * [BUGFIX]: /* This kind of comments */ is now highlighted.
- * [BUGFIX]: Shortcut edits doesn't crash when Control key was pressed and released without any other key togather.
- * [BUGFIX]: ScrolledFrame fixed to fit well into parent widgets. It affects numerous Configuration Dialog tabs as well, as Form View of data, Index dialog and others.
- * [BUGFIX]: Fixed editing tables with name containing whitespaces.
- * [BUGFIX]: Font of grids is now set properly.
- * [BUGFIX]: Fixed indexes for columns with spaces in name.
- * [BUGFIX]: Fixed new index dialog when choosing target table from database with uncommon name.
- * [BUGFIX]: Fixed view edit dialog to support views with spaces in name.
- * [BUGFIX]: Fixed editing table columns with value length specified, as 'VARCHAR(10)'.
- * [BUGFIX]: Fixed validation of integer value for maximum results per page in data preview.
- * [BUGFIX]: Font dialog fixed so it looks a bit better.
- * [BUGFIX]: Total number of rows in table data tab updates on the fly when new rows are added or deleted.
- * [BUGFIX]: Fixed SQL highlighting in editor history tab.
- * [BUGFIX]: Setting Foreign Key for column(s) while creating new table (it worked for editing tables).
- * [BUGFIX]: Fixed restoring session - in some cases it wasn't restoring properly.
- * [BUGFIX]: Fixed creating and opening table with strange names, like '''''''''''.
- * [BUGFIX]: Edit widget (for non-BLOB columns) is now moved correctly when scrolling grid.
- * [BUGFIX]: Exporting dialog doesn't close on input error anymore and lets user to fix input.
- * [BUGFIX]: Add/Edit database dialog doesn't change main window title anymore.
- * [BUGFIX]: Fixed support for strange database names (such as abc';'efg).
- * [BUGFIX]: Refreshing toolbar after changing schema is now performed correctly.
- * [BUGFIX]: Fixed View dialog database selection.
- * [BUGFIX]: CSV exporting fixed in case of spearator character in cell value.
- * [BUGFIX]: Other minor fixes.
-
-[1.0.1]
- * [CHANGE]: SQLite 3 engine updated to 3.5.9 for binary distributions.
- * [CHANGE]: Index dialog modified to use ScrolledFrame instead of canvas, so it looks much better.
- * [BUGFIX]: Fixed common error "item X column Y has no style" that was very hard to reproduce, at last!
- * [BUGFIX]: Fixed running binary application with "[" character in its file name.
- * [BUGFIX]: Granted permissions to load external SQLite extensions using load_extension() SQL function.
-
-[1.0.0]
- * [CHANGE]: SQLiteStudio has been released on GPLv2 licence!
- * [CHANGE]: Removed licence-responsible code. Tbcload extension is no more required.
-
-[1.0.0-beta6]
- * [CHANGE]: Columns in table data view and editor results view can be resized now, but BLOB fileds still can't be loaded whole directly to grid cell (I think the reason is obvious).
- * [CHANGE]: There is a known bug that is not 100%-repeatable. It occurs sometimes when switching to FormView of table data. This change has added some additional logs to debug the bug.
- * [BUGFIX]: A very obvious bug included in beta5 - adding database dialog didn't disappear when database is added correctly.
- * [BUGFIX]: Fixed error while switching from standard BLOB editor to hexadecimal editor.
- * [BUGFIX]: Fixed committing new rows from FormView of table data.
-
-[1.0.0-beta5]
- * [ADDED]: Databases tree refresh button on toolbar and in View menu.
- * [CHANGE]: SQLite engine updated to 3.5.4 for binary distributions.
- * [CHANGE]: Now 'Triggers' tab in table window contains triggers related to the table by 'ON' clause only.
- * [CHANGE]: View dialogs (new and edit) can be resized now.
- * [BUGFIX]: Another fixes related to proper SQL updates and inserts with strange data characters.
- * [BUGFIX]: Fixed support for 'main'.'table' expressions in triggers.
- * [BUGFIX]: Fixed crashes on closing main window (quiting). Sometimes it denied to quit because of error...
- * [BUGFIX]: Fixed errors occuring on few Grid widgets containing images or widgets inside of them.
- * [BUGFIX]: Fixed error when right-clicking on empty tree list on the left.
- * [BUGFIX]: Added handling of settings file from previous versions of SQLiteStudio.
- * [BUGFIX]: Fixed bug when maximizing the only one MDI window, which was in normal mode while application startup.
- * [BUGFIX]: Fixed 'window name "edit" already exists in parent' bug occuring in DataGrid and ResultGrid.
- * [BUGFIX]: Fixed error while closing application and some of MDI windows has closed before it's session was saved.
- * [BUGFIX]: Fixed exporting query results to CSV format (new line characters).
- * [BUGFIX]: Fixed executing queries with semi-colon and white-space at the end of query.
- * [BUGFIX]: Fixed problem with untranslated messages and unsupported localizations so '%s' are substituted correctly.
- * [BUGFIX]: Fixed Tcl core critical error related to exporting large databases/tables (problem with memory allocation).
- * [BUGFIX]: Fixed displaying list of indexes in table window in Indexes tab.
- * [BUGFIX]: Few minor fixes related to object names (like tables, columns) that are surrounded with [] or " characters.
- * [BUGFIX]: Fixed error while clicking on Primary Key column in table structure with no primary key set.
- * [BUGFIX]: Fixed 'Add database' dialog so it doesn't disappear when database cannot be added for some reason, but lets user fix it.
- * [BUGFIX]: Full support for NULL values while exporting to various formats.
-
-[1.0.0-beta4]
- * [ADDED]: New SQL function tcl() to execute Tcl code in separate interpreter and return its results.
- * [ADDED]: Full support for NULL value (which is not same as empty value).
- * [ADDED]: Universal 'Delete' shortcut for databases tree. Deletes selected item (if possible).
- * [CHANGE]: 'New database' label renamed to 'Add database' to be less confusing.
- * [CHANGE]: SQLite engine updated to 3.4.2 for binary distributions.
- * [REMOVED]: Removed date() function while there is standard SQLite date() function.
- * [BUGFIX]: 'View data preview' window is now properly stored in session so it's title is restored in next session.
- * [BUGFIX]: 'View data preview' can not be opened in two separate windows now, so it will not cause problems with doubled tasks on taskbar anymore.
- * [BUGFIX]: Another little bug with 'REFERENCES' in table edition dialog - occured when column reference was wrapped with white-spaces.
- * [BUGFIX]: Detection of 'REFERENCES' constraints in table browsing window on Constraints tab. It used to detect more constraints than there was.
- * [BUGFIX]: Handling table global constraints in table browsing window on Constraints tab.
- * [BUGFIX]: Fixed (finally?) problem with UTF-8 data in database.
- * [BUGFIX]: While editing table schema: renaming a column causes losing data from that column. Fixed.
- * [BUGFIX]: Support for multi-word names enclosed in quotes, instead of square brackets.
- * [BUGFIX]: Yet another fix related to global table contraints. This time - named global constraints.
- * [BUGFIX]: Right-click (context menu) now selects currently clicked node - it's common behaviour.
- * [BUGFIX]: Disabling clipboard pasting to SQL editor on systems that causes problems with that feature.
- * [BUGFIX]: Fixed error with trying to create second editor in Grid widget, while there still is a first.
- * [BUGFIX]: Foreign key wizard dialog now interpretes main table and foreign table as they should be: foreign table/fields determinates cascades on main table.
- * [BUGFIX]: Fixed 'Refresh' shortcut in table data preview, as well as in table structure tab and table DDL tab.
- * [BUGFIX]: Fixed international characters support in various edit widgets.
-
-[1.0.0-beta3]
- * [ADDED]: 'Report the bug' button in critical error dialog. Now it's much easier to report these kind of bugs.
- * [BUGFIX]: Few detection bugs with constraints detection (in table editon dialog).
- * [BUGFIX]: Browsing table data with BLOB columns (broken in beta2).
- * [BUGFIX]: Bugs with exporting whole database to SQL and XML formats.
-
-[1.0.0-beta2]
- * [ADDED]: date() function to read unixtime from database. It formats unixtime value into human-readable format.
- * [ADDED]: Support for 'REFERENCES' keyword in columns and all stuff related to this keyword.
- * [ADDED]: Support for table global constraints.
- * [ADDED]: Support for triggers on views.
- * [ADDED]: ChangeLog dialog.
- * [ADDED]: 'Escape' shortcut in editor window to hide status field.
- * [CHANGE]: SQLite engine updated to 3.4.1 for binary distributions.
- * [CHANGE]: Insertion cursor in SQL editor blinks a little faster so it's easier to locate it.
- * [CHANGE]: PageDown and PageUp shortcuts upgraded (moves cursor too, not just pages).
- * [CHANGE]: Tab and Shift+Tab upgraded to let indent and unindent multiple lines as well as single lines.
- * [CHANGE]: Handling completion for column names entered in function arguments, like 'max(columnname)'.
- * [BUGFIX]: ColorPicker handles incorrect colors passed to it and in that case it uses white color as default.
- * [BUGFIX]: ColorPicker handles HTML color editing much better then before. Now it might be impossible to break it.
- * [BUGFIX]: Better detection of operating system (fixed problems with Windows Vista and Windows 2000).
- * [BUGFIX]: Fixed adding new row to table data grid when there was an error while committing previous row.
- * [BUGFIX]: Shortcuts Ctrl+Left, Ctrl+Right, Ctrl+Shift+Left and Ctrl+Shift+Right are back!
- * [BUGFIX]: Detection of 'language changed' in configuration dialog fixed (it used to detect change even there was no change).
- * [BUGFIX]: Fixed active task changing while setting MDI windows in cascade layout, then pushing maximize button on some window other than the currently active.
- * [BUGFIX]: Fixed formatting of preformatted table DDL code.
- * [BUGFIX]: Refreshing toolbar state after deletion of any object in the tree.
- * [BUGFIX]: Problems with highlighting of first line in SQL editor in View Edit Dialog.
- * [BUGFIX]: Numerous fixes in all dialog windows, so they don't disappear on errors, but let user fix his input.
- * [BUGFIX]: Minor fixes in Polish translation.
- * [BUGFIX]: SQLiteStudio doesn't let to create objects with empty names (or just whitespaces in name) anymore.
- * [BUGFIX]: Changing table in New Index Dialog didn't work.
- * [BUGFIX]: Clear History toolbar button in SQL Editor window has been fixed.
- * [BUGFIX]: Mouse Wheel is now working on Windows platform.
- * [BUGFIX]: Minor memory leaks fixed in Edit Table Dialog.
- * [BUGFIX]: Constraints list in table window displays now correct list of constraints.
- * [BUGFIX]: Using ' (single quote) character in table data grid has been fixed.
- * [BUGFIX]: SQLite objects containing spaces in name are now supported correctly.
- * [BUGFIX]: Fixed execution of multiple SQL statements that are creating some SQLite objects (it tried to create some of them twice).
- * [BUGFIX]: DDL formatting in table window fixed.
- * [BUGFIX]: Fixed critical error while exporting some data as a XML.
- * [BUGFIX]: Fixed critical error while some error occured when trying to create trigger.
- * [BUGFIX]: Fixed critical errors while customizing toolbar.
diff --git a/SQLiteStudio3/coreSQLiteStudio/TODO.txt b/SQLiteStudio3/coreSQLiteStudio/TODO.txt
deleted file mode 100644
index e4121f0..0000000
--- a/SQLiteStudio3/coreSQLiteStudio/TODO.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-* Next versions:
-- specialized validation of expressions for DEFAULT constraint.
-- in configuration dialog option to disable each individual native SQL function
-- move "integrity check" into dedicated window, add "PRAGMA foreign_key_check" as a second stage of checking and present all in one window
-- constraints tab in table window should have toolbar for adding/editing/deleting constraints
-
-CLI:
-- plugin management commands
-- export commands
-- import commands
-- populate commands
-- formatting command
-
-UNIT TESTS:
-- Parser::parse: more complex examples, errors detecting
-- Lexer::detokenize
-- utils_sql (for splitQueries() check the CREATE TRIGGER)
-- utils
-- SelectResolver
-- SchemaResolver
-
-* Advanced syntax error checks:
-- many idxColumns are not allowed for column FK
-- autoincrement not allowed for not integer type
diff --git a/SQLiteStudio3/coreSQLiteStudio/common/bistrhash.cpp b/SQLiteStudio3/coreSQLiteStudio/common/bistrhash.cpp
index 5f40521..5aac017 100644
--- a/SQLiteStudio3/coreSQLiteStudio/common/bistrhash.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/common/bistrhash.cpp
@@ -31,7 +31,7 @@ void BiStrHash::insert(const QString& left, const QString& right)
lowerInverted.insert(right.toLower(), right);
}
-bool BiStrHash::containsLeft(const QString& left, Qt::CaseSensitivity cs)
+bool BiStrHash::containsLeft(const QString& left, Qt::CaseSensitivity cs) const
{
if (cs == Qt::CaseSensitive)
return hash.contains(left);
@@ -39,7 +39,7 @@ bool BiStrHash::containsLeft(const QString& left, Qt::CaseSensitivity cs)
return lowerHash.contains(left.toLower());
}
-bool BiStrHash::containsRight(const QString& right, Qt::CaseSensitivity cs)
+bool BiStrHash::containsRight(const QString& right, Qt::CaseSensitivity cs) const
{
if (cs == Qt::CaseSensitive)
return inverted.contains(right);
@@ -147,7 +147,10 @@ BiStrHash& BiStrHash::unite(const QHash<QString, QString>& other)
{
QHashIterator<QString, QString> it(other);
while (it.hasNext())
- insert(it.next().key(), it.value());
+ {
+ it.next();
+ insert(it.key(), it.value());
+ }
return *this;
}
diff --git a/SQLiteStudio3/coreSQLiteStudio/common/bistrhash.h b/SQLiteStudio3/coreSQLiteStudio/common/bistrhash.h
index 2089010..cec9b8a 100644
--- a/SQLiteStudio3/coreSQLiteStudio/common/bistrhash.h
+++ b/SQLiteStudio3/coreSQLiteStudio/common/bistrhash.h
@@ -60,7 +60,7 @@ class API_EXPORT BiStrHash
* @param cs Case sensitivity flag.
* @return true if the key was matched in left side values, or false otherwise.
*/
- bool containsLeft(const QString& left, Qt::CaseSensitivity cs = Qt::CaseSensitive);
+ bool containsLeft(const QString& left, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
/**
* @brief Tests if given value is in the right values of the hash.
@@ -68,7 +68,7 @@ class API_EXPORT BiStrHash
* @param cs Case sensitivity flag.
* @return true if the key was matched in right side values, or false otherwise.
*/
- bool containsRight(const QString& right, Qt::CaseSensitivity cs = Qt::CaseSensitive);
+ bool containsRight(const QString& right, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
/**
* @brief Removes entry matching given value in left-side values.
diff --git a/SQLiteStudio3/coreSQLiteStudio/common/column.cpp b/SQLiteStudio3/coreSQLiteStudio/common/column.cpp
index cc282e6..852ff45 100644
--- a/SQLiteStudio3/coreSQLiteStudio/common/column.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/common/column.cpp
@@ -32,7 +32,55 @@ void Column::setColumn(const QString& value)
column = value;
}
+QString Column::getDeclaredType() const
+{
+ return declaredType;
+}
+
+void Column::setDeclaredType(const QString& value)
+{
+ declaredType = value;
+}
+
int qHash(Column column)
{
- return qHash(column.getDatabase() + "." + column.getTable() + "." + column.getColumn());
+ return qHash(column.getDatabase() + "." + column.getTable() + "." + column.getColumn() + "/" + column.getDeclaredType());
+}
+
+AliasedColumn::AliasedColumn()
+{
+}
+
+AliasedColumn::AliasedColumn(const QString& database, const QString& table, const QString& column, const QString& alias) :
+ Column(database, table, column)
+{
+ setAlias(alias);
+}
+
+AliasedColumn::AliasedColumn(const AliasedColumn& other) :
+ Column(other)
+{
+ alias = other.alias;
+}
+
+int AliasedColumn::operator ==(const AliasedColumn& other) const
+{
+ return Column::operator==(other) && alias == other.alias;
+
+}
+
+QString AliasedColumn::getAlias() const
+{
+ return alias;
+}
+
+void AliasedColumn::setAlias(const QString& value)
+{
+ alias = value;
+}
+
+int qHash(AliasedColumn column)
+{
+ return qHash(column.getDatabase() + "." + column.getTable() + "." + column.getColumn() + "/" + column.getDeclaredType()
+ + "/" + column.getAlias());
}
diff --git a/SQLiteStudio3/coreSQLiteStudio/common/column.h b/SQLiteStudio3/coreSQLiteStudio/common/column.h
index 18e5edd..4ddf3e1 100644
--- a/SQLiteStudio3/coreSQLiteStudio/common/column.h
+++ b/SQLiteStudio3/coreSQLiteStudio/common/column.h
@@ -17,10 +17,31 @@ struct API_EXPORT Column : public Table
QString getColumn() const;
void setColumn(const QString& value);
+ QString getDeclaredType() const;
+ void setDeclaredType(const QString& value);
+
private:
QString column;
+ QString declaredType;
+};
+
+struct API_EXPORT AliasedColumn : public Column
+{
+ public:
+ AliasedColumn();
+ AliasedColumn(const QString& database, const QString& table, const QString& column, const QString& alias);
+ AliasedColumn(const AliasedColumn& other);
+
+ int operator ==(const AliasedColumn& other) const;
+
+ QString getAlias() const;
+ void setAlias(const QString& value);
+
+ private:
+ QString alias;
};
int API_EXPORT qHash(Column column);
+int API_EXPORT qHash(AliasedColumn column);
#endif // COLUMN_H
diff --git a/SQLiteStudio3/coreSQLiteStudio/common/compatibility.cpp b/SQLiteStudio3/coreSQLiteStudio/common/compatibility.cpp
new file mode 100644
index 0000000..9676105
--- /dev/null
+++ b/SQLiteStudio3/coreSQLiteStudio/common/compatibility.cpp
@@ -0,0 +1,2 @@
+#include "compatibility.h"
+
diff --git a/SQLiteStudio3/coreSQLiteStudio/common/compatibility.h b/SQLiteStudio3/coreSQLiteStudio/common/compatibility.h
new file mode 100644
index 0000000..5ed5c8b
--- /dev/null
+++ b/SQLiteStudio3/coreSQLiteStudio/common/compatibility.h
@@ -0,0 +1,40 @@
+#ifndef COMPATIBILITY_H
+#define COMPATIBILITY_H
+
+#include <QList>
+#include <QSet>
+#include <QHash>
+
+template <class T>
+inline QSet<T> toSet(const QList<T>& list)
+{
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
+ return QSet<T>(list.begin(), list.end());
+#else
+ return list.toSet();
+#endif
+}
+
+template <class K, class V>
+inline void unite(QHash<K, V>& h1, const QHash<K, V>& h2)
+{
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
+ h1.insert(h2);
+#else
+ h1.unite(h2);
+#endif
+}
+
+template <class T>
+void sSort(T& collection)
+{
+ std::sort(collection.begin(), collection.end());
+}
+
+template <class T, class C>
+void sSort(T& collection, C cmp)
+{
+ std::sort(collection.begin(), collection.end(), cmp);
+}
+
+#endif // COMPATIBILITY_H
diff --git a/SQLiteStudio3/coreSQLiteStudio/common/global.h b/SQLiteStudio3/coreSQLiteStudio/common/global.h
index cfd8dc0..e09391a 100644
--- a/SQLiteStudio3/coreSQLiteStudio/common/global.h
+++ b/SQLiteStudio3/coreSQLiteStudio/common/global.h
@@ -39,6 +39,10 @@
var = nullptr; \
}
+#define parser_safe_delete(var) \
+ if (var) \
+ delete var
+
#define static_char static constexpr const char
#define static_qstring(N,V) const static QString N = QStringLiteral(V)
diff --git a/SQLiteStudio3/coreSQLiteStudio/common/readwritelocker.cpp b/SQLiteStudio3/coreSQLiteStudio/common/readwritelocker.cpp
index cdf8110..07752ff 100644
--- a/SQLiteStudio3/coreSQLiteStudio/common/readwritelocker.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/common/readwritelocker.cpp
@@ -11,9 +11,9 @@ ReadWriteLocker::ReadWriteLocker(QReadWriteLock* lock, Mode mode)
init(lock, mode);
}
-ReadWriteLocker::ReadWriteLocker(QReadWriteLock* lock, const QString& query, Dialect dialect, bool noLock)
+ReadWriteLocker::ReadWriteLocker(QReadWriteLock* lock, const QString& query, bool noLock)
{
- init(lock, getMode(query, dialect, noLock));
+ init(lock, getMode(query, noLock));
}
ReadWriteLocker::~ReadWriteLocker()
@@ -47,12 +47,12 @@ void ReadWriteLocker::init(QReadWriteLock* lock, ReadWriteLocker::Mode mode)
}
}
-ReadWriteLocker::Mode ReadWriteLocker::getMode(const QString &query, Dialect dialect, bool noLock)
+ReadWriteLocker::Mode ReadWriteLocker::getMode(const QString &query, bool noLock)
{
if (noLock)
return ReadWriteLocker::NONE;
- QueryAccessMode queryMode = getQueryAccessMode(query, dialect);
+ QueryAccessMode queryMode = getQueryAccessMode(query);
switch (queryMode)
{
case QueryAccessMode::READ:
diff --git a/SQLiteStudio3/coreSQLiteStudio/common/readwritelocker.h b/SQLiteStudio3/coreSQLiteStudio/common/readwritelocker.h
index cac9368..e12c4e6 100644
--- a/SQLiteStudio3/coreSQLiteStudio/common/readwritelocker.h
+++ b/SQLiteStudio3/coreSQLiteStudio/common/readwritelocker.h
@@ -2,7 +2,6 @@
#define READWRITELOCKER_H
#include "coreSQLiteStudio_global.h"
-#include "dialect.h"
class QReadLocker;
class QWriteLocker;
@@ -31,7 +30,7 @@ class API_EXPORT ReadWriteLocker
};
ReadWriteLocker(QReadWriteLock* lock, Mode mode);
- ReadWriteLocker(QReadWriteLock* lock, const QString& query, Dialect dialect, bool noLock);
+ ReadWriteLocker(QReadWriteLock* lock, const QString& query, bool noLock);
virtual ~ReadWriteLocker();
/**
@@ -53,7 +52,7 @@ class API_EXPORT ReadWriteLocker
*
* In case of WITH statement it filters out the "WITH clause" and then checks for SELECT keyword.
*/
- static ReadWriteLocker::Mode getMode(const QString& query, Dialect dialect, bool noLock);
+ static ReadWriteLocker::Mode getMode(const QString& query, bool noLock);
private:
void init(QReadWriteLock* lock, Mode mode);
diff --git a/SQLiteStudio3/coreSQLiteStudio/common/signalwait.cpp b/SQLiteStudio3/coreSQLiteStudio/common/signalwait.cpp
index 4a22e83..45472f4 100644
--- a/SQLiteStudio3/coreSQLiteStudio/common/signalwait.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/common/signalwait.cpp
@@ -1,6 +1,6 @@
#include "signalwait.h"
#include <QCoreApplication>
-#include <QTime>
+#include <QElapsedTimer>
SignalWait::SignalWait(QObject* object, const char* signal) :
QObject()
@@ -10,7 +10,7 @@ SignalWait::SignalWait(QObject* object, const char* signal) :
bool SignalWait::wait(int msTimeout)
{
- QTime timer(0, 0, 0, msTimeout);
+ QElapsedTimer timer;
timer.start();
while (!called && !failed && timer.elapsed() < msTimeout)
QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
diff --git a/SQLiteStudio3/coreSQLiteStudio/common/utils.cpp b/SQLiteStudio3/coreSQLiteStudio/common/utils.cpp
index fd40355..0b95a85 100644
--- a/SQLiteStudio3/coreSQLiteStudio/common/utils.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/common/utils.cpp
@@ -2,6 +2,7 @@
#include "common/global.h"
#include "dbobjecttype.h"
#include "rsa/RSA.h"
+#include "common/compatibility.h"
#include <QTextCodec>
#include <QString>
#include <QSet>
@@ -12,7 +13,9 @@
#include <QRegularExpression>
#include <QDir>
#include <QByteArray>
+#include <QBitArray>
#include <QDataStream>
+#include <QRandomGenerator>
#ifdef Q_OS_LINUX
#include <sys/utsname.h>
@@ -68,7 +71,7 @@ QChar charAt(const QString& str, int pos)
int rand(int min, int max)
{
- return qrand() % (max-min) + min;
+ return QRandomGenerator::system()->generate() % (max-min) + min;
}
QString randStr(int length, bool numChars, bool whiteSpaces)
@@ -414,7 +417,7 @@ QString shortest(const QStringList& strList)
QString longestCommonPart(const QStringList& strList)
{
if (strList.size() == 0)
- return QString::null;
+ return QString();
QString common;
QString first = strList.first();
@@ -626,8 +629,8 @@ QStringList textCodecNames()
for (const QByteArray& codec : codecs)
nameSet << QString::fromLatin1(codec.constData());
- names = nameSet.toList();
- qSort(names);
+ names = nameSet.values();
+ sSort(names);
return names;
}
@@ -975,7 +978,7 @@ QString doubleToString(const QVariant& val)
void sortWithReferenceList(QList<QString>& listToSort, const QList<QString>& referenceList, Qt::CaseSensitivity cs)
{
- qSort(listToSort.begin(), listToSort.end(), [referenceList, cs](const QString& s1, const QString& s2) -> bool
+ sSort(listToSort, [referenceList, cs](const QString& s1, const QString& s2) -> bool
{
int idx1 = indexOf(referenceList, s1, cs);
int idx2 = indexOf(referenceList, s2, cs);
@@ -1031,3 +1034,66 @@ QString readFileContents(const QString& path, QString* err)
return contents;
}
+
+
+uint qHash(const QVariant& var)
+{
+ if (!var.isValid() || var.isNull())
+ return -1;
+
+ switch (var.type())
+ {
+ case QVariant::Int:
+ return qHash(var.toInt());
+ case QVariant::UInt:
+ return qHash(var.toUInt());
+ case QVariant::Bool:
+ return qHash(var.toUInt());
+ case QVariant::Double:
+ return qHash(var.toUInt());
+ case QVariant::LongLong:
+ return qHash(var.toLongLong());
+ case QVariant::ULongLong:
+ return qHash(var.toULongLong());
+ case QVariant::String:
+ return qHash(var.toString());
+ case QVariant::Char:
+ return qHash(var.toChar());
+ case QVariant::StringList:
+ return qHash(var.toString());
+ case QVariant::ByteArray:
+ return qHash(var.toByteArray());
+ case QVariant::Date:
+ case QVariant::Time:
+ case QVariant::DateTime:
+ case QVariant::Url:
+ case QVariant::Locale:
+ case QVariant::RegExp:
+ return qHash(var.toString());
+ case QVariant::Hash:
+ return qHash(var.toHash());
+ case QVariant::Map:
+ return qHash(var.toMap());
+ case QVariant::List:
+ return qHash(var.toList());
+ case QVariant::BitArray:
+ return qHash(var.toBitArray());
+ case QVariant::Size:
+ case QVariant::SizeF:
+ case QVariant::Rect:
+ case QVariant::LineF:
+ case QVariant::Line:
+ case QVariant::RectF:
+ case QVariant::Point:
+ case QVariant::PointF:
+ // not supported yet
+ break;
+ case QVariant::UserType:
+ case QVariant::Invalid:
+ default:
+ return -3;
+ }
+
+ // could not generate a hash for the given variant
+ return -2;
+}
diff --git a/SQLiteStudio3/coreSQLiteStudio/common/utils.h b/SQLiteStudio3/coreSQLiteStudio/common/utils.h
index 24ea150..f7317e2 100644
--- a/SQLiteStudio3/coreSQLiteStudio/common/utils.h
+++ b/SQLiteStudio3/coreSQLiteStudio/common/utils.h
@@ -140,6 +140,33 @@ QList<T> concat(const QList<QList<T>>& list)
return result;
}
+template <class T, typename R = QList<T>>
+R concat(const QList<QSet<T>>& list)
+{
+ R result;
+ for (const QSet<T>& itemSet : list)
+ for (const T& subitem : itemSet)
+ result << subitem;
+
+ return result;
+}
+
+template <class T>
+QSet<T> concatSet(const QList<QSet<T>>& list)
+{
+ return concat<T, QSet<T>>(list);
+}
+
+template <class T>
+QSet<T> concat(const QSet<QSet<T>>& list)
+{
+ QSet<T> result;
+ for (const QSet<T>& item : list)
+ result.unite(item);
+
+ return result;
+}
+
API_EXPORT QStringList concat(const QList<QStringList>& list);
/**
@@ -293,6 +320,8 @@ void removeDuplicates(QList<T>& list)
}
}
+API_EXPORT uint qHash(const QVariant& var);
+
API_EXPORT QByteArray serializeToBytes(const QVariant& value);
API_EXPORT QVariant deserializeFromBytes(const QByteArray& bytes);
diff --git a/SQLiteStudio3/coreSQLiteStudio/common/utils_sql.cpp b/SQLiteStudio3/coreSQLiteStudio/common/utils_sql.cpp
index b5642ec..c8d63e1 100644
--- a/SQLiteStudio3/coreSQLiteStudio/common/utils_sql.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/common/utils_sql.cpp
@@ -15,7 +15,6 @@ QString invalidIdCharacters = "[]()\"'@*.,+-=/%&|:; \t\n<>";
QHash<NameWrapper,QPair<QChar,QChar>> wrapperChars;
QHash<NameWrapper,QPair<QChar,bool>> wrapperEscapedEnding;
QList<NameWrapper> sqlite3Wrappers;
-QList<NameWrapper> sqlite2Wrappers;
void initUtilsSql()
{
@@ -33,22 +32,19 @@ void initUtilsSql()
<< NameWrapper::BRACKET
<< NameWrapper::QUOTE
<< NameWrapper::BACK_QUOTE;
- sqlite2Wrappers << NameWrapper::DOUBLE_QUOTE
- << NameWrapper::BRACKET
- << NameWrapper::QUOTE;
qRegisterMetaType<SqlQueryPtr>("SqlQueryPtr");
}
-bool doesObjectNeedWrapping(const QString& str, Dialect dialect)
+bool doesObjectNeedWrapping(const QString& str)
{
if (str.isEmpty())
return true;
- if (isObjWrapped(str, dialect))
+ if (isObjWrapped(str))
return false;
- if (isKeyword(str, dialect))
+ if (isKeyword(str))
return true;
for (int i = 0; i < str.size(); i++)
@@ -66,41 +62,36 @@ bool doesObjectNeedWrapping(const QChar& c)
return invalidIdCharacters.indexOf(c) >= 0;
}
-bool isObjectWrapped(const QChar& c, Dialect dialect)
-{
- return !doesObjectNeedWrapping(c, dialect);
-}
-
bool isObjectWrapped(const QChar& c)
{
return !doesObjectNeedWrapping(c);
}
-QString wrapObjIfNeeded(const QString& obj, Dialect dialect, NameWrapper favWrapper)
+QString wrapObjIfNeeded(const QString& obj, NameWrapper favWrapper)
{
- if (doesObjectNeedWrapping(obj, dialect))
- return wrapObjName(obj, dialect, favWrapper);
+ if (doesObjectNeedWrapping(obj))
+ return wrapObjName(obj, favWrapper);
return obj;
}
-QString wrapObjIfNeeded(const QString& obj, Dialect dialect, bool useDoubleQuoteForEmptyValue, NameWrapper favWrapper)
+QString wrapObjIfNeeded(const QString& obj, bool useDoubleQuoteForEmptyValue, NameWrapper favWrapper)
{
- return wrapObjIfNeeded(obj, dialect, ((useDoubleQuoteForEmptyValue && obj.isEmpty()) ? NameWrapper::DOUBLE_QUOTE : favWrapper));
+ return wrapObjIfNeeded(obj, ((useDoubleQuoteForEmptyValue && obj.isEmpty()) ? NameWrapper::DOUBLE_QUOTE : favWrapper));
}
-QString wrapObjName(const QString& obj, Dialect dialect, bool useDoubleQuoteForEmptyValue, NameWrapper favWrapper)
+QString wrapObjName(const QString& obj, bool useDoubleQuoteForEmptyValue, NameWrapper favWrapper)
{
- return wrapObjName(obj, dialect, ((useDoubleQuoteForEmptyValue && obj.isEmpty()) ? NameWrapper::DOUBLE_QUOTE : favWrapper));
+ return wrapObjName(obj, ((useDoubleQuoteForEmptyValue && obj.isEmpty()) ? NameWrapper::DOUBLE_QUOTE : favWrapper));
}
-QString wrapObjName(const QString& obj, Dialect dialect, NameWrapper favWrapper)
+QString wrapObjName(const QString& obj, NameWrapper favWrapper)
{
QString result = obj;
if (result.isNull())
result = "";
- QPair<QChar,QChar> wrapChars = getQuoteCharacter(result, dialect, favWrapper);
+ QPair<QChar,QChar> wrapChars = getQuoteCharacter(result, favWrapper);
if (wrapChars.first.isNull() || wrapChars.second.isNull())
{
@@ -112,20 +103,9 @@ QString wrapObjName(const QString& obj, Dialect dialect, NameWrapper favWrapper)
return result;
}
-QString wrapObjName(const QString& obj, NameWrapper wrapper)
+QPair<QChar,QChar> getQuoteCharacter(QString& obj, NameWrapper favWrapper)
{
- QString result = obj;
- if (wrapper == NameWrapper::null)
- return result;
-
- result.prepend(wrapperChars[wrapper].first);
- result.append(wrapperChars[wrapper].second);
- return result;
-}
-
-QPair<QChar,QChar> getQuoteCharacter(QString& obj, Dialect dialect, NameWrapper favWrapper)
-{
- QList<NameWrapper> wrappers = (dialect == Dialect::Sqlite3) ? sqlite3Wrappers : sqlite2Wrappers;
+ QList<NameWrapper> wrappers = sqlite3Wrappers;
// Move favourite wrapper to front of list
if (wrappers.contains(favWrapper))
@@ -150,30 +130,27 @@ QPair<QChar,QChar> getQuoteCharacter(QString& obj, Dialect dialect, NameWrapper
return QPair<QChar,QChar>();
}
-QList<QString> wrapObjNames(const QList<QString>& objList, Dialect dialect, NameWrapper favWrapper)
+QList<QString> wrapObjNames(const QList<QString>& objList, NameWrapper favWrapper)
{
QList<QString> results;
for (int i = 0; i < objList.size(); i++)
- results << wrapObjName(objList[i], dialect, favWrapper);
+ results << wrapObjName(objList[i], favWrapper);
return results;
}
-QList<QString> wrapObjNamesIfNeeded(const QList<QString>& objList, Dialect dialect, NameWrapper favWrapper)
+QList<QString> wrapObjNamesIfNeeded(const QList<QString>& objList, NameWrapper favWrapper)
{
QList<QString> results;
for (int i = 0; i < objList.size(); i++)
- results << wrapObjIfNeeded(objList[i], dialect, favWrapper);
+ results << wrapObjIfNeeded(objList[i], favWrapper);
return results;
}
-QList<NameWrapper> getAllNameWrappers(Dialect dialect)
+QList<NameWrapper> getAllNameWrappers()
{
- if (dialect == Dialect::Sqlite3)
- return {NameWrapper::DOUBLE_QUOTE, NameWrapper::BRACKET, NameWrapper::BACK_QUOTE, NameWrapper::QUOTE};
- else
- return {NameWrapper::DOUBLE_QUOTE, NameWrapper::BRACKET, NameWrapper::QUOTE};
+ return {NameWrapper::DOUBLE_QUOTE, NameWrapper::BRACKET, NameWrapper::BACK_QUOTE, NameWrapper::QUOTE};
}
QString wrapValueIfNeeded(const QString& str)
@@ -183,7 +160,7 @@ QString wrapValueIfNeeded(const QString& str)
QString wrapValueIfNeeded(const QVariant& value)
{
- if (value.canConvert(QMetaType::LongLong) || value.canConvert(QMetaType::Double))
+ if (isNumeric(value))
return value.toString();
return wrapString(value.toString());
@@ -199,6 +176,9 @@ QString wrapString(const QString& str)
bool doesStringNeedWrapping(const QString& str)
{
+ if (str.size() == 0)
+ return false;
+
return str[0] == '\'' && str[str.length()-1] == '\'';
}
@@ -258,13 +238,13 @@ QString stripEndingSemicolon(const QString& str)
return str;
}
-QString stripObjName(const QString &str, Dialect dialect)
+QString stripObjName(const QString &str)
{
QString newStr = str;
- return stripObjName(newStr, dialect);
+ return stripObjName(newStr);
}
-QString stripObjName(QString &str, Dialect dialect)
+QString stripObjName(QString &str)
{
if (str.isNull())
return str;
@@ -272,15 +252,15 @@ QString stripObjName(QString &str, Dialect dialect)
if (str.length() <= 1)
return str;
- if (!isObjWrapped(str, dialect))
+ if (!isObjWrapped(str))
return str;
return str.mid(1, str.length()-2);
}
-bool isObjWrapped(const QString& str, Dialect dialect)
+bool isObjWrapped(const QString& str)
{
- return getObjWrapper(str, dialect) != NameWrapper::null;
+ return getObjWrapper(str) != NameWrapper::null;
}
bool doesNotContainEndingWrapperChar(const QString& str, NameWrapper wrapper)
@@ -300,19 +280,12 @@ bool doesNotContainEndingWrapperChar(const QString& str, NameWrapper wrapper)
return true;
}
-NameWrapper getObjWrapper(const QString& str, Dialect dialect)
+NameWrapper getObjWrapper(const QString& str)
{
if (str.isEmpty())
return NameWrapper::null;
- QList<NameWrapper> wrappers;
-
- if (dialect == Dialect::Sqlite2)
- wrappers = sqlite2Wrappers;
- else
- wrappers = sqlite3Wrappers;
-
- for (NameWrapper wrapper : wrappers)
+ for (NameWrapper wrapper : sqlite3Wrappers)
{
QPair<QChar,QChar> chars = wrapperChars[wrapper];
if (str[0] == chars.first && str[str.length()-1] == chars.second && doesNotContainEndingWrapperChar(str, wrapper))
@@ -321,15 +294,9 @@ NameWrapper getObjWrapper(const QString& str, Dialect dialect)
return NameWrapper::null;
}
-bool isWrapperChar(const QChar& c, Dialect dialect)
+bool isWrapperChar(const QChar& c)
{
- QList<NameWrapper> wrappers;
- if (dialect == Dialect::Sqlite2)
- wrappers = sqlite2Wrappers;
- else
- wrappers = sqlite3Wrappers;
-
- for (NameWrapper wrapper : wrappers)
+ for (NameWrapper wrapper : sqlite3Wrappers)
{
QPair<QChar,QChar> chars = wrapperChars[wrapper];
if (c == chars.first || c == chars.second)
@@ -343,12 +310,12 @@ int qHash(NameWrapper wrapper)
return (uint)wrapper;
}
-QString getPrefixDb(const QString& origDbName, Dialect dialect)
+QString getPrefixDb(const QString& origDbName)
{
if (origDbName.isEmpty())
return "main";
else
- return wrapObjIfNeeded(origDbName, dialect);
+ return wrapObjIfNeeded(origDbName);
}
bool isSystemTable(const QString &name)
@@ -356,35 +323,24 @@ bool isSystemTable(const QString &name)
return name.startsWith("sqlite_");
}
-bool isSystemIndex(const QString &name, Dialect dialect)
+bool isSystemIndex(const QString &name)
{
- switch (dialect)
- {
- case Dialect::Sqlite3:
- return name.startsWith("sqlite_autoindex_");
- case Dialect::Sqlite2:
- {
- QRegExp re("*(*autoindex*)*");
- re.setPatternSyntax(QRegExp::Wildcard);
- return re.exactMatch(name);
- }
- }
- return false;
+ return name.startsWith("sqlite_autoindex_");
}
-TokenPtr stripObjName(TokenPtr token, Dialect dialect)
+TokenPtr stripObjName(TokenPtr token)
{
if (!token)
return token;
- token->value = stripObjName(token->value, dialect);
+ token->value = stripObjName(token->value);
return token;
}
QString removeComments(const QString& value)
{
- Lexer lexer(Dialect::Sqlite3);
+ Lexer lexer;
TokenList tokens = lexer.tokenize(value);
while (tokens.remove(Token::COMMENT))
continue;
@@ -569,9 +525,9 @@ QStringList quickSplitQueries(const QString& sql, bool keepEmptyQueries, bool re
return queries;
}
-QStringList splitQueries(const QString& sql, Dialect dialect, bool keepEmptyQueries, bool removeComments, bool* complete)
+QStringList splitQueries(const QString& sql, bool keepEmptyQueries, bool removeComments, bool* complete)
{
- TokenList tokens = Lexer::tokenize(sql, dialect);
+ TokenList tokens = Lexer::tokenize(sql);
if (removeComments)
tokens = tokens.filterOut(Token::COMMENT);
@@ -621,12 +577,12 @@ QString getQueryWithPosition(const QStringList& queries, int position, int* star
if (startPos)
*startPos = -1;
- return QString::null;
+ return QString();
}
QString getQueryWithPosition(const QString& queries, int position, int* startPos)
{
- QStringList queryList = quickSplitQueries(queries);
+ QStringList queryList = splitQueries(queries);
return getQueryWithPosition(queryList, position, startPos);
}
@@ -641,11 +597,11 @@ QString trimBindParamPrefix(const QString& param)
return param;
}
-QList<QueryWithParamNames> getQueriesWithParamNames(const QString& query, Dialect dialect)
+QList<QueryWithParamNames> getQueriesWithParamNames(const QString& query)
{
QList<QueryWithParamNames> results;
- TokenList allTokens = Lexer::tokenize(query, dialect);
+ TokenList allTokens = Lexer::tokenize(query);
QList<TokenList> queries = splitQueries(allTokens);
QString queryStr;
@@ -663,11 +619,11 @@ QList<QueryWithParamNames> getQueriesWithParamNames(const QString& query, Dialec
return results;
}
-QList<QueryWithParamCount> getQueriesWithParamCount(const QString& query, Dialect dialect)
+QList<QueryWithParamCount> getQueriesWithParamCount(const QString& query)
{
QList<QueryWithParamCount> results;
- TokenList allTokens = Lexer::tokenize(query, dialect);
+ TokenList allTokens = Lexer::tokenize(query);
QList<TokenList> queries = splitQueries(allTokens);
QString queryStr;
@@ -681,9 +637,9 @@ QList<QueryWithParamCount> getQueriesWithParamCount(const QString& query, Dialec
return results;
}
-QueryWithParamNames getQueryWithParamNames(const QString& query, Dialect dialect)
+QueryWithParamNames getQueryWithParamNames(const QString& query)
{
- TokenList allTokens = Lexer::tokenize(query, dialect);
+ TokenList allTokens = Lexer::tokenize(query);
QStringList paramNames;
for (const TokenPtr& token : allTokens.filter(Token::BIND_PARAM))
@@ -692,9 +648,9 @@ QueryWithParamNames getQueryWithParamNames(const QString& query, Dialect dialect
return QueryWithParamNames(query, paramNames);
}
-QueryWithParamCount getQueryWithParamCount(const QString& query, Dialect dialect)
+QueryWithParamCount getQueryWithParamCount(const QString& query)
{
- TokenList allTokens = Lexer::tokenize(query, dialect);
+ TokenList allTokens = Lexer::tokenize(query);
return QueryWithParamCount(query, allTokens.filter(Token::BIND_PARAM).size());
}
@@ -719,14 +675,14 @@ QString getBindTokenName(const TokenPtr& token)
return token->value.mid(1);
}
-QueryAccessMode getQueryAccessMode(const QString& query, Dialect dialect, bool* isSelect)
+QueryAccessMode getQueryAccessMode(const QString& query, bool* isSelect)
{
static QStringList readOnlyCommands = {"ANALYZE", "EXPLAIN", "PRAGMA", "SELECT"};
if (isSelect)
*isSelect = false;
- TokenList tokens = Lexer::tokenize(query, dialect);
+ TokenList tokens = Lexer::tokenize(query);
int keywordIdx = tokens.indexOf(Token::KEYWORD);
if (keywordIdx < 0)
return QueryAccessMode::WRITE;
@@ -790,7 +746,7 @@ QueryAccessMode getQueryAccessMode(const QString& query, Dialect dialect, bool*
return QueryAccessMode::WRITE;
}
-QStringList valueListToSqlList(const QVariantList& values, Dialect dialect)
+QStringList valueListToSqlList(const QVariantList& values)
{
QStringList argList;
for (const QVariant& value : values)
@@ -816,13 +772,8 @@ QStringList valueListToSqlList(const QVariantList& values, Dialect dialect)
argList << QString::number(value.toInt());
break;
case QVariant::ByteArray:
- {
- if (dialect == Dialect::Sqlite3) // version 2 will go to the regular string processing
- {
- argList << "X'" + value.toByteArray().toHex().toUpper() + "'";
- break;
- }
- }
+ argList << "X'" + value.toByteArray().toHex().toUpper() + "'";
+ break;
default:
argList << wrapString(escapeString(value.toString()));
break;
@@ -850,3 +801,24 @@ QString trimQueryEnd(const QString &query)
}
return q;
}
+
+SqliteDataType toSqliteDataType(const QString& typeStr)
+{
+ QString upperType = typeStr.trimmed().toUpper();
+ if (upperType == "INTEGER")
+ return SqliteDataType::INTEGER;
+
+ if (upperType == "REAL")
+ return SqliteDataType::REAL;
+
+ if (upperType == "TEXT")
+ return SqliteDataType::TEXT;
+
+ if (upperType == "BLOB")
+ return SqliteDataType::BLOB;
+
+ if (upperType == "NULL")
+ return SqliteDataType::_NULL;
+
+ return SqliteDataType::UNKNOWN;
+}
diff --git a/SQLiteStudio3/coreSQLiteStudio/common/utils_sql.h b/SQLiteStudio3/coreSQLiteStudio/common/utils_sql.h
index 1da3108..b9cfdcf 100644
--- a/SQLiteStudio3/coreSQLiteStudio/common/utils_sql.h
+++ b/SQLiteStudio3/coreSQLiteStudio/common/utils_sql.h
@@ -1,7 +1,6 @@
#ifndef UTILS_SQL_H
#define UTILS_SQL_H
-#include "dialect.h"
#include "parser/token.h"
#include "coreSQLiteStudio_global.h"
#include <QString>
@@ -25,27 +24,36 @@ enum class QueryAccessMode
WRITE
};
+enum class SqliteDataType
+{
+ UNKNOWN = -1,
+ _NULL = 0,
+ INTEGER = 1,
+ REAL = 2,
+ TEXT = 3,
+ BLOB = 4
+};
+
typedef QPair<QString,QStringList> QueryWithParamNames;
typedef QPair<QString,int> QueryWithParamCount;
API_EXPORT void initUtilsSql();
-API_EXPORT bool doesObjectNeedWrapping(const QString& str, Dialect dialect);
+API_EXPORT SqliteDataType toSqliteDataType(const QString& typeStr);
+API_EXPORT bool doesObjectNeedWrapping(const QString& str);
API_EXPORT bool doesObjectNeedWrapping(const QChar& c);
-API_EXPORT bool isObjectWrapped(const QChar& c, Dialect dialect);
API_EXPORT bool isObjectWrapped(const QChar& c);
API_EXPORT bool doesStringNeedWrapping(const QString& str);
API_EXPORT bool isStringWrapped(const QString& str);
-API_EXPORT QString wrapObjIfNeeded(const QString& obj, Dialect dialect, NameWrapper favWrapper = NameWrapper::null);
-API_EXPORT QString wrapObjIfNeeded(const QString& obj, Dialect dialect, bool useDoubleQuoteForEmptyValue, NameWrapper favWrapper = NameWrapper::null);
-API_EXPORT QString wrapObjName(const QString& obj, Dialect dialect, NameWrapper favWrapper = NameWrapper::null);
-API_EXPORT QString wrapObjName(const QString& obj, Dialect dialect, bool useDoubleQuoteForEmptyValue, NameWrapper favWrapper = NameWrapper::null);
-API_EXPORT QString wrapObjName(const QString& obj, NameWrapper wrapper);
-API_EXPORT TokenPtr stripObjName(TokenPtr token, Dialect dialect);
-API_EXPORT QString stripObjName(const QString &str, Dialect dialect);
-API_EXPORT QString stripObjName(QString& str, Dialect dialect);
-API_EXPORT bool isObjWrapped(const QString& str, Dialect dialect);
-API_EXPORT NameWrapper getObjWrapper(const QString& str, Dialect dialect);
-API_EXPORT bool isWrapperChar(const QChar& c, Dialect dialect);
+API_EXPORT QString wrapObjIfNeeded(const QString& obj, NameWrapper favWrapper = NameWrapper::null);
+API_EXPORT QString wrapObjIfNeeded(const QString& obj, bool useDoubleQuoteForEmptyValue, NameWrapper favWrapper = NameWrapper::null);
+API_EXPORT QString wrapObjName(const QString& obj, NameWrapper favWrapper = NameWrapper::null);
+API_EXPORT QString wrapObjName(const QString& obj, bool useDoubleQuoteForEmptyValue, NameWrapper favWrapper = NameWrapper::null);
+API_EXPORT TokenPtr stripObjName(TokenPtr token);
+API_EXPORT QString stripObjName(const QString &str);
+API_EXPORT QString stripObjName(QString& str);
+API_EXPORT bool isObjWrapped(const QString& str);
+API_EXPORT NameWrapper getObjWrapper(const QString& str);
+API_EXPORT bool isWrapperChar(const QChar& c);
API_EXPORT QString wrapString(const QString& str);
API_EXPORT QStringList wrapStrings(const QStringList& strList);
API_EXPORT QString wrapStringIfNeeded(const QString& str);
@@ -54,32 +62,31 @@ API_EXPORT QString escapeString(const QString& str);
API_EXPORT QString stripString(QString& str);
API_EXPORT QString stripString(const QString& str);
API_EXPORT QString stripEndingSemicolon(const QString& str);
-API_EXPORT QPair<QChar,QChar> getQuoteCharacter(QString& obj, Dialect dialect,
- NameWrapper favWrapper = NameWrapper::null);
-API_EXPORT QList<QString> wrapObjNames(const QList<QString>& objList, Dialect dialect = Dialect::Sqlite3, NameWrapper favWrapper = NameWrapper::null);
-API_EXPORT QList<QString> wrapObjNamesIfNeeded(const QList<QString>& objList, Dialect dialect, NameWrapper favWrapper = NameWrapper::null);
-API_EXPORT QList<NameWrapper> getAllNameWrappers(Dialect dialect = Dialect::Sqlite3);
+API_EXPORT QPair<QChar,QChar> getQuoteCharacter(QString& obj, NameWrapper favWrapper = NameWrapper::null);
+API_EXPORT QList<QString> wrapObjNames(const QList<QString>& objList, NameWrapper favWrapper = NameWrapper::null);
+API_EXPORT QList<QString> wrapObjNamesIfNeeded(const QList<QString>& objList, NameWrapper favWrapper = NameWrapper::null);
+API_EXPORT QList<NameWrapper> getAllNameWrappers();
API_EXPORT QString wrapValueIfNeeded(const QString& str);
API_EXPORT QString wrapValueIfNeeded(const QVariant& value);
API_EXPORT int qHash(NameWrapper wrapper);
-API_EXPORT QString getPrefixDb(const QString& origDbName, Dialect dialect);
+API_EXPORT QString getPrefixDb(const QString& origDbName);
API_EXPORT bool isSystemTable(const QString& name);
-API_EXPORT bool isSystemIndex(const QString& name, Dialect dialect);
+API_EXPORT bool isSystemIndex(const QString& name);
API_EXPORT QString removeComments(const QString& value);
API_EXPORT QList<TokenList> splitQueries(const TokenList& tokenizedQueries, bool* complete = nullptr);
-API_EXPORT QStringList splitQueries(const QString& sql, Dialect dialect, bool keepEmptyQueries = true, bool removeComments = false, bool* complete = nullptr);
+API_EXPORT QStringList splitQueries(const QString& sql, bool keepEmptyQueries = true, bool removeComments = false, bool* complete = nullptr);
API_EXPORT QStringList quickSplitQueries(const QString& sql, bool keepEmptyQueries = true, bool removeComments = false);
API_EXPORT QString getQueryWithPosition(const QStringList& queries, int position, int* startPos = nullptr);
API_EXPORT QString getQueryWithPosition(const QString& queries, int position, int* startPos = nullptr);
-API_EXPORT QList<QueryWithParamNames> getQueriesWithParamNames(const QString& query, Dialect dialect);
-API_EXPORT QList<QueryWithParamCount> getQueriesWithParamCount(const QString& query, Dialect dialect);
-API_EXPORT QueryWithParamNames getQueryWithParamNames(const QString& query, Dialect dialect);
-API_EXPORT QueryWithParamCount getQueryWithParamCount(const QString& query, Dialect dialect);
+API_EXPORT QList<QueryWithParamNames> getQueriesWithParamNames(const QString& query);
+API_EXPORT QList<QueryWithParamCount> getQueriesWithParamCount(const QString& query);
+API_EXPORT QueryWithParamNames getQueryWithParamNames(const QString& query);
+API_EXPORT QueryWithParamCount getQueryWithParamCount(const QString& query);
API_EXPORT QString trimBindParamPrefix(const QString& param);
API_EXPORT QString commentAllSqlLines(const QString& sql);
API_EXPORT QString getBindTokenName(const TokenPtr& token);
-API_EXPORT QueryAccessMode getQueryAccessMode(const QString& query, Dialect dialect, bool* isSelect = nullptr);
-API_EXPORT QStringList valueListToSqlList(const QList<QVariant>& values, Dialect dialect);
+API_EXPORT QueryAccessMode getQueryAccessMode(const QString& query, bool* isSelect = nullptr);
+API_EXPORT QStringList valueListToSqlList(const QList<QVariant>& values);
API_EXPORT QString trimQueryEnd(const QString& query);
diff --git a/SQLiteStudio3/coreSQLiteStudio/completioncomparer.cpp b/SQLiteStudio3/coreSQLiteStudio/completioncomparer.cpp
index ae64de8..28f383d 100644
--- a/SQLiteStudio3/coreSQLiteStudio/completioncomparer.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/completioncomparer.cpp
@@ -8,7 +8,6 @@
CompletionComparer::CompletionComparer(CompletionHelper *helper)
: helper(helper)
{
- dialect = helper->db->getDialect();
init();
}
@@ -40,12 +39,7 @@ bool CompletionComparer::operator ()(const ExpectedTokenPtr& token1, const Expec
case ExpectedToken::PRAGMA:
return compareValues(token1, token2);
case ExpectedToken::COLLATION:
- {
- if (dialect == Dialect::Sqlite3)
- return compareValues(token1, token2);
- else
- return false;
- }
+ return compareValues(token1, token2);
case ExpectedToken::OTHER:
case ExpectedToken::STRING:
case ExpectedToken::NUMBER:
diff --git a/SQLiteStudio3/coreSQLiteStudio/completioncomparer.h b/SQLiteStudio3/coreSQLiteStudio/completioncomparer.h
index d482f3a..4d5dd79 100644
--- a/SQLiteStudio3/coreSQLiteStudio/completioncomparer.h
+++ b/SQLiteStudio3/coreSQLiteStudio/completioncomparer.h
@@ -2,7 +2,6 @@
#define COMPLETIONCOMPARER_H
#include "expectedtoken.h"
-#include "dialect.h"
#include "selectresolver.h"
class CompletionHelper;
@@ -16,7 +15,6 @@ class CompletionComparer
private:
CompletionHelper* helper = nullptr;
- Dialect dialect;
/**
* @brief contextDatabases
* Context objects are any names mentioned anywhere in the query at the same level as completion takes place.
diff --git a/SQLiteStudio3/coreSQLiteStudio/completionhelper.cpp b/SQLiteStudio3/coreSQLiteStudio/completionhelper.cpp
index f0d00a1..675a6a6 100644
--- a/SQLiteStudio3/coreSQLiteStudio/completionhelper.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/completionhelper.cpp
@@ -9,14 +9,14 @@
#include "dbattacher.h"
#include "common/utils.h"
#include "common/utils_sql.h"
+#include "common/compatibility.h"
#include "services/dbmanager.h"
+#include "db/dbsqlite3.h"
#include <QStringList>
#include <QDebug>
QStringList sqlite3Pragmas;
-QStringList sqlite2Pragmas;
QStringList sqlite3Functions;
-QStringList sqlite2Functions;
bool CompletionHelper::enableLemonDebug = false;
@@ -36,56 +36,15 @@ CompletionHelper::CompletionHelper(const QString &sql, quint32 cursorPos, Db* db
void CompletionHelper::init()
{
- sqlite3Pragmas << "auto_vacuum" << "automatic_index" << "busy_timeout" << "cache_size"
- << "case_sensitive_like" << "checkpoint_fullfsync" << "collation_list"
- << "compile_options" << "count_changes" << "data_store_directory"
- << "database_list" << "default_cache_size" << "empty_result_callbacks"
- << "encoding" << "foreign_key_check" << "foreign_key_list" << "foreign_keys"
- << "freelist_count" << "full_column_names" << "fullfsync"
- << "ignore_check_constraints" << "incremental_vacuum" << "index_info"
- << "index_list" << "integrity_check" << "journal_mode" << "journal_size_limit"
- << "legacy_file_format" << "locking_mode" << "max_page_count" << "page_count"
- << "page_size" << "quick_check" << "read_uncommitted" << "recursive_triggers"
- << "reverse_unordered_selects" << "schema_version" << "secure_delete"
- << "short_column_names" << "shrink_memory" << "synchronous" << "table_info"
- << "temp_store" << "temp_store_directory" << "user_version"
- << "wal_autocheckpoint" << "wal_checkpoint" << "writable_schema";
-
- sqlite2Pragmas << "cache_size" << "count_changes" << "database_list" << "default_cache_size"
- << "default_synchronous" << "default_temp_store" << "empty_result_callbacks"
- << "foreign_key_list" << "full_column_names" << "index_info" << "index_list"
- << "integrity_check" << "parser_trace" << "show_datatypes" << "synchronous"
- << "table_info" << "temp_store";
+ Db* db = new DbSqlite3("CompletionHelper::init()", ":memory:", {{DB_PURE_INIT, true}});
+ if (!db->open())
+ qWarning() << "Could not open memory db for initializing function list:" << db->getErrorText();
- sqlite3Functions << "avg(X)" << "count(X)" << "count(*)" << "group_concat(X)"
- << "group_concat(X,Y)" << "max(X)" << "min(X)" << "sum(X)" << "total(X)"
- << "abs(X)" << "changes()" << "char(X1,X2,...,XN)" << "coalesce(X,Y,...)"
- << "glob(X,Y)" << "ifnull(X,Y)" << "instr(X,Y)" << "hex(X)"
- << "last_insert_rowid()" << "length(X)" << "like(X,Y)" << "like(X,Y,Z)"
- << "load_extension(X,Y)" << "lower(X)" << "ltrim(X)" << "ltrim(X,Y)"
- << "max(X,Y,...)" << "min(X,Y,...)" << "nullif(X,Y)" << "quote(X)"
- << "random()" << "randomblob(N)" << "hex(randomblob(16))"
- << "lower(hex(randomblob(16)))" << "replace(X,Y,Z)" << "round(X)"
- << "round(X,Y)" << "rtrim(X)" << "rtrim(X,Y)" << "soundex(X)"
- << "sqlite_compileoption_get(N)" << "sqlite_compileoption_used(X)"
- << "sqlite_source_id()" << "sqlite_version()" << "substr(X,Y,Z)"
- << "substr(X,Y)" << "total_changes()" << "trim(X)" << "trim(X,Y)"
- << "typeof(X)" << "unicode(X)" << "upper(X)" << "zeroblob(N)"
- << "date(timestr,mod,mod,...)" << "time(timestr,mod,mod,...)"
- << "datetime(timestr,mod,mod,...)" << "julianday(timestr,mod,mod,...)"
- << "strftime(format,timestr,mod,mod,...)" << "likelihood(X,Y)"
- << "likely(X)" << "unlikely(X)";
+ initFunctions(db);
+ initPragmas(db);
+ delete db;
- sqlite2Functions << "abs(X)" << "coalesce(X,Y,...)" << "glob(X,Y)" << "ifnull(X,Y)"
- << "last_insert_rowid()" << "length(X)" << "like(X,Y)" << "lower(X)"
- << "max(X,Y,...)" << "min(X,Y,...)" << "nullif(X,Y)" << "random(*)"
- << "round(X,)" << "round(X,Y)" << "soundex(X)" << "sqlite_version(*)"
- << "substr(X,Y,Z)" << "typeof(X)" << "upper(X)" << "avg(X)" << "count(X)"
- << "count(*)" << "max(X)" << "min(X)" << "sum(X)";
-
- sqlite2Pragmas.sort();
sqlite3Pragmas.sort();
- sqlite2Functions.sort();
sqlite3Functions.sort();
}
@@ -121,12 +80,12 @@ CompletionHelper::Results CompletionHelper::getExpectedTokens()
// If asked for completion when being in the middle of keyword or ID,
// then remove that unfinished keyword/ID from sql and put it into
// the final filter - to be used at the end of this method.
- QString finalFilter = QString::null;
+ QString finalFilter = QString();
bool wrappedFilter = false;
adjustedSql = removeStartedToken(adjustedSql, finalFilter, wrappedFilter);
// Parse SQL up to cursor position, get accepted tokens and tokens that were parsed.
- Parser parser(db->getDialect());
+ Parser parser;
TokenList tokens = parser.getNextTokenCandidates(adjustedSql);
TokenList parsedTokens = parser.getParsedTokens();
@@ -193,43 +152,43 @@ QList<ExpectedTokenPtr> CompletionHelper::getExpectedTokens(TokenPtr token)
case Token::CTX_NEW_KW:
{
if (context == Context::CREATE_TRIGGER)
- results += getExpectedToken(ExpectedToken::TABLE, "new", QString::null, tr("New row reference"), 1);
+ results += getExpectedToken(ExpectedToken::TABLE, "new", QString(), tr("New row reference"), 1);
break;
}
case Token::CTX_OLD_KW:
{
if (context == Context::CREATE_TRIGGER)
- results += getExpectedToken(ExpectedToken::TABLE, "old", QString::null, tr("Old row reference"), 1);
+ results += getExpectedToken(ExpectedToken::TABLE, "old", QString(), tr("Old row reference"), 1);
break;
}
case Token::CTX_TABLE_NEW:
- results += getExpectedToken(ExpectedToken::NO_VALUE, QString::null, QString::null, tr("New table name"));
+ results += getExpectedToken(ExpectedToken::NO_VALUE, QString(), QString(), tr("New table name"));
break;
case Token::CTX_INDEX_NEW:
- results += getExpectedToken(ExpectedToken::NO_VALUE, QString::null, QString::null, tr("New index name"));
+ results += getExpectedToken(ExpectedToken::NO_VALUE, QString(), QString(), tr("New index name"));
break;
case Token::CTX_VIEW_NEW:
- results += getExpectedToken(ExpectedToken::NO_VALUE, QString::null, QString::null, tr("New view name"));
+ results += getExpectedToken(ExpectedToken::NO_VALUE, QString(), QString(), tr("New view name"));
break;
case Token::CTX_TRIGGER_NEW:
- results += getExpectedToken(ExpectedToken::NO_VALUE, QString::null, QString::null, tr("New trigger name"));
+ results += getExpectedToken(ExpectedToken::NO_VALUE, QString(), QString(), tr("New trigger name"));
break;
case Token::CTX_ALIAS:
- results += getExpectedToken(ExpectedToken::NO_VALUE, QString::null, QString::null, tr("Table or column alias"));
+ results += getExpectedToken(ExpectedToken::NO_VALUE, QString(), QString(), tr("Table or column alias"));
break;
case Token::CTX_TRANSACTION:
- results += getExpectedToken(ExpectedToken::NO_VALUE, QString::null, QString::null, tr("transaction name"));
+ results += getExpectedToken(ExpectedToken::NO_VALUE, QString(), QString(), tr("transaction name"));
break;
case Token::CTX_COLUMN_NEW:
- results += getExpectedToken(ExpectedToken::NO_VALUE, QString::null, QString::null, tr("New column name"));
+ results += getExpectedToken(ExpectedToken::NO_VALUE, QString(), QString(), tr("New column name"));
break;
case Token::CTX_COLUMN_TYPE:
- results += getExpectedToken(ExpectedToken::NO_VALUE, QString::null, QString::null, tr("Column data type"));
+ results += getExpectedToken(ExpectedToken::NO_VALUE, QString(), QString(), tr("Column data type"));
break;
case Token::CTX_CONSTRAINT:
- results += getExpectedToken(ExpectedToken::NO_VALUE, QString::null, QString::null, tr("Constraint name"));
+ results += getExpectedToken(ExpectedToken::NO_VALUE, QString(), QString(), tr("Constraint name"));
break;
case Token::CTX_FK_MATCH:
{
@@ -239,10 +198,10 @@ QList<ExpectedTokenPtr> CompletionHelper::getExpectedTokens(TokenPtr token)
break;
}
case Token::CTX_PRAGMA:
- results += getPragmas(db->getDialect());
+ results += getPragmas();
break;
case Token::CTX_ERROR_MESSAGE:
- results += getExpectedToken(ExpectedToken::NO_VALUE, QString::null, QString::null, tr("Error message"));
+ results += getExpectedToken(ExpectedToken::NO_VALUE, QString(), QString(), tr("Error message"));
break;
case Token::CTX_COLUMN:
{
@@ -281,17 +240,7 @@ QList<ExpectedTokenPtr> CompletionHelper::getExpectedTokens(TokenPtr token)
}
case Token::CTX_COLLATION:
{
- if (db->getDialect() == Dialect::Sqlite2)
- {
- // SQLite 2 doesn't really support collation. It has collations
- // in grammar, but doesn't make use of them. There's no list
- // of collations to be suggested.
- results += getExpectedToken(ExpectedToken::NO_VALUE, QString::null, QString::null, tr("Collation name"));
- }
- else
- {
- results += getCollations();
- }
+ results += getCollations();
break;
}
case Token::CTX_JOIN_OPTS:
@@ -301,7 +250,7 @@ QList<ExpectedTokenPtr> CompletionHelper::getExpectedTokens(TokenPtr token)
break;
}
case Token::OTHER:
- results += getExpectedToken(ExpectedToken::OTHER, QString::null, QString::null, tr("Any word"));
+ results += getExpectedToken(ExpectedToken::OTHER, QString(), QString(), tr("Any word"));
break;
case Token::STRING:
results += getExpectedToken(ExpectedToken::STRING);
@@ -428,7 +377,7 @@ bool CompletionHelper::validatePreviousIdForGetObjects(QString* dbName)
if (previousId)
{
localDbName = previousId->value;
- QStringList databases = schemaResolver->getDatabases().toList();
+ QStringList databases = schemaResolver->getDatabases().values();
databases += DBLIST->getDbNames();
if (!databases.contains(localDbName, Qt::CaseInsensitive))
return false; // if db is not on the set, then getObjects() would return empty list anyway;
@@ -494,15 +443,8 @@ QList<ExpectedTokenPtr> CompletionHelper::getDatabases()
results += getExpectedToken(ExpectedToken::DATABASE, dbName);
}
- Dialect dialect = db->getDialect();
-
for (Db* otherDb : DBLIST->getValidDbList())
- {
- if (otherDb->getDialect() != dialect)
- continue;
-
results += getExpectedToken(ExpectedToken::DATABASE, otherDb->getName());
- }
return results;
}
@@ -599,7 +541,7 @@ QList<ExpectedTokenPtr> CompletionHelper::getColumnsNoPrefix()
// Getting all tables for main db. If any column repeats in many tables,
// then tables are stored as a list for the same column.
- for (QString table : schemaResolver->getTables(QString::null))
+ for (QString table : schemaResolver->getTables(QString()))
for (QString column : schemaResolver->getTableColumns(table))
columnList[column] += table;
@@ -745,13 +687,7 @@ QList<ExpectedTokenPtr> CompletionHelper::getFunctions(Db* db)
{
// TODO to do later - make function completion more verbose,
// like what are arguments of the function, etc.
- Dialect dialect = db->getDialect();
-
- QStringList functions;
- if (dialect == Dialect::Sqlite2)
- functions = sqlite2Functions;
- else
- functions = sqlite3Functions;
+ QStringList functions = sqlite3Functions;
for (FunctionManager::ScriptFunction* fn : FUNCTIONS->getScriptFunctionsForDatabase(db->getName()))
functions << fn->toString();
@@ -766,16 +702,10 @@ QList<ExpectedTokenPtr> CompletionHelper::getFunctions(Db* db)
return expectedTokens;
}
-QList<ExpectedTokenPtr> CompletionHelper::getPragmas(Dialect dialect)
+QList<ExpectedTokenPtr> CompletionHelper::getPragmas()
{
- QStringList pragmas;
- if (dialect == Dialect::Sqlite2)
- pragmas = sqlite2Pragmas;
- else
- pragmas = sqlite3Pragmas;
-
QList<ExpectedTokenPtr> expectedTokens;
- for (QString pragma : pragmas)
+ for (QString pragma : sqlite3Pragmas)
expectedTokens += getExpectedToken(ExpectedToken::PRAGMA, pragma);
return expectedTokens;
@@ -847,7 +777,7 @@ void CompletionHelper::attachDatabases()
QString query = parsedQuery->detokenize();
- Parser parser(db->getDialect());
+ Parser parser;
if (parser.parse(query, true) && !parser.getQueries().isEmpty())
parsedQuery = parser.getQueries().first();
}
@@ -886,7 +816,7 @@ QString CompletionHelper::removeStartedToken(const QString& adjustedSql, QString
{
QString result = adjustedSql;
- Lexer lexer(db->getDialect());
+ Lexer lexer;
TokenList tokens = lexer.tokenize(adjustedSql);
if (tokens.size() == 0)
return result;
@@ -898,7 +828,7 @@ QString CompletionHelper::removeStartedToken(const QString& adjustedSql, QString
result = Lexer::detokenize(tokens.mid(0, tokens.size()-1));
finalFilter = lastToken->value;
- if (finalFilter.length() > 0 && isWrapperChar(finalFilter[0], db->getDialect()))
+ if (finalFilter.length() > 0 && isWrapperChar(finalFilter[0]))
{
finalFilter = finalFilter.mid(1);
wrappedFilter = true;
@@ -992,8 +922,7 @@ void CompletionHelper::filterOtherId(QList<ExpectedTokenPtr> &resultsSoFar, cons
void CompletionHelper::filterDuplicates(QList<ExpectedTokenPtr>& resultsSoFar)
{
- QSet<ExpectedTokenPtr> set = resultsSoFar.toSet();
- resultsSoFar = set.toList();
+ resultsSoFar = toSet(resultsSoFar).values();
}
void CompletionHelper::applyFilter(QList<ExpectedTokenPtr>& resultsSoFar, const QString& filter)
@@ -1027,15 +956,13 @@ bool CompletionHelper::isFilterType(Token::Type type)
void CompletionHelper::parseFullSql()
{
- Dialect dialect = db->getDialect();
-
QString sql = fullSql;
// Selecting query at cursor position
QString query = getQueryWithPosition(sql, cursorPosition);
// Token list of the query. Also useful, not only parsed query.
- queryTokens = Lexer::tokenize(query, dialect);
+ queryTokens = Lexer::tokenize(query);
queryTokens.trim();
// Completing query
@@ -1043,7 +970,7 @@ void CompletionHelper::parseFullSql()
query += ";";
// Parsing query
- Parser parser(dialect);
+ Parser parser;
parser.setLemonDebug(enableLemonDebug);
if (tryToParse(&parser, query))
return;
@@ -1072,17 +999,15 @@ bool CompletionHelper::tryToParse(Parser* parser, const QString& query)
void CompletionHelper::sort(QList<ExpectedTokenPtr> &resultsSoFar)
{
CompletionComparer comparer(this);
- qSort(resultsSoFar.begin(), resultsSoFar.end(), comparer);
+ std::sort(resultsSoFar.begin(), resultsSoFar.end(), comparer);
}
void CompletionHelper::extractPreviousIdTokens(const TokenList &parsedTokens)
{
- Dialect dialect = db->getDialect();
-
// The previous ID token (if any) is being used in
// getExpectedToken() and it's always the same token,
// so here we find it just once and reuse it.
- previousId = stripObjName(getPreviousDbOrTable(parsedTokens), dialect);
+ previousId = stripObjName(getPreviousDbOrTable(parsedTokens));
// In case of column context we need to know if there was
// up to two ID tokens before. If we had one above,
@@ -1092,7 +1017,7 @@ void CompletionHelper::extractPreviousIdTokens(const TokenList &parsedTokens)
{
int idx = parsedTokens.indexOf(previousId);
TokenList parsedTokensSubSet = parsedTokens.mid(0, idx);
- twoIdsBack = stripObjName(getPreviousDbOrTable(parsedTokensSubSet), dialect);
+ twoIdsBack = stripObjName(getPreviousDbOrTable(parsedTokensSubSet));
}
}
@@ -1317,6 +1242,97 @@ void CompletionHelper::setCreateTriggerTable(const QString& value)
createTriggerTable = value;
}
+void CompletionHelper::initFunctions(Db* db)
+{
+ sqlite3Functions << "avg(X)" << "count(X)" << "count(*)" << "group_concat(X)"
+ << "group_concat(X,Y)" << "max(X)" << "min(X)" << "sum(X)" << "total(X)"
+ << "abs(X)" << "changes()" << "char(X1,X2,...,XN)" << "coalesce(X,Y,...)"
+ << "glob(X,Y)" << "ifnull(X,Y)" << "instr(X,Y)" << "hex(X)" << "iif(X,Y,Z)"
+ << "last_insert_rowid()" << "length(X)" << "like(X,Y)" << "like(X,Y,Z)"
+ << "load_extension(X,Y)" << "lower(X)" << "ltrim(X)" << "ltrim(X,Y)"
+ << "max(X,Y,...)" << "min(X,Y,...)" << "nullif(X,Y)" << "quote(X)"
+ << "random()" << "randomblob(N)" << "hex(randomblob(16))"
+ << "lower(hex(randomblob(16)))" << "replace(X,Y,Z)" << "round(X)"
+ << "round(X,Y)" << "rtrim(X)" << "rtrim(X,Y)" << "soundex(X)"
+ << "sqlite_compileoption_get(N)" << "sqlite_compileoption_used(X)"
+ << "sqlite_source_id()" << "sqlite_version()" << "substr(X,Y,Z)"
+ << "substr(X,Y)" << "total_changes()" << "trim(X)" << "trim(X,Y)"
+ << "typeof(X)" << "unicode(X)" << "upper(X)" << "zeroblob(N)"
+ << "date(timestr,mod,mod,...)" << "time(timestr,mod,mod,...)"
+ << "datetime(timestr,mod,mod,...)" << "julianday(timestr,mod,mod,...)"
+ << "strftime(format,timestr,mod,mod,...)" << "likelihood(X,Y)"
+ << "likely(X)" << "unlikely(X)" "row_number()" << "rank()"
+ << "dense_rank()" << "percent_rank()" << "cume_dist()" << "ntile(N)"
+ << "lag(expr)" << "lag(expr, offset)" << "lag(expr, offset, default)"
+ << "lead(expr)" << "lead(expr, offset)" << "lead(expr, offset, default)"
+ << "first_value(expr)" << "last_value(expr)" << "nth_value(expr, N)"
+ << "substring(X,Y,Z)" << "substring(X,Y)";
+
+ if (!db->isOpen())
+ return;
+
+ // Parse what we already have
+ QSet<QString> handledSignatures;
+ static_qstring(sigTpl, "%1_%2");
+ for (const QString& fn : sqlite3Functions)
+ {
+ int argStart = fn.lastIndexOf("(");
+ int argEnd = fn.lastIndexOf(")");
+ QString fnName = fn.left(argStart);
+ QString args = fn.mid(argStart + 1, argEnd - argStart - 1);
+ QStringList argList = args.split(",");
+
+ int argCount = argList.size();;
+ if (args.trimmed().isEmpty())
+ argCount = 0;
+ else if (argList.last() == "...")
+ argCount = -1;
+
+ handledSignatures << sigTpl.arg(fnName, QString::number(argCount));
+ }
+
+ // Find what is missing and add it
+ static_qstring(funTpl, "%1(%2)");
+ static const QStringList argSymbols = {"X", "Y", "Z", "A", "B", "C", "D", "E", "F", "G", "H", "I"};
+ static const int argSymbolCnt = argSymbols.size();
+
+ SqlQueryPtr res = db->exec("PRAGMA function_list;");
+ while (res->hasNext())
+ {
+ SqlResultsRowPtr row = res->next();
+ QVariant nargsVar = row->value("narg");
+ QString fnName = row->value("name").toString();
+ QString sig = sigTpl.arg(fnName, nargsVar.toString());
+ if (!handledSignatures.contains(sig))
+ {
+ int nargs = nargsVar.toInt();
+ QStringList args;
+ if (nargs == -1)
+ args << "...";
+
+ for (int i = 0; i < nargs; i++)
+ args << argSymbols[i % argSymbolCnt];
+
+ sqlite3Functions << funTpl.arg(fnName, args.join(","));
+ handledSignatures << sig;
+ }
+ }
+}
+
+void CompletionHelper::initPragmas(Db* db)
+{
+ if (!db->isOpen())
+ return;
+
+ SqlQueryPtr res = db->exec("PRAGMA pragma_list;");
+ while (res->hasNext())
+ {
+ SqlResultsRowPtr row = res->next();
+ QString name = row->value("name").toString();
+ sqlite3Pragmas << name;
+ }
+}
+
DbAttacher* CompletionHelper::getDbAttacher() const
{
return dbAttacher;
diff --git a/SQLiteStudio3/coreSQLiteStudio/completionhelper.h b/SQLiteStudio3/coreSQLiteStudio/completionhelper.h
index 5c656c2..8df1912 100644
--- a/SQLiteStudio3/coreSQLiteStudio/completionhelper.h
+++ b/SQLiteStudio3/coreSQLiteStudio/completionhelper.h
@@ -4,7 +4,6 @@
#include "expectedtoken.h"
#include "schemaresolver.h"
#include "selectresolver.h"
-#include "dialect.h"
#include "completioncomparer.h"
#include "parser/ast/sqliteselect.h"
#include "parser/token.h"
@@ -68,6 +67,9 @@ class API_EXPORT CompletionHelper : public QObject
EXPR
};
+ static void initFunctions(Db* db);
+ static void initPragmas(Db* db);
+
QList<ExpectedTokenPtr> getExpectedTokens(TokenPtr token);
ExpectedTokenPtr getExpectedToken(ExpectedToken::Type type);
ExpectedTokenPtr getExpectedToken(ExpectedToken::Type type, const QString& value);
@@ -103,7 +105,7 @@ class API_EXPORT CompletionHelper : public QObject
QList<ExpectedTokenPtr> getColumns(const QString& prefixDb, const QString& prefixTable);
QList<ExpectedTokenPtr> getFavoredColumns(const QList<ExpectedTokenPtr>& resultsSoFar);
- QList<ExpectedTokenPtr> getPragmas(Dialect dialect);
+ QList<ExpectedTokenPtr> getPragmas();
QList<ExpectedTokenPtr> getFunctions(Db* db);
QList<ExpectedTokenPtr> getCollations();
TokenPtr getPreviousDbOrTable(const TokenList& parsedTokens);
diff --git a/SQLiteStudio3/coreSQLiteStudio/coreSQLiteStudio.pro b/SQLiteStudio3/coreSQLiteStudio/coreSQLiteStudio.pro
index 3eba953..bcd8148 100644
--- a/SQLiteStudio3/coreSQLiteStudio/coreSQLiteStudio.pro
+++ b/SQLiteStudio3/coreSQLiteStudio/coreSQLiteStudio.pro
@@ -17,14 +17,17 @@ QT += script network
TARGET = coreSQLiteStudio
TEMPLATE = lib
-win32 {
+win32: {
LIBS += -lpsapi -limagehlp
-
- THE_FILE = $$PWD/qt.conf
- THE_DEST = $${DESTDIR}
- THE_FILE ~= s,/,\\,g
- THE_DEST ~= s,/,\\,g
- QMAKE_POST_LINK += $$QMAKE_COPY $$THE_FILE $$THE_DEST $$escape_expand(\\n\\t)
+ DEFINES += "SQLITE_API=\"__declspec(dllexport)\""
+
+ !debug: {
+ THE_FILE = $$PWD/qt.conf
+ THE_DEST = $${DESTDIR}
+ THE_FILE ~= s,/,\\,g
+ THE_DEST ~= s,/,\\,g
+ QMAKE_POST_LINK += $$QMAKE_COPY $$THE_FILE $$THE_DEST $$escape_expand(\\n\\t)
+ }
}
linux: {
@@ -37,7 +40,7 @@ linux: {
macx: {
out_file = $$DESTDIR/lib $$TARGET .dylib
QMAKE_POST_LINK += install_name_tool -change libsqlite3.dylib @loader_path/../Frameworks/libsqlite3.dylib $$join(out_file)
- QMAKE_POST_LINK += ; $$QMAKE_MKDIR $$DESTDIR/SQLiteStudio.app
+ QMAKE_POST_LINK += $$QMAKE_MKDIR $$DESTDIR/SQLiteStudio.app
QMAKE_POST_LINK += ; $$QMAKE_MKDIR $$DESTDIR/SQLiteStudio.app/Contents
QMAKE_POST_LINK += ; $$QMAKE_COPY $$PWD/Info.plist $$DESTDIR/SQLiteStudio.app/Contents
LIBS += -L/usr/local/lib
@@ -51,7 +54,7 @@ portable {
DEFINES += PORTABLE_CONFIG
}
-CONFIG += c++11
+CONFIG += c++17
QMAKE_CXXFLAGS += -pedantic
TRANSLATIONS += translations/coreSQLiteStudio_ro_RO.ts \
@@ -66,6 +69,11 @@ TRANSLATIONS += translations/coreSQLiteStudio_ro_RO.ts \
translations/coreSQLiteStudio_pl.ts
SOURCES += sqlitestudio.cpp \
+ common/compatibility.cpp \
+ db/queryexecutorsteps/queryexecutorcolumntype.cpp \
+ parser/ast/sqlitefilterover.cpp \
+ parser/ast/sqlitenulls.cpp \
+ parser/ast/sqlitewindowdefinition.cpp \
returncode.cpp \
services/config.cpp \
common/nulldevice.cpp \
@@ -78,7 +86,6 @@ SOURCES += sqlitestudio.cpp \
parser/sqlite3_parse.cpp \
parser/parsercontext.cpp \
parser/parser.cpp \
- parser/sqlite2_parse.cpp \
parser/ast/sqlitestatement.cpp \
parser/ast/sqlitequery.cpp \
parser/ast/sqlitealtertable.cpp \
@@ -189,7 +196,6 @@ SOURCES += sqlitestudio.cpp \
dbobjectorganizer.cpp \
db/attachguard.cpp \
db/invaliddb.cpp \
- dbversionconverter.cpp \
diff/diff_match_patch.cpp \
db/sqlquery.cpp \
db/queryexecutorsteps/queryexecutorvaluesmode.cpp \
@@ -234,7 +240,13 @@ SOURCES += sqlitestudio.cpp \
parser/ast/sqliteupsert.cpp
HEADERS += sqlitestudio.h\
+ common/compatibility.h \
coreSQLiteStudio_global.h \
+ db/queryexecutorsteps/queryexecutorcolumntype.h \
+ db/sqlite3.h \
+ parser/ast/sqlitefilterover.h \
+ parser/ast/sqlitenulls.h \
+ parser/ast/sqlitewindowdefinition.h \
returncode.h \
services/config.h \
common/nulldevice.h \
@@ -247,7 +259,6 @@ HEADERS += sqlitestudio.h\
parser/sqlite3_parse.h \
parser/parsercontext.h \
parser/parser.h \
- parser/sqlite2_parse.h \
parser/ast/sqlitestatement.h \
parser/ast/sqlitequery.h \
parser/ast/sqlitealtertable.h \
@@ -293,7 +304,6 @@ HEADERS += sqlitestudio.h\
common/objectpool.h \
selectresolver.h \
schemaresolver.h \
- dialect.h \
db/db.h \
services/dbmanager.h \
db/sqlresultsrow.h \
@@ -364,7 +374,6 @@ HEADERS += sqlitestudio.h\
db/abstractdb3.h \
db/dbsqlite3.h \
plugins/dbpluginsqlite3.h \
- db/abstractdb2.h \
parser/ast/sqlitewith.h \
services/collationmanager.h \
services/impl/collationmanagerimpl.h \
@@ -380,7 +389,6 @@ HEADERS += sqlitestudio.h\
db/attachguard.h \
interruptable.h \
db/invaliddb.h \
- dbversionconverter.h \
diff/diff_match_patch.h \
db/sqlquery.h \
dbobjecttype.h \
@@ -444,16 +452,13 @@ OTHER_FILES += \
parser/lempar.c \
parser/lemon.c \
parser/sqlite3_parse.y \
- parser/sqlite2_parse.y \
parser/run_lemon.sh \
- TODO.txt \
licenses/fugue_icons.txt \
licenses/qhexedit.txt \
licenses/sqlitestudio_license.txt \
licenses/lgpl.txt \
licenses/diff_match.txt \
licenses/gpl.txt \
- ChangeLog.txt \
qt.conf
\
Info.plist
@@ -471,18 +476,3 @@ RESOURCES += \
DISTFILES += \
licenses/mit.txt
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/SQLiteStudio3/coreSQLiteStudio/csvserializer.cpp b/SQLiteStudio3/coreSQLiteStudio/csvserializer.cpp
index 4c4ed0e..aceba03 100644
--- a/SQLiteStudio3/coreSQLiteStudio/csvserializer.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/csvserializer.cpp
@@ -162,8 +162,15 @@ void typedDeserializeInternal(QTextStream& data, const CsvFormat& format, QList<
if (field.size() > 0 || sepAsLast)
*cells << field;
- if (rows && cells->size() > 0)
- *rows << *cells;
+ if (rows)
+ {
+ if (cells->size() > 0)
+ *rows << *cells;
+ }
+ else if (!ahead.isEmpty())
+ {
+ data.seek(data.pos() - 1);
+ }
}
template <class T, class C>
diff --git a/SQLiteStudio3/coreSQLiteStudio/datatype.cpp b/SQLiteStudio3/coreSQLiteStudio/datatype.cpp
index 38d47d5..4fbd7ef 100644
--- a/SQLiteStudio3/coreSQLiteStudio/datatype.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/datatype.cpp
@@ -164,7 +164,7 @@ QString DataType::toString(DataType::Enum e)
QMetaEnum metaEnum = staticMetaObject.enumerator(0);
const char* key = metaEnum.valueToKey(e);
if (!key)
- return QString::null;
+ return QString();
return key;
}
diff --git a/SQLiteStudio3/coreSQLiteStudio/db/abstractdb.cpp b/SQLiteStudio3/coreSQLiteStudio/db/abstractdb.cpp
index 70037b0..9bfb46f 100644
--- a/SQLiteStudio3/coreSQLiteStudio/db/abstractdb.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/db/abstractdb.cpp
@@ -11,6 +11,7 @@
#include "services/sqliteextensionmanager.h"
#include "log.h"
#include "parser/lexer.h"
+#include "common/compatibility.h"
#include <QDebug>
#include <QTime>
#include <QWriteLocker>
@@ -211,7 +212,7 @@ QString AbstractDb::generateUniqueDbNameNoLock()
ReadWriteLocker::Mode AbstractDb::getLockingMode(const QString &query, Flags flags)
{
- return ReadWriteLocker::getMode(query, getDialect(), flags.testFlag(Flag::NO_LOCK));
+ return ReadWriteLocker::getMode(query, flags.testFlag(Flag::NO_LOCK));
}
QString AbstractDb::getName() const
@@ -229,21 +230,13 @@ quint8 AbstractDb::getVersion() const
return version;
}
-Dialect AbstractDb::getDialect() const
-{
- if (version == 2)
- return Dialect::Sqlite2;
- else
- return Dialect::Sqlite3;
-}
-
QString AbstractDb::getEncoding()
{
bool doClose = false;
if (!isOpen())
{
if (!openQuiet())
- return QString::null;
+ return QString();
doClose = true;
}
@@ -402,7 +395,7 @@ void AbstractDb::initAfterOpen()
void AbstractDb::checkForDroppedObject(const QString& query)
{
- TokenList tokens = Lexer::tokenize(query, getDialect());
+ TokenList tokens = Lexer::tokenize(query);
tokens.trim(Token::OPERATOR, ";");
if (tokens.size() == 0)
return;
@@ -441,7 +434,7 @@ void AbstractDb::checkForDroppedObject(const QString& query)
else
object = tokens.first()->value;
- object = stripObjName(object, getDialect());
+ object = stripObjName(object);
if (type == "TABLE")
emit dbObjectDeleted(database, object, DbObjectType::TABLE);
@@ -627,7 +620,7 @@ QString AbstractDb::attach(Db* otherDb, bool silent)
{
QWriteLocker locker(&dbOperLock);
if (!isOpenInternal())
- return QString::null;
+ return QString();
if (attachedDbMap.containsRight(otherDb))
{
@@ -644,7 +637,7 @@ QString AbstractDb::attach(Db* otherDb, bool silent)
else
qDebug() << QString("Error attaching database %1: %2").arg(otherDb->getName()).arg(results->getErrorText());
- return QString::null;
+ return QString();
}
attachedDbMap.insert(attName, otherDb);
@@ -711,14 +704,14 @@ const QHash<Db *, QString> &AbstractDb::getAttachedDatabases()
QSet<QString> AbstractDb::getAllAttaches()
{
QReadLocker locker(&dbOperLock);
- QSet<QString> attaches = attachedDbMap.leftValues().toSet();
+ QSet<QString> attaches = toSet(attachedDbMap.leftValues());
// TODO query database for attached databases and unite them here
return attaches;
}
QString AbstractDb::getUniqueNewObjectName(const QString &attachedDbName)
{
- QString dbName = getPrefixDb(attachedDbName, getDialect());
+ QString dbName = getPrefixDb(attachedDbName);
QSet<QString> existingNames;
SqlQueryPtr results = exec(QString("SELECT name FROM %1.sqlite_master").arg(dbName));
diff --git a/SQLiteStudio3/coreSQLiteStudio/db/abstractdb.h b/SQLiteStudio3/coreSQLiteStudio/db/abstractdb.h
index c69c9f2..a465679 100644
--- a/SQLiteStudio3/coreSQLiteStudio/db/abstractdb.h
+++ b/SQLiteStudio3/coreSQLiteStudio/db/abstractdb.h
@@ -3,7 +3,6 @@
#include "returncode.h"
#include "sqlquery.h"
-#include "dialect.h"
#include "db/db.h"
#include "common/bihash.h"
#include "services/functionmanager.h"
@@ -48,7 +47,6 @@ class API_EXPORT AbstractDb : public Db
QString getName() const;
QString getPath() const;
quint8 getVersion() const;
- Dialect getDialect() const;
QString getEncoding();
QHash<QString,QVariant>& getConnectionOptions();
void setName(const QString& value);
diff --git a/SQLiteStudio3/coreSQLiteStudio/db/abstractdb2.h b/SQLiteStudio3/coreSQLiteStudio/db/abstractdb2.h
deleted file mode 100644
index 51465f9..0000000
--- a/SQLiteStudio3/coreSQLiteStudio/db/abstractdb2.h
+++ /dev/null
@@ -1,925 +0,0 @@
-#ifndef ABSTRACTDB2_H
-#define ABSTRACTDB2_H
-
-#include "db/abstractdb.h"
-#include "parser/lexer.h"
-#include "common/utils_sql.h"
-#include "common/unused.h"
-#include "db/sqlerrorcodes.h"
-#include "db/sqlerrorresults.h"
-#include "log.h"
-#include <sqlite.h>
-#include <QThread>
-#include <QPointer>
-#include <QDebug>
-#include <QMutexLocker>
-#include <QMutex>
-
-/**
- * @brief Complete implementation of SQLite 2 driver for SQLiteStudio.
- *
- * Inherit this when implementing Db for SQLite 2. In most cases you will only need
- * to create one public constructor, which forwards parameters to the AbstractDb constructor.
- * This be sufficient to implement SQLite 2 database plugin.
- * Just link it with proper SQLite library.
- *
- * The template parameter is currently not used for anything specific, so pass any unique type name.
- * The best would be to define empty class/structure just for this purpose.
- * The parameter is there, so this class becomes a template class.
- * We need a template class so we can provide common code base for all SQLite 2 plugins, while the
- * code doesn't introduce dependency to SQLite 2 library, until it's used, which is in SQLite 2 plugins.
- *
- * @see DbQt
- */
-template <class T>
-class AbstractDb2 : public AbstractDb
-{
- public:
- /**
- * @brief Creates SQLite database object.
- * @param name Name for the database.
- * @param path File path of the database.
- * @param connOptions Connection options. See AbstractDb for details.
- *
- * All values from this constructor are just passed to AbstractDb constructor.
- */
- AbstractDb2(const QString& name, const QString& path, const QHash<QString, QVariant>& connOptions);
- ~AbstractDb2();
-
- bool loadExtension(const QString& filePath, const QString& initFunc = QString());
- bool isComplete(const QString& sql) const;
-
- protected:
- bool isOpenInternal();
- void interruptExecution();
- QString getErrorTextInternal();
- int getErrorCodeInternal();
- bool openInternal();
- bool closeInternal();
- bool initAfterCreated();
- void initAfterOpen();
- SqlQueryPtr prepare(const QString& query);
- QString getTypeLabel();
- bool deregisterFunction(const QString& name, int argCount);
- bool registerScalarFunction(const QString& name, int argCount);
- bool registerAggregateFunction(const QString& name, int argCount);
- bool registerCollationInternal(const QString& name);
- bool deregisterCollationInternal(const QString& name);
-
- private:
- class Query : public SqlQuery, public Sqlite2ColumnDataTypeHelper
- {
- public:
- class Row : public SqlResultsRow
- {
- public:
- void init(const QStringList& columns, const QList<QVariant>& resultValues);
- };
-
- Query(AbstractDb2<T>* db, const QString& query);
- ~Query();
-
- QString getErrorText();
- int getErrorCode();
- QStringList getColumnNames();
- int columnCount();
- qint64 rowsAffected();
- QString finalize();
-
- protected:
- SqlResultsRowPtr nextInternal();
- bool hasNextInternal();
- bool execInternal(const QList<QVariant>& args);
- bool execInternal(const QHash<QString, QVariant>& args);
-
- private:
- int prepareStmt(const QString& processedQuery);
- int resetStmt();
- int bindParam(int paramIdx, const QVariant& value);
- int fetchNext();
- int fetchFirst();
- void init(int columnsCount, const char** columns);
- bool checkDbState();
- void copyErrorFromDb();
- void copyErrorToDb();
- void setError(int code, const QString& msg);
-
- static QString replaceNamedParams(const QString& query);
-
- QPointer<AbstractDb2<T>> db;
- sqlite_vm* stmt = nullptr;
- int errorCode = SQLITE_OK;
- QString errorMessage;
- int colCount = -1;
- QStringList colNames;
- QList<QVariant> nextRowValues;
- bool rowAvailable = false;
- };
-
- void cleanUp();
- void resetError();
- QString freeStatement(sqlite_vm* stmt);
-
- static void storeResult(sqlite_func* func, const QVariant& result, bool ok);
- static QList<QVariant> getArgs(int argCount, const char** args);
- static void evaluateScalar(sqlite_func* func, int argCount, const char** args);
- static void evaluateAggregateStep(sqlite_func* func, int argCount, const char** args);
- static void evaluateAggregateFinal(sqlite_func* func);
- static void* getContextMemPtr(sqlite_func* func);
- static QHash<QString,QVariant> getAggregateContext(sqlite_func* func);
- static void setAggregateContext(sqlite_func* func, const QHash<QString,QVariant>& aggregateContext);
- static void releaseAggregateContext(sqlite_func* func);
-
- sqlite* dbHandle = nullptr;
- QString dbErrorMessage;
- int dbErrorCode = SQLITE_OK;
- QList<FunctionUserData*> userDataList;
- QList<Query*> queries;
- QMutex* dbOperMutex = nullptr;
-};
-
-//------------------------------------------------------------------------------------
-// AbstractDb2
-//------------------------------------------------------------------------------------
-
-template <class T>
-AbstractDb2<T>::AbstractDb2(const QString& name, const QString& path, const QHash<QString, QVariant>& connOptions) :
- AbstractDb(name, path, connOptions)
-{
- dbOperMutex = new QMutex(QMutex::Recursive);
-}
-
-template <class T>
-AbstractDb2<T>::~AbstractDb2()
-{
- safe_delete(dbOperMutex);
- if (isOpenInternal())
- closeInternal();
-}
-
-template <class T>
-bool AbstractDb2<T>::loadExtension(const QString& filePath, const QString& initFunc)
-{
- UNUSED(filePath);
- UNUSED(initFunc);
- return false;
-}
-
-template<class T>
-bool AbstractDb2<T>::isComplete(const QString& sql) const
-{
- return sqlite_complete(sql.toUtf8().constData());
-}
-
-template <class T>
-bool AbstractDb2<T>::isOpenInternal()
-{
- return dbHandle != nullptr;
-}
-
-template <class T>
-SqlQueryPtr AbstractDb2<T>::prepare(const QString& query)
-{
- return SqlQueryPtr(new Query(this, query));
-}
-
-template <class T>
-void AbstractDb2<T>::interruptExecution()
-{
- if (!isOpenInternal())
- return;
-
- QMutexLocker mutexLocker(dbOperMutex);
- sqlite_interrupt(dbHandle);
-}
-
-template <class T>
-QString AbstractDb2<T>::getErrorTextInternal()
-{
- return dbErrorMessage;
-}
-
-template <class T>
-int AbstractDb2<T>::getErrorCodeInternal()
-{
- return dbErrorCode;
-}
-
-template <class T>
-bool AbstractDb2<T>::openInternal()
-{
- resetError();
- sqlite* handle = nullptr;
- char* errMsg = nullptr;
- QMutexLocker mutexLocker(dbOperMutex);
- handle = sqlite_open(path.toUtf8().constData(), 0, &errMsg);
- if (!handle)
- {
- dbErrorCode = SQLITE_ERROR;
-
- if (errMsg)
- {
- dbErrorMessage = QObject::tr("Could not open database: %1").arg(QString::fromUtf8(errMsg));
- sqlite_freemem(errMsg);
- }
- return false;
- }
- dbHandle = handle;
- return true;
-}
-
-template <class T>
-bool AbstractDb2<T>::closeInternal()
-{
- resetError();
- if (!dbHandle)
- return false;
-
- cleanUp();
-
- QMutexLocker mutexLocker(dbOperMutex);
- sqlite_close(dbHandle);
- dbHandle = nullptr;
- return true;
-}
-
-template <class T>
-bool AbstractDb2<T>::initAfterCreated()
-{
- version = 2;
- return AbstractDb::initAfterCreated();
-}
-
-template <class T>
-void AbstractDb2<T>::initAfterOpen()
-{
-}
-
-template <class T>
-QString AbstractDb2<T>::getTypeLabel()
-{
- return T::label;
-}
-
-template <class T>
-bool AbstractDb2<T>::deregisterFunction(const QString& name, int argCount)
-{
- if (!dbHandle)
- return false;
-
- QMutexLocker mutexLocker(dbOperMutex);
- sqlite_create_function(dbHandle, name.toLatin1().data(), argCount, nullptr, nullptr);
- sqlite_create_aggregate(dbHandle, name.toLatin1().data(), argCount, nullptr, nullptr, nullptr);
-
- FunctionUserData* userData = nullptr;
- QMutableListIterator<FunctionUserData*> it(userDataList);
- while (it.hasNext())
- {
- userData = it.next();
- if (userData->name == name && userData->argCount == argCount)
- {
- it.remove();
- delete userData;
- }
- }
-
- return true;
-}
-
-template <class T>
-bool AbstractDb2<T>::registerScalarFunction(const QString& name, int argCount)
-{
- if (!dbHandle)
- return false;
-
- FunctionUserData* userData = new FunctionUserData;
- userData->db = this;
- userData->name = name;
- userData->argCount = argCount;
- userDataList << userData;
-
- QMutexLocker mutexLocker(dbOperMutex);
- int res = sqlite_create_function(dbHandle, name.toUtf8().constData(), argCount,
- &AbstractDb2<T>::evaluateScalar, userData);
-
- return res == SQLITE_OK;
-}
-
-template <class T>
-bool AbstractDb2<T>::registerAggregateFunction(const QString& name, int argCount)
-{
- if (!dbHandle)
- return false;
-
- FunctionUserData* userData = new FunctionUserData;
- userData->db = this;
- userData->name = name;
- userData->argCount = argCount;
- userDataList << userData;
-
- QMutexLocker mutexLocker(dbOperMutex);
- int res = sqlite_create_aggregate(dbHandle, name.toUtf8().constData(), argCount,
- &AbstractDb2<T>::evaluateAggregateStep,
- &AbstractDb2<T>::evaluateAggregateFinal,
- userData);
-
- return res == SQLITE_OK;
-}
-
-template <class T>
-bool AbstractDb2<T>::registerCollationInternal(const QString& name)
-{
- // Not supported in SQLite 2
- UNUSED(name);
- return false;
-}
-
-template <class T>
-bool AbstractDb2<T>::deregisterCollationInternal(const QString& name)
-{
- // Not supported in SQLite 2
- UNUSED(name);
- return false;
-}
-
-template <class T>
-void AbstractDb2<T>::cleanUp()
-{
- for (Query* q : queries)
- q->finalize();
-}
-
-template <class T>
-void AbstractDb2<T>::resetError()
-{
- dbErrorCode = 0;
- dbErrorMessage = QString::null;
-}
-
-template <class T>
-void AbstractDb2<T>::storeResult(sqlite_func* func, const QVariant& result, bool ok)
-{
- if (!ok)
- {
- QByteArray ba = result.toString().toUtf8();
- sqlite_set_result_error(func, ba.constData(), ba.size());
- return;
- }
-
- // Code below is a modified code from Qt (its SQLite plugin).
- if (result.isNull())
- {
- sqlite_set_result_string(func, nullptr, -1);
- return;
- }
-
- switch (result.type())
- {
- case QVariant::ByteArray:
- {
- QByteArray ba = result.toByteArray();
- sqlite_set_result_string(func, ba.constData(), ba.size());
- break;
- }
- case QVariant::Int:
- case QVariant::Bool:
- case QVariant::UInt:
- case QVariant::LongLong:
- {
- sqlite_set_result_int(func, result.toLongLong());
- break;
- }
- case QVariant::Double:
- {
- sqlite_set_result_double(func, result.toDouble());
- break;
- }
- case QVariant::List:
- {
- QList<QVariant> list = result.toList();
- QStringList strList;
- for (const QVariant& v : list)
- strList << v.toString();
-
- QByteArray ba = strList.join(" ").toUtf8();
- sqlite_set_result_string(func, ba.constData(), ba.size());
- break;
- }
- case QVariant::StringList:
- {
- QByteArray ba = result.toStringList().join(" ").toUtf8();
- sqlite_set_result_string(func, ba.constData(), ba.size());
- break;
- }
- default:
- {
- // SQLITE_TRANSIENT makes sure that sqlite buffers the data
- QByteArray ba = result.toString().toUtf8();
- sqlite_set_result_string(func, ba.constData(), ba.size());
- break;
- }
- }
-}
-
-template <class T>
-QList<QVariant> AbstractDb2<T>::getArgs(int argCount, const char** args)
-{
- QList<QVariant> results;
-
- for (int i = 0; i < argCount; i++)
- {
- if (!args[i])
- {
- results << QVariant();
- continue;
- }
-
- results << QString::fromUtf8(args[i]);
- }
- return results;
-}
-
-template <class T>
-void AbstractDb2<T>::evaluateScalar(sqlite_func* func, int argCount, const char** args)
-{
- QList<QVariant> argList = getArgs(argCount, args);
- bool ok = true;
- QVariant result = AbstractDb::evaluateScalar(sqlite_user_data(func), argList, ok);
- storeResult(func, result, ok);
-}
-
-template <class T>
-void AbstractDb2<T>::evaluateAggregateStep(sqlite_func* func, int argCount, const char** args)
-{
- void* dataPtr = sqlite_user_data(func);
- QList<QVariant> argList = getArgs(argCount, args);
- QHash<QString,QVariant> aggregateContext = getAggregateContext(func);
-
- AbstractDb::evaluateAggregateStep(dataPtr, aggregateContext, argList);
-
- setAggregateContext(func, aggregateContext);
-}
-
-template <class T>
-void AbstractDb2<T>::evaluateAggregateFinal(sqlite_func* func)
-{
- void* dataPtr = sqlite_user_data(func);
- QHash<QString,QVariant> aggregateContext = getAggregateContext(func);
-
- bool ok = true;
- QVariant result = AbstractDb::evaluateAggregateFinal(dataPtr, aggregateContext, ok);
-
- storeResult(func, result, ok);
- releaseAggregateContext(func);
-}
-
-template <class T>
-void*AbstractDb2<T>::getContextMemPtr(sqlite_func* func)
-{
- return sqlite_aggregate_context(func, sizeof(QHash<QString,QVariant>**));
-}
-
-template <class T>
-QHash<QString, QVariant> AbstractDb2<T>::getAggregateContext(sqlite_func* func)
-{
- return AbstractDb::getAggregateContext(getContextMemPtr(func));
-}
-
-template <class T>
-void AbstractDb2<T>::setAggregateContext(sqlite_func* func, const QHash<QString, QVariant>& aggregateContext)
-{
- AbstractDb::setAggregateContext(getContextMemPtr(func), aggregateContext);
-}
-
-template <class T>
-void AbstractDb2<T>::releaseAggregateContext(sqlite_func* func)
-{
- AbstractDb::releaseAggregateContext(getContextMemPtr(func));
-}
-
-//------------------------------------------------------------------------------------
-// Query
-//------------------------------------------------------------------------------------
-
-template <class T>
-AbstractDb2<T>::Query::Query(AbstractDb2<T>* db, const QString& query) :
- db(db)
-{
- this->query = query;
- db->queries << this;
-}
-
-template <class T>
-AbstractDb2<T>::Query::~Query()
-{
- if (db.isNull())
- return;
-
- finalize();
- db->queries.removeOne(this);
-}
-
-template <class T>
-void AbstractDb2<T>::Query::copyErrorFromDb()
-{
- if (db->dbErrorCode != 0)
- {
- errorCode = db->dbErrorCode;
- errorMessage = db->dbErrorMessage;
- return;
- }
-}
-
-template <class T>
-void AbstractDb2<T>::Query::copyErrorToDb()
-{
- db->dbErrorCode = errorCode;
- db->dbErrorMessage = errorMessage;
-}
-
-template <class T>
-void AbstractDb2<T>::Query::setError(int code, const QString& msg)
-{
- if (errorCode != SQLITE_OK)
- return; // don't overwrite first error
-
- errorCode = code;
- errorMessage = msg;
- copyErrorToDb();
-}
-
-template <class T>
-int AbstractDb2<T>::Query::prepareStmt(const QString& processedQuery)
-{
- char* errMsg = nullptr;
- const char* tail;
- QByteArray queryBytes = processedQuery.toUtf8();
- QMutexLocker mutexLocker(db->dbOperMutex);
- int res = sqlite_compile(db->dbHandle, queryBytes.constData(), &tail, &stmt, &errMsg);
- if (res != SQLITE_OK)
- {
- finalize();
- if (errMsg)
- {
- setError(res, QString::fromUtf8((errMsg)));
- sqlite_freemem(errMsg);
- }
- return res;
- }
-
- if (tail && !QString::fromUtf8(tail).trimmed().isEmpty())
- qWarning() << "Executed query left with tailing contents:" << tail << ", while executing query:" << query;
-
- return SQLITE_OK;
-}
-
-template <class T>
-int AbstractDb2<T>::Query::resetStmt()
-{
- errorCode = 0;
- errorMessage = QString::null;
- affected = 0;
- colCount = -1;
- rowAvailable = false;
- nextRowValues.clear();
-
- char* errMsg = nullptr;
- QMutexLocker mutexLocker(db->dbOperMutex);
- int res = sqlite_reset(stmt, &errMsg);
- if (res != SQLITE_OK)
- {
- stmt = nullptr;
- if (errMsg)
- {
- setError(res, QString::fromUtf8((errMsg)));
- sqlite_freemem(errMsg);
- }
- return res;
- }
- return SQLITE_OK;
-}
-
-template <class T>
-bool AbstractDb2<T>::Query::execInternal(const QList<QVariant>& args)
-{
- if (!checkDbState())
- return false;
-
- QMutexLocker mutexLocker(db->dbOperMutex);
-
- logSql(db.data(), query, args, flags);
-
- int res;
- if (stmt)
- res = resetStmt();
- else
- res = prepareStmt(query);
-
- if (res != SQLITE_OK)
- return false;
-
- int maxParamIdx = args.size();
- if (!flags.testFlag(Db::Flag::SKIP_PARAM_COUNTING))
- {
- QueryWithParamCount queryWithParams = getQueryWithParamCount(query, Dialect::Sqlite2);
- maxParamIdx = qMin(maxParamIdx, queryWithParams.second);
- }
-
- for (int paramIdx = 1; paramIdx <= maxParamIdx; paramIdx++)
- {
- res = bindParam(paramIdx, args[paramIdx-1]);
- if (res != SQLITE_OK)
- return false;
- }
-
- bool ok = (fetchFirst() == SQLITE_OK);
- if (ok && !flags.testFlag(Db::Flag::SKIP_DROP_DETECTION))
- db->checkForDroppedObject(query);
-
- return ok;
-}
-
-template <class T>
-bool AbstractDb2<T>::Query::execInternal(const QHash<QString, QVariant>& args)
-{
- if (!checkDbState())
- return false;
-
- QMutexLocker mutexLocker(db->dbOperMutex);
-
- logSql(db.data(), query, args, flags);
-
- QueryWithParamNames queryWithParams = getQueryWithParamNames(query, Dialect::Sqlite2);
- QString singleStr = replaceNamedParams(queryWithParams.first);
-
- int res;
- if (stmt)
- res = resetStmt();
- else
- res = prepareStmt(singleStr);
-
- if (res != SQLITE_OK)
- return false;
-
- int paramIdx = 1;
- for (const QString& paramName : queryWithParams.second)
- {
- if (!args.contains(paramName))
- {
- setError(SqlErrorCode::OTHER_EXECUTION_ERROR, "Error while preparing statement: could not bind parameter " + paramName);
- return false;
- }
-
- res = bindParam(paramIdx++, args[paramName]);
- if (res != SQLITE_OK)
- return false;
- }
-
- bool ok = (fetchFirst() == SQLITE_OK);
- if (ok && !flags.testFlag(Db::Flag::SKIP_DROP_DETECTION))
- db->checkForDroppedObject(query);
-
- return ok;
-}
-
-template <class T>
-QString AbstractDb2<T>::Query::replaceNamedParams(const QString& query)
-{
- TokenList tokens = Lexer::tokenize(query, Dialect::Sqlite2);
- for (TokenPtr token : tokens)
- {
- if (token->type == Token::BIND_PARAM)
- token->value = "?";
- }
- return tokens.detokenize();
-}
-
-template <class T>
-int AbstractDb2<T>::Query::bindParam(int paramIdx, const QVariant& value)
-{
- if (value.isNull())
- return sqlite_bind(stmt, paramIdx, nullptr, 0, 0);
-
- switch (value.type())
- {
- case QVariant::ByteArray:
- {
- // NOTE: SQLite 2 has a bug that makes it impossible to write BLOB with nulls inside. First occurrance of the null
- // makes the whole value to be saved as truncated to that position. Nothing I can do about it.
- QByteArray ba = value.toByteArray();
- return sqlite_bind(stmt, paramIdx, ba.constData(), ba.size(), true);
- }
- default:
- {
- QByteArray ba = value.toString().toUtf8();
- ba.append('\0');
- return sqlite_bind(stmt, paramIdx, ba.constData(), ba.size(), true);
- }
- }
-
- qWarning() << "sqlite_bind() MISUSE";
- return SQLITE_MISUSE; // not going to happen
-}
-template <class T>
-QString AbstractDb2<T>::Query::getErrorText()
-{
- return errorMessage;
-}
-
-template <class T>
-int AbstractDb2<T>::Query::getErrorCode()
-{
- return errorCode;
-}
-
-template <class T>
-QStringList AbstractDb2<T>::Query::getColumnNames()
-{
- return colNames;
-}
-
-template <class T>
-int AbstractDb2<T>::Query::columnCount()
-{
- return colCount;
-}
-
-template <class T>
-qint64 AbstractDb2<T>::Query::rowsAffected()
-{
- return affected;
-}
-
-template <class T>
-SqlResultsRowPtr AbstractDb2<T>::Query::nextInternal()
-{
- if (!rowAvailable || db.isNull())
- return SqlResultsRowPtr();
-
- ReadWriteLocker locker(&(db->dbOperLock), query, Dialect::Sqlite2, flags.testFlag(Db::Flag::NO_LOCK));
-
- Row* row = new Row;
- row->init(colNames, nextRowValues);
-
- int res = fetchNext();
- if (res != SQLITE_OK)
- {
- delete row;
- return SqlResultsRowPtr();
- }
- return SqlResultsRowPtr(row);
-}
-
-template <class T>
-bool AbstractDb2<T>::Query::hasNextInternal()
-{
- return rowAvailable && stmt;
-}
-
-template <class T>
-int AbstractDb2<T>::Query::fetchFirst()
-{
- QMutexLocker mutexLocker(db->dbOperMutex);
- rowAvailable = true;
- int res = fetchNext();
- affected = 0;
- if (res == SQLITE_OK)
- {
- affected = sqlite_changes(db->dbHandle);
- insertRowId["ROWID"] = sqlite_last_insert_rowid(db->dbHandle);
- }
- return res;
-}
-
-template <class T>
-bool AbstractDb2<T>::Query::checkDbState()
-{
- if (db.isNull() || !db->dbHandle)
- {
- setError(SqlErrorCode::DB_NOT_DEFINED, "SqlQuery is no longer valid.");
- return false;
- }
-
- return true;
-}
-
-template <class T>
-QString AbstractDb2<T>::Query::finalize()
-{
- QString msg;
- if (stmt)
- {
- char* errMsg = nullptr;
- QMutexLocker mutexLocker(db->dbOperMutex);
- sqlite_finalize(stmt, &errMsg);
- stmt = nullptr;
- if (errMsg)
- {
- msg = QString::fromUtf8(errMsg);
- sqlite_freemem(errMsg);
- }
- }
- return msg;
-}
-
-template <class T>
-int AbstractDb2<T>::Query::fetchNext()
-{
- if (!checkDbState())
- rowAvailable = false;
-
- if (!rowAvailable || !stmt)
- {
- setError(SQLITE_MISUSE, QObject::tr("Result set expired or no row available."));
- return SQLITE_MISUSE;
- }
-
- rowAvailable = false;
-
- const char** values;
- const char** columns;
- int columnsCount;
-
- int res;
- int secondsSpent = 0;
- QMutexLocker mutexLocker(db->dbOperMutex);
- while ((res = sqlite_step(stmt, &columnsCount, &values, &columns)) == SQLITE_BUSY && secondsSpent < db->getTimeout())
- {
- QThread::sleep(1);
- if (db->getTimeout() >= 0)
- secondsSpent++;
- }
-
- switch (res)
- {
- case SQLITE_ROW:
- rowAvailable = true;
- break;
- case SQLITE_DONE:
- // Empty pointer as no more results are available.
- break;
- default:
- setError(res, finalize());
- return SQLITE_ERROR;
- }
-
- // First row, initialize members
- if (colCount == -1)
- init(columnsCount, columns);
-
- // Then read the next row data
- nextRowValues.clear();
- if (rowAvailable)
- {
- for (int i = 0; i < colCount; i++)
- {
- if (isBinaryColumn(i))
- nextRowValues << QByteArray(values[i]);
- else
- nextRowValues << QString::fromUtf8(values[i]);
- }
- }
-
- return SQLITE_OK;
-}
-
-template <class T>
-void AbstractDb2<T>::Query::init(int columnsCount, const char** columns)
-{
- colCount = columnsCount;
-
- TokenList columnDescription;
- for (int i = 0; i < colCount; i++)
- {
- columnDescription = Lexer::tokenize(QString::fromUtf8(columns[i]), Dialect::Sqlite2).filterWhiteSpaces();
- if (columnDescription.size() > 0)
- {
- // If the column is prefixed with dbname and table name, then we remove them.
- for (int j = 0; j < 2 &&columnDescription.size() > 1 && columnDescription[1]->type == Token::OPERATOR && columnDescription[1]->value == "."; j++)
- {
- columnDescription.removeFirst();
- columnDescription.removeFirst();
- }
-
- colNames << stripObjName(columnDescription.first()->value, Dialect::Sqlite2);
- }
- else
- colNames << "";
- }
-}
-
-//------------------------------------------------------------------------------------
-// Row
-//------------------------------------------------------------------------------------
-
-template <class T>
-void AbstractDb2<T>::Query::Row::init(const QStringList& columns, const QList<QVariant>& resultValues)
-{
- for (int i = 0; i < columns.size(); i++)
- {
- values << resultValues[i];
- valuesMap[columns[i]] = resultValues[i];
- }
-}
-
-#endif // ABSTRACTDB2_H
diff --git a/SQLiteStudio3/coreSQLiteStudio/db/abstractdb3.h b/SQLiteStudio3/coreSQLiteStudio/db/abstractdb3.h
index f45e475..72c1614 100644
--- a/SQLiteStudio3/coreSQLiteStudio/db/abstractdb3.h
+++ b/SQLiteStudio3/coreSQLiteStudio/db/abstractdb3.h
@@ -46,6 +46,7 @@ class AbstractDb3 : public AbstractDb
bool loadExtension(const QString& filePath, const QString& initFunc = QString());
bool isComplete(const QString& sql) const;
+ QList<AliasedColumn> columnsForQuery(const QString& query);
protected:
bool isOpenInternal();
@@ -343,6 +344,41 @@ bool AbstractDb3<T>::isComplete(const QString& sql) const
return T::complete(sql.toUtf8().constData());
}
+template<class T>
+QList<AliasedColumn> AbstractDb3<T>::columnsForQuery(const QString& query)
+{
+ QList<AliasedColumn> result;
+ const char* tail;
+ QByteArray queryBytes = query.toUtf8();
+ typename T::stmt* stmt = nullptr;
+ int res = T::prepare_v2(dbHandle, queryBytes.constData(), queryBytes.size(), &stmt, &tail);
+ if (res != T::OK)
+ {
+ stmt = nullptr;
+ extractLastError();
+ T::finalize(stmt);
+ return result;
+ }
+
+ if (tail && !QString::fromUtf8(tail).trimmed().isEmpty())
+ qWarning() << "Executed query left with tailing contents:" << tail << ", while finding columns for query:" << query;
+
+
+ int colCount = T::column_count(stmt);
+ for (int i = 0; i < colCount; i++)
+ {
+ AliasedColumn col;
+ col.setDatabase(QString::fromUtf8(T::column_database_name(stmt, i)));
+ col.setTable(QString::fromUtf8(T::column_table_name(stmt, i)));
+ col.setColumn(QString::fromUtf8(T::column_origin_name(stmt, i)));
+ col.setAlias(QString::fromUtf8(T::column_name(stmt, i)));
+ result << col;
+ }
+
+ T::finalize(stmt);
+ return result;
+}
+
template <class T>
bool AbstractDb3<T>::isOpenInternal()
{
@@ -534,7 +570,7 @@ template <class T>
void AbstractDb3<T>::resetError()
{
dbErrorCode = 0;
- dbErrorMessage = QString::null;
+ dbErrorMessage = QString();
}
template <class T>
@@ -868,7 +904,7 @@ template <class T>
int AbstractDb3<T>::Query::resetStmt()
{
errorCode = 0;
- errorMessage = QString::null;
+ errorMessage = QString();
affected = 0;
colCount = -1;
rowAvailable = false;
@@ -889,7 +925,7 @@ bool AbstractDb3<T>::Query::execInternal(const QList<QVariant>& args)
if (!checkDbState())
return false;
- ReadWriteLocker locker(&(db->dbOperLock), query, Dialect::Sqlite3, flags.testFlag(Db::Flag::NO_LOCK));
+ ReadWriteLocker locker(&(db->dbOperLock), query, flags.testFlag(Db::Flag::NO_LOCK));
logSql(db.data(), query, args, flags);
int res;
@@ -904,7 +940,7 @@ bool AbstractDb3<T>::Query::execInternal(const QList<QVariant>& args)
int maxParamIdx = args.size();
if (!flags.testFlag(Db::Flag::SKIP_PARAM_COUNTING))
{
- QueryWithParamCount queryWithParams = getQueryWithParamCount(query, Dialect::Sqlite3);
+ QueryWithParamCount queryWithParams = getQueryWithParamCount(query);
maxParamIdx = qMin(maxParamIdx, queryWithParams.second);
}
@@ -932,10 +968,10 @@ bool AbstractDb3<T>::Query::execInternal(const QHash<QString, QVariant>& args)
if (!checkDbState())
return false;
- ReadWriteLocker locker(&(db->dbOperLock), query, Dialect::Sqlite3, flags.testFlag(Db::Flag::NO_LOCK));
+ ReadWriteLocker locker(&(db->dbOperLock), query, flags.testFlag(Db::Flag::NO_LOCK));
logSql(db.data(), query, args, flags);
- QueryWithParamNames queryWithParams = getQueryWithParamNames(query, Dialect::Sqlite3);
+ QueryWithParamNames queryWithParams = getQueryWithParamNames(query);
int res;
if (stmt)
diff --git a/SQLiteStudio3/coreSQLiteStudio/db/chainexecutor.cpp b/SQLiteStudio3/coreSQLiteStudio/db/chainexecutor.cpp
index 1f553ea..64fe575 100644
--- a/SQLiteStudio3/coreSQLiteStudio/db/chainexecutor.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/db/chainexecutor.cpp
@@ -45,7 +45,7 @@ void ChainExecutor::exec()
return;
}
- if (disableForeignKeys && db->getDialect() == Dialect::Sqlite3)
+ if (disableForeignKeys)
{
SqlQueryPtr result = db->exec("PRAGMA foreign_keys = 0;");
if (result->isError())
@@ -198,7 +198,7 @@ Db::Flags ChainExecutor::getExecFlags() const
void ChainExecutor::restoreFk()
{
- if (disableForeignKeys && db->getDialect() == Dialect::Sqlite3)
+ if (disableForeignKeys)
{
SqlQueryPtr result = db->exec("PRAGMA foreign_keys = 1;");
if (result->isError())
diff --git a/SQLiteStudio3/coreSQLiteStudio/db/db.cpp b/SQLiteStudio3/coreSQLiteStudio/db/db.cpp
index ebe6731..b3ad91b 100644
--- a/SQLiteStudio3/coreSQLiteStudio/db/db.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/db/db.cpp
@@ -23,7 +23,7 @@ QString Db::flagsToString(Db::Flags flags)
{
int idx = staticMetaObject.indexOfEnumerator("Flag");
if (idx == -1)
- return QString::null;
+ return QString();
QMetaEnum en = staticMetaObject.enumerator(idx);
return en.valueToKeys(static_cast<int>(flags));
@@ -44,23 +44,6 @@ QDataStream &operator >>(QDataStream &in, Db*& myObj)
return in;
}
-
-void Sqlite2ColumnDataTypeHelper::setBinaryType(int columnIndex)
-{
- binaryColumns << columnIndex;
-}
-
-bool Sqlite2ColumnDataTypeHelper::isBinaryColumn(int columnIndex) const
-{
- return binaryColumns.contains(columnIndex);
-}
-
-void Sqlite2ColumnDataTypeHelper::clearBinaryTypes()
-{
- binaryColumns.clear();
-}
-
-
QDebug operator<<(QDebug dbg, const Db* db)
{
dbg.nospace() << "<DB:" << db->getName() << ">";
diff --git a/SQLiteStudio3/coreSQLiteStudio/db/db.h b/SQLiteStudio3/coreSQLiteStudio/db/db.h
index 2ee79aa..d937fb7 100644
--- a/SQLiteStudio3/coreSQLiteStudio/db/db.h
+++ b/SQLiteStudio3/coreSQLiteStudio/db/db.h
@@ -3,13 +3,13 @@
#include <QVariant>
#include "returncode.h"
-#include "dialect.h"
#include "services/functionmanager.h"
#include "common/readwritelocker.h"
#include "coreSQLiteStudio_global.h"
#include "db/attachguard.h"
#include "interruptable.h"
#include "dbobjecttype.h"
+#include "common/column.h"
#include <QObject>
#include <QList>
#include <QHash>
@@ -51,7 +51,7 @@ static_char* DB_PLUGIN = "plugin";
* Everything you might want to do with SQLite databases goes through this interface in the application.
* It's has a common interface for common database operations, such as connecting and disconnecting,
* checking current status, executing queries and reading results.
- * It keeps information about the database version, dialect (SQLite 2 vs SQLite 3), encoding (UTF-8, UTF-16, etc.),
+ * It keeps information about the database version, encoding (UTF-8, UTF-16, etc.),
* symbolic name of the database and path to the file.
*
* Regular routine with the database object would be to open it (if not open yet), execute some query
@@ -148,8 +148,6 @@ class API_EXPORT Db : public QObject, public Interruptable
* of code, where the lock on Db was already set. Never (!) use this to ommit lock from different
* threads. Justified situation is when you implement Db::initialDbSetup() in the derived class,
* or when you implement SqlFunctionPlugin. Don't use it for the usual cases.
- * This flag is ignored by SQLite2 plugin, because SQLite2 is not prepared for multithreaded
- * processing, therefore all operations must be synchronized.
*/
SKIP_DROP_DETECTION = 0x4, /**< Query execution will not notify about any detected objects dropped by the query.
* Benefit is that it speeds up execution. */
@@ -212,21 +210,13 @@ class API_EXPORT Db : public QObject, public Interruptable
/**
* @brief Gets SQLite version major number for this database.
- * @return Major version number, that is 3 for SQLite 3.x.x and 2 for SQLite 2.x.x.
+ * @return Major version number, that is 3 for SQLite 3.x.x and nothing else for now.
*
* You don't have to open the database. This information is always available.
*/
virtual quint8 getVersion() const = 0;
/**
- * @brief Gets database dialect.
- * @return Database dialect, which is either Sqlite2 or Sqlite3.
- *
- * You don't have to open the database. This information is always available.
- */
- virtual Dialect getDialect() const = 0;
-
- /**
* @brief Gets database encoding.
* @return Database encoding as returned from SQLite query: <tt>PRAGMA encoding;</tt>
*
@@ -290,6 +280,21 @@ class API_EXPORT Db : public QObject, public Interruptable
virtual int getTimeout() const = 0;
/**
+ * @brief Provides information in expected result columns from given query.
+ * @param query SQL query that returns results.
+ * @return List of columns expected from the query if executed.
+ *
+ * This method used SQLite API functions, which leverage SQLite column metadata to identify
+ * real column, table and database of the expected result columns. It also fills in column names as displayed
+ * in the result set and declared type for certain column (if can be determined), whereas the actual type in each
+ * result row may be different (as SQLite allows it explicitly).
+ *
+ * If the query is not the one that returns any results (i.e. not SELECT nor PRAGMA), then this command returns
+ * empty list.
+ */
+ virtual QList<AliasedColumn> columnsForQuery(const QString& query) = 0;
+
+ /**
* @brief Executes SQL query.
* @param query Query to be executed. Parameter placeholders can be either of: ?, :param, \@param, just don't mix different types in single query.
* @param args List of values to bind to parameter placeholders. As those are unnamed parameters, the order is important.
@@ -449,7 +454,6 @@ class API_EXPORT Db : public QObject, public Interruptable
* @return true on success, or false on failure.
*
* This method uses basic "BEGIN" statement to begin transaction, therefore recurrent transactions are not supported.
- * This is because SQLite2 doesn't support "SAVEPOINT" and this is the common interface for all SQLite versions.
*/
virtual bool begin() = 0;
@@ -847,15 +851,4 @@ QDebug operator<<(QDebug dbg, const Db* db);
Q_DECLARE_METATYPE(Db*)
Q_DECLARE_OPERATORS_FOR_FLAGS(Db::Flags)
-class API_EXPORT Sqlite2ColumnDataTypeHelper
-{
- public:
- void setBinaryType(int columnIndex);
- bool isBinaryColumn(int columnIndex) const;
- void clearBinaryTypes();
-
- private:
- QSet<int> binaryColumns;
-};
-
#endif // DB_H
diff --git a/SQLiteStudio3/coreSQLiteStudio/db/dbpluginoption.h b/SQLiteStudio3/coreSQLiteStudio/db/dbpluginoption.h
index e2ed66f..6cf27d5 100644
--- a/SQLiteStudio3/coreSQLiteStudio/db/dbpluginoption.h
+++ b/SQLiteStudio3/coreSQLiteStudio/db/dbpluginoption.h
@@ -45,7 +45,8 @@ struct DbPluginOption
FILE = 4, /**< QLineEdit will be added */
PASSWORD = 5, /**< QLineEdit with value masking will be added */
CHOICE = 6, /**< QComboBox will be added */
- CUSTOM_PATH_BROWSE = 7 /**< File path browse button will be handled by the plugin. No additional editor will be added. */
+ CUSTOM_PATH_BROWSE = 7, /**< File path browse button will be handled by the plugin. No additional editor will be added. */
+ SQL = 8, /**< SqlEditor will be added. */
};
/**
@@ -75,6 +76,11 @@ struct DbPluginOption
QStringList choiceValues;
/**
+ * @brief List of value for QComboBox, including it's data (hidden) component.
+ */
+ QMap<QString, QVariant> choiceDataValues;
+
+ /**
* @brief Default value to be set in the editor widget.
*/
QVariant defaultValue;
diff --git a/SQLiteStudio3/coreSQLiteStudio/db/dbsqlite.h.autosave b/SQLiteStudio3/coreSQLiteStudio/db/dbsqlite.h.autosave
deleted file mode 100644
index 9d11dac..0000000
--- a/SQLiteStudio3/coreSQLiteStudio/db/dbsqlite.h.autosave
+++ /dev/null
@@ -1,72 +0,0 @@
-#ifndef DBSQLITE_H
-#define DBSQLITE_H
-
-#include "db.h"
-#include "../returncode.h"
-#include "sqlerror.h"
-#include "sqlresults.h"
-#include "../dialect.h"
-
-#include <QObject>
-#include <QSqlDatabase>
-#include <QVariant>
-#include <QList>
-#include <QMap>
-#include <QHash>
-#include <QMutex>
-#include <QRunnable>
-
-class AsyncQueryRunner;
-
-class DbSqlite : public Db
-{
- Q_OBJECT
-
- public:
- virtual ~DbSqlite();
-
- static DbPtr getInstance(const QString &name, const QString& path,
- const QString &options = QString::null);
-
- QString getName();
- QString getPath();
- quint8 getVersion();
- virtual QString driver() = 0;
- Dialect getDialect();
-
- quint32 asyncExec(const QString& query, const QVariant& arg1 = QVariant(),
- const QVariant& arg2 = QVariant(), const QVariant& arg3 = QVariant());
- quint32 asyncExecStr(const QString& query, const QVariant& arg1 = QVariant(),
- const QVariant& arg2 = QVariant(), const QVariant& arg3 = QVariant());
- quint32 asyncExecArgs(const QString& query, const QList<QVariant>& args);
- quint32 asyncExecArgs(const QString& query, const QMap<QString,QVariant>& args);
-
- void begin();
- bool commit();
- void rollback();
- QString getType();
- SqlError lastError();
-
- protected:
- Db();
-
- void cleanUp();
- QString generateUniqueDbName();
- bool isOpenNoLock();
- quint32 asyncExec(AsyncQueryRunner* runner);
- SqlResultsPtr execInternal(const QString& query, const QList<QVariant>& args,
- bool singleCell);
- SqlResultsPtr execInternal(const QString& query, const QMap<QString,QVariant>& args,
- bool singleCell);
- bool init();
-
- QSqlDatabase db;
- quint8 version = 0;
-
- public slots:
- bool openQuiet();
- bool closeQuiet();
-
-};
-
-#endif // DBSQLITE_H
diff --git a/SQLiteStudio3/coreSQLiteStudio/db/dbsqlite3.h b/SQLiteStudio3/coreSQLiteStudio/db/dbsqlite3.h
index 1509dff..1e7f6e2 100644
--- a/SQLiteStudio3/coreSQLiteStudio/db/dbsqlite3.h
+++ b/SQLiteStudio3/coreSQLiteStudio/db/dbsqlite3.h
@@ -4,7 +4,7 @@
#include "abstractdb3.h"
#include "common/global.h"
#include "stdsqlite3driver.h"
-#include <sqlite3.h>
+#include "db/sqlite3.h"
STD_SQLITE3_DRIVER(Sqlite3, "SQLite 3",,)
diff --git a/SQLiteStudio3/coreSQLiteStudio/db/invaliddb.cpp b/SQLiteStudio3/coreSQLiteStudio/db/invaliddb.cpp
index 5e210f2..e7acb7b 100644
--- a/SQLiteStudio3/coreSQLiteStudio/db/invaliddb.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/db/invaliddb.cpp
@@ -27,14 +27,9 @@ quint8 InvalidDb::getVersion() const
return 0;
}
-Dialect InvalidDb::getDialect() const
-{
- return Dialect::Sqlite3;
-}
-
QString InvalidDb::getEncoding()
{
- return QString::null;
+ return QString();
}
QHash<QString, QVariant>& InvalidDb::getConnectionOptions()
@@ -67,6 +62,12 @@ int InvalidDb::getTimeout() const
return timeout;
}
+QList<AliasedColumn> InvalidDb::columnsForQuery(const QString& query)
+{
+ UNUSED(query);
+ return QList<AliasedColumn>();
+}
+
SqlQueryPtr InvalidDb::exec(const QString& query, const QList<QVariant>& args, Db::Flags flags)
{
UNUSED(query);
@@ -196,13 +197,13 @@ QString InvalidDb::attach(Db* otherDb, bool silent)
{
UNUSED(otherDb);
UNUSED(silent);
- return QString::null;
+ return QString();
}
AttachGuard InvalidDb::guardedAttach(Db* otherDb, bool silent)
{
UNUSED(silent);
- return AttachGuard::create(this, otherDb, QString::null);
+ return AttachGuard::create(this, otherDb, QString());
}
void InvalidDb::detach(Db* otherDb)
@@ -227,12 +228,12 @@ QSet<QString> InvalidDb::getAllAttaches()
QString InvalidDb::getUniqueNewObjectName(const QString& attachedDbName)
{
UNUSED(attachedDbName);
- return QString::null;
+ return QString();
}
QString InvalidDb::getErrorText()
{
- return QString::null;
+ return QString();
}
int InvalidDb::getErrorCode()
diff --git a/SQLiteStudio3/coreSQLiteStudio/db/invaliddb.h b/SQLiteStudio3/coreSQLiteStudio/db/invaliddb.h
index 3bc91a4..c56da2e 100644
--- a/SQLiteStudio3/coreSQLiteStudio/db/invaliddb.h
+++ b/SQLiteStudio3/coreSQLiteStudio/db/invaliddb.h
@@ -12,7 +12,6 @@ class API_EXPORT InvalidDb : public Db
QString getName() const;
QString getPath() const;
quint8 getVersion() const;
- Dialect getDialect() const;
QString getEncoding();
QHash<QString, QVariant>& getConnectionOptions();
void setName(const QString& value);
@@ -20,6 +19,7 @@ class API_EXPORT InvalidDb : public Db
void setConnectionOptions(const QHash<QString, QVariant>& value);
void setTimeout(int secs);
int getTimeout() const;
+ QList<AliasedColumn> columnsForQuery(const QString& query);
SqlQueryPtr exec(const QString& query, const QList<QVariant>& args, Flags flags);
SqlQueryPtr exec(const QString& query, const QHash<QString, QVariant>& args, Flags flags);
SqlQueryPtr exec(const QString& query, Db::Flags flags);
diff --git a/SQLiteStudio3/coreSQLiteStudio/db/queryexecutor.cpp b/SQLiteStudio3/coreSQLiteStudio/db/queryexecutor.cpp
index 4160e41..83dae5d 100644
--- a/SQLiteStudio3/coreSQLiteStudio/db/queryexecutor.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/db/queryexecutor.cpp
@@ -19,16 +19,17 @@
#include "queryexecutorsteps/queryexecutorreplaceviews.h"
#include "queryexecutorsteps/queryexecutordetectschemaalter.h"
#include "queryexecutorsteps/queryexecutorvaluesmode.h"
+#include "queryexecutorsteps/queryexecutorcolumntype.h"
#include "common/unused.h"
#include "chainexecutor.h"
#include "log.h"
+#include "schemaresolver.h"
+#include "parser/lexer.h"
+#include "common/table.h"
#include <QMutexLocker>
#include <QDateTime>
#include <QThreadPool>
#include <QDebug>
-#include <schemaresolver.h>
-#include <parser/lexer.h>
-#include <common/table.h>
#include <QtMath>
// TODO modify all executor steps to use rebuildTokensFromContents() method, instead of replacing tokens manually.
@@ -111,6 +112,12 @@ void QueryExecutor::setupExecutionChain()
executionChain.append(additionalStatelessSteps[AFTER_CELL_SIZE_LIMIT]);
executionChain.append(createSteps(AFTER_CELL_SIZE_LIMIT));
+ executionChain << new QueryExecutorColumnType()
+ << new QueryExecutorParseQuery("after ColumnType");
+
+ executionChain.append(additionalStatelessSteps[AFTER_COLUMN_TYPES]);
+ executionChain.append(createSteps(AFTER_COLUMN_TYPES));
+
executionChain << new QueryExecutorLimit()
<< new QueryExecutorParseQuery("after Limit");
@@ -396,6 +403,11 @@ QList<QueryExecutor::ResultColumnPtr> QueryExecutor::getResultColumns() const
return context->resultColumns;
}
+QHash<QString, QString> QueryExecutor::getTypeColumns() const
+{
+ return context->typeColumnToResultColumnAlias;
+}
+
QList<QueryExecutor::ResultRowIdColumnPtr> QueryExecutor::getRowIdResultColumns() const
{
return context->rowIdColumns;
@@ -425,43 +437,6 @@ void QueryExecutor::setParams(const QHash<QString, QVariant>& params)
queryParameters = params;
}
-void QueryExecutor::arg(const QVariant& value)
-{
- QVariant::Type type = value.type();
- switch (type)
- {
- case QVariant::Bool:
- case QVariant::Int:
- originalQuery = originalQuery.arg(value.toInt());
- break;
- case QVariant::LongLong:
- originalQuery = originalQuery.arg(value.toLongLong());
- break;
- case QVariant::UInt:
- originalQuery = originalQuery.arg(value.toUInt());
- break;
- case QVariant::ULongLong:
- originalQuery = originalQuery.arg(value.toULongLong());
- break;
- case QVariant::Double:
- originalQuery = originalQuery.arg(value.toDouble());
- break;
- case QVariant::String:
- {
- if (value.canConvert(QVariant::LongLong))
- originalQuery = originalQuery.arg(value.toLongLong());
- else if (value.canConvert(QVariant::Double))
- originalQuery = originalQuery.arg(value.toDouble());
- else
- originalQuery = originalQuery.arg("'"+value.toString().replace("'", "''")+"'");
-
- break;
- }
- default:
- return;
- }
-}
-
void QueryExecutor::exec(const QString& query)
{
setQuery(query);
@@ -533,7 +508,7 @@ void QueryExecutor::simpleExecutionFinished(SqlQueryPtr results)
bool QueryExecutor::simpleExecIsSelect()
{
- TokenList tokens = Lexer::tokenize(queriesForSimpleExecution.last(), db->getDialect());
+ TokenList tokens = Lexer::tokenize(queriesForSimpleExecution.last());
tokens.trim();
// First check if it's explicit "SELECT" or "VALUES" (the latter one added in SQLite 3.8.4).
@@ -632,7 +607,7 @@ QStringList QueryExecutor::applyLimitForSimpleMethod(const QStringList &queries)
QString lastQuery = queries.last();
bool isSelect = false;
- getQueryAccessMode(lastQuery, db->getDialect(), &isSelect);
+ getQueryAccessMode(lastQuery, &isSelect);
if (isSelect)
{
result.removeLast();
@@ -739,11 +714,10 @@ void QueryExecutor::handleErrorsFromSmartAndSimpleMethods(SqlQueryPtr results)
{
QString match;
QString replaceName;
- Dialect dialect = db->getDialect();
for (const QString& attachName : context->dbNameToAttach.rightValues())
{
match = attachName + ".";
- replaceName = wrapObjIfNeeded(context->dbNameToAttach.valueByRight(attachName), dialect) + ".";
+ replaceName = wrapObjIfNeeded(context->dbNameToAttach.valueByRight(attachName)) + ".";
while (msg.contains(match))
msg.replace(match, replaceName);
}
diff --git a/SQLiteStudio3/coreSQLiteStudio/db/queryexecutor.h b/SQLiteStudio3/coreSQLiteStudio/db/queryexecutor.h
index 85c39bf..ffbcb7b 100644
--- a/SQLiteStudio3/coreSQLiteStudio/db/queryexecutor.h
+++ b/SQLiteStudio3/coreSQLiteStudio/db/queryexecutor.h
@@ -591,6 +591,14 @@ class API_EXPORT QueryExecutor : public QObject, public QRunnable
QSet<SourceTablePtr> sourceTables;
/**
+ * @brief Map of column aliases containing column types.
+ *
+ * Keys are query executor column aliases of column representing types
+ * and values are query executor column aliases of column to which these types apply to.
+ */
+ QHash<QString, QString> typeColumnToResultColumnAlias;
+
+ /**
* @brief Query used for counting results.
*
* Filled with SQL to be used for results counting (even if counting is disabled).
@@ -672,6 +680,7 @@ class API_EXPORT QueryExecutor : public QObject, public QRunnable
AFTER_ORDER, /**< After order clause was applied/modified */
AFTER_DISTINCT_WRAP, /**< After wrapping SELECT was added in case of DISTINCT or GROUP BY clauses were used */
AFTER_CELL_SIZE_LIMIT, /**< After cell result size was limited to save memory usage */
+ AFTER_COLUMN_TYPES, /**< After typeof() result meta columns were added */
AFTER_ROW_LIMIT_AND_OFFSET, /**< After LIMIT and ORDER clauses were added/modified. This is the last possible moment, directly ahead of final query execution */
JUST_BEFORE_EXECUTION, /**< Same as AFTER_ROW_LIMIT_AND_OFFSET */
LAST /**< Same as AFTER_ROW_LIMIT_AND_OFFSET */
@@ -699,7 +708,7 @@ class API_EXPORT QueryExecutor : public QObject, public QRunnable
* @param query Optional query to execute. If not provided, it has to be defined later with setQuery().
* @param parent Parent QObject.
*/
- QueryExecutor(Db* db = nullptr, const QString& query = QString::null, QObject *parent = 0);
+ QueryExecutor(Db* db = nullptr, const QString& query = QString(), QObject *parent = 0);
/**
* @brief Releases internal resources.
@@ -813,6 +822,12 @@ class API_EXPORT QueryExecutor : public QObject, public QRunnable
QList<QueryExecutor::ResultColumnPtr> getResultColumns() const;
/**
+ * @brief Gets map of meta columns providing SQLite data types.
+ * @return Map of type column alias to target column alias (for which the type applies).
+ */
+ QHash<QString, QString> getTypeColumns() const;
+
+ /**
* @brief Gets list of ROWID columns.
* @return ROWID columns.
*
@@ -865,21 +880,6 @@ class API_EXPORT QueryExecutor : public QObject, public QRunnable
void setParams(const QHash<QString, QVariant>& params);
/**
- * @brief Replaces placeholder in the query.
- * @param value Value to replace placeholder with.
- *
- * This works almost the same as QString::arg(), but it's specialized
- * for SQL domain. It means that it will work only with numeric
- * or string values passed in the parameter. If the value is numeric,
- * then it just replaces a placeholder. If the value is a string,
- * then it's wrapped with a quote character ('), if necessary, then
- * it replaces a placeholder.
- *
- * Placeholders are the same as for QString::arg(): %1, %2, %3...
- */
- void arg(const QVariant& value);
-
- /**
* @brief Gets currently defined database.
* @return Database object, or null pointer if not yet defined.
*/
diff --git a/SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutoraddrowids.cpp b/SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutoraddrowids.cpp
index d59d73c..a487623 100644
--- a/SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutoraddrowids.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutoraddrowids.cpp
@@ -4,6 +4,7 @@
#include "common/utils_sql.h"
#include "parser/ast/sqlitecreatetable.h"
#include "schemaresolver.h"
+#include "common/compatibility.h"
#include <QDebug>
bool QueryExecutorAddRowIds::exec()
@@ -56,7 +57,7 @@ QHash<SelectResolver::Table,QHash<QString,QString>> QueryExecutorAddRowIds::addR
// Go trough subselects to add ROWID result columns there and collect rowId mapping to use here.
for (SqliteSelect* subSelect : getSubSelects(core))
{
- rowIdColsMap.unite(addRowIdForTables(subSelect, ok, false));
+ unite(rowIdColsMap, addRowIdForTables(subSelect, ok, false));
if (!ok)
return rowIdColsMap;
}
@@ -68,7 +69,8 @@ QHash<SelectResolver::Table,QHash<QString,QString>> QueryExecutorAddRowIds::addR
QSet<SelectResolver::Table> tables = resolver.resolveTables(core);
for (const SelectResolver::Table& table : tables)
{
- if (table.flags & (SelectResolver::FROM_COMPOUND_SELECT | SelectResolver::FROM_DISTINCT_SELECT | SelectResolver::FROM_GROUPED_SELECT))
+ if (table.flags & (SelectResolver::FROM_COMPOUND_SELECT | SelectResolver::FROM_DISTINCT_SELECT | SelectResolver::FROM_GROUPED_SELECT |
+ SelectResolver::FROM_CTE_SELECT))
continue; // we don't get ROWID from compound, distinct or aggregated subselects
if (checkInWithClause(table, select->with))
@@ -154,7 +156,18 @@ bool QueryExecutorAddRowIds::addResultColumns(SqliteSelect::Core* core, const Se
QHash<SelectResolver::Table,QHash<QString,QString>>& rowIdColsMap, bool isTopSelect)
{
SelectResolver::Table keyTable = table;
- if (!rowIdColsMap.contains(table))
+
+ // If selecting from named subselect, where table in that subselect has no alias, we need to match
+ // Table by table&database, but excluding alias.
+ if (!rowIdColsMap.contains(keyTable) && !keyTable.tableAlias.isEmpty())
+ {
+ keyTable.tableAlias = QString();
+ if (!rowIdColsMap.contains(keyTable))
+ keyTable = table;
+ }
+
+ // Aliased matching should be performed also against pushed (to old) aliases, due to multi-level subselects.
+ if (!rowIdColsMap.contains(keyTable))
{
for (const SelectResolver::Table& rowIdColsMapTable : rowIdColsMap.keys())
{
diff --git a/SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutorcolumns.cpp b/SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutorcolumns.cpp
index 0cb6b7a..5ababcd 100644
--- a/SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutorcolumns.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutorcolumns.cpp
@@ -139,9 +139,9 @@ SqliteSelect::Core::ResultColumn* QueryExecutorColumns::getResultColumnForSelect
colString = col.alias;
if (!resultColumn->expression)
- colString = wrapObjIfNeeded(colString, dialect);
+ colString = wrapObjIfNeeded(colString);
- Parser parser(dialect);
+ Parser parser;
SqliteExpr* expr = parser.parseExpr(colString);
if (!expr)
{
@@ -189,6 +189,7 @@ SqliteSelect::Core::ResultColumn* QueryExecutorColumns::getResultColumnForSelect
selectResultColumn->alias = aliasTpl.arg(aliasBase, QString::number(nextAliasCounter++));
usedAliases += selectResultColumn->alias;
+ selectResultColumn->alias = wrapObjIfNeeded(selectResultColumn->alias);
return selectResultColumn;
}
@@ -243,7 +244,7 @@ void QueryExecutorColumns::wrapWithAliasedColumns(SqliteSelect* select)
colName = colNameTpl.arg(resCol->column, QString::number(i));
columnNamesUsed << colName;
- outerColumns << TokenPtr::create(Token::OTHER, wrapObjIfNeeded(colName, dialect));
+ outerColumns << TokenPtr::create(Token::OTHER, wrapObjIfNeeded(colName));
outerColumns << TokenPtr::create(Token::SPACE, " ");
outerColumns << TokenPtr::create(Token::KEYWORD, "AS");
outerColumns << TokenPtr::create(Token::SPACE, " ");
diff --git a/SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutorcolumntype.cpp b/SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutorcolumntype.cpp
new file mode 100644
index 0000000..fb788f4
--- /dev/null
+++ b/SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutorcolumntype.cpp
@@ -0,0 +1,47 @@
+#include "queryexecutorcolumntype.h"
+
+bool QueryExecutorColumnType::exec()
+{
+ if (context->noMetaColumns)
+ return true;
+
+ SqliteSelectPtr select = getSelect();
+ if (!select || select->explain)
+ return true;
+
+ addTypeColumns(select.data());
+
+ select->rebuildTokens();
+ updateQueries();
+
+ return true;
+}
+
+void QueryExecutorColumnType::addTypeColumns(SqliteSelect* select)
+{
+ for (const QueryExecutor::ResultColumnPtr& resCol : context->resultColumns)
+ {
+ QString nextCol = getNextColName();
+ QString targetCol = resCol->queryExecutorAlias;
+
+ for (SqliteSelect::Core* core : select->coreSelects)
+ {
+ SqliteSelect::Core::ResultColumn* realResCol = createRealTypeOfResCol(targetCol, nextCol);
+ core->resultColumns << realResCol;
+ realResCol->setParent(core);
+ }
+
+ context->typeColumnToResultColumnAlias[nextCol] = targetCol;
+ }
+}
+
+SqliteSelect::Core::ResultColumn* QueryExecutorColumnType::createRealTypeOfResCol(const QString& targetCol, const QString& alias)
+{
+ SqliteExpr* targetColExpr = new SqliteExpr();
+ targetColExpr->initId(targetCol);
+
+ SqliteExpr* expr = new SqliteExpr();
+ expr->initFunction("typeof", false, {targetColExpr});
+
+ return new SqliteSelect::Core::ResultColumn(expr, true, alias);
+}
diff --git a/SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutorcolumntype.h b/SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutorcolumntype.h
new file mode 100644
index 0000000..f492313
--- /dev/null
+++ b/SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutorcolumntype.h
@@ -0,0 +1,19 @@
+#ifndef QUERYEXECUTORCOLUMNTYPE_H
+#define QUERYEXECUTORCOLUMNTYPE_H
+
+#include "queryexecutorstep.h"
+#include "parser/ast/sqliteselect.h"
+
+class QueryExecutorColumnType : public QueryExecutorStep
+{
+ Q_OBJECT
+
+ public:
+ bool exec();
+
+ private:
+ void addTypeColumns(SqliteSelect* select);
+ SqliteSelect::Core::ResultColumn* createRealTypeOfResCol(const QString& targetCol, const QString& alias);
+};
+
+#endif // QUERYEXECUTORCOLUMNTYPE_H
diff --git a/SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutordatasources.cpp b/SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutordatasources.cpp
index 88c957b..be7a873 100644
--- a/SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutordatasources.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutordatasources.cpp
@@ -21,6 +21,9 @@ bool QueryExecutorDataSources::exec()
QSet<SelectResolver::Table> tables = resolver.resolveTables(core);
for (SelectResolver::Table resolvedTable : tables)
{
+ if (resolvedTable.flags & SelectResolver::FROM_CTE_SELECT)
+ continue;
+
QueryExecutor::SourceTablePtr table = QueryExecutor::SourceTablePtr::create();
table->database = resolvedTable.database;
table->table = resolvedTable.table;
diff --git a/SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutorexecute.cpp b/SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutorexecute.cpp
index 0a97c1e..1ffc1bf 100644
--- a/SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutorexecute.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutorexecute.cpp
@@ -43,7 +43,6 @@ bool QueryExecutorExecute::executeQueries()
flags |= Db::Flag::PRELOAD;
QString queryStr;
- int queryCount = context->parsedQueries.size();
for (const SqliteQueryPtr& query : context->parsedQueries)
{
queryStr = query->detokenize();
@@ -52,10 +51,6 @@ bool QueryExecutorExecute::executeQueries()
results->setArgs(bindParamsForQuery);
results->setFlags(flags);
- queryCount--;
- if (queryCount == 0) // last query?
- setupSqlite2ColumnDataTypes(results);
-
if (isBeginTransaction(query->queryType))
rowsAffectedBeforeTransaction.push(context->rowsAffected);
@@ -117,6 +112,7 @@ void QueryExecutorExecute::handleFailResult(SqlQueryPtr results)
context->errorMessageFromSmartExecution = results->getErrorText();
qWarning() << "Could not execute query with smart method:" << queryExecutor->getOriginalQuery()
<< "\nError message:" << results->getErrorText()
+ << "\nActual, post-processed query:" << context->processedQuery
<< "\nSkipping smart execution.";
}
}
@@ -133,44 +129,6 @@ QHash<QString, QVariant> QueryExecutorExecute::getBindParamsForQuery(SqliteQuery
return queryParams;
}
-void QueryExecutorExecute::setupSqlite2ColumnDataTypes(SqlQueryPtr results)
-{
- Sqlite2ColumnDataTypeHelper* sqlite2Helper = dynamic_cast<Sqlite2ColumnDataTypeHelper*>(results.data());
- if (!sqlite2Helper)
- return;
-
- Table key;
- SqliteCreateTablePtr createTable;
-
- SchemaResolver resolver(db);
- QHash<Table,SqliteCreateTablePtr> tables;
- for (QueryExecutor::SourceTablePtr tab : context->sourceTables)
- {
- if (tab->table.isNull())
- continue;
-
- key = Table(tab->database, tab->table);
- createTable = resolver.getParsedObject(tab->database, tab->table, SchemaResolver::TABLE).dynamicCast<SqliteCreateTable>();
- tables[key] = createTable;
- }
-
- sqlite2Helper->clearBinaryTypes();
-
- SqliteCreateTable::Column* column = nullptr;
- int idx = -1;
- for (QueryExecutor::ResultColumnPtr resCol : context->resultColumns)
- {
- idx++;
- key = Table(resCol->database, resCol->table);
- if (!tables.contains(key))
- continue;
-
- column = tables[key]->getColumn(resCol->column);
- if (column->type && DataType::isBinary(column->type->name))
- sqlite2Helper->setBinaryType(idx);
- }
-}
-
bool QueryExecutorExecute::isBeginTransaction(SqliteQueryType queryType)
{
return (queryType == SqliteQueryType::BeginTrans || queryType == SqliteQueryType::Savepoint);
diff --git a/SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutorexecute.h b/SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutorexecute.h
index ea6fed2..e4ef843 100644
--- a/SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutorexecute.h
+++ b/SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutorexecute.h
@@ -79,7 +79,6 @@ class QueryExecutorExecute : public QueryExecutorStep
*/
qint64 startTime;
- void setupSqlite2ColumnDataTypes(SqlQueryPtr results);
bool isBeginTransaction(SqliteQueryType queryType);
bool isCommitTransaction(SqliteQueryType queryType);
bool isRollbackTransaction(SqliteQueryType queryType);
diff --git a/SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutororder.cpp b/SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutororder.cpp
index 09e35ed..65bb0f6 100644
--- a/SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutororder.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutororder.cpp
@@ -23,7 +23,7 @@ bool QueryExecutorOrder::exec()
static_qstring(selectTpl, "SELECT * FROM (%1) ORDER BY %2");
QString newSelect = selectTpl.arg(select->detokenize(), tokens.detokenize());
- Parser parser(dialect);
+ Parser parser;
if (!parser.parse(newSelect) || parser.getQueries().size() == 0)
{
qWarning() << "Could not parse SELECt after applying order. Tried to parse query:\n" << newSelect;
diff --git a/SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutorparsequery.cpp b/SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutorparsequery.cpp
index cd91734..26192f0 100644
--- a/SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutorparsequery.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutorparsequery.cpp
@@ -21,7 +21,7 @@ bool QueryExecutorParseQuery::exec()
if (parser)
delete parser;
- parser = new Parser(dialect);
+ parser = new Parser();
// Do parsing
context->parsedQueries.clear();
diff --git a/SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutorreplaceviews.cpp b/SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutorreplaceviews.cpp
index affe45c..8195322 100644
--- a/SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutorreplaceviews.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutorreplaceviews.cpp
@@ -73,6 +73,9 @@ void QueryExecutorReplaceViews::replaceViews(SqliteSelect* select)
SqliteCreateViewPtr view;
QList<SqliteSelect::Core::SingleSource*> sources = core->getAllTypedStatements<SqliteSelect::Core::SingleSource>();
+
+ QList<SqliteSelect::Core::SingleSource*> viewSources;
+ QSet<SqliteStatement*> parents;
for (SqliteSelect::Core::SingleSource* src : sources)
{
if (src->table.isNull())
@@ -82,6 +85,22 @@ void QueryExecutorReplaceViews::replaceViews(SqliteSelect* select)
if (!viewsInDatabase.contains(src->table, Qt::CaseInsensitive))
continue;
+ parents << src->parentStatement();
+ viewSources << src;
+ }
+
+ if (parents.size() > 1)
+ {
+ // Multi-level views (view selecting from view, selecting from view...).
+ // Such constructs build up easily to huge, non-optimized queries.
+ // For performance reasons, we won't expand such views.
+ qDebug() << "Multi-level views. Skipping view expanding feature of query executor. Some columns won't be editable due to that. Number of different view parents:"
+ << parents.size();
+ return;
+ }
+
+ for (SqliteSelect::Core::SingleSource* src : viewSources)
+ {
view = getView(src->database, src->table);
if (!view)
{
@@ -90,10 +109,12 @@ void QueryExecutorReplaceViews::replaceViews(SqliteSelect* select)
continue;
}
+ QString alias = src->alias.isNull() ? view->view : src->alias;
+
src->select = view->select;
- src->alias = view->view;
- src->database = QString::null;
- src->table = QString::null;
+ src->alias = alias;
+ src->database = QString();
+ src->table = QString();
replaceViews(src->select);
}
diff --git a/SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutorstep.cpp b/SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutorstep.cpp
index 8fbf026..72dbeec 100644
--- a/SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutorstep.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutorstep.cpp
@@ -11,7 +11,6 @@ void QueryExecutorStep::init(QueryExecutor *queryExecutor, QueryExecutor::Contex
this->queryExecutor = queryExecutor;
this->context = context;
db = queryExecutor->getDb();
- dialect = db->getDialect();
init();
}
diff --git a/SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutorstep.h b/SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutorstep.h
index 9a89b26..fcc0cf6 100644
--- a/SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutorstep.h
+++ b/SQLiteStudio3/coreSQLiteStudio/db/queryexecutorsteps/queryexecutorstep.h
@@ -146,13 +146,6 @@ class API_EXPORT QueryExecutorStep : public QObject
* Defined by init().
*/
Db* db = nullptr;
-
- /**
- * @brief SQLite dialect of the database.
- *
- * Defined by init().
- */
- Dialect dialect;
};
#endif // QUERYEXECUTORSTEP_H
diff --git a/SQLiteStudio3/coreSQLiteStudio/db/sqlite3.h b/SQLiteStudio3/coreSQLiteStudio/db/sqlite3.h
new file mode 100644
index 0000000..44e53ef
--- /dev/null
+++ b/SQLiteStudio3/coreSQLiteStudio/db/sqlite3.h
@@ -0,0 +1,12237 @@
+/*
+** 2001-09-15
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+*************************************************************************
+** This header file defines the interface that the SQLite library
+** presents to client programs. If a C-function, structure, datatype,
+** or constant definition does not appear in this file, then it is
+** not a published API of SQLite, is subject to change without
+** notice, and should not be referenced by programs that use SQLite.
+**
+** Some of the definitions that are in this file are marked as
+** "experimental". Experimental interfaces are normally new
+** features recently added to SQLite. We do not anticipate changes
+** to experimental interfaces but reserve the right to make minor changes
+** if experience from use "in the wild" suggest such changes are prudent.
+**
+** The official C-language API documentation for SQLite is derived
+** from comments in this file. This file is the authoritative source
+** on how SQLite interfaces are supposed to operate.
+**
+** The name of this file under configuration management is "sqlite.h.in".
+** The makefile makes some minor changes to this file (such as inserting
+** the version number) and changes its name to "sqlite3.h" as
+** part of the build process.
+*/
+#ifndef SQLITE3_H
+#define SQLITE3_H
+#include <stdarg.h> /* Needed for the definition of va_list */
+
+/*
+** Make sure we can call this stuff from C++.
+*/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*
+** Provide the ability to override linkage features of the interface.
+*/
+#ifndef SQLITE_EXTERN
+# define SQLITE_EXTERN extern
+#endif
+#ifndef SQLITE_API
+# define SQLITE_API
+#endif
+#ifndef SQLITE_CDECL
+# define SQLITE_CDECL
+#endif
+#ifndef SQLITE_APICALL
+# define SQLITE_APICALL
+#endif
+#ifndef SQLITE_STDCALL
+# define SQLITE_STDCALL SQLITE_APICALL
+#endif
+#ifndef SQLITE_CALLBACK
+# define SQLITE_CALLBACK
+#endif
+#ifndef SQLITE_SYSAPI
+# define SQLITE_SYSAPI
+#endif
+
+/*
+** These no-op macros are used in front of interfaces to mark those
+** interfaces as either deprecated or experimental. New applications
+** should not use deprecated interfaces - they are supported for backwards
+** compatibility only. Application writers should be aware that
+** experimental interfaces are subject to change in point releases.
+**
+** These macros used to resolve to various kinds of compiler magic that
+** would generate warning messages when they were used. But that
+** compiler magic ended up generating such a flurry of bug reports
+** that we have taken it all out and gone back to using simple
+** noop macros.
+*/
+#define SQLITE_DEPRECATED
+#define SQLITE_EXPERIMENTAL
+
+/*
+** Ensure these symbols were not defined by some previous header file.
+*/
+#ifdef SQLITE_VERSION
+# undef SQLITE_VERSION
+#endif
+#ifdef SQLITE_VERSION_NUMBER
+# undef SQLITE_VERSION_NUMBER
+#endif
+
+/*
+** CAPI3REF: Compile-Time Library Version Numbers
+**
+** ^(The [SQLITE_VERSION] C preprocessor macro in the sqlite3.h header
+** evaluates to a string literal that is the SQLite version in the
+** format "X.Y.Z" where X is the major version number (always 3 for
+** SQLite3) and Y is the minor version number and Z is the release number.)^
+** ^(The [SQLITE_VERSION_NUMBER] C preprocessor macro resolves to an integer
+** with the value (X*1000000 + Y*1000 + Z) where X, Y, and Z are the same
+** numbers used in [SQLITE_VERSION].)^
+** The SQLITE_VERSION_NUMBER for any given release of SQLite will also
+** be larger than the release from which it is derived. Either Y will
+** be held constant and Z will be incremented or else Y will be incremented
+** and Z will be reset to zero.
+**
+** Since [version 3.6.18] ([dateof:3.6.18]),
+** SQLite source code has been stored in the
+** <a href="http://www.fossil-scm.org/">Fossil configuration management
+** system</a>. ^The SQLITE_SOURCE_ID macro evaluates to
+** a string which identifies a particular check-in of SQLite
+** within its configuration management system. ^The SQLITE_SOURCE_ID
+** string contains the date and time of the check-in (UTC) and a SHA1
+** or SHA3-256 hash of the entire source tree. If the source code has
+** been edited in any way since it was last checked in, then the last
+** four hexadecimal digits of the hash may be modified.
+**
+** See also: [sqlite3_libversion()],
+** [sqlite3_libversion_number()], [sqlite3_sourceid()],
+** [sqlite_version()] and [sqlite_source_id()].
+*/
+#define SQLITE_VERSION "3.34.1"
+#define SQLITE_VERSION_NUMBER 3034001
+#define SQLITE_SOURCE_ID "2021-01-20 14:10:07 10e20c0b43500cfb9bbc0eaa061c57514f715d87238f4d835880cd846b9ebd1f"
+
+/*
+** CAPI3REF: Run-Time Library Version Numbers
+** KEYWORDS: sqlite3_version sqlite3_sourceid
+**
+** These interfaces provide the same information as the [SQLITE_VERSION],
+** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros
+** but are associated with the library instead of the header file. ^(Cautious
+** programmers might include assert() statements in their application to
+** verify that values returned by these interfaces match the macros in
+** the header, and thus ensure that the application is
+** compiled with matching library and header files.
+**
+** <blockquote><pre>
+** assert( sqlite3_libversion_number()==SQLITE_VERSION_NUMBER );
+** assert( strncmp(sqlite3_sourceid(),SQLITE_SOURCE_ID,80)==0 );
+** assert( strcmp(sqlite3_libversion(),SQLITE_VERSION)==0 );
+** </pre></blockquote>)^
+**
+** ^The sqlite3_version[] string constant contains the text of [SQLITE_VERSION]
+** macro. ^The sqlite3_libversion() function returns a pointer to the
+** to the sqlite3_version[] string constant. The sqlite3_libversion()
+** function is provided for use in DLLs since DLL users usually do not have
+** direct access to string constants within the DLL. ^The
+** sqlite3_libversion_number() function returns an integer equal to
+** [SQLITE_VERSION_NUMBER]. ^(The sqlite3_sourceid() function returns
+** a pointer to a string constant whose value is the same as the
+** [SQLITE_SOURCE_ID] C preprocessor macro. Except if SQLite is built
+** using an edited copy of [the amalgamation], then the last four characters
+** of the hash might be different from [SQLITE_SOURCE_ID].)^
+**
+** See also: [sqlite_version()] and [sqlite_source_id()].
+*/
+SQLITE_API SQLITE_EXTERN const char sqlite3_version[];
+SQLITE_API const char *sqlite3_libversion(void);
+SQLITE_API const char *sqlite3_sourceid(void);
+SQLITE_API int sqlite3_libversion_number(void);
+
+/*
+** CAPI3REF: Run-Time Library Compilation Options Diagnostics
+**
+** ^The sqlite3_compileoption_used() function returns 0 or 1
+** indicating whether the specified option was defined at
+** compile time. ^The SQLITE_ prefix may be omitted from the
+** option name passed to sqlite3_compileoption_used().
+**
+** ^The sqlite3_compileoption_get() function allows iterating
+** over the list of options that were defined at compile time by
+** returning the N-th compile time option string. ^If N is out of range,
+** sqlite3_compileoption_get() returns a NULL pointer. ^The SQLITE_
+** prefix is omitted from any strings returned by
+** sqlite3_compileoption_get().
+**
+** ^Support for the diagnostic functions sqlite3_compileoption_used()
+** and sqlite3_compileoption_get() may be omitted by specifying the
+** [SQLITE_OMIT_COMPILEOPTION_DIAGS] option at compile time.
+**
+** See also: SQL functions [sqlite_compileoption_used()] and
+** [sqlite_compileoption_get()] and the [compile_options pragma].
+*/
+#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
+SQLITE_API int sqlite3_compileoption_used(const char *zOptName);
+SQLITE_API const char *sqlite3_compileoption_get(int N);
+#else
+# define sqlite3_compileoption_used(X) 0
+# define sqlite3_compileoption_get(X) ((void*)0)
+#endif
+
+/*
+** CAPI3REF: Test To See If The Library Is Threadsafe
+**
+** ^The sqlite3_threadsafe() function returns zero if and only if
+** SQLite was compiled with mutexing code omitted due to the
+** [SQLITE_THREADSAFE] compile-time option being set to 0.
+**
+** SQLite can be compiled with or without mutexes. When
+** the [SQLITE_THREADSAFE] C preprocessor macro is 1 or 2, mutexes
+** are enabled and SQLite is threadsafe. When the
+** [SQLITE_THREADSAFE] macro is 0,
+** the mutexes are omitted. Without the mutexes, it is not safe
+** to use SQLite concurrently from more than one thread.
+**
+** Enabling mutexes incurs a measurable performance penalty.
+** So if speed is of utmost importance, it makes sense to disable
+** the mutexes. But for maximum safety, mutexes should be enabled.
+** ^The default behavior is for mutexes to be enabled.
+**
+** This interface can be used by an application to make sure that the
+** version of SQLite that it is linking against was compiled with
+** the desired setting of the [SQLITE_THREADSAFE] macro.
+**
+** This interface only reports on the compile-time mutex setting
+** of the [SQLITE_THREADSAFE] flag. If SQLite is compiled with
+** SQLITE_THREADSAFE=1 or =2 then mutexes are enabled by default but
+** can be fully or partially disabled using a call to [sqlite3_config()]
+** with the verbs [SQLITE_CONFIG_SINGLETHREAD], [SQLITE_CONFIG_MULTITHREAD],
+** or [SQLITE_CONFIG_SERIALIZED]. ^(The return value of the
+** sqlite3_threadsafe() function shows only the compile-time setting of
+** thread safety, not any run-time changes to that setting made by
+** sqlite3_config(). In other words, the return value from sqlite3_threadsafe()
+** is unchanged by calls to sqlite3_config().)^
+**
+** See the [threading mode] documentation for additional information.
+*/
+SQLITE_API int sqlite3_threadsafe(void);
+
+/*
+** CAPI3REF: Database Connection Handle
+** KEYWORDS: {database connection} {database connections}
+**
+** Each open SQLite database is represented by a pointer to an instance of
+** the opaque structure named "sqlite3". It is useful to think of an sqlite3
+** pointer as an object. The [sqlite3_open()], [sqlite3_open16()], and
+** [sqlite3_open_v2()] interfaces are its constructors, and [sqlite3_close()]
+** and [sqlite3_close_v2()] are its destructors. There are many other
+** interfaces (such as
+** [sqlite3_prepare_v2()], [sqlite3_create_function()], and
+** [sqlite3_busy_timeout()] to name but three) that are methods on an
+** sqlite3 object.
+*/
+typedef struct sqlite3 sqlite3;
+
+/*
+** CAPI3REF: 64-Bit Integer Types
+** KEYWORDS: sqlite_int64 sqlite_uint64
+**
+** Because there is no cross-platform way to specify 64-bit integer types
+** SQLite includes typedefs for 64-bit signed and unsigned integers.
+**
+** The sqlite3_int64 and sqlite3_uint64 are the preferred type definitions.
+** The sqlite_int64 and sqlite_uint64 types are supported for backwards
+** compatibility only.
+**
+** ^The sqlite3_int64 and sqlite_int64 types can store integer values
+** between -9223372036854775808 and +9223372036854775807 inclusive. ^The
+** sqlite3_uint64 and sqlite_uint64 types can store integer values
+** between 0 and +18446744073709551615 inclusive.
+*/
+#ifdef SQLITE_INT64_TYPE
+ typedef SQLITE_INT64_TYPE sqlite_int64;
+# ifdef SQLITE_UINT64_TYPE
+ typedef SQLITE_UINT64_TYPE sqlite_uint64;
+# else
+ typedef unsigned SQLITE_INT64_TYPE sqlite_uint64;
+# endif
+#elif defined(_MSC_VER) || defined(__BORLANDC__)
+ typedef __int64 sqlite_int64;
+ typedef unsigned __int64 sqlite_uint64;
+#else
+ typedef long long int sqlite_int64;
+ typedef unsigned long long int sqlite_uint64;
+#endif
+typedef sqlite_int64 sqlite3_int64;
+typedef sqlite_uint64 sqlite3_uint64;
+
+/*
+** If compiling for a processor that lacks floating point support,
+** substitute integer for floating-point.
+*/
+#ifdef SQLITE_OMIT_FLOATING_POINT
+# define double sqlite3_int64
+#endif
+
+/*
+** CAPI3REF: Closing A Database Connection
+** DESTRUCTOR: sqlite3
+**
+** ^The sqlite3_close() and sqlite3_close_v2() routines are destructors
+** for the [sqlite3] object.
+** ^Calls to sqlite3_close() and sqlite3_close_v2() return [SQLITE_OK] if
+** the [sqlite3] object is successfully destroyed and all associated
+** resources are deallocated.
+**
+** Ideally, applications should [sqlite3_finalize | finalize] all
+** [prepared statements], [sqlite3_blob_close | close] all [BLOB handles], and
+** [sqlite3_backup_finish | finish] all [sqlite3_backup] objects associated
+** with the [sqlite3] object prior to attempting to close the object.
+** ^If the database connection is associated with unfinalized prepared
+** statements, BLOB handlers, and/or unfinished sqlite3_backup objects then
+** sqlite3_close() will leave the database connection open and return
+** [SQLITE_BUSY]. ^If sqlite3_close_v2() is called with unfinalized prepared
+** statements, unclosed BLOB handlers, and/or unfinished sqlite3_backups,
+** it returns [SQLITE_OK] regardless, but instead of deallocating the database
+** connection immediately, it marks the database connection as an unusable
+** "zombie" and makes arrangements to automatically deallocate the database
+** connection after all prepared statements are finalized, all BLOB handles
+** are closed, and all backups have finished. The sqlite3_close_v2() interface
+** is intended for use with host languages that are garbage collected, and
+** where the order in which destructors are called is arbitrary.
+**
+** ^If an [sqlite3] object is destroyed while a transaction is open,
+** the transaction is automatically rolled back.
+**
+** The C parameter to [sqlite3_close(C)] and [sqlite3_close_v2(C)]
+** must be either a NULL
+** pointer or an [sqlite3] object pointer obtained
+** from [sqlite3_open()], [sqlite3_open16()], or
+** [sqlite3_open_v2()], and not previously closed.
+** ^Calling sqlite3_close() or sqlite3_close_v2() with a NULL pointer
+** argument is a harmless no-op.
+*/
+SQLITE_API int sqlite3_close(sqlite3*);
+SQLITE_API int sqlite3_close_v2(sqlite3*);
+
+/*
+** The type for a callback function.
+** This is legacy and deprecated. It is included for historical
+** compatibility and is not documented.
+*/
+typedef int (*sqlite3_callback)(void*,int,char**, char**);
+
+/*
+** CAPI3REF: One-Step Query Execution Interface
+** METHOD: sqlite3
+**
+** The sqlite3_exec() interface is a convenience wrapper around
+** [sqlite3_prepare_v2()], [sqlite3_step()], and [sqlite3_finalize()],
+** that allows an application to run multiple statements of SQL
+** without having to use a lot of C code.
+**
+** ^The sqlite3_exec() interface runs zero or more UTF-8 encoded,
+** semicolon-separate SQL statements passed into its 2nd argument,
+** in the context of the [database connection] passed in as its 1st
+** argument. ^If the callback function of the 3rd argument to
+** sqlite3_exec() is not NULL, then it is invoked for each result row
+** coming out of the evaluated SQL statements. ^The 4th argument to
+** sqlite3_exec() is relayed through to the 1st argument of each
+** callback invocation. ^If the callback pointer to sqlite3_exec()
+** is NULL, then no callback is ever invoked and result rows are
+** ignored.
+**
+** ^If an error occurs while evaluating the SQL statements passed into
+** sqlite3_exec(), then execution of the current statement stops and
+** subsequent statements are skipped. ^If the 5th parameter to sqlite3_exec()
+** is not NULL then any error message is written into memory obtained
+** from [sqlite3_malloc()] and passed back through the 5th parameter.
+** To avoid memory leaks, the application should invoke [sqlite3_free()]
+** on error message strings returned through the 5th parameter of
+** sqlite3_exec() after the error message string is no longer needed.
+** ^If the 5th parameter to sqlite3_exec() is not NULL and no errors
+** occur, then sqlite3_exec() sets the pointer in its 5th parameter to
+** NULL before returning.
+**
+** ^If an sqlite3_exec() callback returns non-zero, the sqlite3_exec()
+** routine returns SQLITE_ABORT without invoking the callback again and
+** without running any subsequent SQL statements.
+**
+** ^The 2nd argument to the sqlite3_exec() callback function is the
+** number of columns in the result. ^The 3rd argument to the sqlite3_exec()
+** callback is an array of pointers to strings obtained as if from
+** [sqlite3_column_text()], one for each column. ^If an element of a
+** result row is NULL then the corresponding string pointer for the
+** sqlite3_exec() callback is a NULL pointer. ^The 4th argument to the
+** sqlite3_exec() callback is an array of pointers to strings where each
+** entry represents the name of corresponding result column as obtained
+** from [sqlite3_column_name()].
+**
+** ^If the 2nd parameter to sqlite3_exec() is a NULL pointer, a pointer
+** to an empty string, or a pointer that contains only whitespace and/or
+** SQL comments, then no SQL statements are evaluated and the database
+** is not changed.
+**
+** Restrictions:
+**
+** <ul>
+** <li> The application must ensure that the 1st parameter to sqlite3_exec()
+** is a valid and open [database connection].
+** <li> The application must not close the [database connection] specified by
+** the 1st parameter to sqlite3_exec() while sqlite3_exec() is running.
+** <li> The application must not modify the SQL statement text passed into
+** the 2nd parameter of sqlite3_exec() while sqlite3_exec() is running.
+** </ul>
+*/
+SQLITE_API int sqlite3_exec(
+ sqlite3*, /* An open database */
+ const char *sql, /* SQL to be evaluated */
+ int (*callback)(void*,int,char**,char**), /* Callback function */
+ void *, /* 1st argument to callback */
+ char **errmsg /* Error msg written here */
+);
+
+/*
+** CAPI3REF: Result Codes
+** KEYWORDS: {result code definitions}
+**
+** Many SQLite functions return an integer result code from the set shown
+** here in order to indicate success or failure.
+**
+** New error codes may be added in future versions of SQLite.
+**
+** See also: [extended result code definitions]
+*/
+#define SQLITE_OK 0 /* Successful result */
+/* beginning-of-error-codes */
+#define SQLITE_ERROR 1 /* Generic error */
+#define SQLITE_INTERNAL 2 /* Internal logic error in SQLite */
+#define SQLITE_PERM 3 /* Access permission denied */
+#define SQLITE_ABORT 4 /* Callback routine requested an abort */
+#define SQLITE_BUSY 5 /* The database file is locked */
+#define SQLITE_LOCKED 6 /* A table in the database is locked */
+#define SQLITE_NOMEM 7 /* A malloc() failed */
+#define SQLITE_READONLY 8 /* Attempt to write a readonly database */
+#define SQLITE_INTERRUPT 9 /* Operation terminated by sqlite3_interrupt()*/
+#define SQLITE_IOERR 10 /* Some kind of disk I/O error occurred */
+#define SQLITE_CORRUPT 11 /* The database disk image is malformed */
+#define SQLITE_NOTFOUND 12 /* Unknown opcode in sqlite3_file_control() */
+#define SQLITE_FULL 13 /* Insertion failed because database is full */
+#define SQLITE_CANTOPEN 14 /* Unable to open the database file */
+#define SQLITE_PROTOCOL 15 /* Database lock protocol error */
+#define SQLITE_EMPTY 16 /* Internal use only */
+#define SQLITE_SCHEMA 17 /* The database schema changed */
+#define SQLITE_TOOBIG 18 /* String or BLOB exceeds size limit */
+#define SQLITE_CONSTRAINT 19 /* Abort due to constraint violation */
+#define SQLITE_MISMATCH 20 /* Data type mismatch */
+#define SQLITE_MISUSE 21 /* Library used incorrectly */
+#define SQLITE_NOLFS 22 /* Uses OS features not supported on host */
+#define SQLITE_AUTH 23 /* Authorization denied */
+#define SQLITE_FORMAT 24 /* Not used */
+#define SQLITE_RANGE 25 /* 2nd parameter to sqlite3_bind out of range */
+#define SQLITE_NOTADB 26 /* File opened that is not a database file */
+#define SQLITE_NOTICE 27 /* Notifications from sqlite3_log() */
+#define SQLITE_WARNING 28 /* Warnings from sqlite3_log() */
+#define SQLITE_ROW 100 /* sqlite3_step() has another row ready */
+#define SQLITE_DONE 101 /* sqlite3_step() has finished executing */
+/* end-of-error-codes */
+
+/*
+** CAPI3REF: Extended Result Codes
+** KEYWORDS: {extended result code definitions}
+**
+** In its default configuration, SQLite API routines return one of 30 integer
+** [result codes]. However, experience has shown that many of
+** these result codes are too coarse-grained. They do not provide as
+** much information about problems as programmers might like. In an effort to
+** address this, newer versions of SQLite (version 3.3.8 [dateof:3.3.8]
+** and later) include
+** support for additional result codes that provide more detailed information
+** about errors. These [extended result codes] are enabled or disabled
+** on a per database connection basis using the
+** [sqlite3_extended_result_codes()] API. Or, the extended code for
+** the most recent error can be obtained using
+** [sqlite3_extended_errcode()].
+*/
+#define SQLITE_ERROR_MISSING_COLLSEQ (SQLITE_ERROR | (1<<8))
+#define SQLITE_ERROR_RETRY (SQLITE_ERROR | (2<<8))
+#define SQLITE_ERROR_SNAPSHOT (SQLITE_ERROR | (3<<8))
+#define SQLITE_IOERR_READ (SQLITE_IOERR | (1<<8))
+#define SQLITE_IOERR_SHORT_READ (SQLITE_IOERR | (2<<8))
+#define SQLITE_IOERR_WRITE (SQLITE_IOERR | (3<<8))
+#define SQLITE_IOERR_FSYNC (SQLITE_IOERR | (4<<8))
+#define SQLITE_IOERR_DIR_FSYNC (SQLITE_IOERR | (5<<8))
+#define SQLITE_IOERR_TRUNCATE (SQLITE_IOERR | (6<<8))
+#define SQLITE_IOERR_FSTAT (SQLITE_IOERR | (7<<8))
+#define SQLITE_IOERR_UNLOCK (SQLITE_IOERR | (8<<8))
+#define SQLITE_IOERR_RDLOCK (SQLITE_IOERR | (9<<8))
+#define SQLITE_IOERR_DELETE (SQLITE_IOERR | (10<<8))
+#define SQLITE_IOERR_BLOCKED (SQLITE_IOERR | (11<<8))
+#define SQLITE_IOERR_NOMEM (SQLITE_IOERR | (12<<8))
+#define SQLITE_IOERR_ACCESS (SQLITE_IOERR | (13<<8))
+#define SQLITE_IOERR_CHECKRESERVEDLOCK (SQLITE_IOERR | (14<<8))
+#define SQLITE_IOERR_LOCK (SQLITE_IOERR | (15<<8))
+#define SQLITE_IOERR_CLOSE (SQLITE_IOERR | (16<<8))
+#define SQLITE_IOERR_DIR_CLOSE (SQLITE_IOERR | (17<<8))
+#define SQLITE_IOERR_SHMOPEN (SQLITE_IOERR | (18<<8))
+#define SQLITE_IOERR_SHMSIZE (SQLITE_IOERR | (19<<8))
+#define SQLITE_IOERR_SHMLOCK (SQLITE_IOERR | (20<<8))
+#define SQLITE_IOERR_SHMMAP (SQLITE_IOERR | (21<<8))
+#define SQLITE_IOERR_SEEK (SQLITE_IOERR | (22<<8))
+#define SQLITE_IOERR_DELETE_NOENT (SQLITE_IOERR | (23<<8))
+#define SQLITE_IOERR_MMAP (SQLITE_IOERR | (24<<8))
+#define SQLITE_IOERR_GETTEMPPATH (SQLITE_IOERR | (25<<8))
+#define SQLITE_IOERR_CONVPATH (SQLITE_IOERR | (26<<8))
+#define SQLITE_IOERR_VNODE (SQLITE_IOERR | (27<<8))
+#define SQLITE_IOERR_AUTH (SQLITE_IOERR | (28<<8))
+#define SQLITE_IOERR_BEGIN_ATOMIC (SQLITE_IOERR | (29<<8))
+#define SQLITE_IOERR_COMMIT_ATOMIC (SQLITE_IOERR | (30<<8))
+#define SQLITE_IOERR_ROLLBACK_ATOMIC (SQLITE_IOERR | (31<<8))
+#define SQLITE_IOERR_DATA (SQLITE_IOERR | (32<<8))
+#define SQLITE_IOERR_CORRUPTFS (SQLITE_IOERR | (33<<8))
+#define SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1<<8))
+#define SQLITE_LOCKED_VTAB (SQLITE_LOCKED | (2<<8))
+#define SQLITE_BUSY_RECOVERY (SQLITE_BUSY | (1<<8))
+#define SQLITE_BUSY_SNAPSHOT (SQLITE_BUSY | (2<<8))
+#define SQLITE_BUSY_TIMEOUT (SQLITE_BUSY | (3<<8))
+#define SQLITE_CANTOPEN_NOTEMPDIR (SQLITE_CANTOPEN | (1<<8))
+#define SQLITE_CANTOPEN_ISDIR (SQLITE_CANTOPEN | (2<<8))
+#define SQLITE_CANTOPEN_FULLPATH (SQLITE_CANTOPEN | (3<<8))
+#define SQLITE_CANTOPEN_CONVPATH (SQLITE_CANTOPEN | (4<<8))
+#define SQLITE_CANTOPEN_DIRTYWAL (SQLITE_CANTOPEN | (5<<8)) /* Not Used */
+#define SQLITE_CANTOPEN_SYMLINK (SQLITE_CANTOPEN | (6<<8))
+#define SQLITE_CORRUPT_VTAB (SQLITE_CORRUPT | (1<<8))
+#define SQLITE_CORRUPT_SEQUENCE (SQLITE_CORRUPT | (2<<8))
+#define SQLITE_CORRUPT_INDEX (SQLITE_CORRUPT | (3<<8))
+#define SQLITE_READONLY_RECOVERY (SQLITE_READONLY | (1<<8))
+#define SQLITE_READONLY_CANTLOCK (SQLITE_READONLY | (2<<8))
+#define SQLITE_READONLY_ROLLBACK (SQLITE_READONLY | (3<<8))
+#define SQLITE_READONLY_DBMOVED (SQLITE_READONLY | (4<<8))
+#define SQLITE_READONLY_CANTINIT (SQLITE_READONLY | (5<<8))
+#define SQLITE_READONLY_DIRECTORY (SQLITE_READONLY | (6<<8))
+#define SQLITE_ABORT_ROLLBACK (SQLITE_ABORT | (2<<8))
+#define SQLITE_CONSTRAINT_CHECK (SQLITE_CONSTRAINT | (1<<8))
+#define SQLITE_CONSTRAINT_COMMITHOOK (SQLITE_CONSTRAINT | (2<<8))
+#define SQLITE_CONSTRAINT_FOREIGNKEY (SQLITE_CONSTRAINT | (3<<8))
+#define SQLITE_CONSTRAINT_FUNCTION (SQLITE_CONSTRAINT | (4<<8))
+#define SQLITE_CONSTRAINT_NOTNULL (SQLITE_CONSTRAINT | (5<<8))
+#define SQLITE_CONSTRAINT_PRIMARYKEY (SQLITE_CONSTRAINT | (6<<8))
+#define SQLITE_CONSTRAINT_TRIGGER (SQLITE_CONSTRAINT | (7<<8))
+#define SQLITE_CONSTRAINT_UNIQUE (SQLITE_CONSTRAINT | (8<<8))
+#define SQLITE_CONSTRAINT_VTAB (SQLITE_CONSTRAINT | (9<<8))
+#define SQLITE_CONSTRAINT_ROWID (SQLITE_CONSTRAINT |(10<<8))
+#define SQLITE_CONSTRAINT_PINNED (SQLITE_CONSTRAINT |(11<<8))
+#define SQLITE_NOTICE_RECOVER_WAL (SQLITE_NOTICE | (1<<8))
+#define SQLITE_NOTICE_RECOVER_ROLLBACK (SQLITE_NOTICE | (2<<8))
+#define SQLITE_WARNING_AUTOINDEX (SQLITE_WARNING | (1<<8))
+#define SQLITE_AUTH_USER (SQLITE_AUTH | (1<<8))
+#define SQLITE_OK_LOAD_PERMANENTLY (SQLITE_OK | (1<<8))
+#define SQLITE_OK_SYMLINK (SQLITE_OK | (2<<8))
+
+/*
+** CAPI3REF: Flags For File Open Operations
+**
+** These bit values are intended for use in the
+** 3rd parameter to the [sqlite3_open_v2()] interface and
+** in the 4th parameter to the [sqlite3_vfs.xOpen] method.
+*/
+#define SQLITE_OPEN_READONLY 0x00000001 /* Ok for sqlite3_open_v2() */
+#define SQLITE_OPEN_READWRITE 0x00000002 /* Ok for sqlite3_open_v2() */
+#define SQLITE_OPEN_CREATE 0x00000004 /* Ok for sqlite3_open_v2() */
+#define SQLITE_OPEN_DELETEONCLOSE 0x00000008 /* VFS only */
+#define SQLITE_OPEN_EXCLUSIVE 0x00000010 /* VFS only */
+#define SQLITE_OPEN_AUTOPROXY 0x00000020 /* VFS only */
+#define SQLITE_OPEN_URI 0x00000040 /* Ok for sqlite3_open_v2() */
+#define SQLITE_OPEN_MEMORY 0x00000080 /* Ok for sqlite3_open_v2() */
+#define SQLITE_OPEN_MAIN_DB 0x00000100 /* VFS only */
+#define SQLITE_OPEN_TEMP_DB 0x00000200 /* VFS only */
+#define SQLITE_OPEN_TRANSIENT_DB 0x00000400 /* VFS only */
+#define SQLITE_OPEN_MAIN_JOURNAL 0x00000800 /* VFS only */
+#define SQLITE_OPEN_TEMP_JOURNAL 0x00001000 /* VFS only */
+#define SQLITE_OPEN_SUBJOURNAL 0x00002000 /* VFS only */
+#define SQLITE_OPEN_SUPER_JOURNAL 0x00004000 /* VFS only */
+#define SQLITE_OPEN_NOMUTEX 0x00008000 /* Ok for sqlite3_open_v2() */
+#define SQLITE_OPEN_FULLMUTEX 0x00010000 /* Ok for sqlite3_open_v2() */
+#define SQLITE_OPEN_SHAREDCACHE 0x00020000 /* Ok for sqlite3_open_v2() */
+#define SQLITE_OPEN_PRIVATECACHE 0x00040000 /* Ok for sqlite3_open_v2() */
+#define SQLITE_OPEN_WAL 0x00080000 /* VFS only */
+#define SQLITE_OPEN_NOFOLLOW 0x01000000 /* Ok for sqlite3_open_v2() */
+
+/* Reserved: 0x00F00000 */
+/* Legacy compatibility: */
+#define SQLITE_OPEN_MASTER_JOURNAL 0x00004000 /* VFS only */
+
+
+/*
+** CAPI3REF: Device Characteristics
+**
+** The xDeviceCharacteristics method of the [sqlite3_io_methods]
+** object returns an integer which is a vector of these
+** bit values expressing I/O characteristics of the mass storage
+** device that holds the file that the [sqlite3_io_methods]
+** refers to.
+**
+** The SQLITE_IOCAP_ATOMIC property means that all writes of
+** any size are atomic. The SQLITE_IOCAP_ATOMICnnn values
+** mean that writes of blocks that are nnn bytes in size and
+** are aligned to an address which is an integer multiple of
+** nnn are atomic. The SQLITE_IOCAP_SAFE_APPEND value means
+** that when data is appended to a file, the data is appended
+** first then the size of the file is extended, never the other
+** way around. The SQLITE_IOCAP_SEQUENTIAL property means that
+** information is written to disk in the same order as calls
+** to xWrite(). The SQLITE_IOCAP_POWERSAFE_OVERWRITE property means that
+** after reboot following a crash or power loss, the only bytes in a
+** file that were written at the application level might have changed
+** and that adjacent bytes, even bytes within the same sector are
+** guaranteed to be unchanged. The SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN
+** flag indicates that a file cannot be deleted when open. The
+** SQLITE_IOCAP_IMMUTABLE flag indicates that the file is on
+** read-only media and cannot be changed even by processes with
+** elevated privileges.
+**
+** The SQLITE_IOCAP_BATCH_ATOMIC property means that the underlying
+** filesystem supports doing multiple write operations atomically when those
+** write operations are bracketed by [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] and
+** [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE].
+*/
+#define SQLITE_IOCAP_ATOMIC 0x00000001
+#define SQLITE_IOCAP_ATOMIC512 0x00000002
+#define SQLITE_IOCAP_ATOMIC1K 0x00000004
+#define SQLITE_IOCAP_ATOMIC2K 0x00000008
+#define SQLITE_IOCAP_ATOMIC4K 0x00000010
+#define SQLITE_IOCAP_ATOMIC8K 0x00000020
+#define SQLITE_IOCAP_ATOMIC16K 0x00000040
+#define SQLITE_IOCAP_ATOMIC32K 0x00000080
+#define SQLITE_IOCAP_ATOMIC64K 0x00000100
+#define SQLITE_IOCAP_SAFE_APPEND 0x00000200
+#define SQLITE_IOCAP_SEQUENTIAL 0x00000400
+#define SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN 0x00000800
+#define SQLITE_IOCAP_POWERSAFE_OVERWRITE 0x00001000
+#define SQLITE_IOCAP_IMMUTABLE 0x00002000
+#define SQLITE_IOCAP_BATCH_ATOMIC 0x00004000
+
+/*
+** CAPI3REF: File Locking Levels
+**
+** SQLite uses one of these integer values as the second
+** argument to calls it makes to the xLock() and xUnlock() methods
+** of an [sqlite3_io_methods] object.
+*/
+#define SQLITE_LOCK_NONE 0
+#define SQLITE_LOCK_SHARED 1
+#define SQLITE_LOCK_RESERVED 2
+#define SQLITE_LOCK_PENDING 3
+#define SQLITE_LOCK_EXCLUSIVE 4
+
+/*
+** CAPI3REF: Synchronization Type Flags
+**
+** When SQLite invokes the xSync() method of an
+** [sqlite3_io_methods] object it uses a combination of
+** these integer values as the second argument.
+**
+** When the SQLITE_SYNC_DATAONLY flag is used, it means that the
+** sync operation only needs to flush data to mass storage. Inode
+** information need not be flushed. If the lower four bits of the flag
+** equal SQLITE_SYNC_NORMAL, that means to use normal fsync() semantics.
+** If the lower four bits equal SQLITE_SYNC_FULL, that means
+** to use Mac OS X style fullsync instead of fsync().
+**
+** Do not confuse the SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL flags
+** with the [PRAGMA synchronous]=NORMAL and [PRAGMA synchronous]=FULL
+** settings. The [synchronous pragma] determines when calls to the
+** xSync VFS method occur and applies uniformly across all platforms.
+** The SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL flags determine how
+** energetic or rigorous or forceful the sync operations are and
+** only make a difference on Mac OSX for the default SQLite code.
+** (Third-party VFS implementations might also make the distinction
+** between SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL, but among the
+** operating systems natively supported by SQLite, only Mac OSX
+** cares about the difference.)
+*/
+#define SQLITE_SYNC_NORMAL 0x00002
+#define SQLITE_SYNC_FULL 0x00003
+#define SQLITE_SYNC_DATAONLY 0x00010
+
+/*
+** CAPI3REF: OS Interface Open File Handle
+**
+** An [sqlite3_file] object represents an open file in the
+** [sqlite3_vfs | OS interface layer]. Individual OS interface
+** implementations will
+** want to subclass this object by appending additional fields
+** for their own use. The pMethods entry is a pointer to an
+** [sqlite3_io_methods] object that defines methods for performing
+** I/O operations on the open file.
+*/
+typedef struct sqlite3_file sqlite3_file;
+struct sqlite3_file {
+ const struct sqlite3_io_methods *pMethods; /* Methods for an open file */
+};
+
+/*
+** CAPI3REF: OS Interface File Virtual Methods Object
+**
+** Every file opened by the [sqlite3_vfs.xOpen] method populates an
+** [sqlite3_file] object (or, more commonly, a subclass of the
+** [sqlite3_file] object) with a pointer to an instance of this object.
+** This object defines the methods used to perform various operations
+** against the open file represented by the [sqlite3_file] object.
+**
+** If the [sqlite3_vfs.xOpen] method sets the sqlite3_file.pMethods element
+** to a non-NULL pointer, then the sqlite3_io_methods.xClose method
+** may be invoked even if the [sqlite3_vfs.xOpen] reported that it failed. The
+** only way to prevent a call to xClose following a failed [sqlite3_vfs.xOpen]
+** is for the [sqlite3_vfs.xOpen] to set the sqlite3_file.pMethods element
+** to NULL.
+**
+** The flags argument to xSync may be one of [SQLITE_SYNC_NORMAL] or
+** [SQLITE_SYNC_FULL]. The first choice is the normal fsync().
+** The second choice is a Mac OS X style fullsync. The [SQLITE_SYNC_DATAONLY]
+** flag may be ORed in to indicate that only the data of the file
+** and not its inode needs to be synced.
+**
+** The integer values to xLock() and xUnlock() are one of
+** <ul>
+** <li> [SQLITE_LOCK_NONE],
+** <li> [SQLITE_LOCK_SHARED],
+** <li> [SQLITE_LOCK_RESERVED],
+** <li> [SQLITE_LOCK_PENDING], or
+** <li> [SQLITE_LOCK_EXCLUSIVE].
+** </ul>
+** xLock() increases the lock. xUnlock() decreases the lock.
+** The xCheckReservedLock() method checks whether any database connection,
+** either in this process or in some other process, is holding a RESERVED,
+** PENDING, or EXCLUSIVE lock on the file. It returns true
+** if such a lock exists and false otherwise.
+**
+** The xFileControl() method is a generic interface that allows custom
+** VFS implementations to directly control an open file using the
+** [sqlite3_file_control()] interface. The second "op" argument is an
+** integer opcode. The third argument is a generic pointer intended to
+** point to a structure that may contain arguments or space in which to
+** write return values. Potential uses for xFileControl() might be
+** functions to enable blocking locks with timeouts, to change the
+** locking strategy (for example to use dot-file locks), to inquire
+** about the status of a lock, or to break stale locks. The SQLite
+** core reserves all opcodes less than 100 for its own use.
+** A [file control opcodes | list of opcodes] less than 100 is available.
+** Applications that define a custom xFileControl method should use opcodes
+** greater than 100 to avoid conflicts. VFS implementations should
+** return [SQLITE_NOTFOUND] for file control opcodes that they do not
+** recognize.
+**
+** The xSectorSize() method returns the sector size of the
+** device that underlies the file. The sector size is the
+** minimum write that can be performed without disturbing
+** other bytes in the file. The xDeviceCharacteristics()
+** method returns a bit vector describing behaviors of the
+** underlying device:
+**
+** <ul>
+** <li> [SQLITE_IOCAP_ATOMIC]
+** <li> [SQLITE_IOCAP_ATOMIC512]
+** <li> [SQLITE_IOCAP_ATOMIC1K]
+** <li> [SQLITE_IOCAP_ATOMIC2K]
+** <li> [SQLITE_IOCAP_ATOMIC4K]
+** <li> [SQLITE_IOCAP_ATOMIC8K]
+** <li> [SQLITE_IOCAP_ATOMIC16K]
+** <li> [SQLITE_IOCAP_ATOMIC32K]
+** <li> [SQLITE_IOCAP_ATOMIC64K]
+** <li> [SQLITE_IOCAP_SAFE_APPEND]
+** <li> [SQLITE_IOCAP_SEQUENTIAL]
+** <li> [SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN]
+** <li> [SQLITE_IOCAP_POWERSAFE_OVERWRITE]
+** <li> [SQLITE_IOCAP_IMMUTABLE]
+** <li> [SQLITE_IOCAP_BATCH_ATOMIC]
+** </ul>
+**
+** The SQLITE_IOCAP_ATOMIC property means that all writes of
+** any size are atomic. The SQLITE_IOCAP_ATOMICnnn values
+** mean that writes of blocks that are nnn bytes in size and
+** are aligned to an address which is an integer multiple of
+** nnn are atomic. The SQLITE_IOCAP_SAFE_APPEND value means
+** that when data is appended to a file, the data is appended
+** first then the size of the file is extended, never the other
+** way around. The SQLITE_IOCAP_SEQUENTIAL property means that
+** information is written to disk in the same order as calls
+** to xWrite().
+**
+** If xRead() returns SQLITE_IOERR_SHORT_READ it must also fill
+** in the unread portions of the buffer with zeros. A VFS that
+** fails to zero-fill short reads might seem to work. However,
+** failure to zero-fill short reads will eventually lead to
+** database corruption.
+*/
+typedef struct sqlite3_io_methods sqlite3_io_methods;
+struct sqlite3_io_methods {
+ int iVersion;
+ int (*xClose)(sqlite3_file*);
+ int (*xRead)(sqlite3_file*, void*, int iAmt, sqlite3_int64 iOfst);
+ int (*xWrite)(sqlite3_file*, const void*, int iAmt, sqlite3_int64 iOfst);
+ int (*xTruncate)(sqlite3_file*, sqlite3_int64 size);
+ int (*xSync)(sqlite3_file*, int flags);
+ int (*xFileSize)(sqlite3_file*, sqlite3_int64 *pSize);
+ int (*xLock)(sqlite3_file*, int);
+ int (*xUnlock)(sqlite3_file*, int);
+ int (*xCheckReservedLock)(sqlite3_file*, int *pResOut);
+ int (*xFileControl)(sqlite3_file*, int op, void *pArg);
+ int (*xSectorSize)(sqlite3_file*);
+ int (*xDeviceCharacteristics)(sqlite3_file*);
+ /* Methods above are valid for version 1 */
+ int (*xShmMap)(sqlite3_file*, int iPg, int pgsz, int, void volatile**);
+ int (*xShmLock)(sqlite3_file*, int offset, int n, int flags);
+ void (*xShmBarrier)(sqlite3_file*);
+ int (*xShmUnmap)(sqlite3_file*, int deleteFlag);
+ /* Methods above are valid for version 2 */
+ int (*xFetch)(sqlite3_file*, sqlite3_int64 iOfst, int iAmt, void **pp);
+ int (*xUnfetch)(sqlite3_file*, sqlite3_int64 iOfst, void *p);
+ /* Methods above are valid for version 3 */
+ /* Additional methods may be added in future releases */
+};
+
+/*
+** CAPI3REF: Standard File Control Opcodes
+** KEYWORDS: {file control opcodes} {file control opcode}
+**
+** These integer constants are opcodes for the xFileControl method
+** of the [sqlite3_io_methods] object and for the [sqlite3_file_control()]
+** interface.
+**
+** <ul>
+** <li>[[SQLITE_FCNTL_LOCKSTATE]]
+** The [SQLITE_FCNTL_LOCKSTATE] opcode is used for debugging. This
+** opcode causes the xFileControl method to write the current state of
+** the lock (one of [SQLITE_LOCK_NONE], [SQLITE_LOCK_SHARED],
+** [SQLITE_LOCK_RESERVED], [SQLITE_LOCK_PENDING], or [SQLITE_LOCK_EXCLUSIVE])
+** into an integer that the pArg argument points to. This capability
+** is used during testing and is only available when the SQLITE_TEST
+** compile-time option is used.
+**
+** <li>[[SQLITE_FCNTL_SIZE_HINT]]
+** The [SQLITE_FCNTL_SIZE_HINT] opcode is used by SQLite to give the VFS
+** layer a hint of how large the database file will grow to be during the
+** current transaction. This hint is not guaranteed to be accurate but it
+** is often close. The underlying VFS might choose to preallocate database
+** file space based on this hint in order to help writes to the database
+** file run faster.
+**
+** <li>[[SQLITE_FCNTL_SIZE_LIMIT]]
+** The [SQLITE_FCNTL_SIZE_LIMIT] opcode is used by in-memory VFS that
+** implements [sqlite3_deserialize()] to set an upper bound on the size
+** of the in-memory database. The argument is a pointer to a [sqlite3_int64].
+** If the integer pointed to is negative, then it is filled in with the
+** current limit. Otherwise the limit is set to the larger of the value
+** of the integer pointed to and the current database size. The integer
+** pointed to is set to the new limit.
+**
+** <li>[[SQLITE_FCNTL_CHUNK_SIZE]]
+** The [SQLITE_FCNTL_CHUNK_SIZE] opcode is used to request that the VFS
+** extends and truncates the database file in chunks of a size specified
+** by the user. The fourth argument to [sqlite3_file_control()] should
+** point to an integer (type int) containing the new chunk-size to use
+** for the nominated database. Allocating database file space in large
+** chunks (say 1MB at a time), may reduce file-system fragmentation and
+** improve performance on some systems.
+**
+** <li>[[SQLITE_FCNTL_FILE_POINTER]]
+** The [SQLITE_FCNTL_FILE_POINTER] opcode is used to obtain a pointer
+** to the [sqlite3_file] object associated with a particular database
+** connection. See also [SQLITE_FCNTL_JOURNAL_POINTER].
+**
+** <li>[[SQLITE_FCNTL_JOURNAL_POINTER]]
+** The [SQLITE_FCNTL_JOURNAL_POINTER] opcode is used to obtain a pointer
+** to the [sqlite3_file] object associated with the journal file (either
+** the [rollback journal] or the [write-ahead log]) for a particular database
+** connection. See also [SQLITE_FCNTL_FILE_POINTER].
+**
+** <li>[[SQLITE_FCNTL_SYNC_OMITTED]]
+** No longer in use.
+**
+** <li>[[SQLITE_FCNTL_SYNC]]
+** The [SQLITE_FCNTL_SYNC] opcode is generated internally by SQLite and
+** sent to the VFS immediately before the xSync method is invoked on a
+** database file descriptor. Or, if the xSync method is not invoked
+** because the user has configured SQLite with
+** [PRAGMA synchronous | PRAGMA synchronous=OFF] it is invoked in place
+** of the xSync method. In most cases, the pointer argument passed with
+** this file-control is NULL. However, if the database file is being synced
+** as part of a multi-database commit, the argument points to a nul-terminated
+** string containing the transactions super-journal file name. VFSes that
+** do not need this signal should silently ignore this opcode. Applications
+** should not call [sqlite3_file_control()] with this opcode as doing so may
+** disrupt the operation of the specialized VFSes that do require it.
+**
+** <li>[[SQLITE_FCNTL_COMMIT_PHASETWO]]
+** The [SQLITE_FCNTL_COMMIT_PHASETWO] opcode is generated internally by SQLite
+** and sent to the VFS after a transaction has been committed immediately
+** but before the database is unlocked. VFSes that do not need this signal
+** should silently ignore this opcode. Applications should not call
+** [sqlite3_file_control()] with this opcode as doing so may disrupt the
+** operation of the specialized VFSes that do require it.
+**
+** <li>[[SQLITE_FCNTL_WIN32_AV_RETRY]]
+** ^The [SQLITE_FCNTL_WIN32_AV_RETRY] opcode is used to configure automatic
+** retry counts and intervals for certain disk I/O operations for the
+** windows [VFS] in order to provide robustness in the presence of
+** anti-virus programs. By default, the windows VFS will retry file read,
+** file write, and file delete operations up to 10 times, with a delay
+** of 25 milliseconds before the first retry and with the delay increasing
+** by an additional 25 milliseconds with each subsequent retry. This
+** opcode allows these two values (10 retries and 25 milliseconds of delay)
+** to be adjusted. The values are changed for all database connections
+** within the same process. The argument is a pointer to an array of two
+** integers where the first integer is the new retry count and the second
+** integer is the delay. If either integer is negative, then the setting
+** is not changed but instead the prior value of that setting is written
+** into the array entry, allowing the current retry settings to be
+** interrogated. The zDbName parameter is ignored.
+**
+** <li>[[SQLITE_FCNTL_PERSIST_WAL]]
+** ^The [SQLITE_FCNTL_PERSIST_WAL] opcode is used to set or query the
+** persistent [WAL | Write Ahead Log] setting. By default, the auxiliary
+** write ahead log ([WAL file]) and shared memory
+** files used for transaction control
+** are automatically deleted when the latest connection to the database
+** closes. Setting persistent WAL mode causes those files to persist after
+** close. Persisting the files is useful when other processes that do not
+** have write permission on the directory containing the database file want
+** to read the database file, as the WAL and shared memory files must exist
+** in order for the database to be readable. The fourth parameter to
+** [sqlite3_file_control()] for this opcode should be a pointer to an integer.
+** That integer is 0 to disable persistent WAL mode or 1 to enable persistent
+** WAL mode. If the integer is -1, then it is overwritten with the current
+** WAL persistence setting.
+**
+** <li>[[SQLITE_FCNTL_POWERSAFE_OVERWRITE]]
+** ^The [SQLITE_FCNTL_POWERSAFE_OVERWRITE] opcode is used to set or query the
+** persistent "powersafe-overwrite" or "PSOW" setting. The PSOW setting
+** determines the [SQLITE_IOCAP_POWERSAFE_OVERWRITE] bit of the
+** xDeviceCharacteristics methods. The fourth parameter to
+** [sqlite3_file_control()] for this opcode should be a pointer to an integer.
+** That integer is 0 to disable zero-damage mode or 1 to enable zero-damage
+** mode. If the integer is -1, then it is overwritten with the current
+** zero-damage mode setting.
+**
+** <li>[[SQLITE_FCNTL_OVERWRITE]]
+** ^The [SQLITE_FCNTL_OVERWRITE] opcode is invoked by SQLite after opening
+** a write transaction to indicate that, unless it is rolled back for some
+** reason, the entire database file will be overwritten by the current
+** transaction. This is used by VACUUM operations.
+**
+** <li>[[SQLITE_FCNTL_VFSNAME]]
+** ^The [SQLITE_FCNTL_VFSNAME] opcode can be used to obtain the names of
+** all [VFSes] in the VFS stack. The names are of all VFS shims and the
+** final bottom-level VFS are written into memory obtained from
+** [sqlite3_malloc()] and the result is stored in the char* variable
+** that the fourth parameter of [sqlite3_file_control()] points to.
+** The caller is responsible for freeing the memory when done. As with
+** all file-control actions, there is no guarantee that this will actually
+** do anything. Callers should initialize the char* variable to a NULL
+** pointer in case this file-control is not implemented. This file-control
+** is intended for diagnostic use only.
+**
+** <li>[[SQLITE_FCNTL_VFS_POINTER]]
+** ^The [SQLITE_FCNTL_VFS_POINTER] opcode finds a pointer to the top-level
+** [VFSes] currently in use. ^(The argument X in
+** sqlite3_file_control(db,SQLITE_FCNTL_VFS_POINTER,X) must be
+** of type "[sqlite3_vfs] **". This opcodes will set *X
+** to a pointer to the top-level VFS.)^
+** ^When there are multiple VFS shims in the stack, this opcode finds the
+** upper-most shim only.
+**
+** <li>[[SQLITE_FCNTL_PRAGMA]]
+** ^Whenever a [PRAGMA] statement is parsed, an [SQLITE_FCNTL_PRAGMA]
+** file control is sent to the open [sqlite3_file] object corresponding
+** to the database file to which the pragma statement refers. ^The argument
+** to the [SQLITE_FCNTL_PRAGMA] file control is an array of
+** pointers to strings (char**) in which the second element of the array
+** is the name of the pragma and the third element is the argument to the
+** pragma or NULL if the pragma has no argument. ^The handler for an
+** [SQLITE_FCNTL_PRAGMA] file control can optionally make the first element
+** of the char** argument point to a string obtained from [sqlite3_mprintf()]
+** or the equivalent and that string will become the result of the pragma or
+** the error message if the pragma fails. ^If the
+** [SQLITE_FCNTL_PRAGMA] file control returns [SQLITE_NOTFOUND], then normal
+** [PRAGMA] processing continues. ^If the [SQLITE_FCNTL_PRAGMA]
+** file control returns [SQLITE_OK], then the parser assumes that the
+** VFS has handled the PRAGMA itself and the parser generates a no-op
+** prepared statement if result string is NULL, or that returns a copy
+** of the result string if the string is non-NULL.
+** ^If the [SQLITE_FCNTL_PRAGMA] file control returns
+** any result code other than [SQLITE_OK] or [SQLITE_NOTFOUND], that means
+** that the VFS encountered an error while handling the [PRAGMA] and the
+** compilation of the PRAGMA fails with an error. ^The [SQLITE_FCNTL_PRAGMA]
+** file control occurs at the beginning of pragma statement analysis and so
+** it is able to override built-in [PRAGMA] statements.
+**
+** <li>[[SQLITE_FCNTL_BUSYHANDLER]]
+** ^The [SQLITE_FCNTL_BUSYHANDLER]
+** file-control may be invoked by SQLite on the database file handle
+** shortly after it is opened in order to provide a custom VFS with access
+** to the connection's busy-handler callback. The argument is of type (void**)
+** - an array of two (void *) values. The first (void *) actually points
+** to a function of type (int (*)(void *)). In order to invoke the connection's
+** busy-handler, this function should be invoked with the second (void *) in
+** the array as the only argument. If it returns non-zero, then the operation
+** should be retried. If it returns zero, the custom VFS should abandon the
+** current operation.
+**
+** <li>[[SQLITE_FCNTL_TEMPFILENAME]]
+** ^Applications can invoke the [SQLITE_FCNTL_TEMPFILENAME] file-control
+** to have SQLite generate a
+** temporary filename using the same algorithm that is followed to generate
+** temporary filenames for TEMP tables and other internal uses. The
+** argument should be a char** which will be filled with the filename
+** written into memory obtained from [sqlite3_malloc()]. The caller should
+** invoke [sqlite3_free()] on the result to avoid a memory leak.
+**
+** <li>[[SQLITE_FCNTL_MMAP_SIZE]]
+** The [SQLITE_FCNTL_MMAP_SIZE] file control is used to query or set the
+** maximum number of bytes that will be used for memory-mapped I/O.
+** The argument is a pointer to a value of type sqlite3_int64 that
+** is an advisory maximum number of bytes in the file to memory map. The
+** pointer is overwritten with the old value. The limit is not changed if
+** the value originally pointed to is negative, and so the current limit
+** can be queried by passing in a pointer to a negative number. This
+** file-control is used internally to implement [PRAGMA mmap_size].
+**
+** <li>[[SQLITE_FCNTL_TRACE]]
+** The [SQLITE_FCNTL_TRACE] file control provides advisory information
+** to the VFS about what the higher layers of the SQLite stack are doing.
+** This file control is used by some VFS activity tracing [shims].
+** The argument is a zero-terminated string. Higher layers in the
+** SQLite stack may generate instances of this file control if
+** the [SQLITE_USE_FCNTL_TRACE] compile-time option is enabled.
+**
+** <li>[[SQLITE_FCNTL_HAS_MOVED]]
+** The [SQLITE_FCNTL_HAS_MOVED] file control interprets its argument as a
+** pointer to an integer and it writes a boolean into that integer depending
+** on whether or not the file has been renamed, moved, or deleted since it
+** was first opened.
+**
+** <li>[[SQLITE_FCNTL_WIN32_GET_HANDLE]]
+** The [SQLITE_FCNTL_WIN32_GET_HANDLE] opcode can be used to obtain the
+** underlying native file handle associated with a file handle. This file
+** control interprets its argument as a pointer to a native file handle and
+** writes the resulting value there.
+**
+** <li>[[SQLITE_FCNTL_WIN32_SET_HANDLE]]
+** The [SQLITE_FCNTL_WIN32_SET_HANDLE] opcode is used for debugging. This
+** opcode causes the xFileControl method to swap the file handle with the one
+** pointed to by the pArg argument. This capability is used during testing
+** and only needs to be supported when SQLITE_TEST is defined.
+**
+** <li>[[SQLITE_FCNTL_WAL_BLOCK]]
+** The [SQLITE_FCNTL_WAL_BLOCK] is a signal to the VFS layer that it might
+** be advantageous to block on the next WAL lock if the lock is not immediately
+** available. The WAL subsystem issues this signal during rare
+** circumstances in order to fix a problem with priority inversion.
+** Applications should <em>not</em> use this file-control.
+**
+** <li>[[SQLITE_FCNTL_ZIPVFS]]
+** The [SQLITE_FCNTL_ZIPVFS] opcode is implemented by zipvfs only. All other
+** VFS should return SQLITE_NOTFOUND for this opcode.
+**
+** <li>[[SQLITE_FCNTL_RBU]]
+** The [SQLITE_FCNTL_RBU] opcode is implemented by the special VFS used by
+** the RBU extension only. All other VFS should return SQLITE_NOTFOUND for
+** this opcode.
+**
+** <li>[[SQLITE_FCNTL_BEGIN_ATOMIC_WRITE]]
+** If the [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] opcode returns SQLITE_OK, then
+** the file descriptor is placed in "batch write mode", which
+** means all subsequent write operations will be deferred and done
+** atomically at the next [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE]. Systems
+** that do not support batch atomic writes will return SQLITE_NOTFOUND.
+** ^Following a successful SQLITE_FCNTL_BEGIN_ATOMIC_WRITE and prior to
+** the closing [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE] or
+** [SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE], SQLite will make
+** no VFS interface calls on the same [sqlite3_file] file descriptor
+** except for calls to the xWrite method and the xFileControl method
+** with [SQLITE_FCNTL_SIZE_HINT].
+**
+** <li>[[SQLITE_FCNTL_COMMIT_ATOMIC_WRITE]]
+** The [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE] opcode causes all write
+** operations since the previous successful call to
+** [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] to be performed atomically.
+** This file control returns [SQLITE_OK] if and only if the writes were
+** all performed successfully and have been committed to persistent storage.
+** ^Regardless of whether or not it is successful, this file control takes
+** the file descriptor out of batch write mode so that all subsequent
+** write operations are independent.
+** ^SQLite will never invoke SQLITE_FCNTL_COMMIT_ATOMIC_WRITE without
+** a prior successful call to [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE].
+**
+** <li>[[SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE]]
+** The [SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE] opcode causes all write
+** operations since the previous successful call to
+** [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] to be rolled back.
+** ^This file control takes the file descriptor out of batch write mode
+** so that all subsequent write operations are independent.
+** ^SQLite will never invoke SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE without
+** a prior successful call to [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE].
+**
+** <li>[[SQLITE_FCNTL_LOCK_TIMEOUT]]
+** The [SQLITE_FCNTL_LOCK_TIMEOUT] opcode is used to configure a VFS
+** to block for up to M milliseconds before failing when attempting to
+** obtain a file lock using the xLock or xShmLock methods of the VFS.
+** The parameter is a pointer to a 32-bit signed integer that contains
+** the value that M is to be set to. Before returning, the 32-bit signed
+** integer is overwritten with the previous value of M.
+**
+** <li>[[SQLITE_FCNTL_DATA_VERSION]]
+** The [SQLITE_FCNTL_DATA_VERSION] opcode is used to detect changes to
+** a database file. The argument is a pointer to a 32-bit unsigned integer.
+** The "data version" for the pager is written into the pointer. The
+** "data version" changes whenever any change occurs to the corresponding
+** database file, either through SQL statements on the same database
+** connection or through transactions committed by separate database
+** connections possibly in other processes. The [sqlite3_total_changes()]
+** interface can be used to find if any database on the connection has changed,
+** but that interface responds to changes on TEMP as well as MAIN and does
+** not provide a mechanism to detect changes to MAIN only. Also, the
+** [sqlite3_total_changes()] interface responds to internal changes only and
+** omits changes made by other database connections. The
+** [PRAGMA data_version] command provides a mechanism to detect changes to
+** a single attached database that occur due to other database connections,
+** but omits changes implemented by the database connection on which it is
+** called. This file control is the only mechanism to detect changes that
+** happen either internally or externally and that are associated with
+** a particular attached database.
+**
+** <li>[[SQLITE_FCNTL_CKPT_START]]
+** The [SQLITE_FCNTL_CKPT_START] opcode is invoked from within a checkpoint
+** in wal mode before the client starts to copy pages from the wal
+** file to the database file.
+**
+** <li>[[SQLITE_FCNTL_CKPT_DONE]]
+** The [SQLITE_FCNTL_CKPT_DONE] opcode is invoked from within a checkpoint
+** in wal mode after the client has finished copying pages from the wal
+** file to the database file, but before the *-shm file is updated to
+** record the fact that the pages have been checkpointed.
+** </ul>
+*/
+#define SQLITE_FCNTL_LOCKSTATE 1
+#define SQLITE_FCNTL_GET_LOCKPROXYFILE 2
+#define SQLITE_FCNTL_SET_LOCKPROXYFILE 3
+#define SQLITE_FCNTL_LAST_ERRNO 4
+#define SQLITE_FCNTL_SIZE_HINT 5
+#define SQLITE_FCNTL_CHUNK_SIZE 6
+#define SQLITE_FCNTL_FILE_POINTER 7
+#define SQLITE_FCNTL_SYNC_OMITTED 8
+#define SQLITE_FCNTL_WIN32_AV_RETRY 9
+#define SQLITE_FCNTL_PERSIST_WAL 10
+#define SQLITE_FCNTL_OVERWRITE 11
+#define SQLITE_FCNTL_VFSNAME 12
+#define SQLITE_FCNTL_POWERSAFE_OVERWRITE 13
+#define SQLITE_FCNTL_PRAGMA 14
+#define SQLITE_FCNTL_BUSYHANDLER 15
+#define SQLITE_FCNTL_TEMPFILENAME 16
+#define SQLITE_FCNTL_MMAP_SIZE 18
+#define SQLITE_FCNTL_TRACE 19
+#define SQLITE_FCNTL_HAS_MOVED 20
+#define SQLITE_FCNTL_SYNC 21
+#define SQLITE_FCNTL_COMMIT_PHASETWO 22
+#define SQLITE_FCNTL_WIN32_SET_HANDLE 23
+#define SQLITE_FCNTL_WAL_BLOCK 24
+#define SQLITE_FCNTL_ZIPVFS 25
+#define SQLITE_FCNTL_RBU 26
+#define SQLITE_FCNTL_VFS_POINTER 27
+#define SQLITE_FCNTL_JOURNAL_POINTER 28
+#define SQLITE_FCNTL_WIN32_GET_HANDLE 29
+#define SQLITE_FCNTL_PDB 30
+#define SQLITE_FCNTL_BEGIN_ATOMIC_WRITE 31
+#define SQLITE_FCNTL_COMMIT_ATOMIC_WRITE 32
+#define SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE 33
+#define SQLITE_FCNTL_LOCK_TIMEOUT 34
+#define SQLITE_FCNTL_DATA_VERSION 35
+#define SQLITE_FCNTL_SIZE_LIMIT 36
+#define SQLITE_FCNTL_CKPT_DONE 37
+#define SQLITE_FCNTL_RESERVE_BYTES 38
+#define SQLITE_FCNTL_CKPT_START 39
+
+/* deprecated names */
+#define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE
+#define SQLITE_SET_LOCKPROXYFILE SQLITE_FCNTL_SET_LOCKPROXYFILE
+#define SQLITE_LAST_ERRNO SQLITE_FCNTL_LAST_ERRNO
+
+
+/*
+** CAPI3REF: Mutex Handle
+**
+** The mutex module within SQLite defines [sqlite3_mutex] to be an
+** abstract type for a mutex object. The SQLite core never looks
+** at the internal representation of an [sqlite3_mutex]. It only
+** deals with pointers to the [sqlite3_mutex] object.
+**
+** Mutexes are created using [sqlite3_mutex_alloc()].
+*/
+typedef struct sqlite3_mutex sqlite3_mutex;
+
+/*
+** CAPI3REF: Loadable Extension Thunk
+**
+** A pointer to the opaque sqlite3_api_routines structure is passed as
+** the third parameter to entry points of [loadable extensions]. This
+** structure must be typedefed in order to work around compiler warnings
+** on some platforms.
+*/
+typedef struct sqlite3_api_routines sqlite3_api_routines;
+
+/*
+** CAPI3REF: OS Interface Object
+**
+** An instance of the sqlite3_vfs object defines the interface between
+** the SQLite core and the underlying operating system. The "vfs"
+** in the name of the object stands for "virtual file system". See
+** the [VFS | VFS documentation] for further information.
+**
+** The VFS interface is sometimes extended by adding new methods onto
+** the end. Each time such an extension occurs, the iVersion field
+** is incremented. The iVersion value started out as 1 in
+** SQLite [version 3.5.0] on [dateof:3.5.0], then increased to 2
+** with SQLite [version 3.7.0] on [dateof:3.7.0], and then increased
+** to 3 with SQLite [version 3.7.6] on [dateof:3.7.6]. Additional fields
+** may be appended to the sqlite3_vfs object and the iVersion value
+** may increase again in future versions of SQLite.
+** Note that due to an oversight, the structure
+** of the sqlite3_vfs object changed in the transition from
+** SQLite [version 3.5.9] to [version 3.6.0] on [dateof:3.6.0]
+** and yet the iVersion field was not increased.
+**
+** The szOsFile field is the size of the subclassed [sqlite3_file]
+** structure used by this VFS. mxPathname is the maximum length of
+** a pathname in this VFS.
+**
+** Registered sqlite3_vfs objects are kept on a linked list formed by
+** the pNext pointer. The [sqlite3_vfs_register()]
+** and [sqlite3_vfs_unregister()] interfaces manage this list
+** in a thread-safe way. The [sqlite3_vfs_find()] interface
+** searches the list. Neither the application code nor the VFS
+** implementation should use the pNext pointer.
+**
+** The pNext field is the only field in the sqlite3_vfs
+** structure that SQLite will ever modify. SQLite will only access
+** or modify this field while holding a particular static mutex.
+** The application should never modify anything within the sqlite3_vfs
+** object once the object has been registered.
+**
+** The zName field holds the name of the VFS module. The name must
+** be unique across all VFS modules.
+**
+** [[sqlite3_vfs.xOpen]]
+** ^SQLite guarantees that the zFilename parameter to xOpen
+** is either a NULL pointer or string obtained
+** from xFullPathname() with an optional suffix added.
+** ^If a suffix is added to the zFilename parameter, it will
+** consist of a single "-" character followed by no more than
+** 11 alphanumeric and/or "-" characters.
+** ^SQLite further guarantees that
+** the string will be valid and unchanged until xClose() is
+** called. Because of the previous sentence,
+** the [sqlite3_file] can safely store a pointer to the
+** filename if it needs to remember the filename for some reason.
+** If the zFilename parameter to xOpen is a NULL pointer then xOpen
+** must invent its own temporary name for the file. ^Whenever the
+** xFilename parameter is NULL it will also be the case that the
+** flags parameter will include [SQLITE_OPEN_DELETEONCLOSE].
+**
+** The flags argument to xOpen() includes all bits set in
+** the flags argument to [sqlite3_open_v2()]. Or if [sqlite3_open()]
+** or [sqlite3_open16()] is used, then flags includes at least
+** [SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE].
+** If xOpen() opens a file read-only then it sets *pOutFlags to
+** include [SQLITE_OPEN_READONLY]. Other bits in *pOutFlags may be set.
+**
+** ^(SQLite will also add one of the following flags to the xOpen()
+** call, depending on the object being opened:
+**
+** <ul>
+** <li> [SQLITE_OPEN_MAIN_DB]
+** <li> [SQLITE_OPEN_MAIN_JOURNAL]
+** <li> [SQLITE_OPEN_TEMP_DB]
+** <li> [SQLITE_OPEN_TEMP_JOURNAL]
+** <li> [SQLITE_OPEN_TRANSIENT_DB]
+** <li> [SQLITE_OPEN_SUBJOURNAL]
+** <li> [SQLITE_OPEN_SUPER_JOURNAL]
+** <li> [SQLITE_OPEN_WAL]
+** </ul>)^
+**
+** The file I/O implementation can use the object type flags to
+** change the way it deals with files. For example, an application
+** that does not care about crash recovery or rollback might make
+** the open of a journal file a no-op. Writes to this journal would
+** also be no-ops, and any attempt to read the journal would return
+** SQLITE_IOERR. Or the implementation might recognize that a database
+** file will be doing page-aligned sector reads and writes in a random
+** order and set up its I/O subsystem accordingly.
+**
+** SQLite might also add one of the following flags to the xOpen method:
+**
+** <ul>
+** <li> [SQLITE_OPEN_DELETEONCLOSE]
+** <li> [SQLITE_OPEN_EXCLUSIVE]
+** </ul>
+**
+** The [SQLITE_OPEN_DELETEONCLOSE] flag means the file should be
+** deleted when it is closed. ^The [SQLITE_OPEN_DELETEONCLOSE]
+** will be set for TEMP databases and their journals, transient
+** databases, and subjournals.
+**
+** ^The [SQLITE_OPEN_EXCLUSIVE] flag is always used in conjunction
+** with the [SQLITE_OPEN_CREATE] flag, which are both directly
+** analogous to the O_EXCL and O_CREAT flags of the POSIX open()
+** API. The SQLITE_OPEN_EXCLUSIVE flag, when paired with the
+** SQLITE_OPEN_CREATE, is used to indicate that file should always
+** be created, and that it is an error if it already exists.
+** It is <i>not</i> used to indicate the file should be opened
+** for exclusive access.
+**
+** ^At least szOsFile bytes of memory are allocated by SQLite
+** to hold the [sqlite3_file] structure passed as the third
+** argument to xOpen. The xOpen method does not have to
+** allocate the structure; it should just fill it in. Note that
+** the xOpen method must set the sqlite3_file.pMethods to either
+** a valid [sqlite3_io_methods] object or to NULL. xOpen must do
+** this even if the open fails. SQLite expects that the sqlite3_file.pMethods
+** element will be valid after xOpen returns regardless of the success
+** or failure of the xOpen call.
+**
+** [[sqlite3_vfs.xAccess]]
+** ^The flags argument to xAccess() may be [SQLITE_ACCESS_EXISTS]
+** to test for the existence of a file, or [SQLITE_ACCESS_READWRITE] to
+** test whether a file is readable and writable, or [SQLITE_ACCESS_READ]
+** to test whether a file is at least readable. The SQLITE_ACCESS_READ
+** flag is never actually used and is not implemented in the built-in
+** VFSes of SQLite. The file is named by the second argument and can be a
+** directory. The xAccess method returns [SQLITE_OK] on success or some
+** non-zero error code if there is an I/O error or if the name of
+** the file given in the second argument is illegal. If SQLITE_OK
+** is returned, then non-zero or zero is written into *pResOut to indicate
+** whether or not the file is accessible.
+**
+** ^SQLite will always allocate at least mxPathname+1 bytes for the
+** output buffer xFullPathname. The exact size of the output buffer
+** is also passed as a parameter to both methods. If the output buffer
+** is not large enough, [SQLITE_CANTOPEN] should be returned. Since this is
+** handled as a fatal error by SQLite, vfs implementations should endeavor
+** to prevent this by setting mxPathname to a sufficiently large value.
+**
+** The xRandomness(), xSleep(), xCurrentTime(), and xCurrentTimeInt64()
+** interfaces are not strictly a part of the filesystem, but they are
+** included in the VFS structure for completeness.
+** The xRandomness() function attempts to return nBytes bytes
+** of good-quality randomness into zOut. The return value is
+** the actual number of bytes of randomness obtained.
+** The xSleep() method causes the calling thread to sleep for at
+** least the number of microseconds given. ^The xCurrentTime()
+** method returns a Julian Day Number for the current date and time as
+** a floating point value.
+** ^The xCurrentTimeInt64() method returns, as an integer, the Julian
+** Day Number multiplied by 86400000 (the number of milliseconds in
+** a 24-hour day).
+** ^SQLite will use the xCurrentTimeInt64() method to get the current
+** date and time if that method is available (if iVersion is 2 or
+** greater and the function pointer is not NULL) and will fall back
+** to xCurrentTime() if xCurrentTimeInt64() is unavailable.
+**
+** ^The xSetSystemCall(), xGetSystemCall(), and xNestSystemCall() interfaces
+** are not used by the SQLite core. These optional interfaces are provided
+** by some VFSes to facilitate testing of the VFS code. By overriding
+** system calls with functions under its control, a test program can
+** simulate faults and error conditions that would otherwise be difficult
+** or impossible to induce. The set of system calls that can be overridden
+** varies from one VFS to another, and from one version of the same VFS to the
+** next. Applications that use these interfaces must be prepared for any
+** or all of these interfaces to be NULL or for their behavior to change
+** from one release to the next. Applications must not attempt to access
+** any of these methods if the iVersion of the VFS is less than 3.
+*/
+typedef struct sqlite3_vfs sqlite3_vfs;
+typedef void (*sqlite3_syscall_ptr)(void);
+struct sqlite3_vfs {
+ int iVersion; /* Structure version number (currently 3) */
+ int szOsFile; /* Size of subclassed sqlite3_file */
+ int mxPathname; /* Maximum file pathname length */
+ sqlite3_vfs *pNext; /* Next registered VFS */
+ const char *zName; /* Name of this virtual file system */
+ void *pAppData; /* Pointer to application-specific data */
+ int (*xOpen)(sqlite3_vfs*, const char *zName, sqlite3_file*,
+ int flags, int *pOutFlags);
+ int (*xDelete)(sqlite3_vfs*, const char *zName, int syncDir);
+ int (*xAccess)(sqlite3_vfs*, const char *zName, int flags, int *pResOut);
+ int (*xFullPathname)(sqlite3_vfs*, const char *zName, int nOut, char *zOut);
+ void *(*xDlOpen)(sqlite3_vfs*, const char *zFilename);
+ void (*xDlError)(sqlite3_vfs*, int nByte, char *zErrMsg);
+ void (*(*xDlSym)(sqlite3_vfs*,void*, const char *zSymbol))(void);
+ void (*xDlClose)(sqlite3_vfs*, void*);
+ int (*xRandomness)(sqlite3_vfs*, int nByte, char *zOut);
+ int (*xSleep)(sqlite3_vfs*, int microseconds);
+ int (*xCurrentTime)(sqlite3_vfs*, double*);
+ int (*xGetLastError)(sqlite3_vfs*, int, char *);
+ /*
+ ** The methods above are in version 1 of the sqlite_vfs object
+ ** definition. Those that follow are added in version 2 or later
+ */
+ int (*xCurrentTimeInt64)(sqlite3_vfs*, sqlite3_int64*);
+ /*
+ ** The methods above are in versions 1 and 2 of the sqlite_vfs object.
+ ** Those below are for version 3 and greater.
+ */
+ int (*xSetSystemCall)(sqlite3_vfs*, const char *zName, sqlite3_syscall_ptr);
+ sqlite3_syscall_ptr (*xGetSystemCall)(sqlite3_vfs*, const char *zName);
+ const char *(*xNextSystemCall)(sqlite3_vfs*, const char *zName);
+ /*
+ ** The methods above are in versions 1 through 3 of the sqlite_vfs object.
+ ** New fields may be appended in future versions. The iVersion
+ ** value will increment whenever this happens.
+ */
+};
+
+/*
+** CAPI3REF: Flags for the xAccess VFS method
+**
+** These integer constants can be used as the third parameter to
+** the xAccess method of an [sqlite3_vfs] object. They determine
+** what kind of permissions the xAccess method is looking for.
+** With SQLITE_ACCESS_EXISTS, the xAccess method
+** simply checks whether the file exists.
+** With SQLITE_ACCESS_READWRITE, the xAccess method
+** checks whether the named directory is both readable and writable
+** (in other words, if files can be added, removed, and renamed within
+** the directory).
+** The SQLITE_ACCESS_READWRITE constant is currently used only by the
+** [temp_store_directory pragma], though this could change in a future
+** release of SQLite.
+** With SQLITE_ACCESS_READ, the xAccess method
+** checks whether the file is readable. The SQLITE_ACCESS_READ constant is
+** currently unused, though it might be used in a future release of
+** SQLite.
+*/
+#define SQLITE_ACCESS_EXISTS 0
+#define SQLITE_ACCESS_READWRITE 1 /* Used by PRAGMA temp_store_directory */
+#define SQLITE_ACCESS_READ 2 /* Unused */
+
+/*
+** CAPI3REF: Flags for the xShmLock VFS method
+**
+** These integer constants define the various locking operations
+** allowed by the xShmLock method of [sqlite3_io_methods]. The
+** following are the only legal combinations of flags to the
+** xShmLock method:
+**
+** <ul>
+** <li> SQLITE_SHM_LOCK | SQLITE_SHM_SHARED
+** <li> SQLITE_SHM_LOCK | SQLITE_SHM_EXCLUSIVE
+** <li> SQLITE_SHM_UNLOCK | SQLITE_SHM_SHARED
+** <li> SQLITE_SHM_UNLOCK | SQLITE_SHM_EXCLUSIVE
+** </ul>
+**
+** When unlocking, the same SHARED or EXCLUSIVE flag must be supplied as
+** was given on the corresponding lock.
+**
+** The xShmLock method can transition between unlocked and SHARED or
+** between unlocked and EXCLUSIVE. It cannot transition between SHARED
+** and EXCLUSIVE.
+*/
+#define SQLITE_SHM_UNLOCK 1
+#define SQLITE_SHM_LOCK 2
+#define SQLITE_SHM_SHARED 4
+#define SQLITE_SHM_EXCLUSIVE 8
+
+/*
+** CAPI3REF: Maximum xShmLock index
+**
+** The xShmLock method on [sqlite3_io_methods] may use values
+** between 0 and this upper bound as its "offset" argument.
+** The SQLite core will never attempt to acquire or release a
+** lock outside of this range
+*/
+#define SQLITE_SHM_NLOCK 8
+
+
+/*
+** CAPI3REF: Initialize The SQLite Library
+**
+** ^The sqlite3_initialize() routine initializes the
+** SQLite library. ^The sqlite3_shutdown() routine
+** deallocates any resources that were allocated by sqlite3_initialize().
+** These routines are designed to aid in process initialization and
+** shutdown on embedded systems. Workstation applications using
+** SQLite normally do not need to invoke either of these routines.
+**
+** A call to sqlite3_initialize() is an "effective" call if it is
+** the first time sqlite3_initialize() is invoked during the lifetime of
+** the process, or if it is the first time sqlite3_initialize() is invoked
+** following a call to sqlite3_shutdown(). ^(Only an effective call
+** of sqlite3_initialize() does any initialization. All other calls
+** are harmless no-ops.)^
+**
+** A call to sqlite3_shutdown() is an "effective" call if it is the first
+** call to sqlite3_shutdown() since the last sqlite3_initialize(). ^(Only
+** an effective call to sqlite3_shutdown() does any deinitialization.
+** All other valid calls to sqlite3_shutdown() are harmless no-ops.)^
+**
+** The sqlite3_initialize() interface is threadsafe, but sqlite3_shutdown()
+** is not. The sqlite3_shutdown() interface must only be called from a
+** single thread. All open [database connections] must be closed and all
+** other SQLite resources must be deallocated prior to invoking
+** sqlite3_shutdown().
+**
+** Among other things, ^sqlite3_initialize() will invoke
+** sqlite3_os_init(). Similarly, ^sqlite3_shutdown()
+** will invoke sqlite3_os_end().
+**
+** ^The sqlite3_initialize() routine returns [SQLITE_OK] on success.
+** ^If for some reason, sqlite3_initialize() is unable to initialize
+** the library (perhaps it is unable to allocate a needed resource such
+** as a mutex) it returns an [error code] other than [SQLITE_OK].
+**
+** ^The sqlite3_initialize() routine is called internally by many other
+** SQLite interfaces so that an application usually does not need to
+** invoke sqlite3_initialize() directly. For example, [sqlite3_open()]
+** calls sqlite3_initialize() so the SQLite library will be automatically
+** initialized when [sqlite3_open()] is called if it has not be initialized
+** already. ^However, if SQLite is compiled with the [SQLITE_OMIT_AUTOINIT]
+** compile-time option, then the automatic calls to sqlite3_initialize()
+** are omitted and the application must call sqlite3_initialize() directly
+** prior to using any other SQLite interface. For maximum portability,
+** it is recommended that applications always invoke sqlite3_initialize()
+** directly prior to using any other SQLite interface. Future releases
+** of SQLite may require this. In other words, the behavior exhibited
+** when SQLite is compiled with [SQLITE_OMIT_AUTOINIT] might become the
+** default behavior in some future release of SQLite.
+**
+** The sqlite3_os_init() routine does operating-system specific
+** initialization of the SQLite library. The sqlite3_os_end()
+** routine undoes the effect of sqlite3_os_init(). Typical tasks
+** performed by these routines include allocation or deallocation
+** of static resources, initialization of global variables,
+** setting up a default [sqlite3_vfs] module, or setting up
+** a default configuration using [sqlite3_config()].
+**
+** The application should never invoke either sqlite3_os_init()
+** or sqlite3_os_end() directly. The application should only invoke
+** sqlite3_initialize() and sqlite3_shutdown(). The sqlite3_os_init()
+** interface is called automatically by sqlite3_initialize() and
+** sqlite3_os_end() is called by sqlite3_shutdown(). Appropriate
+** implementations for sqlite3_os_init() and sqlite3_os_end()
+** are built into SQLite when it is compiled for Unix, Windows, or OS/2.
+** When [custom builds | built for other platforms]
+** (using the [SQLITE_OS_OTHER=1] compile-time
+** option) the application must supply a suitable implementation for
+** sqlite3_os_init() and sqlite3_os_end(). An application-supplied
+** implementation of sqlite3_os_init() or sqlite3_os_end()
+** must return [SQLITE_OK] on success and some other [error code] upon
+** failure.
+*/
+SQLITE_API int sqlite3_initialize(void);
+SQLITE_API int sqlite3_shutdown(void);
+SQLITE_API int sqlite3_os_init(void);
+SQLITE_API int sqlite3_os_end(void);
+
+/*
+** CAPI3REF: Configuring The SQLite Library
+**
+** The sqlite3_config() interface is used to make global configuration
+** changes to SQLite in order to tune SQLite to the specific needs of
+** the application. The default configuration is recommended for most
+** applications and so this routine is usually not necessary. It is
+** provided to support rare applications with unusual needs.
+**
+** <b>The sqlite3_config() interface is not threadsafe. The application
+** must ensure that no other SQLite interfaces are invoked by other
+** threads while sqlite3_config() is running.</b>
+**
+** The sqlite3_config() interface
+** may only be invoked prior to library initialization using
+** [sqlite3_initialize()] or after shutdown by [sqlite3_shutdown()].
+** ^If sqlite3_config() is called after [sqlite3_initialize()] and before
+** [sqlite3_shutdown()] then it will return SQLITE_MISUSE.
+** Note, however, that ^sqlite3_config() can be called as part of the
+** implementation of an application-defined [sqlite3_os_init()].
+**
+** The first argument to sqlite3_config() is an integer
+** [configuration option] that determines
+** what property of SQLite is to be configured. Subsequent arguments
+** vary depending on the [configuration option]
+** in the first argument.
+**
+** ^When a configuration option is set, sqlite3_config() returns [SQLITE_OK].
+** ^If the option is unknown or SQLite is unable to set the option
+** then this routine returns a non-zero [error code].
+*/
+SQLITE_API int sqlite3_config(int, ...);
+
+/*
+** CAPI3REF: Configure database connections
+** METHOD: sqlite3
+**
+** The sqlite3_db_config() interface is used to make configuration
+** changes to a [database connection]. The interface is similar to
+** [sqlite3_config()] except that the changes apply to a single
+** [database connection] (specified in the first argument).
+**
+** The second argument to sqlite3_db_config(D,V,...) is the
+** [SQLITE_DBCONFIG_LOOKASIDE | configuration verb] - an integer code
+** that indicates what aspect of the [database connection] is being configured.
+** Subsequent arguments vary depending on the configuration verb.
+**
+** ^Calls to sqlite3_db_config() return SQLITE_OK if and only if
+** the call is considered successful.
+*/
+SQLITE_API int sqlite3_db_config(sqlite3*, int op, ...);
+
+/*
+** CAPI3REF: Memory Allocation Routines
+**
+** An instance of this object defines the interface between SQLite
+** and low-level memory allocation routines.
+**
+** This object is used in only one place in the SQLite interface.
+** A pointer to an instance of this object is the argument to
+** [sqlite3_config()] when the configuration option is
+** [SQLITE_CONFIG_MALLOC] or [SQLITE_CONFIG_GETMALLOC].
+** By creating an instance of this object
+** and passing it to [sqlite3_config]([SQLITE_CONFIG_MALLOC])
+** during configuration, an application can specify an alternative
+** memory allocation subsystem for SQLite to use for all of its
+** dynamic memory needs.
+**
+** Note that SQLite comes with several [built-in memory allocators]
+** that are perfectly adequate for the overwhelming majority of applications
+** and that this object is only useful to a tiny minority of applications
+** with specialized memory allocation requirements. This object is
+** also used during testing of SQLite in order to specify an alternative
+** memory allocator that simulates memory out-of-memory conditions in
+** order to verify that SQLite recovers gracefully from such
+** conditions.
+**
+** The xMalloc, xRealloc, and xFree methods must work like the
+** malloc(), realloc() and free() functions from the standard C library.
+** ^SQLite guarantees that the second argument to
+** xRealloc is always a value returned by a prior call to xRoundup.
+**
+** xSize should return the allocated size of a memory allocation
+** previously obtained from xMalloc or xRealloc. The allocated size
+** is always at least as big as the requested size but may be larger.
+**
+** The xRoundup method returns what would be the allocated size of
+** a memory allocation given a particular requested size. Most memory
+** allocators round up memory allocations at least to the next multiple
+** of 8. Some allocators round up to a larger multiple or to a power of 2.
+** Every memory allocation request coming in through [sqlite3_malloc()]
+** or [sqlite3_realloc()] first calls xRoundup. If xRoundup returns 0,
+** that causes the corresponding memory allocation to fail.
+**
+** The xInit method initializes the memory allocator. For example,
+** it might allocate any required mutexes or initialize internal data
+** structures. The xShutdown method is invoked (indirectly) by
+** [sqlite3_shutdown()] and should deallocate any resources acquired
+** by xInit. The pAppData pointer is used as the only parameter to
+** xInit and xShutdown.
+**
+** SQLite holds the [SQLITE_MUTEX_STATIC_MAIN] mutex when it invokes
+** the xInit method, so the xInit method need not be threadsafe. The
+** xShutdown method is only called from [sqlite3_shutdown()] so it does
+** not need to be threadsafe either. For all other methods, SQLite
+** holds the [SQLITE_MUTEX_STATIC_MEM] mutex as long as the
+** [SQLITE_CONFIG_MEMSTATUS] configuration option is turned on (which
+** it is by default) and so the methods are automatically serialized.
+** However, if [SQLITE_CONFIG_MEMSTATUS] is disabled, then the other
+** methods must be threadsafe or else make their own arrangements for
+** serialization.
+**
+** SQLite will never invoke xInit() more than once without an intervening
+** call to xShutdown().
+*/
+typedef struct sqlite3_mem_methods sqlite3_mem_methods;
+struct sqlite3_mem_methods {
+ void *(*xMalloc)(int); /* Memory allocation function */
+ void (*xFree)(void*); /* Free a prior allocation */
+ void *(*xRealloc)(void*,int); /* Resize an allocation */
+ int (*xSize)(void*); /* Return the size of an allocation */
+ int (*xRoundup)(int); /* Round up request size to allocation size */
+ int (*xInit)(void*); /* Initialize the memory allocator */
+ void (*xShutdown)(void*); /* Deinitialize the memory allocator */
+ void *pAppData; /* Argument to xInit() and xShutdown() */
+};
+
+/*
+** CAPI3REF: Configuration Options
+** KEYWORDS: {configuration option}
+**
+** These constants are the available integer configuration options that
+** can be passed as the first argument to the [sqlite3_config()] interface.
+**
+** New configuration options may be added in future releases of SQLite.
+** Existing configuration options might be discontinued. Applications
+** should check the return code from [sqlite3_config()] to make sure that
+** the call worked. The [sqlite3_config()] interface will return a
+** non-zero [error code] if a discontinued or unsupported configuration option
+** is invoked.
+**
+** <dl>
+** [[SQLITE_CONFIG_SINGLETHREAD]] <dt>SQLITE_CONFIG_SINGLETHREAD</dt>
+** <dd>There are no arguments to this option. ^This option sets the
+** [threading mode] to Single-thread. In other words, it disables
+** all mutexing and puts SQLite into a mode where it can only be used
+** by a single thread. ^If SQLite is compiled with
+** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then
+** it is not possible to change the [threading mode] from its default
+** value of Single-thread and so [sqlite3_config()] will return
+** [SQLITE_ERROR] if called with the SQLITE_CONFIG_SINGLETHREAD
+** configuration option.</dd>
+**
+** [[SQLITE_CONFIG_MULTITHREAD]] <dt>SQLITE_CONFIG_MULTITHREAD</dt>
+** <dd>There are no arguments to this option. ^This option sets the
+** [threading mode] to Multi-thread. In other words, it disables
+** mutexing on [database connection] and [prepared statement] objects.
+** The application is responsible for serializing access to
+** [database connections] and [prepared statements]. But other mutexes
+** are enabled so that SQLite will be safe to use in a multi-threaded
+** environment as long as no two threads attempt to use the same
+** [database connection] at the same time. ^If SQLite is compiled with
+** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then
+** it is not possible to set the Multi-thread [threading mode] and
+** [sqlite3_config()] will return [SQLITE_ERROR] if called with the
+** SQLITE_CONFIG_MULTITHREAD configuration option.</dd>
+**
+** [[SQLITE_CONFIG_SERIALIZED]] <dt>SQLITE_CONFIG_SERIALIZED</dt>
+** <dd>There are no arguments to this option. ^This option sets the
+** [threading mode] to Serialized. In other words, this option enables
+** all mutexes including the recursive
+** mutexes on [database connection] and [prepared statement] objects.
+** In this mode (which is the default when SQLite is compiled with
+** [SQLITE_THREADSAFE=1]) the SQLite library will itself serialize access
+** to [database connections] and [prepared statements] so that the
+** application is free to use the same [database connection] or the
+** same [prepared statement] in different threads at the same time.
+** ^If SQLite is compiled with
+** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then
+** it is not possible to set the Serialized [threading mode] and
+** [sqlite3_config()] will return [SQLITE_ERROR] if called with the
+** SQLITE_CONFIG_SERIALIZED configuration option.</dd>
+**
+** [[SQLITE_CONFIG_MALLOC]] <dt>SQLITE_CONFIG_MALLOC</dt>
+** <dd> ^(The SQLITE_CONFIG_MALLOC option takes a single argument which is
+** a pointer to an instance of the [sqlite3_mem_methods] structure.
+** The argument specifies
+** alternative low-level memory allocation routines to be used in place of
+** the memory allocation routines built into SQLite.)^ ^SQLite makes
+** its own private copy of the content of the [sqlite3_mem_methods] structure
+** before the [sqlite3_config()] call returns.</dd>
+**
+** [[SQLITE_CONFIG_GETMALLOC]] <dt>SQLITE_CONFIG_GETMALLOC</dt>
+** <dd> ^(The SQLITE_CONFIG_GETMALLOC option takes a single argument which
+** is a pointer to an instance of the [sqlite3_mem_methods] structure.
+** The [sqlite3_mem_methods]
+** structure is filled with the currently defined memory allocation routines.)^
+** This option can be used to overload the default memory allocation
+** routines with a wrapper that simulations memory allocation failure or
+** tracks memory usage, for example. </dd>
+**
+** [[SQLITE_CONFIG_SMALL_MALLOC]] <dt>SQLITE_CONFIG_SMALL_MALLOC</dt>
+** <dd> ^The SQLITE_CONFIG_SMALL_MALLOC option takes single argument of
+** type int, interpreted as a boolean, which if true provides a hint to
+** SQLite that it should avoid large memory allocations if possible.
+** SQLite will run faster if it is free to make large memory allocations,
+** but some application might prefer to run slower in exchange for
+** guarantees about memory fragmentation that are possible if large
+** allocations are avoided. This hint is normally off.
+** </dd>
+**
+** [[SQLITE_CONFIG_MEMSTATUS]] <dt>SQLITE_CONFIG_MEMSTATUS</dt>
+** <dd> ^The SQLITE_CONFIG_MEMSTATUS option takes single argument of type int,
+** interpreted as a boolean, which enables or disables the collection of
+** memory allocation statistics. ^(When memory allocation statistics are
+** disabled, the following SQLite interfaces become non-operational:
+** <ul>
+** <li> [sqlite3_hard_heap_limit64()]
+** <li> [sqlite3_memory_used()]
+** <li> [sqlite3_memory_highwater()]
+** <li> [sqlite3_soft_heap_limit64()]
+** <li> [sqlite3_status64()]
+** </ul>)^
+** ^Memory allocation statistics are enabled by default unless SQLite is
+** compiled with [SQLITE_DEFAULT_MEMSTATUS]=0 in which case memory
+** allocation statistics are disabled by default.
+** </dd>
+**
+** [[SQLITE_CONFIG_SCRATCH]] <dt>SQLITE_CONFIG_SCRATCH</dt>
+** <dd> The SQLITE_CONFIG_SCRATCH option is no longer used.
+** </dd>
+**
+** [[SQLITE_CONFIG_PAGECACHE]] <dt>SQLITE_CONFIG_PAGECACHE</dt>
+** <dd> ^The SQLITE_CONFIG_PAGECACHE option specifies a memory pool
+** that SQLite can use for the database page cache with the default page
+** cache implementation.
+** This configuration option is a no-op if an application-defined page
+** cache implementation is loaded using the [SQLITE_CONFIG_PCACHE2].
+** ^There are three arguments to SQLITE_CONFIG_PAGECACHE: A pointer to
+** 8-byte aligned memory (pMem), the size of each page cache line (sz),
+** and the number of cache lines (N).
+** The sz argument should be the size of the largest database page
+** (a power of two between 512 and 65536) plus some extra bytes for each
+** page header. ^The number of extra bytes needed by the page header
+** can be determined using [SQLITE_CONFIG_PCACHE_HDRSZ].
+** ^It is harmless, apart from the wasted memory,
+** for the sz parameter to be larger than necessary. The pMem
+** argument must be either a NULL pointer or a pointer to an 8-byte
+** aligned block of memory of at least sz*N bytes, otherwise
+** subsequent behavior is undefined.
+** ^When pMem is not NULL, SQLite will strive to use the memory provided
+** to satisfy page cache needs, falling back to [sqlite3_malloc()] if
+** a page cache line is larger than sz bytes or if all of the pMem buffer
+** is exhausted.
+** ^If pMem is NULL and N is non-zero, then each database connection
+** does an initial bulk allocation for page cache memory
+** from [sqlite3_malloc()] sufficient for N cache lines if N is positive or
+** of -1024*N bytes if N is negative, . ^If additional
+** page cache memory is needed beyond what is provided by the initial
+** allocation, then SQLite goes to [sqlite3_malloc()] separately for each
+** additional cache line. </dd>
+**
+** [[SQLITE_CONFIG_HEAP]] <dt>SQLITE_CONFIG_HEAP</dt>
+** <dd> ^The SQLITE_CONFIG_HEAP option specifies a static memory buffer
+** that SQLite will use for all of its dynamic memory allocation needs
+** beyond those provided for by [SQLITE_CONFIG_PAGECACHE].
+** ^The SQLITE_CONFIG_HEAP option is only available if SQLite is compiled
+** with either [SQLITE_ENABLE_MEMSYS3] or [SQLITE_ENABLE_MEMSYS5] and returns
+** [SQLITE_ERROR] if invoked otherwise.
+** ^There are three arguments to SQLITE_CONFIG_HEAP:
+** An 8-byte aligned pointer to the memory,
+** the number of bytes in the memory buffer, and the minimum allocation size.
+** ^If the first pointer (the memory pointer) is NULL, then SQLite reverts
+** to using its default memory allocator (the system malloc() implementation),
+** undoing any prior invocation of [SQLITE_CONFIG_MALLOC]. ^If the
+** memory pointer is not NULL then the alternative memory
+** allocator is engaged to handle all of SQLites memory allocation needs.
+** The first pointer (the memory pointer) must be aligned to an 8-byte
+** boundary or subsequent behavior of SQLite will be undefined.
+** The minimum allocation size is capped at 2**12. Reasonable values
+** for the minimum allocation size are 2**5 through 2**8.</dd>
+**
+** [[SQLITE_CONFIG_MUTEX]] <dt>SQLITE_CONFIG_MUTEX</dt>
+** <dd> ^(The SQLITE_CONFIG_MUTEX option takes a single argument which is a
+** pointer to an instance of the [sqlite3_mutex_methods] structure.
+** The argument specifies alternative low-level mutex routines to be used
+** in place the mutex routines built into SQLite.)^ ^SQLite makes a copy of
+** the content of the [sqlite3_mutex_methods] structure before the call to
+** [sqlite3_config()] returns. ^If SQLite is compiled with
+** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then
+** the entire mutexing subsystem is omitted from the build and hence calls to
+** [sqlite3_config()] with the SQLITE_CONFIG_MUTEX configuration option will
+** return [SQLITE_ERROR].</dd>
+**
+** [[SQLITE_CONFIG_GETMUTEX]] <dt>SQLITE_CONFIG_GETMUTEX</dt>
+** <dd> ^(The SQLITE_CONFIG_GETMUTEX option takes a single argument which
+** is a pointer to an instance of the [sqlite3_mutex_methods] structure. The
+** [sqlite3_mutex_methods]
+** structure is filled with the currently defined mutex routines.)^
+** This option can be used to overload the default mutex allocation
+** routines with a wrapper used to track mutex usage for performance
+** profiling or testing, for example. ^If SQLite is compiled with
+** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then
+** the entire mutexing subsystem is omitted from the build and hence calls to
+** [sqlite3_config()] with the SQLITE_CONFIG_GETMUTEX configuration option will
+** return [SQLITE_ERROR].</dd>
+**
+** [[SQLITE_CONFIG_LOOKASIDE]] <dt>SQLITE_CONFIG_LOOKASIDE</dt>
+** <dd> ^(The SQLITE_CONFIG_LOOKASIDE option takes two arguments that determine
+** the default size of lookaside memory on each [database connection].
+** The first argument is the
+** size of each lookaside buffer slot and the second is the number of
+** slots allocated to each database connection.)^ ^(SQLITE_CONFIG_LOOKASIDE
+** sets the <i>default</i> lookaside size. The [SQLITE_DBCONFIG_LOOKASIDE]
+** option to [sqlite3_db_config()] can be used to change the lookaside
+** configuration on individual connections.)^ </dd>
+**
+** [[SQLITE_CONFIG_PCACHE2]] <dt>SQLITE_CONFIG_PCACHE2</dt>
+** <dd> ^(The SQLITE_CONFIG_PCACHE2 option takes a single argument which is
+** a pointer to an [sqlite3_pcache_methods2] object. This object specifies
+** the interface to a custom page cache implementation.)^
+** ^SQLite makes a copy of the [sqlite3_pcache_methods2] object.</dd>
+**
+** [[SQLITE_CONFIG_GETPCACHE2]] <dt>SQLITE_CONFIG_GETPCACHE2</dt>
+** <dd> ^(The SQLITE_CONFIG_GETPCACHE2 option takes a single argument which
+** is a pointer to an [sqlite3_pcache_methods2] object. SQLite copies of
+** the current page cache implementation into that object.)^ </dd>
+**
+** [[SQLITE_CONFIG_LOG]] <dt>SQLITE_CONFIG_LOG</dt>
+** <dd> The SQLITE_CONFIG_LOG option is used to configure the SQLite
+** global [error log].
+** (^The SQLITE_CONFIG_LOG option takes two arguments: a pointer to a
+** function with a call signature of void(*)(void*,int,const char*),
+** and a pointer to void. ^If the function pointer is not NULL, it is
+** invoked by [sqlite3_log()] to process each logging event. ^If the
+** function pointer is NULL, the [sqlite3_log()] interface becomes a no-op.
+** ^The void pointer that is the second argument to SQLITE_CONFIG_LOG is
+** passed through as the first parameter to the application-defined logger
+** function whenever that function is invoked. ^The second parameter to
+** the logger function is a copy of the first parameter to the corresponding
+** [sqlite3_log()] call and is intended to be a [result code] or an
+** [extended result code]. ^The third parameter passed to the logger is
+** log message after formatting via [sqlite3_snprintf()].
+** The SQLite logging interface is not reentrant; the logger function
+** supplied by the application must not invoke any SQLite interface.
+** In a multi-threaded application, the application-defined logger
+** function must be threadsafe. </dd>
+**
+** [[SQLITE_CONFIG_URI]] <dt>SQLITE_CONFIG_URI
+** <dd>^(The SQLITE_CONFIG_URI option takes a single argument of type int.
+** If non-zero, then URI handling is globally enabled. If the parameter is zero,
+** then URI handling is globally disabled.)^ ^If URI handling is globally
+** enabled, all filenames passed to [sqlite3_open()], [sqlite3_open_v2()],
+** [sqlite3_open16()] or
+** specified as part of [ATTACH] commands are interpreted as URIs, regardless
+** of whether or not the [SQLITE_OPEN_URI] flag is set when the database
+** connection is opened. ^If it is globally disabled, filenames are
+** only interpreted as URIs if the SQLITE_OPEN_URI flag is set when the
+** database connection is opened. ^(By default, URI handling is globally
+** disabled. The default value may be changed by compiling with the
+** [SQLITE_USE_URI] symbol defined.)^
+**
+** [[SQLITE_CONFIG_COVERING_INDEX_SCAN]] <dt>SQLITE_CONFIG_COVERING_INDEX_SCAN
+** <dd>^The SQLITE_CONFIG_COVERING_INDEX_SCAN option takes a single integer
+** argument which is interpreted as a boolean in order to enable or disable
+** the use of covering indices for full table scans in the query optimizer.
+** ^The default setting is determined
+** by the [SQLITE_ALLOW_COVERING_INDEX_SCAN] compile-time option, or is "on"
+** if that compile-time option is omitted.
+** The ability to disable the use of covering indices for full table scans
+** is because some incorrectly coded legacy applications might malfunction
+** when the optimization is enabled. Providing the ability to
+** disable the optimization allows the older, buggy application code to work
+** without change even with newer versions of SQLite.
+**
+** [[SQLITE_CONFIG_PCACHE]] [[SQLITE_CONFIG_GETPCACHE]]
+** <dt>SQLITE_CONFIG_PCACHE and SQLITE_CONFIG_GETPCACHE
+** <dd> These options are obsolete and should not be used by new code.
+** They are retained for backwards compatibility but are now no-ops.
+** </dd>
+**
+** [[SQLITE_CONFIG_SQLLOG]]
+** <dt>SQLITE_CONFIG_SQLLOG
+** <dd>This option is only available if sqlite is compiled with the
+** [SQLITE_ENABLE_SQLLOG] pre-processor macro defined. The first argument should
+** be a pointer to a function of type void(*)(void*,sqlite3*,const char*, int).
+** The second should be of type (void*). The callback is invoked by the library
+** in three separate circumstances, identified by the value passed as the
+** fourth parameter. If the fourth parameter is 0, then the database connection
+** passed as the second argument has just been opened. The third argument
+** points to a buffer containing the name of the main database file. If the
+** fourth parameter is 1, then the SQL statement that the third parameter
+** points to has just been executed. Or, if the fourth parameter is 2, then
+** the connection being passed as the second parameter is being closed. The
+** third parameter is passed NULL In this case. An example of using this
+** configuration option can be seen in the "test_sqllog.c" source file in
+** the canonical SQLite source tree.</dd>
+**
+** [[SQLITE_CONFIG_MMAP_SIZE]]
+** <dt>SQLITE_CONFIG_MMAP_SIZE
+** <dd>^SQLITE_CONFIG_MMAP_SIZE takes two 64-bit integer (sqlite3_int64) values
+** that are the default mmap size limit (the default setting for
+** [PRAGMA mmap_size]) and the maximum allowed mmap size limit.
+** ^The default setting can be overridden by each database connection using
+** either the [PRAGMA mmap_size] command, or by using the
+** [SQLITE_FCNTL_MMAP_SIZE] file control. ^(The maximum allowed mmap size
+** will be silently truncated if necessary so that it does not exceed the
+** compile-time maximum mmap size set by the
+** [SQLITE_MAX_MMAP_SIZE] compile-time option.)^
+** ^If either argument to this option is negative, then that argument is
+** changed to its compile-time default.
+**
+** [[SQLITE_CONFIG_WIN32_HEAPSIZE]]
+** <dt>SQLITE_CONFIG_WIN32_HEAPSIZE
+** <dd>^The SQLITE_CONFIG_WIN32_HEAPSIZE option is only available if SQLite is
+** compiled for Windows with the [SQLITE_WIN32_MALLOC] pre-processor macro
+** defined. ^SQLITE_CONFIG_WIN32_HEAPSIZE takes a 32-bit unsigned integer value
+** that specifies the maximum size of the created heap.
+**
+** [[SQLITE_CONFIG_PCACHE_HDRSZ]]
+** <dt>SQLITE_CONFIG_PCACHE_HDRSZ
+** <dd>^The SQLITE_CONFIG_PCACHE_HDRSZ option takes a single parameter which
+** is a pointer to an integer and writes into that integer the number of extra
+** bytes per page required for each page in [SQLITE_CONFIG_PAGECACHE].
+** The amount of extra space required can change depending on the compiler,
+** target platform, and SQLite version.
+**
+** [[SQLITE_CONFIG_PMASZ]]
+** <dt>SQLITE_CONFIG_PMASZ
+** <dd>^The SQLITE_CONFIG_PMASZ option takes a single parameter which
+** is an unsigned integer and sets the "Minimum PMA Size" for the multithreaded
+** sorter to that integer. The default minimum PMA Size is set by the
+** [SQLITE_SORTER_PMASZ] compile-time option. New threads are launched
+** to help with sort operations when multithreaded sorting
+** is enabled (using the [PRAGMA threads] command) and the amount of content
+** to be sorted exceeds the page size times the minimum of the
+** [PRAGMA cache_size] setting and this value.
+**
+** [[SQLITE_CONFIG_STMTJRNL_SPILL]]
+** <dt>SQLITE_CONFIG_STMTJRNL_SPILL
+** <dd>^The SQLITE_CONFIG_STMTJRNL_SPILL option takes a single parameter which
+** becomes the [statement journal] spill-to-disk threshold.
+** [Statement journals] are held in memory until their size (in bytes)
+** exceeds this threshold, at which point they are written to disk.
+** Or if the threshold is -1, statement journals are always held
+** exclusively in memory.
+** Since many statement journals never become large, setting the spill
+** threshold to a value such as 64KiB can greatly reduce the amount of
+** I/O required to support statement rollback.
+** The default value for this setting is controlled by the
+** [SQLITE_STMTJRNL_SPILL] compile-time option.
+**
+** [[SQLITE_CONFIG_SORTERREF_SIZE]]
+** <dt>SQLITE_CONFIG_SORTERREF_SIZE
+** <dd>The SQLITE_CONFIG_SORTERREF_SIZE option accepts a single parameter
+** of type (int) - the new value of the sorter-reference size threshold.
+** Usually, when SQLite uses an external sort to order records according
+** to an ORDER BY clause, all fields required by the caller are present in the
+** sorted records. However, if SQLite determines based on the declared type
+** of a table column that its values are likely to be very large - larger
+** than the configured sorter-reference size threshold - then a reference
+** is stored in each sorted record and the required column values loaded
+** from the database as records are returned in sorted order. The default
+** value for this option is to never use this optimization. Specifying a
+** negative value for this option restores the default behaviour.
+** This option is only available if SQLite is compiled with the
+** [SQLITE_ENABLE_SORTER_REFERENCES] compile-time option.
+**
+** [[SQLITE_CONFIG_MEMDB_MAXSIZE]]
+** <dt>SQLITE_CONFIG_MEMDB_MAXSIZE
+** <dd>The SQLITE_CONFIG_MEMDB_MAXSIZE option accepts a single parameter
+** [sqlite3_int64] parameter which is the default maximum size for an in-memory
+** database created using [sqlite3_deserialize()]. This default maximum
+** size can be adjusted up or down for individual databases using the
+** [SQLITE_FCNTL_SIZE_LIMIT] [sqlite3_file_control|file-control]. If this
+** configuration setting is never used, then the default maximum is determined
+** by the [SQLITE_MEMDB_DEFAULT_MAXSIZE] compile-time option. If that
+** compile-time option is not set, then the default maximum is 1073741824.
+** </dl>
+*/
+#define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */
+#define SQLITE_CONFIG_MULTITHREAD 2 /* nil */
+#define SQLITE_CONFIG_SERIALIZED 3 /* nil */
+#define SQLITE_CONFIG_MALLOC 4 /* sqlite3_mem_methods* */
+#define SQLITE_CONFIG_GETMALLOC 5 /* sqlite3_mem_methods* */
+#define SQLITE_CONFIG_SCRATCH 6 /* No longer used */
+#define SQLITE_CONFIG_PAGECACHE 7 /* void*, int sz, int N */
+#define SQLITE_CONFIG_HEAP 8 /* void*, int nByte, int min */
+#define SQLITE_CONFIG_MEMSTATUS 9 /* boolean */
+#define SQLITE_CONFIG_MUTEX 10 /* sqlite3_mutex_methods* */
+#define SQLITE_CONFIG_GETMUTEX 11 /* sqlite3_mutex_methods* */
+/* previously SQLITE_CONFIG_CHUNKALLOC 12 which is now unused. */
+#define SQLITE_CONFIG_LOOKASIDE 13 /* int int */
+#define SQLITE_CONFIG_PCACHE 14 /* no-op */
+#define SQLITE_CONFIG_GETPCACHE 15 /* no-op */
+#define SQLITE_CONFIG_LOG 16 /* xFunc, void* */
+#define SQLITE_CONFIG_URI 17 /* int */
+#define SQLITE_CONFIG_PCACHE2 18 /* sqlite3_pcache_methods2* */
+#define SQLITE_CONFIG_GETPCACHE2 19 /* sqlite3_pcache_methods2* */
+#define SQLITE_CONFIG_COVERING_INDEX_SCAN 20 /* int */
+#define SQLITE_CONFIG_SQLLOG 21 /* xSqllog, void* */
+#define SQLITE_CONFIG_MMAP_SIZE 22 /* sqlite3_int64, sqlite3_int64 */
+#define SQLITE_CONFIG_WIN32_HEAPSIZE 23 /* int nByte */
+#define SQLITE_CONFIG_PCACHE_HDRSZ 24 /* int *psz */
+#define SQLITE_CONFIG_PMASZ 25 /* unsigned int szPma */
+#define SQLITE_CONFIG_STMTJRNL_SPILL 26 /* int nByte */
+#define SQLITE_CONFIG_SMALL_MALLOC 27 /* boolean */
+#define SQLITE_CONFIG_SORTERREF_SIZE 28 /* int nByte */
+#define SQLITE_CONFIG_MEMDB_MAXSIZE 29 /* sqlite3_int64 */
+
+/*
+** CAPI3REF: Database Connection Configuration Options
+**
+** These constants are the available integer configuration options that
+** can be passed as the second argument to the [sqlite3_db_config()] interface.
+**
+** New configuration options may be added in future releases of SQLite.
+** Existing configuration options might be discontinued. Applications
+** should check the return code from [sqlite3_db_config()] to make sure that
+** the call worked. ^The [sqlite3_db_config()] interface will return a
+** non-zero [error code] if a discontinued or unsupported configuration option
+** is invoked.
+**
+** <dl>
+** [[SQLITE_DBCONFIG_LOOKASIDE]]
+** <dt>SQLITE_DBCONFIG_LOOKASIDE</dt>
+** <dd> ^This option takes three additional arguments that determine the
+** [lookaside memory allocator] configuration for the [database connection].
+** ^The first argument (the third parameter to [sqlite3_db_config()] is a
+** pointer to a memory buffer to use for lookaside memory.
+** ^The first argument after the SQLITE_DBCONFIG_LOOKASIDE verb
+** may be NULL in which case SQLite will allocate the
+** lookaside buffer itself using [sqlite3_malloc()]. ^The second argument is the
+** size of each lookaside buffer slot. ^The third argument is the number of
+** slots. The size of the buffer in the first argument must be greater than
+** or equal to the product of the second and third arguments. The buffer
+** must be aligned to an 8-byte boundary. ^If the second argument to
+** SQLITE_DBCONFIG_LOOKASIDE is not a multiple of 8, it is internally
+** rounded down to the next smaller multiple of 8. ^(The lookaside memory
+** configuration for a database connection can only be changed when that
+** connection is not currently using lookaside memory, or in other words
+** when the "current value" returned by
+** [sqlite3_db_status](D,[SQLITE_CONFIG_LOOKASIDE],...) is zero.
+** Any attempt to change the lookaside memory configuration when lookaside
+** memory is in use leaves the configuration unchanged and returns
+** [SQLITE_BUSY].)^</dd>
+**
+** [[SQLITE_DBCONFIG_ENABLE_FKEY]]
+** <dt>SQLITE_DBCONFIG_ENABLE_FKEY</dt>
+** <dd> ^This option is used to enable or disable the enforcement of
+** [foreign key constraints]. There should be two additional arguments.
+** The first argument is an integer which is 0 to disable FK enforcement,
+** positive to enable FK enforcement or negative to leave FK enforcement
+** unchanged. The second parameter is a pointer to an integer into which
+** is written 0 or 1 to indicate whether FK enforcement is off or on
+** following this call. The second parameter may be a NULL pointer, in
+** which case the FK enforcement setting is not reported back. </dd>
+**
+** [[SQLITE_DBCONFIG_ENABLE_TRIGGER]]
+** <dt>SQLITE_DBCONFIG_ENABLE_TRIGGER</dt>
+** <dd> ^This option is used to enable or disable [CREATE TRIGGER | triggers].
+** There should be two additional arguments.
+** The first argument is an integer which is 0 to disable triggers,
+** positive to enable triggers or negative to leave the setting unchanged.
+** The second parameter is a pointer to an integer into which
+** is written 0 or 1 to indicate whether triggers are disabled or enabled
+** following this call. The second parameter may be a NULL pointer, in
+** which case the trigger setting is not reported back. </dd>
+**
+** [[SQLITE_DBCONFIG_ENABLE_VIEW]]
+** <dt>SQLITE_DBCONFIG_ENABLE_VIEW</dt>
+** <dd> ^This option is used to enable or disable [CREATE VIEW | views].
+** There should be two additional arguments.
+** The first argument is an integer which is 0 to disable views,
+** positive to enable views or negative to leave the setting unchanged.
+** The second parameter is a pointer to an integer into which
+** is written 0 or 1 to indicate whether views are disabled or enabled
+** following this call. The second parameter may be a NULL pointer, in
+** which case the view setting is not reported back. </dd>
+**
+** [[SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER]]
+** <dt>SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER</dt>
+** <dd> ^This option is used to enable or disable the
+** [fts3_tokenizer()] function which is part of the
+** [FTS3] full-text search engine extension.
+** There should be two additional arguments.
+** The first argument is an integer which is 0 to disable fts3_tokenizer() or
+** positive to enable fts3_tokenizer() or negative to leave the setting
+** unchanged.
+** The second parameter is a pointer to an integer into which
+** is written 0 or 1 to indicate whether fts3_tokenizer is disabled or enabled
+** following this call. The second parameter may be a NULL pointer, in
+** which case the new setting is not reported back. </dd>
+**
+** [[SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION]]
+** <dt>SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION</dt>
+** <dd> ^This option is used to enable or disable the [sqlite3_load_extension()]
+** interface independently of the [load_extension()] SQL function.
+** The [sqlite3_enable_load_extension()] API enables or disables both the
+** C-API [sqlite3_load_extension()] and the SQL function [load_extension()].
+** There should be two additional arguments.
+** When the first argument to this interface is 1, then only the C-API is
+** enabled and the SQL function remains disabled. If the first argument to
+** this interface is 0, then both the C-API and the SQL function are disabled.
+** If the first argument is -1, then no changes are made to state of either the
+** C-API or the SQL function.
+** The second parameter is a pointer to an integer into which
+** is written 0 or 1 to indicate whether [sqlite3_load_extension()] interface
+** is disabled or enabled following this call. The second parameter may
+** be a NULL pointer, in which case the new setting is not reported back.
+** </dd>
+**
+** [[SQLITE_DBCONFIG_MAINDBNAME]] <dt>SQLITE_DBCONFIG_MAINDBNAME</dt>
+** <dd> ^This option is used to change the name of the "main" database
+** schema. ^The sole argument is a pointer to a constant UTF8 string
+** which will become the new schema name in place of "main". ^SQLite
+** does not make a copy of the new main schema name string, so the application
+** must ensure that the argument passed into this DBCONFIG option is unchanged
+** until after the database connection closes.
+** </dd>
+**
+** [[SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE]]
+** <dt>SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE</dt>
+** <dd> Usually, when a database in wal mode is closed or detached from a
+** database handle, SQLite checks if this will mean that there are now no
+** connections at all to the database. If so, it performs a checkpoint
+** operation before closing the connection. This option may be used to
+** override this behaviour. The first parameter passed to this operation
+** is an integer - positive to disable checkpoints-on-close, or zero (the
+** default) to enable them, and negative to leave the setting unchanged.
+** The second parameter is a pointer to an integer
+** into which is written 0 or 1 to indicate whether checkpoints-on-close
+** have been disabled - 0 if they are not disabled, 1 if they are.
+** </dd>
+**
+** [[SQLITE_DBCONFIG_ENABLE_QPSG]] <dt>SQLITE_DBCONFIG_ENABLE_QPSG</dt>
+** <dd>^(The SQLITE_DBCONFIG_ENABLE_QPSG option activates or deactivates
+** the [query planner stability guarantee] (QPSG). When the QPSG is active,
+** a single SQL query statement will always use the same algorithm regardless
+** of values of [bound parameters].)^ The QPSG disables some query optimizations
+** that look at the values of bound parameters, which can make some queries
+** slower. But the QPSG has the advantage of more predictable behavior. With
+** the QPSG active, SQLite will always use the same query plan in the field as
+** was used during testing in the lab.
+** The first argument to this setting is an integer which is 0 to disable
+** the QPSG, positive to enable QPSG, or negative to leave the setting
+** unchanged. The second parameter is a pointer to an integer into which
+** is written 0 or 1 to indicate whether the QPSG is disabled or enabled
+** following this call.
+** </dd>
+**
+** [[SQLITE_DBCONFIG_TRIGGER_EQP]] <dt>SQLITE_DBCONFIG_TRIGGER_EQP</dt>
+** <dd> By default, the output of EXPLAIN QUERY PLAN commands does not
+** include output for any operations performed by trigger programs. This
+** option is used to set or clear (the default) a flag that governs this
+** behavior. The first parameter passed to this operation is an integer -
+** positive to enable output for trigger programs, or zero to disable it,
+** or negative to leave the setting unchanged.
+** The second parameter is a pointer to an integer into which is written
+** 0 or 1 to indicate whether output-for-triggers has been disabled - 0 if
+** it is not disabled, 1 if it is.
+** </dd>
+**
+** [[SQLITE_DBCONFIG_RESET_DATABASE]] <dt>SQLITE_DBCONFIG_RESET_DATABASE</dt>
+** <dd> Set the SQLITE_DBCONFIG_RESET_DATABASE flag and then run
+** [VACUUM] in order to reset a database back to an empty database
+** with no schema and no content. The following process works even for
+** a badly corrupted database file:
+** <ol>
+** <li> If the database connection is newly opened, make sure it has read the
+** database schema by preparing then discarding some query against the
+** database, or calling sqlite3_table_column_metadata(), ignoring any
+** errors. This step is only necessary if the application desires to keep
+** the database in WAL mode after the reset if it was in WAL mode before
+** the reset.
+** <li> sqlite3_db_config(db, SQLITE_DBCONFIG_RESET_DATABASE, 1, 0);
+** <li> [sqlite3_exec](db, "[VACUUM]", 0, 0, 0);
+** <li> sqlite3_db_config(db, SQLITE_DBCONFIG_RESET_DATABASE, 0, 0);
+** </ol>
+** Because resetting a database is destructive and irreversible, the
+** process requires the use of this obscure API and multiple steps to help
+** ensure that it does not happen by accident.
+**
+** [[SQLITE_DBCONFIG_DEFENSIVE]] <dt>SQLITE_DBCONFIG_DEFENSIVE</dt>
+** <dd>The SQLITE_DBCONFIG_DEFENSIVE option activates or deactivates the
+** "defensive" flag for a database connection. When the defensive
+** flag is enabled, language features that allow ordinary SQL to
+** deliberately corrupt the database file are disabled. The disabled
+** features include but are not limited to the following:
+** <ul>
+** <li> The [PRAGMA writable_schema=ON] statement.
+** <li> The [PRAGMA journal_mode=OFF] statement.
+** <li> Writes to the [sqlite_dbpage] virtual table.
+** <li> Direct writes to [shadow tables].
+** </ul>
+** </dd>
+**
+** [[SQLITE_DBCONFIG_WRITABLE_SCHEMA]] <dt>SQLITE_DBCONFIG_WRITABLE_SCHEMA</dt>
+** <dd>The SQLITE_DBCONFIG_WRITABLE_SCHEMA option activates or deactivates the
+** "writable_schema" flag. This has the same effect and is logically equivalent
+** to setting [PRAGMA writable_schema=ON] or [PRAGMA writable_schema=OFF].
+** The first argument to this setting is an integer which is 0 to disable
+** the writable_schema, positive to enable writable_schema, or negative to
+** leave the setting unchanged. The second parameter is a pointer to an
+** integer into which is written 0 or 1 to indicate whether the writable_schema
+** is enabled or disabled following this call.
+** </dd>
+**
+** [[SQLITE_DBCONFIG_LEGACY_ALTER_TABLE]]
+** <dt>SQLITE_DBCONFIG_LEGACY_ALTER_TABLE</dt>
+** <dd>The SQLITE_DBCONFIG_LEGACY_ALTER_TABLE option activates or deactivates
+** the legacy behavior of the [ALTER TABLE RENAME] command such it
+** behaves as it did prior to [version 3.24.0] (2018-06-04). See the
+** "Compatibility Notice" on the [ALTER TABLE RENAME documentation] for
+** additional information. This feature can also be turned on and off
+** using the [PRAGMA legacy_alter_table] statement.
+** </dd>
+**
+** [[SQLITE_DBCONFIG_DQS_DML]]
+** <dt>SQLITE_DBCONFIG_DQS_DML</td>
+** <dd>The SQLITE_DBCONFIG_DQS_DML option activates or deactivates
+** the legacy [double-quoted string literal] misfeature for DML statements
+** only, that is DELETE, INSERT, SELECT, and UPDATE statements. The
+** default value of this setting is determined by the [-DSQLITE_DQS]
+** compile-time option.
+** </dd>
+**
+** [[SQLITE_DBCONFIG_DQS_DDL]]
+** <dt>SQLITE_DBCONFIG_DQS_DDL</td>
+** <dd>The SQLITE_DBCONFIG_DQS option activates or deactivates
+** the legacy [double-quoted string literal] misfeature for DDL statements,
+** such as CREATE TABLE and CREATE INDEX. The
+** default value of this setting is determined by the [-DSQLITE_DQS]
+** compile-time option.
+** </dd>
+**
+** [[SQLITE_DBCONFIG_TRUSTED_SCHEMA]]
+** <dt>SQLITE_DBCONFIG_TRUSTED_SCHEMA</td>
+** <dd>The SQLITE_DBCONFIG_TRUSTED_SCHEMA option tells SQLite to
+** assume that database schemas are untainted by malicious content.
+** When the SQLITE_DBCONFIG_TRUSTED_SCHEMA option is disabled, SQLite
+** takes additional defensive steps to protect the application from harm
+** including:
+** <ul>
+** <li> Prohibit the use of SQL functions inside triggers, views,
+** CHECK constraints, DEFAULT clauses, expression indexes,
+** partial indexes, or generated columns
+** unless those functions are tagged with [SQLITE_INNOCUOUS].
+** <li> Prohibit the use of virtual tables inside of triggers or views
+** unless those virtual tables are tagged with [SQLITE_VTAB_INNOCUOUS].
+** </ul>
+** This setting defaults to "on" for legacy compatibility, however
+** all applications are advised to turn it off if possible. This setting
+** can also be controlled using the [PRAGMA trusted_schema] statement.
+** </dd>
+**
+** [[SQLITE_DBCONFIG_LEGACY_FILE_FORMAT]]
+** <dt>SQLITE_DBCONFIG_LEGACY_FILE_FORMAT</td>
+** <dd>The SQLITE_DBCONFIG_LEGACY_FILE_FORMAT option activates or deactivates
+** the legacy file format flag. When activated, this flag causes all newly
+** created database file to have a schema format version number (the 4-byte
+** integer found at offset 44 into the database header) of 1. This in turn
+** means that the resulting database file will be readable and writable by
+** any SQLite version back to 3.0.0 ([dateof:3.0.0]). Without this setting,
+** newly created databases are generally not understandable by SQLite versions
+** prior to 3.3.0 ([dateof:3.3.0]). As these words are written, there
+** is now scarcely any need to generated database files that are compatible
+** all the way back to version 3.0.0, and so this setting is of little
+** practical use, but is provided so that SQLite can continue to claim the
+** ability to generate new database files that are compatible with version
+** 3.0.0.
+** <p>Note that when the SQLITE_DBCONFIG_LEGACY_FILE_FORMAT setting is on,
+** the [VACUUM] command will fail with an obscure error when attempting to
+** process a table with generated columns and a descending index. This is
+** not considered a bug since SQLite versions 3.3.0 and earlier do not support
+** either generated columns or decending indexes.
+** </dd>
+** </dl>
+*/
+#define SQLITE_DBCONFIG_MAINDBNAME 1000 /* const char* */
+#define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */
+#define SQLITE_DBCONFIG_ENABLE_FKEY 1002 /* int int* */
+#define SQLITE_DBCONFIG_ENABLE_TRIGGER 1003 /* int int* */
+#define SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER 1004 /* int int* */
+#define SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION 1005 /* int int* */
+#define SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE 1006 /* int int* */
+#define SQLITE_DBCONFIG_ENABLE_QPSG 1007 /* int int* */
+#define SQLITE_DBCONFIG_TRIGGER_EQP 1008 /* int int* */
+#define SQLITE_DBCONFIG_RESET_DATABASE 1009 /* int int* */
+#define SQLITE_DBCONFIG_DEFENSIVE 1010 /* int int* */
+#define SQLITE_DBCONFIG_WRITABLE_SCHEMA 1011 /* int int* */
+#define SQLITE_DBCONFIG_LEGACY_ALTER_TABLE 1012 /* int int* */
+#define SQLITE_DBCONFIG_DQS_DML 1013 /* int int* */
+#define SQLITE_DBCONFIG_DQS_DDL 1014 /* int int* */
+#define SQLITE_DBCONFIG_ENABLE_VIEW 1015 /* int int* */
+#define SQLITE_DBCONFIG_LEGACY_FILE_FORMAT 1016 /* int int* */
+#define SQLITE_DBCONFIG_TRUSTED_SCHEMA 1017 /* int int* */
+#define SQLITE_DBCONFIG_MAX 1017 /* Largest DBCONFIG */
+
+/*
+** CAPI3REF: Enable Or Disable Extended Result Codes
+** METHOD: sqlite3
+**
+** ^The sqlite3_extended_result_codes() routine enables or disables the
+** [extended result codes] feature of SQLite. ^The extended result
+** codes are disabled by default for historical compatibility.
+*/
+SQLITE_API int sqlite3_extended_result_codes(sqlite3*, int onoff);
+
+/*
+** CAPI3REF: Last Insert Rowid
+** METHOD: sqlite3
+**
+** ^Each entry in most SQLite tables (except for [WITHOUT ROWID] tables)
+** has a unique 64-bit signed
+** integer key called the [ROWID | "rowid"]. ^The rowid is always available
+** as an undeclared column named ROWID, OID, or _ROWID_ as long as those
+** names are not also used by explicitly declared columns. ^If
+** the table has a column of type [INTEGER PRIMARY KEY] then that column
+** is another alias for the rowid.
+**
+** ^The sqlite3_last_insert_rowid(D) interface usually returns the [rowid] of
+** the most recent successful [INSERT] into a rowid table or [virtual table]
+** on database connection D. ^Inserts into [WITHOUT ROWID] tables are not
+** recorded. ^If no successful [INSERT]s into rowid tables have ever occurred
+** on the database connection D, then sqlite3_last_insert_rowid(D) returns
+** zero.
+**
+** As well as being set automatically as rows are inserted into database
+** tables, the value returned by this function may be set explicitly by
+** [sqlite3_set_last_insert_rowid()]
+**
+** Some virtual table implementations may INSERT rows into rowid tables as
+** part of committing a transaction (e.g. to flush data accumulated in memory
+** to disk). In this case subsequent calls to this function return the rowid
+** associated with these internal INSERT operations, which leads to
+** unintuitive results. Virtual table implementations that do write to rowid
+** tables in this way can avoid this problem by restoring the original
+** rowid value using [sqlite3_set_last_insert_rowid()] before returning
+** control to the user.
+**
+** ^(If an [INSERT] occurs within a trigger then this routine will
+** return the [rowid] of the inserted row as long as the trigger is
+** running. Once the trigger program ends, the value returned
+** by this routine reverts to what it was before the trigger was fired.)^
+**
+** ^An [INSERT] that fails due to a constraint violation is not a
+** successful [INSERT] and does not change the value returned by this
+** routine. ^Thus INSERT OR FAIL, INSERT OR IGNORE, INSERT OR ROLLBACK,
+** and INSERT OR ABORT make no changes to the return value of this
+** routine when their insertion fails. ^(When INSERT OR REPLACE
+** encounters a constraint violation, it does not fail. The
+** INSERT continues to completion after deleting rows that caused
+** the constraint problem so INSERT OR REPLACE will always change
+** the return value of this interface.)^
+**
+** ^For the purposes of this routine, an [INSERT] is considered to
+** be successful even if it is subsequently rolled back.
+**
+** This function is accessible to SQL statements via the
+** [last_insert_rowid() SQL function].
+**
+** If a separate thread performs a new [INSERT] on the same
+** database connection while the [sqlite3_last_insert_rowid()]
+** function is running and thus changes the last insert [rowid],
+** then the value returned by [sqlite3_last_insert_rowid()] is
+** unpredictable and might not equal either the old or the new
+** last insert [rowid].
+*/
+SQLITE_API sqlite3_int64 sqlite3_last_insert_rowid(sqlite3*);
+
+/*
+** CAPI3REF: Set the Last Insert Rowid value.
+** METHOD: sqlite3
+**
+** The sqlite3_set_last_insert_rowid(D, R) method allows the application to
+** set the value returned by calling sqlite3_last_insert_rowid(D) to R
+** without inserting a row into the database.
+*/
+SQLITE_API void sqlite3_set_last_insert_rowid(sqlite3*,sqlite3_int64);
+
+/*
+** CAPI3REF: Count The Number Of Rows Modified
+** METHOD: sqlite3
+**
+** ^This function returns the number of rows modified, inserted or
+** deleted by the most recently completed INSERT, UPDATE or DELETE
+** statement on the database connection specified by the only parameter.
+** ^Executing any other type of SQL statement does not modify the value
+** returned by this function.
+**
+** ^Only changes made directly by the INSERT, UPDATE or DELETE statement are
+** considered - auxiliary changes caused by [CREATE TRIGGER | triggers],
+** [foreign key actions] or [REPLACE] constraint resolution are not counted.
+**
+** Changes to a view that are intercepted by
+** [INSTEAD OF trigger | INSTEAD OF triggers] are not counted. ^The value
+** returned by sqlite3_changes() immediately after an INSERT, UPDATE or
+** DELETE statement run on a view is always zero. Only changes made to real
+** tables are counted.
+**
+** Things are more complicated if the sqlite3_changes() function is
+** executed while a trigger program is running. This may happen if the
+** program uses the [changes() SQL function], or if some other callback
+** function invokes sqlite3_changes() directly. Essentially:
+**
+** <ul>
+** <li> ^(Before entering a trigger program the value returned by
+** sqlite3_changes() function is saved. After the trigger program
+** has finished, the original value is restored.)^
+**
+** <li> ^(Within a trigger program each INSERT, UPDATE and DELETE
+** statement sets the value returned by sqlite3_changes()
+** upon completion as normal. Of course, this value will not include
+** any changes performed by sub-triggers, as the sqlite3_changes()
+** value will be saved and restored after each sub-trigger has run.)^
+** </ul>
+**
+** ^This means that if the changes() SQL function (or similar) is used
+** by the first INSERT, UPDATE or DELETE statement within a trigger, it
+** returns the value as set when the calling statement began executing.
+** ^If it is used by the second or subsequent such statement within a trigger
+** program, the value returned reflects the number of rows modified by the
+** previous INSERT, UPDATE or DELETE statement within the same trigger.
+**
+** If a separate thread makes changes on the same database connection
+** while [sqlite3_changes()] is running then the value returned
+** is unpredictable and not meaningful.
+**
+** See also:
+** <ul>
+** <li> the [sqlite3_total_changes()] interface
+** <li> the [count_changes pragma]
+** <li> the [changes() SQL function]
+** <li> the [data_version pragma]
+** </ul>
+*/
+SQLITE_API int sqlite3_changes(sqlite3*);
+
+/*
+** CAPI3REF: Total Number Of Rows Modified
+** METHOD: sqlite3
+**
+** ^This function returns the total number of rows inserted, modified or
+** deleted by all [INSERT], [UPDATE] or [DELETE] statements completed
+** since the database connection was opened, including those executed as
+** part of trigger programs. ^Executing any other type of SQL statement
+** does not affect the value returned by sqlite3_total_changes().
+**
+** ^Changes made as part of [foreign key actions] are included in the
+** count, but those made as part of REPLACE constraint resolution are
+** not. ^Changes to a view that are intercepted by INSTEAD OF triggers
+** are not counted.
+**
+** The [sqlite3_total_changes(D)] interface only reports the number
+** of rows that changed due to SQL statement run against database
+** connection D. Any changes by other database connections are ignored.
+** To detect changes against a database file from other database
+** connections use the [PRAGMA data_version] command or the
+** [SQLITE_FCNTL_DATA_VERSION] [file control].
+**
+** If a separate thread makes changes on the same database connection
+** while [sqlite3_total_changes()] is running then the value
+** returned is unpredictable and not meaningful.
+**
+** See also:
+** <ul>
+** <li> the [sqlite3_changes()] interface
+** <li> the [count_changes pragma]
+** <li> the [changes() SQL function]
+** <li> the [data_version pragma]
+** <li> the [SQLITE_FCNTL_DATA_VERSION] [file control]
+** </ul>
+*/
+SQLITE_API int sqlite3_total_changes(sqlite3*);
+
+/*
+** CAPI3REF: Interrupt A Long-Running Query
+** METHOD: sqlite3
+**
+** ^This function causes any pending database operation to abort and
+** return at its earliest opportunity. This routine is typically
+** called in response to a user action such as pressing "Cancel"
+** or Ctrl-C where the user wants a long query operation to halt
+** immediately.
+**
+** ^It is safe to call this routine from a thread different from the
+** thread that is currently running the database operation. But it
+** is not safe to call this routine with a [database connection] that
+** is closed or might close before sqlite3_interrupt() returns.
+**
+** ^If an SQL operation is very nearly finished at the time when
+** sqlite3_interrupt() is called, then it might not have an opportunity
+** to be interrupted and might continue to completion.
+**
+** ^An SQL operation that is interrupted will return [SQLITE_INTERRUPT].
+** ^If the interrupted SQL operation is an INSERT, UPDATE, or DELETE
+** that is inside an explicit transaction, then the entire transaction
+** will be rolled back automatically.
+**
+** ^The sqlite3_interrupt(D) call is in effect until all currently running
+** SQL statements on [database connection] D complete. ^Any new SQL statements
+** that are started after the sqlite3_interrupt() call and before the
+** running statement count reaches zero are interrupted as if they had been
+** running prior to the sqlite3_interrupt() call. ^New SQL statements
+** that are started after the running statement count reaches zero are
+** not effected by the sqlite3_interrupt().
+** ^A call to sqlite3_interrupt(D) that occurs when there are no running
+** SQL statements is a no-op and has no effect on SQL statements
+** that are started after the sqlite3_interrupt() call returns.
+*/
+SQLITE_API void sqlite3_interrupt(sqlite3*);
+
+/*
+** CAPI3REF: Determine If An SQL Statement Is Complete
+**
+** These routines are useful during command-line input to determine if the
+** currently entered text seems to form a complete SQL statement or
+** if additional input is needed before sending the text into
+** SQLite for parsing. ^These routines return 1 if the input string
+** appears to be a complete SQL statement. ^A statement is judged to be
+** complete if it ends with a semicolon token and is not a prefix of a
+** well-formed CREATE TRIGGER statement. ^Semicolons that are embedded within
+** string literals or quoted identifier names or comments are not
+** independent tokens (they are part of the token in which they are
+** embedded) and thus do not count as a statement terminator. ^Whitespace
+** and comments that follow the final semicolon are ignored.
+**
+** ^These routines return 0 if the statement is incomplete. ^If a
+** memory allocation fails, then SQLITE_NOMEM is returned.
+**
+** ^These routines do not parse the SQL statements thus
+** will not detect syntactically incorrect SQL.
+**
+** ^(If SQLite has not been initialized using [sqlite3_initialize()] prior
+** to invoking sqlite3_complete16() then sqlite3_initialize() is invoked
+** automatically by sqlite3_complete16(). If that initialization fails,
+** then the return value from sqlite3_complete16() will be non-zero
+** regardless of whether or not the input SQL is complete.)^
+**
+** The input to [sqlite3_complete()] must be a zero-terminated
+** UTF-8 string.
+**
+** The input to [sqlite3_complete16()] must be a zero-terminated
+** UTF-16 string in native byte order.
+*/
+SQLITE_API int sqlite3_complete(const char *sql);
+SQLITE_API int sqlite3_complete16(const void *sql);
+
+/*
+** CAPI3REF: Register A Callback To Handle SQLITE_BUSY Errors
+** KEYWORDS: {busy-handler callback} {busy handler}
+** METHOD: sqlite3
+**
+** ^The sqlite3_busy_handler(D,X,P) routine sets a callback function X
+** that might be invoked with argument P whenever
+** an attempt is made to access a database table associated with
+** [database connection] D when another thread
+** or process has the table locked.
+** The sqlite3_busy_handler() interface is used to implement
+** [sqlite3_busy_timeout()] and [PRAGMA busy_timeout].
+**
+** ^If the busy callback is NULL, then [SQLITE_BUSY]
+** is returned immediately upon encountering the lock. ^If the busy callback
+** is not NULL, then the callback might be invoked with two arguments.
+**
+** ^The first argument to the busy handler is a copy of the void* pointer which
+** is the third argument to sqlite3_busy_handler(). ^The second argument to
+** the busy handler callback is the number of times that the busy handler has
+** been invoked previously for the same locking event. ^If the
+** busy callback returns 0, then no additional attempts are made to
+** access the database and [SQLITE_BUSY] is returned
+** to the application.
+** ^If the callback returns non-zero, then another attempt
+** is made to access the database and the cycle repeats.
+**
+** The presence of a busy handler does not guarantee that it will be invoked
+** when there is lock contention. ^If SQLite determines that invoking the busy
+** handler could result in a deadlock, it will go ahead and return [SQLITE_BUSY]
+** to the application instead of invoking the
+** busy handler.
+** Consider a scenario where one process is holding a read lock that
+** it is trying to promote to a reserved lock and
+** a second process is holding a reserved lock that it is trying
+** to promote to an exclusive lock. The first process cannot proceed
+** because it is blocked by the second and the second process cannot
+** proceed because it is blocked by the first. If both processes
+** invoke the busy handlers, neither will make any progress. Therefore,
+** SQLite returns [SQLITE_BUSY] for the first process, hoping that this
+** will induce the first process to release its read lock and allow
+** the second process to proceed.
+**
+** ^The default busy callback is NULL.
+**
+** ^(There can only be a single busy handler defined for each
+** [database connection]. Setting a new busy handler clears any
+** previously set handler.)^ ^Note that calling [sqlite3_busy_timeout()]
+** or evaluating [PRAGMA busy_timeout=N] will change the
+** busy handler and thus clear any previously set busy handler.
+**
+** The busy callback should not take any actions which modify the
+** database connection that invoked the busy handler. In other words,
+** the busy handler is not reentrant. Any such actions
+** result in undefined behavior.
+**
+** A busy handler must not close the database connection
+** or [prepared statement] that invoked the busy handler.
+*/
+SQLITE_API int sqlite3_busy_handler(sqlite3*,int(*)(void*,int),void*);
+
+/*
+** CAPI3REF: Set A Busy Timeout
+** METHOD: sqlite3
+**
+** ^This routine sets a [sqlite3_busy_handler | busy handler] that sleeps
+** for a specified amount of time when a table is locked. ^The handler
+** will sleep multiple times until at least "ms" milliseconds of sleeping
+** have accumulated. ^After at least "ms" milliseconds of sleeping,
+** the handler returns 0 which causes [sqlite3_step()] to return
+** [SQLITE_BUSY].
+**
+** ^Calling this routine with an argument less than or equal to zero
+** turns off all busy handlers.
+**
+** ^(There can only be a single busy handler for a particular
+** [database connection] at any given moment. If another busy handler
+** was defined (using [sqlite3_busy_handler()]) prior to calling
+** this routine, that other busy handler is cleared.)^
+**
+** See also: [PRAGMA busy_timeout]
+*/
+SQLITE_API int sqlite3_busy_timeout(sqlite3*, int ms);
+
+/*
+** CAPI3REF: Convenience Routines For Running Queries
+** METHOD: sqlite3
+**
+** This is a legacy interface that is preserved for backwards compatibility.
+** Use of this interface is not recommended.
+**
+** Definition: A <b>result table</b> is memory data structure created by the
+** [sqlite3_get_table()] interface. A result table records the
+** complete query results from one or more queries.
+**
+** The table conceptually has a number of rows and columns. But
+** these numbers are not part of the result table itself. These
+** numbers are obtained separately. Let N be the number of rows
+** and M be the number of columns.
+**
+** A result table is an array of pointers to zero-terminated UTF-8 strings.
+** There are (N+1)*M elements in the array. The first M pointers point
+** to zero-terminated strings that contain the names of the columns.
+** The remaining entries all point to query results. NULL values result
+** in NULL pointers. All other values are in their UTF-8 zero-terminated
+** string representation as returned by [sqlite3_column_text()].
+**
+** A result table might consist of one or more memory allocations.
+** It is not safe to pass a result table directly to [sqlite3_free()].
+** A result table should be deallocated using [sqlite3_free_table()].
+**
+** ^(As an example of the result table format, suppose a query result
+** is as follows:
+**
+** <blockquote><pre>
+** Name | Age
+** -----------------------
+** Alice | 43
+** Bob | 28
+** Cindy | 21
+** </pre></blockquote>
+**
+** There are two columns (M==2) and three rows (N==3). Thus the
+** result table has 8 entries. Suppose the result table is stored
+** in an array named azResult. Then azResult holds this content:
+**
+** <blockquote><pre>
+** azResult&#91;0] = "Name";
+** azResult&#91;1] = "Age";
+** azResult&#91;2] = "Alice";
+** azResult&#91;3] = "43";
+** azResult&#91;4] = "Bob";
+** azResult&#91;5] = "28";
+** azResult&#91;6] = "Cindy";
+** azResult&#91;7] = "21";
+** </pre></blockquote>)^
+**
+** ^The sqlite3_get_table() function evaluates one or more
+** semicolon-separated SQL statements in the zero-terminated UTF-8
+** string of its 2nd parameter and returns a result table to the
+** pointer given in its 3rd parameter.
+**
+** After the application has finished with the result from sqlite3_get_table(),
+** it must pass the result table pointer to sqlite3_free_table() in order to
+** release the memory that was malloced. Because of the way the
+** [sqlite3_malloc()] happens within sqlite3_get_table(), the calling
+** function must not try to call [sqlite3_free()] directly. Only
+** [sqlite3_free_table()] is able to release the memory properly and safely.
+**
+** The sqlite3_get_table() interface is implemented as a wrapper around
+** [sqlite3_exec()]. The sqlite3_get_table() routine does not have access
+** to any internal data structures of SQLite. It uses only the public
+** interface defined here. As a consequence, errors that occur in the
+** wrapper layer outside of the internal [sqlite3_exec()] call are not
+** reflected in subsequent calls to [sqlite3_errcode()] or
+** [sqlite3_errmsg()].
+*/
+SQLITE_API int sqlite3_get_table(
+ sqlite3 *db, /* An open database */
+ const char *zSql, /* SQL to be evaluated */
+ char ***pazResult, /* Results of the query */
+ int *pnRow, /* Number of result rows written here */
+ int *pnColumn, /* Number of result columns written here */
+ char **pzErrmsg /* Error msg written here */
+);
+SQLITE_API void sqlite3_free_table(char **result);
+
+/*
+** CAPI3REF: Formatted String Printing Functions
+**
+** These routines are work-alikes of the "printf()" family of functions
+** from the standard C library.
+** These routines understand most of the common formatting options from
+** the standard library printf()
+** plus some additional non-standard formats ([%q], [%Q], [%w], and [%z]).
+** See the [built-in printf()] documentation for details.
+**
+** ^The sqlite3_mprintf() and sqlite3_vmprintf() routines write their
+** results into memory obtained from [sqlite3_malloc64()].
+** The strings returned by these two routines should be
+** released by [sqlite3_free()]. ^Both routines return a
+** NULL pointer if [sqlite3_malloc64()] is unable to allocate enough
+** memory to hold the resulting string.
+**
+** ^(The sqlite3_snprintf() routine is similar to "snprintf()" from
+** the standard C library. The result is written into the
+** buffer supplied as the second parameter whose size is given by
+** the first parameter. Note that the order of the
+** first two parameters is reversed from snprintf().)^ This is an
+** historical accident that cannot be fixed without breaking
+** backwards compatibility. ^(Note also that sqlite3_snprintf()
+** returns a pointer to its buffer instead of the number of
+** characters actually written into the buffer.)^ We admit that
+** the number of characters written would be a more useful return
+** value but we cannot change the implementation of sqlite3_snprintf()
+** now without breaking compatibility.
+**
+** ^As long as the buffer size is greater than zero, sqlite3_snprintf()
+** guarantees that the buffer is always zero-terminated. ^The first
+** parameter "n" is the total size of the buffer, including space for
+** the zero terminator. So the longest string that can be completely
+** written will be n-1 characters.
+**
+** ^The sqlite3_vsnprintf() routine is a varargs version of sqlite3_snprintf().
+**
+** See also: [built-in printf()], [printf() SQL function]
+*/
+SQLITE_API char *sqlite3_mprintf(const char*,...);
+SQLITE_API char *sqlite3_vmprintf(const char*, va_list);
+SQLITE_API char *sqlite3_snprintf(int,char*,const char*, ...);
+SQLITE_API char *sqlite3_vsnprintf(int,char*,const char*, va_list);
+
+/*
+** CAPI3REF: Memory Allocation Subsystem
+**
+** The SQLite core uses these three routines for all of its own
+** internal memory allocation needs. "Core" in the previous sentence
+** does not include operating-system specific [VFS] implementation. The
+** Windows VFS uses native malloc() and free() for some operations.
+**
+** ^The sqlite3_malloc() routine returns a pointer to a block
+** of memory at least N bytes in length, where N is the parameter.
+** ^If sqlite3_malloc() is unable to obtain sufficient free
+** memory, it returns a NULL pointer. ^If the parameter N to
+** sqlite3_malloc() is zero or negative then sqlite3_malloc() returns
+** a NULL pointer.
+**
+** ^The sqlite3_malloc64(N) routine works just like
+** sqlite3_malloc(N) except that N is an unsigned 64-bit integer instead
+** of a signed 32-bit integer.
+**
+** ^Calling sqlite3_free() with a pointer previously returned
+** by sqlite3_malloc() or sqlite3_realloc() releases that memory so
+** that it might be reused. ^The sqlite3_free() routine is
+** a no-op if is called with a NULL pointer. Passing a NULL pointer
+** to sqlite3_free() is harmless. After being freed, memory
+** should neither be read nor written. Even reading previously freed
+** memory might result in a segmentation fault or other severe error.
+** Memory corruption, a segmentation fault, or other severe error
+** might result if sqlite3_free() is called with a non-NULL pointer that
+** was not obtained from sqlite3_malloc() or sqlite3_realloc().
+**
+** ^The sqlite3_realloc(X,N) interface attempts to resize a
+** prior memory allocation X to be at least N bytes.
+** ^If the X parameter to sqlite3_realloc(X,N)
+** is a NULL pointer then its behavior is identical to calling
+** sqlite3_malloc(N).
+** ^If the N parameter to sqlite3_realloc(X,N) is zero or
+** negative then the behavior is exactly the same as calling
+** sqlite3_free(X).
+** ^sqlite3_realloc(X,N) returns a pointer to a memory allocation
+** of at least N bytes in size or NULL if insufficient memory is available.
+** ^If M is the size of the prior allocation, then min(N,M) bytes
+** of the prior allocation are copied into the beginning of buffer returned
+** by sqlite3_realloc(X,N) and the prior allocation is freed.
+** ^If sqlite3_realloc(X,N) returns NULL and N is positive, then the
+** prior allocation is not freed.
+**
+** ^The sqlite3_realloc64(X,N) interfaces works the same as
+** sqlite3_realloc(X,N) except that N is a 64-bit unsigned integer instead
+** of a 32-bit signed integer.
+**
+** ^If X is a memory allocation previously obtained from sqlite3_malloc(),
+** sqlite3_malloc64(), sqlite3_realloc(), or sqlite3_realloc64(), then
+** sqlite3_msize(X) returns the size of that memory allocation in bytes.
+** ^The value returned by sqlite3_msize(X) might be larger than the number
+** of bytes requested when X was allocated. ^If X is a NULL pointer then
+** sqlite3_msize(X) returns zero. If X points to something that is not
+** the beginning of memory allocation, or if it points to a formerly
+** valid memory allocation that has now been freed, then the behavior
+** of sqlite3_msize(X) is undefined and possibly harmful.
+**
+** ^The memory returned by sqlite3_malloc(), sqlite3_realloc(),
+** sqlite3_malloc64(), and sqlite3_realloc64()
+** is always aligned to at least an 8 byte boundary, or to a
+** 4 byte boundary if the [SQLITE_4_BYTE_ALIGNED_MALLOC] compile-time
+** option is used.
+**
+** The pointer arguments to [sqlite3_free()] and [sqlite3_realloc()]
+** must be either NULL or else pointers obtained from a prior
+** invocation of [sqlite3_malloc()] or [sqlite3_realloc()] that have
+** not yet been released.
+**
+** The application must not read or write any part of
+** a block of memory after it has been released using
+** [sqlite3_free()] or [sqlite3_realloc()].
+*/
+SQLITE_API void *sqlite3_malloc(int);
+SQLITE_API void *sqlite3_malloc64(sqlite3_uint64);
+SQLITE_API void *sqlite3_realloc(void*, int);
+SQLITE_API void *sqlite3_realloc64(void*, sqlite3_uint64);
+SQLITE_API void sqlite3_free(void*);
+SQLITE_API sqlite3_uint64 sqlite3_msize(void*);
+
+/*
+** CAPI3REF: Memory Allocator Statistics
+**
+** SQLite provides these two interfaces for reporting on the status
+** of the [sqlite3_malloc()], [sqlite3_free()], and [sqlite3_realloc()]
+** routines, which form the built-in memory allocation subsystem.
+**
+** ^The [sqlite3_memory_used()] routine returns the number of bytes
+** of memory currently outstanding (malloced but not freed).
+** ^The [sqlite3_memory_highwater()] routine returns the maximum
+** value of [sqlite3_memory_used()] since the high-water mark
+** was last reset. ^The values returned by [sqlite3_memory_used()] and
+** [sqlite3_memory_highwater()] include any overhead
+** added by SQLite in its implementation of [sqlite3_malloc()],
+** but not overhead added by the any underlying system library
+** routines that [sqlite3_malloc()] may call.
+**
+** ^The memory high-water mark is reset to the current value of
+** [sqlite3_memory_used()] if and only if the parameter to
+** [sqlite3_memory_highwater()] is true. ^The value returned
+** by [sqlite3_memory_highwater(1)] is the high-water mark
+** prior to the reset.
+*/
+SQLITE_API sqlite3_int64 sqlite3_memory_used(void);
+SQLITE_API sqlite3_int64 sqlite3_memory_highwater(int resetFlag);
+
+/*
+** CAPI3REF: Pseudo-Random Number Generator
+**
+** SQLite contains a high-quality pseudo-random number generator (PRNG) used to
+** select random [ROWID | ROWIDs] when inserting new records into a table that
+** already uses the largest possible [ROWID]. The PRNG is also used for
+** the built-in random() and randomblob() SQL functions. This interface allows
+** applications to access the same PRNG for other purposes.
+**
+** ^A call to this routine stores N bytes of randomness into buffer P.
+** ^The P parameter can be a NULL pointer.
+**
+** ^If this routine has not been previously called or if the previous
+** call had N less than one or a NULL pointer for P, then the PRNG is
+** seeded using randomness obtained from the xRandomness method of
+** the default [sqlite3_vfs] object.
+** ^If the previous call to this routine had an N of 1 or more and a
+** non-NULL P then the pseudo-randomness is generated
+** internally and without recourse to the [sqlite3_vfs] xRandomness
+** method.
+*/
+SQLITE_API void sqlite3_randomness(int N, void *P);
+
+/*
+** CAPI3REF: Compile-Time Authorization Callbacks
+** METHOD: sqlite3
+** KEYWORDS: {authorizer callback}
+**
+** ^This routine registers an authorizer callback with a particular
+** [database connection], supplied in the first argument.
+** ^The authorizer callback is invoked as SQL statements are being compiled
+** by [sqlite3_prepare()] or its variants [sqlite3_prepare_v2()],
+** [sqlite3_prepare_v3()], [sqlite3_prepare16()], [sqlite3_prepare16_v2()],
+** and [sqlite3_prepare16_v3()]. ^At various
+** points during the compilation process, as logic is being created
+** to perform various actions, the authorizer callback is invoked to
+** see if those actions are allowed. ^The authorizer callback should
+** return [SQLITE_OK] to allow the action, [SQLITE_IGNORE] to disallow the
+** specific action but allow the SQL statement to continue to be
+** compiled, or [SQLITE_DENY] to cause the entire SQL statement to be
+** rejected with an error. ^If the authorizer callback returns
+** any value other than [SQLITE_IGNORE], [SQLITE_OK], or [SQLITE_DENY]
+** then the [sqlite3_prepare_v2()] or equivalent call that triggered
+** the authorizer will fail with an error message.
+**
+** When the callback returns [SQLITE_OK], that means the operation
+** requested is ok. ^When the callback returns [SQLITE_DENY], the
+** [sqlite3_prepare_v2()] or equivalent call that triggered the
+** authorizer will fail with an error message explaining that
+** access is denied.
+**
+** ^The first parameter to the authorizer callback is a copy of the third
+** parameter to the sqlite3_set_authorizer() interface. ^The second parameter
+** to the callback is an integer [SQLITE_COPY | action code] that specifies
+** the particular action to be authorized. ^The third through sixth parameters
+** to the callback are either NULL pointers or zero-terminated strings
+** that contain additional details about the action to be authorized.
+** Applications must always be prepared to encounter a NULL pointer in any
+** of the third through the sixth parameters of the authorization callback.
+**
+** ^If the action code is [SQLITE_READ]
+** and the callback returns [SQLITE_IGNORE] then the
+** [prepared statement] statement is constructed to substitute
+** a NULL value in place of the table column that would have
+** been read if [SQLITE_OK] had been returned. The [SQLITE_IGNORE]
+** return can be used to deny an untrusted user access to individual
+** columns of a table.
+** ^When a table is referenced by a [SELECT] but no column values are
+** extracted from that table (for example in a query like
+** "SELECT count(*) FROM tab") then the [SQLITE_READ] authorizer callback
+** is invoked once for that table with a column name that is an empty string.
+** ^If the action code is [SQLITE_DELETE] and the callback returns
+** [SQLITE_IGNORE] then the [DELETE] operation proceeds but the
+** [truncate optimization] is disabled and all rows are deleted individually.
+**
+** An authorizer is used when [sqlite3_prepare | preparing]
+** SQL statements from an untrusted source, to ensure that the SQL statements
+** do not try to access data they are not allowed to see, or that they do not
+** try to execute malicious statements that damage the database. For
+** example, an application may allow a user to enter arbitrary
+** SQL queries for evaluation by a database. But the application does
+** not want the user to be able to make arbitrary changes to the
+** database. An authorizer could then be put in place while the
+** user-entered SQL is being [sqlite3_prepare | prepared] that
+** disallows everything except [SELECT] statements.
+**
+** Applications that need to process SQL from untrusted sources
+** might also consider lowering resource limits using [sqlite3_limit()]
+** and limiting database size using the [max_page_count] [PRAGMA]
+** in addition to using an authorizer.
+**
+** ^(Only a single authorizer can be in place on a database connection
+** at a time. Each call to sqlite3_set_authorizer overrides the
+** previous call.)^ ^Disable the authorizer by installing a NULL callback.
+** The authorizer is disabled by default.
+**
+** The authorizer callback must not do anything that will modify
+** the database connection that invoked the authorizer callback.
+** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their
+** database connections for the meaning of "modify" in this paragraph.
+**
+** ^When [sqlite3_prepare_v2()] is used to prepare a statement, the
+** statement might be re-prepared during [sqlite3_step()] due to a
+** schema change. Hence, the application should ensure that the
+** correct authorizer callback remains in place during the [sqlite3_step()].
+**
+** ^Note that the authorizer callback is invoked only during
+** [sqlite3_prepare()] or its variants. Authorization is not
+** performed during statement evaluation in [sqlite3_step()], unless
+** as stated in the previous paragraph, sqlite3_step() invokes
+** sqlite3_prepare_v2() to reprepare a statement after a schema change.
+*/
+SQLITE_API int sqlite3_set_authorizer(
+ sqlite3*,
+ int (*xAuth)(void*,int,const char*,const char*,const char*,const char*),
+ void *pUserData
+);
+
+/*
+** CAPI3REF: Authorizer Return Codes
+**
+** The [sqlite3_set_authorizer | authorizer callback function] must
+** return either [SQLITE_OK] or one of these two constants in order
+** to signal SQLite whether or not the action is permitted. See the
+** [sqlite3_set_authorizer | authorizer documentation] for additional
+** information.
+**
+** Note that SQLITE_IGNORE is also used as a [conflict resolution mode]
+** returned from the [sqlite3_vtab_on_conflict()] interface.
+*/
+#define SQLITE_DENY 1 /* Abort the SQL statement with an error */
+#define SQLITE_IGNORE 2 /* Don't allow access, but don't generate an error */
+
+/*
+** CAPI3REF: Authorizer Action Codes
+**
+** The [sqlite3_set_authorizer()] interface registers a callback function
+** that is invoked to authorize certain SQL statement actions. The
+** second parameter to the callback is an integer code that specifies
+** what action is being authorized. These are the integer action codes that
+** the authorizer callback may be passed.
+**
+** These action code values signify what kind of operation is to be
+** authorized. The 3rd and 4th parameters to the authorization
+** callback function will be parameters or NULL depending on which of these
+** codes is used as the second parameter. ^(The 5th parameter to the
+** authorizer callback is the name of the database ("main", "temp",
+** etc.) if applicable.)^ ^The 6th parameter to the authorizer callback
+** is the name of the inner-most trigger or view that is responsible for
+** the access attempt or NULL if this access attempt is directly from
+** top-level SQL code.
+*/
+/******************************************* 3rd ************ 4th ***********/
+#define SQLITE_CREATE_INDEX 1 /* Index Name Table Name */
+#define SQLITE_CREATE_TABLE 2 /* Table Name NULL */
+#define SQLITE_CREATE_TEMP_INDEX 3 /* Index Name Table Name */
+#define SQLITE_CREATE_TEMP_TABLE 4 /* Table Name NULL */
+#define SQLITE_CREATE_TEMP_TRIGGER 5 /* Trigger Name Table Name */
+#define SQLITE_CREATE_TEMP_VIEW 6 /* View Name NULL */
+#define SQLITE_CREATE_TRIGGER 7 /* Trigger Name Table Name */
+#define SQLITE_CREATE_VIEW 8 /* View Name NULL */
+#define SQLITE_DELETE 9 /* Table Name NULL */
+#define SQLITE_DROP_INDEX 10 /* Index Name Table Name */
+#define SQLITE_DROP_TABLE 11 /* Table Name NULL */
+#define SQLITE_DROP_TEMP_INDEX 12 /* Index Name Table Name */
+#define SQLITE_DROP_TEMP_TABLE 13 /* Table Name NULL */
+#define SQLITE_DROP_TEMP_TRIGGER 14 /* Trigger Name Table Name */
+#define SQLITE_DROP_TEMP_VIEW 15 /* View Name NULL */
+#define SQLITE_DROP_TRIGGER 16 /* Trigger Name Table Name */
+#define SQLITE_DROP_VIEW 17 /* View Name NULL */
+#define SQLITE_INSERT 18 /* Table Name NULL */
+#define SQLITE_PRAGMA 19 /* Pragma Name 1st arg or NULL */
+#define SQLITE_READ 20 /* Table Name Column Name */
+#define SQLITE_SELECT 21 /* NULL NULL */
+#define SQLITE_TRANSACTION 22 /* Operation NULL */
+#define SQLITE_UPDATE 23 /* Table Name Column Name */
+#define SQLITE_ATTACH 24 /* Filename NULL */
+#define SQLITE_DETACH 25 /* Database Name NULL */
+#define SQLITE_ALTER_TABLE 26 /* Database Name Table Name */
+#define SQLITE_REINDEX 27 /* Index Name NULL */
+#define SQLITE_ANALYZE 28 /* Table Name NULL */
+#define SQLITE_CREATE_VTABLE 29 /* Table Name Module Name */
+#define SQLITE_DROP_VTABLE 30 /* Table Name Module Name */
+#define SQLITE_FUNCTION 31 /* NULL Function Name */
+#define SQLITE_SAVEPOINT 32 /* Operation Savepoint Name */
+#define SQLITE_COPY 0 /* No longer used */
+#define SQLITE_RECURSIVE 33 /* NULL NULL */
+
+/*
+** CAPI3REF: Tracing And Profiling Functions
+** METHOD: sqlite3
+**
+** These routines are deprecated. Use the [sqlite3_trace_v2()] interface
+** instead of the routines described here.
+**
+** These routines register callback functions that can be used for
+** tracing and profiling the execution of SQL statements.
+**
+** ^The callback function registered by sqlite3_trace() is invoked at
+** various times when an SQL statement is being run by [sqlite3_step()].
+** ^The sqlite3_trace() callback is invoked with a UTF-8 rendering of the
+** SQL statement text as the statement first begins executing.
+** ^(Additional sqlite3_trace() callbacks might occur
+** as each triggered subprogram is entered. The callbacks for triggers
+** contain a UTF-8 SQL comment that identifies the trigger.)^
+**
+** The [SQLITE_TRACE_SIZE_LIMIT] compile-time option can be used to limit
+** the length of [bound parameter] expansion in the output of sqlite3_trace().
+**
+** ^The callback function registered by sqlite3_profile() is invoked
+** as each SQL statement finishes. ^The profile callback contains
+** the original statement text and an estimate of wall-clock time
+** of how long that statement took to run. ^The profile callback
+** time is in units of nanoseconds, however the current implementation
+** is only capable of millisecond resolution so the six least significant
+** digits in the time are meaningless. Future versions of SQLite
+** might provide greater resolution on the profiler callback. Invoking
+** either [sqlite3_trace()] or [sqlite3_trace_v2()] will cancel the
+** profile callback.
+*/
+SQLITE_API SQLITE_DEPRECATED void *sqlite3_trace(sqlite3*,
+ void(*xTrace)(void*,const char*), void*);
+SQLITE_API SQLITE_DEPRECATED void *sqlite3_profile(sqlite3*,
+ void(*xProfile)(void*,const char*,sqlite3_uint64), void*);
+
+/*
+** CAPI3REF: SQL Trace Event Codes
+** KEYWORDS: SQLITE_TRACE
+**
+** These constants identify classes of events that can be monitored
+** using the [sqlite3_trace_v2()] tracing logic. The M argument
+** to [sqlite3_trace_v2(D,M,X,P)] is an OR-ed combination of one or more of
+** the following constants. ^The first argument to the trace callback
+** is one of the following constants.
+**
+** New tracing constants may be added in future releases.
+**
+** ^A trace callback has four arguments: xCallback(T,C,P,X).
+** ^The T argument is one of the integer type codes above.
+** ^The C argument is a copy of the context pointer passed in as the
+** fourth argument to [sqlite3_trace_v2()].
+** The P and X arguments are pointers whose meanings depend on T.
+**
+** <dl>
+** [[SQLITE_TRACE_STMT]] <dt>SQLITE_TRACE_STMT</dt>
+** <dd>^An SQLITE_TRACE_STMT callback is invoked when a prepared statement
+** first begins running and possibly at other times during the
+** execution of the prepared statement, such as at the start of each
+** trigger subprogram. ^The P argument is a pointer to the
+** [prepared statement]. ^The X argument is a pointer to a string which
+** is the unexpanded SQL text of the prepared statement or an SQL comment
+** that indicates the invocation of a trigger. ^The callback can compute
+** the same text that would have been returned by the legacy [sqlite3_trace()]
+** interface by using the X argument when X begins with "--" and invoking
+** [sqlite3_expanded_sql(P)] otherwise.
+**
+** [[SQLITE_TRACE_PROFILE]] <dt>SQLITE_TRACE_PROFILE</dt>
+** <dd>^An SQLITE_TRACE_PROFILE callback provides approximately the same
+** information as is provided by the [sqlite3_profile()] callback.
+** ^The P argument is a pointer to the [prepared statement] and the
+** X argument points to a 64-bit integer which is the estimated of
+** the number of nanosecond that the prepared statement took to run.
+** ^The SQLITE_TRACE_PROFILE callback is invoked when the statement finishes.
+**
+** [[SQLITE_TRACE_ROW]] <dt>SQLITE_TRACE_ROW</dt>
+** <dd>^An SQLITE_TRACE_ROW callback is invoked whenever a prepared
+** statement generates a single row of result.
+** ^The P argument is a pointer to the [prepared statement] and the
+** X argument is unused.
+**
+** [[SQLITE_TRACE_CLOSE]] <dt>SQLITE_TRACE_CLOSE</dt>
+** <dd>^An SQLITE_TRACE_CLOSE callback is invoked when a database
+** connection closes.
+** ^The P argument is a pointer to the [database connection] object
+** and the X argument is unused.
+** </dl>
+*/
+#define SQLITE_TRACE_STMT 0x01
+#define SQLITE_TRACE_PROFILE 0x02
+#define SQLITE_TRACE_ROW 0x04
+#define SQLITE_TRACE_CLOSE 0x08
+
+/*
+** CAPI3REF: SQL Trace Hook
+** METHOD: sqlite3
+**
+** ^The sqlite3_trace_v2(D,M,X,P) interface registers a trace callback
+** function X against [database connection] D, using property mask M
+** and context pointer P. ^If the X callback is
+** NULL or if the M mask is zero, then tracing is disabled. The
+** M argument should be the bitwise OR-ed combination of
+** zero or more [SQLITE_TRACE] constants.
+**
+** ^Each call to either sqlite3_trace() or sqlite3_trace_v2() overrides
+** (cancels) any prior calls to sqlite3_trace() or sqlite3_trace_v2().
+**
+** ^The X callback is invoked whenever any of the events identified by
+** mask M occur. ^The integer return value from the callback is currently
+** ignored, though this may change in future releases. Callback
+** implementations should return zero to ensure future compatibility.
+**
+** ^A trace callback is invoked with four arguments: callback(T,C,P,X).
+** ^The T argument is one of the [SQLITE_TRACE]
+** constants to indicate why the callback was invoked.
+** ^The C argument is a copy of the context pointer.
+** The P and X arguments are pointers whose meanings depend on T.
+**
+** The sqlite3_trace_v2() interface is intended to replace the legacy
+** interfaces [sqlite3_trace()] and [sqlite3_profile()], both of which
+** are deprecated.
+*/
+SQLITE_API int sqlite3_trace_v2(
+ sqlite3*,
+ unsigned uMask,
+ int(*xCallback)(unsigned,void*,void*,void*),
+ void *pCtx
+);
+
+/*
+** CAPI3REF: Query Progress Callbacks
+** METHOD: sqlite3
+**
+** ^The sqlite3_progress_handler(D,N,X,P) interface causes the callback
+** function X to be invoked periodically during long running calls to
+** [sqlite3_exec()], [sqlite3_step()] and [sqlite3_get_table()] for
+** database connection D. An example use for this
+** interface is to keep a GUI updated during a large query.
+**
+** ^The parameter P is passed through as the only parameter to the
+** callback function X. ^The parameter N is the approximate number of
+** [virtual machine instructions] that are evaluated between successive
+** invocations of the callback X. ^If N is less than one then the progress
+** handler is disabled.
+**
+** ^Only a single progress handler may be defined at one time per
+** [database connection]; setting a new progress handler cancels the
+** old one. ^Setting parameter X to NULL disables the progress handler.
+** ^The progress handler is also disabled by setting N to a value less
+** than 1.
+**
+** ^If the progress callback returns non-zero, the operation is
+** interrupted. This feature can be used to implement a
+** "Cancel" button on a GUI progress dialog box.
+**
+** The progress handler callback must not do anything that will modify
+** the database connection that invoked the progress handler.
+** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their
+** database connections for the meaning of "modify" in this paragraph.
+**
+*/
+SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
+
+/*
+** CAPI3REF: Opening A New Database Connection
+** CONSTRUCTOR: sqlite3
+**
+** ^These routines open an SQLite database file as specified by the
+** filename argument. ^The filename argument is interpreted as UTF-8 for
+** sqlite3_open() and sqlite3_open_v2() and as UTF-16 in the native byte
+** order for sqlite3_open16(). ^(A [database connection] handle is usually
+** returned in *ppDb, even if an error occurs. The only exception is that
+** if SQLite is unable to allocate memory to hold the [sqlite3] object,
+** a NULL will be written into *ppDb instead of a pointer to the [sqlite3]
+** object.)^ ^(If the database is opened (and/or created) successfully, then
+** [SQLITE_OK] is returned. Otherwise an [error code] is returned.)^ ^The
+** [sqlite3_errmsg()] or [sqlite3_errmsg16()] routines can be used to obtain
+** an English language description of the error following a failure of any
+** of the sqlite3_open() routines.
+**
+** ^The default encoding will be UTF-8 for databases created using
+** sqlite3_open() or sqlite3_open_v2(). ^The default encoding for databases
+** created using sqlite3_open16() will be UTF-16 in the native byte order.
+**
+** Whether or not an error occurs when it is opened, resources
+** associated with the [database connection] handle should be released by
+** passing it to [sqlite3_close()] when it is no longer required.
+**
+** The sqlite3_open_v2() interface works like sqlite3_open()
+** except that it accepts two additional parameters for additional control
+** over the new database connection. ^(The flags parameter to
+** sqlite3_open_v2() must include, at a minimum, one of the following
+** three flag combinations:)^
+**
+** <dl>
+** ^(<dt>[SQLITE_OPEN_READONLY]</dt>
+** <dd>The database is opened in read-only mode. If the database does not
+** already exist, an error is returned.</dd>)^
+**
+** ^(<dt>[SQLITE_OPEN_READWRITE]</dt>
+** <dd>The database is opened for reading and writing if possible, or reading
+** only if the file is write protected by the operating system. In either
+** case the database must already exist, otherwise an error is returned.</dd>)^
+**
+** ^(<dt>[SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE]</dt>
+** <dd>The database is opened for reading and writing, and is created if
+** it does not already exist. This is the behavior that is always used for
+** sqlite3_open() and sqlite3_open16().</dd>)^
+** </dl>
+**
+** In addition to the required flags, the following optional flags are
+** also supported:
+**
+** <dl>
+** ^(<dt>[SQLITE_OPEN_URI]</dt>
+** <dd>The filename can be interpreted as a URI if this flag is set.</dd>)^
+**
+** ^(<dt>[SQLITE_OPEN_MEMORY]</dt>
+** <dd>The database will be opened as an in-memory database. The database
+** is named by the "filename" argument for the purposes of cache-sharing,
+** if shared cache mode is enabled, but the "filename" is otherwise ignored.
+** </dd>)^
+**
+** ^(<dt>[SQLITE_OPEN_NOMUTEX]</dt>
+** <dd>The new database connection will use the "multi-thread"
+** [threading mode].)^ This means that separate threads are allowed
+** to use SQLite at the same time, as long as each thread is using
+** a different [database connection].
+**
+** ^(<dt>[SQLITE_OPEN_FULLMUTEX]</dt>
+** <dd>The new database connection will use the "serialized"
+** [threading mode].)^ This means the multiple threads can safely
+** attempt to use the same database connection at the same time.
+** (Mutexes will block any actual concurrency, but in this mode
+** there is no harm in trying.)
+**
+** ^(<dt>[SQLITE_OPEN_SHAREDCACHE]</dt>
+** <dd>The database is opened [shared cache] enabled, overriding
+** the default shared cache setting provided by
+** [sqlite3_enable_shared_cache()].)^
+**
+** ^(<dt>[SQLITE_OPEN_PRIVATECACHE]</dt>
+** <dd>The database is opened [shared cache] disabled, overriding
+** the default shared cache setting provided by
+** [sqlite3_enable_shared_cache()].)^
+**
+** [[OPEN_NOFOLLOW]] ^(<dt>[SQLITE_OPEN_NOFOLLOW]</dt>
+** <dd>The database filename is not allowed to be a symbolic link</dd>
+** </dl>)^
+**
+** If the 3rd parameter to sqlite3_open_v2() is not one of the
+** required combinations shown above optionally combined with other
+** [SQLITE_OPEN_READONLY | SQLITE_OPEN_* bits]
+** then the behavior is undefined.
+**
+** ^The fourth parameter to sqlite3_open_v2() is the name of the
+** [sqlite3_vfs] object that defines the operating system interface that
+** the new database connection should use. ^If the fourth parameter is
+** a NULL pointer then the default [sqlite3_vfs] object is used.
+**
+** ^If the filename is ":memory:", then a private, temporary in-memory database
+** is created for the connection. ^This in-memory database will vanish when
+** the database connection is closed. Future versions of SQLite might
+** make use of additional special filenames that begin with the ":" character.
+** It is recommended that when a database filename actually does begin with
+** a ":" character you should prefix the filename with a pathname such as
+** "./" to avoid ambiguity.
+**
+** ^If the filename is an empty string, then a private, temporary
+** on-disk database will be created. ^This private database will be
+** automatically deleted as soon as the database connection is closed.
+**
+** [[URI filenames in sqlite3_open()]] <h3>URI Filenames</h3>
+**
+** ^If [URI filename] interpretation is enabled, and the filename argument
+** begins with "file:", then the filename is interpreted as a URI. ^URI
+** filename interpretation is enabled if the [SQLITE_OPEN_URI] flag is
+** set in the third argument to sqlite3_open_v2(), or if it has
+** been enabled globally using the [SQLITE_CONFIG_URI] option with the
+** [sqlite3_config()] method or by the [SQLITE_USE_URI] compile-time option.
+** URI filename interpretation is turned off
+** by default, but future releases of SQLite might enable URI filename
+** interpretation by default. See "[URI filenames]" for additional
+** information.
+**
+** URI filenames are parsed according to RFC 3986. ^If the URI contains an
+** authority, then it must be either an empty string or the string
+** "localhost". ^If the authority is not an empty string or "localhost", an
+** error is returned to the caller. ^The fragment component of a URI, if
+** present, is ignored.
+**
+** ^SQLite uses the path component of the URI as the name of the disk file
+** which contains the database. ^If the path begins with a '/' character,
+** then it is interpreted as an absolute path. ^If the path does not begin
+** with a '/' (meaning that the authority section is omitted from the URI)
+** then the path is interpreted as a relative path.
+** ^(On windows, the first component of an absolute path
+** is a drive specification (e.g. "C:").)^
+**
+** [[core URI query parameters]]
+** The query component of a URI may contain parameters that are interpreted
+** either by SQLite itself, or by a [VFS | custom VFS implementation].
+** SQLite and its built-in [VFSes] interpret the
+** following query parameters:
+**
+** <ul>
+** <li> <b>vfs</b>: ^The "vfs" parameter may be used to specify the name of
+** a VFS object that provides the operating system interface that should
+** be used to access the database file on disk. ^If this option is set to
+** an empty string the default VFS object is used. ^Specifying an unknown
+** VFS is an error. ^If sqlite3_open_v2() is used and the vfs option is
+** present, then the VFS specified by the option takes precedence over
+** the value passed as the fourth parameter to sqlite3_open_v2().
+**
+** <li> <b>mode</b>: ^(The mode parameter may be set to either "ro", "rw",
+** "rwc", or "memory". Attempting to set it to any other value is
+** an error)^.
+** ^If "ro" is specified, then the database is opened for read-only
+** access, just as if the [SQLITE_OPEN_READONLY] flag had been set in the
+** third argument to sqlite3_open_v2(). ^If the mode option is set to
+** "rw", then the database is opened for read-write (but not create)
+** access, as if SQLITE_OPEN_READWRITE (but not SQLITE_OPEN_CREATE) had
+** been set. ^Value "rwc" is equivalent to setting both
+** SQLITE_OPEN_READWRITE and SQLITE_OPEN_CREATE. ^If the mode option is
+** set to "memory" then a pure [in-memory database] that never reads
+** or writes from disk is used. ^It is an error to specify a value for
+** the mode parameter that is less restrictive than that specified by
+** the flags passed in the third parameter to sqlite3_open_v2().
+**
+** <li> <b>cache</b>: ^The cache parameter may be set to either "shared" or
+** "private". ^Setting it to "shared" is equivalent to setting the
+** SQLITE_OPEN_SHAREDCACHE bit in the flags argument passed to
+** sqlite3_open_v2(). ^Setting the cache parameter to "private" is
+** equivalent to setting the SQLITE_OPEN_PRIVATECACHE bit.
+** ^If sqlite3_open_v2() is used and the "cache" parameter is present in
+** a URI filename, its value overrides any behavior requested by setting
+** SQLITE_OPEN_PRIVATECACHE or SQLITE_OPEN_SHAREDCACHE flag.
+**
+** <li> <b>psow</b>: ^The psow parameter indicates whether or not the
+** [powersafe overwrite] property does or does not apply to the
+** storage media on which the database file resides.
+**
+** <li> <b>nolock</b>: ^The nolock parameter is a boolean query parameter
+** which if set disables file locking in rollback journal modes. This
+** is useful for accessing a database on a filesystem that does not
+** support locking. Caution: Database corruption might result if two
+** or more processes write to the same database and any one of those
+** processes uses nolock=1.
+**
+** <li> <b>immutable</b>: ^The immutable parameter is a boolean query
+** parameter that indicates that the database file is stored on
+** read-only media. ^When immutable is set, SQLite assumes that the
+** database file cannot be changed, even by a process with higher
+** privilege, and so the database is opened read-only and all locking
+** and change detection is disabled. Caution: Setting the immutable
+** property on a database file that does in fact change can result
+** in incorrect query results and/or [SQLITE_CORRUPT] errors.
+** See also: [SQLITE_IOCAP_IMMUTABLE].
+**
+** </ul>
+**
+** ^Specifying an unknown parameter in the query component of a URI is not an
+** error. Future versions of SQLite might understand additional query
+** parameters. See "[query parameters with special meaning to SQLite]" for
+** additional information.
+**
+** [[URI filename examples]] <h3>URI filename examples</h3>
+**
+** <table border="1" align=center cellpadding=5>
+** <tr><th> URI filenames <th> Results
+** <tr><td> file:data.db <td>
+** Open the file "data.db" in the current directory.
+** <tr><td> file:/home/fred/data.db<br>
+** file:///home/fred/data.db <br>
+** file://localhost/home/fred/data.db <br> <td>
+** Open the database file "/home/fred/data.db".
+** <tr><td> file://darkstar/home/fred/data.db <td>
+** An error. "darkstar" is not a recognized authority.
+** <tr><td style="white-space:nowrap">
+** file:///C:/Documents%20and%20Settings/fred/Desktop/data.db
+** <td> Windows only: Open the file "data.db" on fred's desktop on drive
+** C:. Note that the %20 escaping in this example is not strictly
+** necessary - space characters can be used literally
+** in URI filenames.
+** <tr><td> file:data.db?mode=ro&cache=private <td>
+** Open file "data.db" in the current directory for read-only access.
+** Regardless of whether or not shared-cache mode is enabled by
+** default, use a private cache.
+** <tr><td> file:/home/fred/data.db?vfs=unix-dotfile <td>
+** Open file "/home/fred/data.db". Use the special VFS "unix-dotfile"
+** that uses dot-files in place of posix advisory locking.
+** <tr><td> file:data.db?mode=readonly <td>
+** An error. "readonly" is not a valid option for the "mode" parameter.
+** </table>
+**
+** ^URI hexadecimal escape sequences (%HH) are supported within the path and
+** query components of a URI. A hexadecimal escape sequence consists of a
+** percent sign - "%" - followed by exactly two hexadecimal digits
+** specifying an octet value. ^Before the path or query components of a
+** URI filename are interpreted, they are encoded using UTF-8 and all
+** hexadecimal escape sequences replaced by a single byte containing the
+** corresponding octet. If this process generates an invalid UTF-8 encoding,
+** the results are undefined.
+**
+** <b>Note to Windows users:</b> The encoding used for the filename argument
+** of sqlite3_open() and sqlite3_open_v2() must be UTF-8, not whatever
+** codepage is currently defined. Filenames containing international
+** characters must be converted to UTF-8 prior to passing them into
+** sqlite3_open() or sqlite3_open_v2().
+**
+** <b>Note to Windows Runtime users:</b> The temporary directory must be set
+** prior to calling sqlite3_open() or sqlite3_open_v2(). Otherwise, various
+** features that require the use of temporary files may fail.
+**
+** See also: [sqlite3_temp_directory]
+*/
+SQLITE_API int sqlite3_open(
+ const char *filename, /* Database filename (UTF-8) */
+ sqlite3 **ppDb /* OUT: SQLite db handle */
+);
+SQLITE_API int sqlite3_open16(
+ const void *filename, /* Database filename (UTF-16) */
+ sqlite3 **ppDb /* OUT: SQLite db handle */
+);
+SQLITE_API int sqlite3_open_v2(
+ const char *filename, /* Database filename (UTF-8) */
+ sqlite3 **ppDb, /* OUT: SQLite db handle */
+ int flags, /* Flags */
+ const char *zVfs /* Name of VFS module to use */
+);
+
+/*
+** CAPI3REF: Obtain Values For URI Parameters
+**
+** These are utility routines, useful to [VFS|custom VFS implementations],
+** that check if a database file was a URI that contained a specific query
+** parameter, and if so obtains the value of that query parameter.
+**
+** The first parameter to these interfaces (hereafter referred to
+** as F) must be one of:
+** <ul>
+** <li> A database filename pointer created by the SQLite core and
+** passed into the xOpen() method of a VFS implemention, or
+** <li> A filename obtained from [sqlite3_db_filename()], or
+** <li> A new filename constructed using [sqlite3_create_filename()].
+** </ul>
+** If the F parameter is not one of the above, then the behavior is
+** undefined and probably undesirable. Older versions of SQLite were
+** more tolerant of invalid F parameters than newer versions.
+**
+** If F is a suitable filename (as described in the previous paragraph)
+** and if P is the name of the query parameter, then
+** sqlite3_uri_parameter(F,P) returns the value of the P
+** parameter if it exists or a NULL pointer if P does not appear as a
+** query parameter on F. If P is a query parameter of F and it
+** has no explicit value, then sqlite3_uri_parameter(F,P) returns
+** a pointer to an empty string.
+**
+** The sqlite3_uri_boolean(F,P,B) routine assumes that P is a boolean
+** parameter and returns true (1) or false (0) according to the value
+** of P. The sqlite3_uri_boolean(F,P,B) routine returns true (1) if the
+** value of query parameter P is one of "yes", "true", or "on" in any
+** case or if the value begins with a non-zero number. The
+** sqlite3_uri_boolean(F,P,B) routines returns false (0) if the value of
+** query parameter P is one of "no", "false", or "off" in any case or
+** if the value begins with a numeric zero. If P is not a query
+** parameter on F or if the value of P does not match any of the
+** above, then sqlite3_uri_boolean(F,P,B) returns (B!=0).
+**
+** The sqlite3_uri_int64(F,P,D) routine converts the value of P into a
+** 64-bit signed integer and returns that integer, or D if P does not
+** exist. If the value of P is something other than an integer, then
+** zero is returned.
+**
+** The sqlite3_uri_key(F,N) returns a pointer to the name (not
+** the value) of the N-th query parameter for filename F, or a NULL
+** pointer if N is less than zero or greater than the number of query
+** parameters minus 1. The N value is zero-based so N should be 0 to obtain
+** the name of the first query parameter, 1 for the second parameter, and
+** so forth.
+**
+** If F is a NULL pointer, then sqlite3_uri_parameter(F,P) returns NULL and
+** sqlite3_uri_boolean(F,P,B) returns B. If F is not a NULL pointer and
+** is not a database file pathname pointer that the SQLite core passed
+** into the xOpen VFS method, then the behavior of this routine is undefined
+** and probably undesirable.
+**
+** Beginning with SQLite [version 3.31.0] ([dateof:3.31.0]) the input F
+** parameter can also be the name of a rollback journal file or WAL file
+** in addition to the main database file. Prior to version 3.31.0, these
+** routines would only work if F was the name of the main database file.
+** When the F parameter is the name of the rollback journal or WAL file,
+** it has access to all the same query parameters as were found on the
+** main database file.
+**
+** See the [URI filename] documentation for additional information.
+*/
+SQLITE_API const char *sqlite3_uri_parameter(const char *zFilename, const char *zParam);
+SQLITE_API int sqlite3_uri_boolean(const char *zFile, const char *zParam, int bDefault);
+SQLITE_API sqlite3_int64 sqlite3_uri_int64(const char*, const char*, sqlite3_int64);
+SQLITE_API const char *sqlite3_uri_key(const char *zFilename, int N);
+
+/*
+** CAPI3REF: Translate filenames
+**
+** These routines are available to [VFS|custom VFS implementations] for
+** translating filenames between the main database file, the journal file,
+** and the WAL file.
+**
+** If F is the name of an sqlite database file, journal file, or WAL file
+** passed by the SQLite core into the VFS, then sqlite3_filename_database(F)
+** returns the name of the corresponding database file.
+**
+** If F is the name of an sqlite database file, journal file, or WAL file
+** passed by the SQLite core into the VFS, or if F is a database filename
+** obtained from [sqlite3_db_filename()], then sqlite3_filename_journal(F)
+** returns the name of the corresponding rollback journal file.
+**
+** If F is the name of an sqlite database file, journal file, or WAL file
+** that was passed by the SQLite core into the VFS, or if F is a database
+** filename obtained from [sqlite3_db_filename()], then
+** sqlite3_filename_wal(F) returns the name of the corresponding
+** WAL file.
+**
+** In all of the above, if F is not the name of a database, journal or WAL
+** filename passed into the VFS from the SQLite core and F is not the
+** return value from [sqlite3_db_filename()], then the result is
+** undefined and is likely a memory access violation.
+*/
+SQLITE_API const char *sqlite3_filename_database(const char*);
+SQLITE_API const char *sqlite3_filename_journal(const char*);
+SQLITE_API const char *sqlite3_filename_wal(const char*);
+
+/*
+** CAPI3REF: Database File Corresponding To A Journal
+**
+** ^If X is the name of a rollback or WAL-mode journal file that is
+** passed into the xOpen method of [sqlite3_vfs], then
+** sqlite3_database_file_object(X) returns a pointer to the [sqlite3_file]
+** object that represents the main database file.
+**
+** This routine is intended for use in custom [VFS] implementations
+** only. It is not a general-purpose interface.
+** The argument sqlite3_file_object(X) must be a filename pointer that
+** has been passed into [sqlite3_vfs].xOpen method where the
+** flags parameter to xOpen contains one of the bits
+** [SQLITE_OPEN_MAIN_JOURNAL] or [SQLITE_OPEN_WAL]. Any other use
+** of this routine results in undefined and probably undesirable
+** behavior.
+*/
+SQLITE_API sqlite3_file *sqlite3_database_file_object(const char*);
+
+/*
+** CAPI3REF: Create and Destroy VFS Filenames
+**
+** These interfces are provided for use by [VFS shim] implementations and
+** are not useful outside of that context.
+**
+** The sqlite3_create_filename(D,J,W,N,P) allocates memory to hold a version of
+** database filename D with corresponding journal file J and WAL file W and
+** with N URI parameters key/values pairs in the array P. The result from
+** sqlite3_create_filename(D,J,W,N,P) is a pointer to a database filename that
+** is safe to pass to routines like:
+** <ul>
+** <li> [sqlite3_uri_parameter()],
+** <li> [sqlite3_uri_boolean()],
+** <li> [sqlite3_uri_int64()],
+** <li> [sqlite3_uri_key()],
+** <li> [sqlite3_filename_database()],
+** <li> [sqlite3_filename_journal()], or
+** <li> [sqlite3_filename_wal()].
+** </ul>
+** If a memory allocation error occurs, sqlite3_create_filename() might
+** return a NULL pointer. The memory obtained from sqlite3_create_filename(X)
+** must be released by a corresponding call to sqlite3_free_filename(Y).
+**
+** The P parameter in sqlite3_create_filename(D,J,W,N,P) should be an array
+** of 2*N pointers to strings. Each pair of pointers in this array corresponds
+** to a key and value for a query parameter. The P parameter may be a NULL
+** pointer if N is zero. None of the 2*N pointers in the P array may be
+** NULL pointers and key pointers should not be empty strings.
+** None of the D, J, or W parameters to sqlite3_create_filename(D,J,W,N,P) may
+** be NULL pointers, though they can be empty strings.
+**
+** The sqlite3_free_filename(Y) routine releases a memory allocation
+** previously obtained from sqlite3_create_filename(). Invoking
+** sqlite3_free_filename(Y) where Y is a NULL pointer is a harmless no-op.
+**
+** If the Y parameter to sqlite3_free_filename(Y) is anything other
+** than a NULL pointer or a pointer previously acquired from
+** sqlite3_create_filename(), then bad things such as heap
+** corruption or segfaults may occur. The value Y should not be
+** used again after sqlite3_free_filename(Y) has been called. This means
+** that if the [sqlite3_vfs.xOpen()] method of a VFS has been called using Y,
+** then the corresponding [sqlite3_module.xClose() method should also be
+** invoked prior to calling sqlite3_free_filename(Y).
+*/
+SQLITE_API char *sqlite3_create_filename(
+ const char *zDatabase,
+ const char *zJournal,
+ const char *zWal,
+ int nParam,
+ const char **azParam
+);
+SQLITE_API void sqlite3_free_filename(char*);
+
+/*
+** CAPI3REF: Error Codes And Messages
+** METHOD: sqlite3
+**
+** ^If the most recent sqlite3_* API call associated with
+** [database connection] D failed, then the sqlite3_errcode(D) interface
+** returns the numeric [result code] or [extended result code] for that
+** API call.
+** ^The sqlite3_extended_errcode()
+** interface is the same except that it always returns the
+** [extended result code] even when extended result codes are
+** disabled.
+**
+** The values returned by sqlite3_errcode() and/or
+** sqlite3_extended_errcode() might change with each API call.
+** Except, there are some interfaces that are guaranteed to never
+** change the value of the error code. The error-code preserving
+** interfaces are:
+**
+** <ul>
+** <li> sqlite3_errcode()
+** <li> sqlite3_extended_errcode()
+** <li> sqlite3_errmsg()
+** <li> sqlite3_errmsg16()
+** </ul>
+**
+** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language
+** text that describes the error, as either UTF-8 or UTF-16 respectively.
+** ^(Memory to hold the error message string is managed internally.
+** The application does not need to worry about freeing the result.
+** However, the error string might be overwritten or deallocated by
+** subsequent calls to other SQLite interface functions.)^
+**
+** ^The sqlite3_errstr() interface returns the English-language text
+** that describes the [result code], as UTF-8.
+** ^(Memory to hold the error message string is managed internally
+** and must not be freed by the application)^.
+**
+** When the serialized [threading mode] is in use, it might be the
+** case that a second error occurs on a separate thread in between
+** the time of the first error and the call to these interfaces.
+** When that happens, the second error will be reported since these
+** interfaces always report the most recent result. To avoid
+** this, each thread can obtain exclusive use of the [database connection] D
+** by invoking [sqlite3_mutex_enter]([sqlite3_db_mutex](D)) before beginning
+** to use D and invoking [sqlite3_mutex_leave]([sqlite3_db_mutex](D)) after
+** all calls to the interfaces listed here are completed.
+**
+** If an interface fails with SQLITE_MISUSE, that means the interface
+** was invoked incorrectly by the application. In that case, the
+** error code and message may or may not be set.
+*/
+SQLITE_API int sqlite3_errcode(sqlite3 *db);
+SQLITE_API int sqlite3_extended_errcode(sqlite3 *db);
+SQLITE_API const char *sqlite3_errmsg(sqlite3*);
+SQLITE_API const void *sqlite3_errmsg16(sqlite3*);
+SQLITE_API const char *sqlite3_errstr(int);
+
+/*
+** CAPI3REF: Prepared Statement Object
+** KEYWORDS: {prepared statement} {prepared statements}
+**
+** An instance of this object represents a single SQL statement that
+** has been compiled into binary form and is ready to be evaluated.
+**
+** Think of each SQL statement as a separate computer program. The
+** original SQL text is source code. A prepared statement object
+** is the compiled object code. All SQL must be converted into a
+** prepared statement before it can be run.
+**
+** The life-cycle of a prepared statement object usually goes like this:
+**
+** <ol>
+** <li> Create the prepared statement object using [sqlite3_prepare_v2()].
+** <li> Bind values to [parameters] using the sqlite3_bind_*()
+** interfaces.
+** <li> Run the SQL by calling [sqlite3_step()] one or more times.
+** <li> Reset the prepared statement using [sqlite3_reset()] then go back
+** to step 2. Do this zero or more times.
+** <li> Destroy the object using [sqlite3_finalize()].
+** </ol>
+*/
+typedef struct sqlite3_stmt sqlite3_stmt;
+
+/*
+** CAPI3REF: Run-time Limits
+** METHOD: sqlite3
+**
+** ^(This interface allows the size of various constructs to be limited
+** on a connection by connection basis. The first parameter is the
+** [database connection] whose limit is to be set or queried. The
+** second parameter is one of the [limit categories] that define a
+** class of constructs to be size limited. The third parameter is the
+** new limit for that construct.)^
+**
+** ^If the new limit is a negative number, the limit is unchanged.
+** ^(For each limit category SQLITE_LIMIT_<i>NAME</i> there is a
+** [limits | hard upper bound]
+** set at compile-time by a C preprocessor macro called
+** [limits | SQLITE_MAX_<i>NAME</i>].
+** (The "_LIMIT_" in the name is changed to "_MAX_".))^
+** ^Attempts to increase a limit above its hard upper bound are
+** silently truncated to the hard upper bound.
+**
+** ^Regardless of whether or not the limit was changed, the
+** [sqlite3_limit()] interface returns the prior value of the limit.
+** ^Hence, to find the current value of a limit without changing it,
+** simply invoke this interface with the third parameter set to -1.
+**
+** Run-time limits are intended for use in applications that manage
+** both their own internal database and also databases that are controlled
+** by untrusted external sources. An example application might be a
+** web browser that has its own databases for storing history and
+** separate databases controlled by JavaScript applications downloaded
+** off the Internet. The internal databases can be given the
+** large, default limits. Databases managed by external sources can
+** be given much smaller limits designed to prevent a denial of service
+** attack. Developers might also want to use the [sqlite3_set_authorizer()]
+** interface to further control untrusted SQL. The size of the database
+** created by an untrusted script can be contained using the
+** [max_page_count] [PRAGMA].
+**
+** New run-time limit categories may be added in future releases.
+*/
+SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
+
+/*
+** CAPI3REF: Run-Time Limit Categories
+** KEYWORDS: {limit category} {*limit categories}
+**
+** These constants define various performance limits
+** that can be lowered at run-time using [sqlite3_limit()].
+** The synopsis of the meanings of the various limits is shown below.
+** Additional information is available at [limits | Limits in SQLite].
+**
+** <dl>
+** [[SQLITE_LIMIT_LENGTH]] ^(<dt>SQLITE_LIMIT_LENGTH</dt>
+** <dd>The maximum size of any string or BLOB or table row, in bytes.<dd>)^
+**
+** [[SQLITE_LIMIT_SQL_LENGTH]] ^(<dt>SQLITE_LIMIT_SQL_LENGTH</dt>
+** <dd>The maximum length of an SQL statement, in bytes.</dd>)^
+**
+** [[SQLITE_LIMIT_COLUMN]] ^(<dt>SQLITE_LIMIT_COLUMN</dt>
+** <dd>The maximum number of columns in a table definition or in the
+** result set of a [SELECT] or the maximum number of columns in an index
+** or in an ORDER BY or GROUP BY clause.</dd>)^
+**
+** [[SQLITE_LIMIT_EXPR_DEPTH]] ^(<dt>SQLITE_LIMIT_EXPR_DEPTH</dt>
+** <dd>The maximum depth of the parse tree on any expression.</dd>)^
+**
+** [[SQLITE_LIMIT_COMPOUND_SELECT]] ^(<dt>SQLITE_LIMIT_COMPOUND_SELECT</dt>
+** <dd>The maximum number of terms in a compound SELECT statement.</dd>)^
+**
+** [[SQLITE_LIMIT_VDBE_OP]] ^(<dt>SQLITE_LIMIT_VDBE_OP</dt>
+** <dd>The maximum number of instructions in a virtual machine program
+** used to implement an SQL statement. If [sqlite3_prepare_v2()] or
+** the equivalent tries to allocate space for more than this many opcodes
+** in a single prepared statement, an SQLITE_NOMEM error is returned.</dd>)^
+**
+** [[SQLITE_LIMIT_FUNCTION_ARG]] ^(<dt>SQLITE_LIMIT_FUNCTION_ARG</dt>
+** <dd>The maximum number of arguments on a function.</dd>)^
+**
+** [[SQLITE_LIMIT_ATTACHED]] ^(<dt>SQLITE_LIMIT_ATTACHED</dt>
+** <dd>The maximum number of [ATTACH | attached databases].)^</dd>
+**
+** [[SQLITE_LIMIT_LIKE_PATTERN_LENGTH]]
+** ^(<dt>SQLITE_LIMIT_LIKE_PATTERN_LENGTH</dt>
+** <dd>The maximum length of the pattern argument to the [LIKE] or
+** [GLOB] operators.</dd>)^
+**
+** [[SQLITE_LIMIT_VARIABLE_NUMBER]]
+** ^(<dt>SQLITE_LIMIT_VARIABLE_NUMBER</dt>
+** <dd>The maximum index number of any [parameter] in an SQL statement.)^
+**
+** [[SQLITE_LIMIT_TRIGGER_DEPTH]] ^(<dt>SQLITE_LIMIT_TRIGGER_DEPTH</dt>
+** <dd>The maximum depth of recursion for triggers.</dd>)^
+**
+** [[SQLITE_LIMIT_WORKER_THREADS]] ^(<dt>SQLITE_LIMIT_WORKER_THREADS</dt>
+** <dd>The maximum number of auxiliary worker threads that a single
+** [prepared statement] may start.</dd>)^
+** </dl>
+*/
+#define SQLITE_LIMIT_LENGTH 0
+#define SQLITE_LIMIT_SQL_LENGTH 1
+#define SQLITE_LIMIT_COLUMN 2
+#define SQLITE_LIMIT_EXPR_DEPTH 3
+#define SQLITE_LIMIT_COMPOUND_SELECT 4
+#define SQLITE_LIMIT_VDBE_OP 5
+#define SQLITE_LIMIT_FUNCTION_ARG 6
+#define SQLITE_LIMIT_ATTACHED 7
+#define SQLITE_LIMIT_LIKE_PATTERN_LENGTH 8
+#define SQLITE_LIMIT_VARIABLE_NUMBER 9
+#define SQLITE_LIMIT_TRIGGER_DEPTH 10
+#define SQLITE_LIMIT_WORKER_THREADS 11
+
+/*
+** CAPI3REF: Prepare Flags
+**
+** These constants define various flags that can be passed into
+** "prepFlags" parameter of the [sqlite3_prepare_v3()] and
+** [sqlite3_prepare16_v3()] interfaces.
+**
+** New flags may be added in future releases of SQLite.
+**
+** <dl>
+** [[SQLITE_PREPARE_PERSISTENT]] ^(<dt>SQLITE_PREPARE_PERSISTENT</dt>
+** <dd>The SQLITE_PREPARE_PERSISTENT flag is a hint to the query planner
+** that the prepared statement will be retained for a long time and
+** probably reused many times.)^ ^Without this flag, [sqlite3_prepare_v3()]
+** and [sqlite3_prepare16_v3()] assume that the prepared statement will
+** be used just once or at most a few times and then destroyed using
+** [sqlite3_finalize()] relatively soon. The current implementation acts
+** on this hint by avoiding the use of [lookaside memory] so as not to
+** deplete the limited store of lookaside memory. Future versions of
+** SQLite may act on this hint differently.
+**
+** [[SQLITE_PREPARE_NORMALIZE]] <dt>SQLITE_PREPARE_NORMALIZE</dt>
+** <dd>The SQLITE_PREPARE_NORMALIZE flag is a no-op. This flag used
+** to be required for any prepared statement that wanted to use the
+** [sqlite3_normalized_sql()] interface. However, the
+** [sqlite3_normalized_sql()] interface is now available to all
+** prepared statements, regardless of whether or not they use this
+** flag.
+**
+** [[SQLITE_PREPARE_NO_VTAB]] <dt>SQLITE_PREPARE_NO_VTAB</dt>
+** <dd>The SQLITE_PREPARE_NO_VTAB flag causes the SQL compiler
+** to return an error (error code SQLITE_ERROR) if the statement uses
+** any virtual tables.
+** </dl>
+*/
+#define SQLITE_PREPARE_PERSISTENT 0x01
+#define SQLITE_PREPARE_NORMALIZE 0x02
+#define SQLITE_PREPARE_NO_VTAB 0x04
+
+/*
+** CAPI3REF: Compiling An SQL Statement
+** KEYWORDS: {SQL statement compiler}
+** METHOD: sqlite3
+** CONSTRUCTOR: sqlite3_stmt
+**
+** To execute an SQL statement, it must first be compiled into a byte-code
+** program using one of these routines. Or, in other words, these routines
+** are constructors for the [prepared statement] object.
+**
+** The preferred routine to use is [sqlite3_prepare_v2()]. The
+** [sqlite3_prepare()] interface is legacy and should be avoided.
+** [sqlite3_prepare_v3()] has an extra "prepFlags" option that is used
+** for special purposes.
+**
+** The use of the UTF-8 interfaces is preferred, as SQLite currently
+** does all parsing using UTF-8. The UTF-16 interfaces are provided
+** as a convenience. The UTF-16 interfaces work by converting the
+** input text into UTF-8, then invoking the corresponding UTF-8 interface.
+**
+** The first argument, "db", is a [database connection] obtained from a
+** prior successful call to [sqlite3_open()], [sqlite3_open_v2()] or
+** [sqlite3_open16()]. The database connection must not have been closed.
+**
+** The second argument, "zSql", is the statement to be compiled, encoded
+** as either UTF-8 or UTF-16. The sqlite3_prepare(), sqlite3_prepare_v2(),
+** and sqlite3_prepare_v3()
+** interfaces use UTF-8, and sqlite3_prepare16(), sqlite3_prepare16_v2(),
+** and sqlite3_prepare16_v3() use UTF-16.
+**
+** ^If the nByte argument is negative, then zSql is read up to the
+** first zero terminator. ^If nByte is positive, then it is the
+** number of bytes read from zSql. ^If nByte is zero, then no prepared
+** statement is generated.
+** If the caller knows that the supplied string is nul-terminated, then
+** there is a small performance advantage to passing an nByte parameter that
+** is the number of bytes in the input string <i>including</i>
+** the nul-terminator.
+**
+** ^If pzTail is not NULL then *pzTail is made to point to the first byte
+** past the end of the first SQL statement in zSql. These routines only
+** compile the first statement in zSql, so *pzTail is left pointing to
+** what remains uncompiled.
+**
+** ^*ppStmt is left pointing to a compiled [prepared statement] that can be
+** executed using [sqlite3_step()]. ^If there is an error, *ppStmt is set
+** to NULL. ^If the input text contains no SQL (if the input is an empty
+** string or a comment) then *ppStmt is set to NULL.
+** The calling procedure is responsible for deleting the compiled
+** SQL statement using [sqlite3_finalize()] after it has finished with it.
+** ppStmt may not be NULL.
+**
+** ^On success, the sqlite3_prepare() family of routines return [SQLITE_OK];
+** otherwise an [error code] is returned.
+**
+** The sqlite3_prepare_v2(), sqlite3_prepare_v3(), sqlite3_prepare16_v2(),
+** and sqlite3_prepare16_v3() interfaces are recommended for all new programs.
+** The older interfaces (sqlite3_prepare() and sqlite3_prepare16())
+** are retained for backwards compatibility, but their use is discouraged.
+** ^In the "vX" interfaces, the prepared statement
+** that is returned (the [sqlite3_stmt] object) contains a copy of the
+** original SQL text. This causes the [sqlite3_step()] interface to
+** behave differently in three ways:
+**
+** <ol>
+** <li>
+** ^If the database schema changes, instead of returning [SQLITE_SCHEMA] as it
+** always used to do, [sqlite3_step()] will automatically recompile the SQL
+** statement and try to run it again. As many as [SQLITE_MAX_SCHEMA_RETRY]
+** retries will occur before sqlite3_step() gives up and returns an error.
+** </li>
+**
+** <li>
+** ^When an error occurs, [sqlite3_step()] will return one of the detailed
+** [error codes] or [extended error codes]. ^The legacy behavior was that
+** [sqlite3_step()] would only return a generic [SQLITE_ERROR] result code
+** and the application would have to make a second call to [sqlite3_reset()]
+** in order to find the underlying cause of the problem. With the "v2" prepare
+** interfaces, the underlying reason for the error is returned immediately.
+** </li>
+**
+** <li>
+** ^If the specific value bound to a [parameter | host parameter] in the
+** WHERE clause might influence the choice of query plan for a statement,
+** then the statement will be automatically recompiled, as if there had been
+** a schema change, on the first [sqlite3_step()] call following any change
+** to the [sqlite3_bind_text | bindings] of that [parameter].
+** ^The specific value of a WHERE-clause [parameter] might influence the
+** choice of query plan if the parameter is the left-hand side of a [LIKE]
+** or [GLOB] operator or if the parameter is compared to an indexed column
+** and the [SQLITE_ENABLE_STAT4] compile-time option is enabled.
+** </li>
+** </ol>
+**
+** <p>^sqlite3_prepare_v3() differs from sqlite3_prepare_v2() only in having
+** the extra prepFlags parameter, which is a bit array consisting of zero or
+** more of the [SQLITE_PREPARE_PERSISTENT|SQLITE_PREPARE_*] flags. ^The
+** sqlite3_prepare_v2() interface works exactly the same as
+** sqlite3_prepare_v3() with a zero prepFlags parameter.
+*/
+SQLITE_API int sqlite3_prepare(
+ sqlite3 *db, /* Database handle */
+ const char *zSql, /* SQL statement, UTF-8 encoded */
+ int nByte, /* Maximum length of zSql in bytes. */
+ sqlite3_stmt **ppStmt, /* OUT: Statement handle */
+ const char **pzTail /* OUT: Pointer to unused portion of zSql */
+);
+SQLITE_API int sqlite3_prepare_v2(
+ sqlite3 *db, /* Database handle */
+ const char *zSql, /* SQL statement, UTF-8 encoded */
+ int nByte, /* Maximum length of zSql in bytes. */
+ sqlite3_stmt **ppStmt, /* OUT: Statement handle */
+ const char **pzTail /* OUT: Pointer to unused portion of zSql */
+);
+SQLITE_API int sqlite3_prepare_v3(
+ sqlite3 *db, /* Database handle */
+ const char *zSql, /* SQL statement, UTF-8 encoded */
+ int nByte, /* Maximum length of zSql in bytes. */
+ unsigned int prepFlags, /* Zero or more SQLITE_PREPARE_ flags */
+ sqlite3_stmt **ppStmt, /* OUT: Statement handle */
+ const char **pzTail /* OUT: Pointer to unused portion of zSql */
+);
+SQLITE_API int sqlite3_prepare16(
+ sqlite3 *db, /* Database handle */
+ const void *zSql, /* SQL statement, UTF-16 encoded */
+ int nByte, /* Maximum length of zSql in bytes. */
+ sqlite3_stmt **ppStmt, /* OUT: Statement handle */
+ const void **pzTail /* OUT: Pointer to unused portion of zSql */
+);
+SQLITE_API int sqlite3_prepare16_v2(
+ sqlite3 *db, /* Database handle */
+ const void *zSql, /* SQL statement, UTF-16 encoded */
+ int nByte, /* Maximum length of zSql in bytes. */
+ sqlite3_stmt **ppStmt, /* OUT: Statement handle */
+ const void **pzTail /* OUT: Pointer to unused portion of zSql */
+);
+SQLITE_API int sqlite3_prepare16_v3(
+ sqlite3 *db, /* Database handle */
+ const void *zSql, /* SQL statement, UTF-16 encoded */
+ int nByte, /* Maximum length of zSql in bytes. */
+ unsigned int prepFlags, /* Zero or more SQLITE_PREPARE_ flags */
+ sqlite3_stmt **ppStmt, /* OUT: Statement handle */
+ const void **pzTail /* OUT: Pointer to unused portion of zSql */
+);
+
+/*
+** CAPI3REF: Retrieving Statement SQL
+** METHOD: sqlite3_stmt
+**
+** ^The sqlite3_sql(P) interface returns a pointer to a copy of the UTF-8
+** SQL text used to create [prepared statement] P if P was
+** created by [sqlite3_prepare_v2()], [sqlite3_prepare_v3()],
+** [sqlite3_prepare16_v2()], or [sqlite3_prepare16_v3()].
+** ^The sqlite3_expanded_sql(P) interface returns a pointer to a UTF-8
+** string containing the SQL text of prepared statement P with
+** [bound parameters] expanded.
+** ^The sqlite3_normalized_sql(P) interface returns a pointer to a UTF-8
+** string containing the normalized SQL text of prepared statement P. The
+** semantics used to normalize a SQL statement are unspecified and subject
+** to change. At a minimum, literal values will be replaced with suitable
+** placeholders.
+**
+** ^(For example, if a prepared statement is created using the SQL
+** text "SELECT $abc,:xyz" and if parameter $abc is bound to integer 2345
+** and parameter :xyz is unbound, then sqlite3_sql() will return
+** the original string, "SELECT $abc,:xyz" but sqlite3_expanded_sql()
+** will return "SELECT 2345,NULL".)^
+**
+** ^The sqlite3_expanded_sql() interface returns NULL if insufficient memory
+** is available to hold the result, or if the result would exceed the
+** the maximum string length determined by the [SQLITE_LIMIT_LENGTH].
+**
+** ^The [SQLITE_TRACE_SIZE_LIMIT] compile-time option limits the size of
+** bound parameter expansions. ^The [SQLITE_OMIT_TRACE] compile-time
+** option causes sqlite3_expanded_sql() to always return NULL.
+**
+** ^The strings returned by sqlite3_sql(P) and sqlite3_normalized_sql(P)
+** are managed by SQLite and are automatically freed when the prepared
+** statement is finalized.
+** ^The string returned by sqlite3_expanded_sql(P), on the other hand,
+** is obtained from [sqlite3_malloc()] and must be free by the application
+** by passing it to [sqlite3_free()].
+*/
+SQLITE_API const char *sqlite3_sql(sqlite3_stmt *pStmt);
+SQLITE_API char *sqlite3_expanded_sql(sqlite3_stmt *pStmt);
+SQLITE_API const char *sqlite3_normalized_sql(sqlite3_stmt *pStmt);
+
+/*
+** CAPI3REF: Determine If An SQL Statement Writes The Database
+** METHOD: sqlite3_stmt
+**
+** ^The sqlite3_stmt_readonly(X) interface returns true (non-zero) if
+** and only if the [prepared statement] X makes no direct changes to
+** the content of the database file.
+**
+** Note that [application-defined SQL functions] or
+** [virtual tables] might change the database indirectly as a side effect.
+** ^(For example, if an application defines a function "eval()" that
+** calls [sqlite3_exec()], then the following SQL statement would
+** change the database file through side-effects:
+**
+** <blockquote><pre>
+** SELECT eval('DELETE FROM t1') FROM t2;
+** </pre></blockquote>
+**
+** But because the [SELECT] statement does not change the database file
+** directly, sqlite3_stmt_readonly() would still return true.)^
+**
+** ^Transaction control statements such as [BEGIN], [COMMIT], [ROLLBACK],
+** [SAVEPOINT], and [RELEASE] cause sqlite3_stmt_readonly() to return true,
+** since the statements themselves do not actually modify the database but
+** rather they control the timing of when other statements modify the
+** database. ^The [ATTACH] and [DETACH] statements also cause
+** sqlite3_stmt_readonly() to return true since, while those statements
+** change the configuration of a database connection, they do not make
+** changes to the content of the database files on disk.
+** ^The sqlite3_stmt_readonly() interface returns true for [BEGIN] since
+** [BEGIN] merely sets internal flags, but the [BEGIN|BEGIN IMMEDIATE] and
+** [BEGIN|BEGIN EXCLUSIVE] commands do touch the database and so
+** sqlite3_stmt_readonly() returns false for those commands.
+*/
+SQLITE_API int sqlite3_stmt_readonly(sqlite3_stmt *pStmt);
+
+/*
+** CAPI3REF: Query The EXPLAIN Setting For A Prepared Statement
+** METHOD: sqlite3_stmt
+**
+** ^The sqlite3_stmt_isexplain(S) interface returns 1 if the
+** prepared statement S is an EXPLAIN statement, or 2 if the
+** statement S is an EXPLAIN QUERY PLAN.
+** ^The sqlite3_stmt_isexplain(S) interface returns 0 if S is
+** an ordinary statement or a NULL pointer.
+*/
+SQLITE_API int sqlite3_stmt_isexplain(sqlite3_stmt *pStmt);
+
+/*
+** CAPI3REF: Determine If A Prepared Statement Has Been Reset
+** METHOD: sqlite3_stmt
+**
+** ^The sqlite3_stmt_busy(S) interface returns true (non-zero) if the
+** [prepared statement] S has been stepped at least once using
+** [sqlite3_step(S)] but has neither run to completion (returned
+** [SQLITE_DONE] from [sqlite3_step(S)]) nor
+** been reset using [sqlite3_reset(S)]. ^The sqlite3_stmt_busy(S)
+** interface returns false if S is a NULL pointer. If S is not a
+** NULL pointer and is not a pointer to a valid [prepared statement]
+** object, then the behavior is undefined and probably undesirable.
+**
+** This interface can be used in combination [sqlite3_next_stmt()]
+** to locate all prepared statements associated with a database
+** connection that are in need of being reset. This can be used,
+** for example, in diagnostic routines to search for prepared
+** statements that are holding a transaction open.
+*/
+SQLITE_API int sqlite3_stmt_busy(sqlite3_stmt*);
+
+/*
+** CAPI3REF: Dynamically Typed Value Object
+** KEYWORDS: {protected sqlite3_value} {unprotected sqlite3_value}
+**
+** SQLite uses the sqlite3_value object to represent all values
+** that can be stored in a database table. SQLite uses dynamic typing
+** for the values it stores. ^Values stored in sqlite3_value objects
+** can be integers, floating point values, strings, BLOBs, or NULL.
+**
+** An sqlite3_value object may be either "protected" or "unprotected".
+** Some interfaces require a protected sqlite3_value. Other interfaces
+** will accept either a protected or an unprotected sqlite3_value.
+** Every interface that accepts sqlite3_value arguments specifies
+** whether or not it requires a protected sqlite3_value. The
+** [sqlite3_value_dup()] interface can be used to construct a new
+** protected sqlite3_value from an unprotected sqlite3_value.
+**
+** The terms "protected" and "unprotected" refer to whether or not
+** a mutex is held. An internal mutex is held for a protected
+** sqlite3_value object but no mutex is held for an unprotected
+** sqlite3_value object. If SQLite is compiled to be single-threaded
+** (with [SQLITE_THREADSAFE=0] and with [sqlite3_threadsafe()] returning 0)
+** or if SQLite is run in one of reduced mutex modes
+** [SQLITE_CONFIG_SINGLETHREAD] or [SQLITE_CONFIG_MULTITHREAD]
+** then there is no distinction between protected and unprotected
+** sqlite3_value objects and they can be used interchangeably. However,
+** for maximum code portability it is recommended that applications
+** still make the distinction between protected and unprotected
+** sqlite3_value objects even when not strictly required.
+**
+** ^The sqlite3_value objects that are passed as parameters into the
+** implementation of [application-defined SQL functions] are protected.
+** ^The sqlite3_value object returned by
+** [sqlite3_column_value()] is unprotected.
+** Unprotected sqlite3_value objects may only be used as arguments
+** to [sqlite3_result_value()], [sqlite3_bind_value()], and
+** [sqlite3_value_dup()].
+** The [sqlite3_value_blob | sqlite3_value_type()] family of
+** interfaces require protected sqlite3_value objects.
+*/
+typedef struct sqlite3_value sqlite3_value;
+
+/*
+** CAPI3REF: SQL Function Context Object
+**
+** The context in which an SQL function executes is stored in an
+** sqlite3_context object. ^A pointer to an sqlite3_context object
+** is always first parameter to [application-defined SQL functions].
+** The application-defined SQL function implementation will pass this
+** pointer through into calls to [sqlite3_result_int | sqlite3_result()],
+** [sqlite3_aggregate_context()], [sqlite3_user_data()],
+** [sqlite3_context_db_handle()], [sqlite3_get_auxdata()],
+** and/or [sqlite3_set_auxdata()].
+*/
+typedef struct sqlite3_context sqlite3_context;
+
+/*
+** CAPI3REF: Binding Values To Prepared Statements
+** KEYWORDS: {host parameter} {host parameters} {host parameter name}
+** KEYWORDS: {SQL parameter} {SQL parameters} {parameter binding}
+** METHOD: sqlite3_stmt
+**
+** ^(In the SQL statement text input to [sqlite3_prepare_v2()] and its variants,
+** literals may be replaced by a [parameter] that matches one of following
+** templates:
+**
+** <ul>
+** <li> ?
+** <li> ?NNN
+** <li> :VVV
+** <li> @VVV
+** <li> $VVV
+** </ul>
+**
+** In the templates above, NNN represents an integer literal,
+** and VVV represents an alphanumeric identifier.)^ ^The values of these
+** parameters (also called "host parameter names" or "SQL parameters")
+** can be set using the sqlite3_bind_*() routines defined here.
+**
+** ^The first argument to the sqlite3_bind_*() routines is always
+** a pointer to the [sqlite3_stmt] object returned from
+** [sqlite3_prepare_v2()] or its variants.
+**
+** ^The second argument is the index of the SQL parameter to be set.
+** ^The leftmost SQL parameter has an index of 1. ^When the same named
+** SQL parameter is used more than once, second and subsequent
+** occurrences have the same index as the first occurrence.
+** ^The index for named parameters can be looked up using the
+** [sqlite3_bind_parameter_index()] API if desired. ^The index
+** for "?NNN" parameters is the value of NNN.
+** ^The NNN value must be between 1 and the [sqlite3_limit()]
+** parameter [SQLITE_LIMIT_VARIABLE_NUMBER] (default value: 32766).
+**
+** ^The third argument is the value to bind to the parameter.
+** ^If the third parameter to sqlite3_bind_text() or sqlite3_bind_text16()
+** or sqlite3_bind_blob() is a NULL pointer then the fourth parameter
+** is ignored and the end result is the same as sqlite3_bind_null().
+** ^If the third parameter to sqlite3_bind_text() is not NULL, then
+** it should be a pointer to well-formed UTF8 text.
+** ^If the third parameter to sqlite3_bind_text16() is not NULL, then
+** it should be a pointer to well-formed UTF16 text.
+** ^If the third parameter to sqlite3_bind_text64() is not NULL, then
+** it should be a pointer to a well-formed unicode string that is
+** either UTF8 if the sixth parameter is SQLITE_UTF8, or UTF16
+** otherwise.
+**
+** [[byte-order determination rules]] ^The byte-order of
+** UTF16 input text is determined by the byte-order mark (BOM, U+FEFF)
+** found in first character, which is removed, or in the absence of a BOM
+** the byte order is the native byte order of the host
+** machine for sqlite3_bind_text16() or the byte order specified in
+** the 6th parameter for sqlite3_bind_text64().)^
+** ^If UTF16 input text contains invalid unicode
+** characters, then SQLite might change those invalid characters
+** into the unicode replacement character: U+FFFD.
+**
+** ^(In those routines that have a fourth argument, its value is the
+** number of bytes in the parameter. To be clear: the value is the
+** number of <u>bytes</u> in the value, not the number of characters.)^
+** ^If the fourth parameter to sqlite3_bind_text() or sqlite3_bind_text16()
+** is negative, then the length of the string is
+** the number of bytes up to the first zero terminator.
+** If the fourth parameter to sqlite3_bind_blob() is negative, then
+** the behavior is undefined.
+** If a non-negative fourth parameter is provided to sqlite3_bind_text()
+** or sqlite3_bind_text16() or sqlite3_bind_text64() then
+** that parameter must be the byte offset
+** where the NUL terminator would occur assuming the string were NUL
+** terminated. If any NUL characters occurs at byte offsets less than
+** the value of the fourth parameter then the resulting string value will
+** contain embedded NULs. The result of expressions involving strings
+** with embedded NULs is undefined.
+**
+** ^The fifth argument to the BLOB and string binding interfaces
+** is a destructor used to dispose of the BLOB or
+** string after SQLite has finished with it. ^The destructor is called
+** to dispose of the BLOB or string even if the call to the bind API fails,
+** except the destructor is not called if the third parameter is a NULL
+** pointer or the fourth parameter is negative.
+** ^If the fifth argument is
+** the special value [SQLITE_STATIC], then SQLite assumes that the
+** information is in static, unmanaged space and does not need to be freed.
+** ^If the fifth argument has the value [SQLITE_TRANSIENT], then
+** SQLite makes its own private copy of the data immediately, before
+** the sqlite3_bind_*() routine returns.
+**
+** ^The sixth argument to sqlite3_bind_text64() must be one of
+** [SQLITE_UTF8], [SQLITE_UTF16], [SQLITE_UTF16BE], or [SQLITE_UTF16LE]
+** to specify the encoding of the text in the third parameter. If
+** the sixth argument to sqlite3_bind_text64() is not one of the
+** allowed values shown above, or if the text encoding is different
+** from the encoding specified by the sixth parameter, then the behavior
+** is undefined.
+**
+** ^The sqlite3_bind_zeroblob() routine binds a BLOB of length N that
+** is filled with zeroes. ^A zeroblob uses a fixed amount of memory
+** (just an integer to hold its size) while it is being processed.
+** Zeroblobs are intended to serve as placeholders for BLOBs whose
+** content is later written using
+** [sqlite3_blob_open | incremental BLOB I/O] routines.
+** ^A negative value for the zeroblob results in a zero-length BLOB.
+**
+** ^The sqlite3_bind_pointer(S,I,P,T,D) routine causes the I-th parameter in
+** [prepared statement] S to have an SQL value of NULL, but to also be
+** associated with the pointer P of type T. ^D is either a NULL pointer or
+** a pointer to a destructor function for P. ^SQLite will invoke the
+** destructor D with a single argument of P when it is finished using
+** P. The T parameter should be a static string, preferably a string
+** literal. The sqlite3_bind_pointer() routine is part of the
+** [pointer passing interface] added for SQLite 3.20.0.
+**
+** ^If any of the sqlite3_bind_*() routines are called with a NULL pointer
+** for the [prepared statement] or with a prepared statement for which
+** [sqlite3_step()] has been called more recently than [sqlite3_reset()],
+** then the call will return [SQLITE_MISUSE]. If any sqlite3_bind_()
+** routine is passed a [prepared statement] that has been finalized, the
+** result is undefined and probably harmful.
+**
+** ^Bindings are not cleared by the [sqlite3_reset()] routine.
+** ^Unbound parameters are interpreted as NULL.
+**
+** ^The sqlite3_bind_* routines return [SQLITE_OK] on success or an
+** [error code] if anything goes wrong.
+** ^[SQLITE_TOOBIG] might be returned if the size of a string or BLOB
+** exceeds limits imposed by [sqlite3_limit]([SQLITE_LIMIT_LENGTH]) or
+** [SQLITE_MAX_LENGTH].
+** ^[SQLITE_RANGE] is returned if the parameter
+** index is out of range. ^[SQLITE_NOMEM] is returned if malloc() fails.
+**
+** See also: [sqlite3_bind_parameter_count()],
+** [sqlite3_bind_parameter_name()], and [sqlite3_bind_parameter_index()].
+*/
+SQLITE_API int sqlite3_bind_blob(sqlite3_stmt*, int, const void*, int n, void(*)(void*));
+SQLITE_API int sqlite3_bind_blob64(sqlite3_stmt*, int, const void*, sqlite3_uint64,
+ void(*)(void*));
+SQLITE_API int sqlite3_bind_double(sqlite3_stmt*, int, double);
+SQLITE_API int sqlite3_bind_int(sqlite3_stmt*, int, int);
+SQLITE_API int sqlite3_bind_int64(sqlite3_stmt*, int, sqlite3_int64);
+SQLITE_API int sqlite3_bind_null(sqlite3_stmt*, int);
+SQLITE_API int sqlite3_bind_text(sqlite3_stmt*,int,const char*,int,void(*)(void*));
+SQLITE_API int sqlite3_bind_text16(sqlite3_stmt*, int, const void*, int, void(*)(void*));
+SQLITE_API int sqlite3_bind_text64(sqlite3_stmt*, int, const char*, sqlite3_uint64,
+ void(*)(void*), unsigned char encoding);
+SQLITE_API int sqlite3_bind_value(sqlite3_stmt*, int, const sqlite3_value*);
+SQLITE_API int sqlite3_bind_pointer(sqlite3_stmt*, int, void*, const char*,void(*)(void*));
+SQLITE_API int sqlite3_bind_zeroblob(sqlite3_stmt*, int, int n);
+SQLITE_API int sqlite3_bind_zeroblob64(sqlite3_stmt*, int, sqlite3_uint64);
+
+/*
+** CAPI3REF: Number Of SQL Parameters
+** METHOD: sqlite3_stmt
+**
+** ^This routine can be used to find the number of [SQL parameters]
+** in a [prepared statement]. SQL parameters are tokens of the
+** form "?", "?NNN", ":AAA", "$AAA", or "@AAA" that serve as
+** placeholders for values that are [sqlite3_bind_blob | bound]
+** to the parameters at a later time.
+**
+** ^(This routine actually returns the index of the largest (rightmost)
+** parameter. For all forms except ?NNN, this will correspond to the
+** number of unique parameters. If parameters of the ?NNN form are used,
+** there may be gaps in the list.)^
+**
+** See also: [sqlite3_bind_blob|sqlite3_bind()],
+** [sqlite3_bind_parameter_name()], and
+** [sqlite3_bind_parameter_index()].
+*/
+SQLITE_API int sqlite3_bind_parameter_count(sqlite3_stmt*);
+
+/*
+** CAPI3REF: Name Of A Host Parameter
+** METHOD: sqlite3_stmt
+**
+** ^The sqlite3_bind_parameter_name(P,N) interface returns
+** the name of the N-th [SQL parameter] in the [prepared statement] P.
+** ^(SQL parameters of the form "?NNN" or ":AAA" or "@AAA" or "$AAA"
+** have a name which is the string "?NNN" or ":AAA" or "@AAA" or "$AAA"
+** respectively.
+** In other words, the initial ":" or "$" or "@" or "?"
+** is included as part of the name.)^
+** ^Parameters of the form "?" without a following integer have no name
+** and are referred to as "nameless" or "anonymous parameters".
+**
+** ^The first host parameter has an index of 1, not 0.
+**
+** ^If the value N is out of range or if the N-th parameter is
+** nameless, then NULL is returned. ^The returned string is
+** always in UTF-8 encoding even if the named parameter was
+** originally specified as UTF-16 in [sqlite3_prepare16()],
+** [sqlite3_prepare16_v2()], or [sqlite3_prepare16_v3()].
+**
+** See also: [sqlite3_bind_blob|sqlite3_bind()],
+** [sqlite3_bind_parameter_count()], and
+** [sqlite3_bind_parameter_index()].
+*/
+SQLITE_API const char *sqlite3_bind_parameter_name(sqlite3_stmt*, int);
+
+/*
+** CAPI3REF: Index Of A Parameter With A Given Name
+** METHOD: sqlite3_stmt
+**
+** ^Return the index of an SQL parameter given its name. ^The
+** index value returned is suitable for use as the second
+** parameter to [sqlite3_bind_blob|sqlite3_bind()]. ^A zero
+** is returned if no matching parameter is found. ^The parameter
+** name must be given in UTF-8 even if the original statement
+** was prepared from UTF-16 text using [sqlite3_prepare16_v2()] or
+** [sqlite3_prepare16_v3()].
+**
+** See also: [sqlite3_bind_blob|sqlite3_bind()],
+** [sqlite3_bind_parameter_count()], and
+** [sqlite3_bind_parameter_name()].
+*/
+SQLITE_API int sqlite3_bind_parameter_index(sqlite3_stmt*, const char *zName);
+
+/*
+** CAPI3REF: Reset All Bindings On A Prepared Statement
+** METHOD: sqlite3_stmt
+**
+** ^Contrary to the intuition of many, [sqlite3_reset()] does not reset
+** the [sqlite3_bind_blob | bindings] on a [prepared statement].
+** ^Use this routine to reset all host parameters to NULL.
+*/
+SQLITE_API int sqlite3_clear_bindings(sqlite3_stmt*);
+
+/*
+** CAPI3REF: Number Of Columns In A Result Set
+** METHOD: sqlite3_stmt
+**
+** ^Return the number of columns in the result set returned by the
+** [prepared statement]. ^If this routine returns 0, that means the
+** [prepared statement] returns no data (for example an [UPDATE]).
+** ^However, just because this routine returns a positive number does not
+** mean that one or more rows of data will be returned. ^A SELECT statement
+** will always have a positive sqlite3_column_count() but depending on the
+** WHERE clause constraints and the table content, it might return no rows.
+**
+** See also: [sqlite3_data_count()]
+*/
+SQLITE_API int sqlite3_column_count(sqlite3_stmt *pStmt);
+
+/*
+** CAPI3REF: Column Names In A Result Set
+** METHOD: sqlite3_stmt
+**
+** ^These routines return the name assigned to a particular column
+** in the result set of a [SELECT] statement. ^The sqlite3_column_name()
+** interface returns a pointer to a zero-terminated UTF-8 string
+** and sqlite3_column_name16() returns a pointer to a zero-terminated
+** UTF-16 string. ^The first parameter is the [prepared statement]
+** that implements the [SELECT] statement. ^The second parameter is the
+** column number. ^The leftmost column is number 0.
+**
+** ^The returned string pointer is valid until either the [prepared statement]
+** is destroyed by [sqlite3_finalize()] or until the statement is automatically
+** reprepared by the first call to [sqlite3_step()] for a particular run
+** or until the next call to
+** sqlite3_column_name() or sqlite3_column_name16() on the same column.
+**
+** ^If sqlite3_malloc() fails during the processing of either routine
+** (for example during a conversion from UTF-8 to UTF-16) then a
+** NULL pointer is returned.
+**
+** ^The name of a result column is the value of the "AS" clause for
+** that column, if there is an AS clause. If there is no AS clause
+** then the name of the column is unspecified and may change from
+** one release of SQLite to the next.
+*/
+SQLITE_API const char *sqlite3_column_name(sqlite3_stmt*, int N);
+SQLITE_API const void *sqlite3_column_name16(sqlite3_stmt*, int N);
+
+/*
+** CAPI3REF: Source Of Data In A Query Result
+** METHOD: sqlite3_stmt
+**
+** ^These routines provide a means to determine the database, table, and
+** table column that is the origin of a particular result column in
+** [SELECT] statement.
+** ^The name of the database or table or column can be returned as
+** either a UTF-8 or UTF-16 string. ^The _database_ routines return
+** the database name, the _table_ routines return the table name, and
+** the origin_ routines return the column name.
+** ^The returned string is valid until the [prepared statement] is destroyed
+** using [sqlite3_finalize()] or until the statement is automatically
+** reprepared by the first call to [sqlite3_step()] for a particular run
+** or until the same information is requested
+** again in a different encoding.
+**
+** ^The names returned are the original un-aliased names of the
+** database, table, and column.
+**
+** ^The first argument to these interfaces is a [prepared statement].
+** ^These functions return information about the Nth result column returned by
+** the statement, where N is the second function argument.
+** ^The left-most column is column 0 for these routines.
+**
+** ^If the Nth column returned by the statement is an expression or
+** subquery and is not a column value, then all of these functions return
+** NULL. ^These routines might also return NULL if a memory allocation error
+** occurs. ^Otherwise, they return the name of the attached database, table,
+** or column that query result column was extracted from.
+**
+** ^As with all other SQLite APIs, those whose names end with "16" return
+** UTF-16 encoded strings and the other functions return UTF-8.
+**
+** ^These APIs are only available if the library was compiled with the
+** [SQLITE_ENABLE_COLUMN_METADATA] C-preprocessor symbol.
+**
+** If two or more threads call one or more
+** [sqlite3_column_database_name | column metadata interfaces]
+** for the same [prepared statement] and result column
+** at the same time then the results are undefined.
+*/
+SQLITE_API const char *sqlite3_column_database_name(sqlite3_stmt*,int);
+SQLITE_API const void *sqlite3_column_database_name16(sqlite3_stmt*,int);
+SQLITE_API const char *sqlite3_column_table_name(sqlite3_stmt*,int);
+SQLITE_API const void *sqlite3_column_table_name16(sqlite3_stmt*,int);
+SQLITE_API const char *sqlite3_column_origin_name(sqlite3_stmt*,int);
+SQLITE_API const void *sqlite3_column_origin_name16(sqlite3_stmt*,int);
+
+/*
+** CAPI3REF: Declared Datatype Of A Query Result
+** METHOD: sqlite3_stmt
+**
+** ^(The first parameter is a [prepared statement].
+** If this statement is a [SELECT] statement and the Nth column of the
+** returned result set of that [SELECT] is a table column (not an
+** expression or subquery) then the declared type of the table
+** column is returned.)^ ^If the Nth column of the result set is an
+** expression or subquery, then a NULL pointer is returned.
+** ^The returned string is always UTF-8 encoded.
+**
+** ^(For example, given the database schema:
+**
+** CREATE TABLE t1(c1 VARIANT);
+**
+** and the following statement to be compiled:
+**
+** SELECT c1 + 1, c1 FROM t1;
+**
+** this routine would return the string "VARIANT" for the second result
+** column (i==1), and a NULL pointer for the first result column (i==0).)^
+**
+** ^SQLite uses dynamic run-time typing. ^So just because a column
+** is declared to contain a particular type does not mean that the
+** data stored in that column is of the declared type. SQLite is
+** strongly typed, but the typing is dynamic not static. ^Type
+** is associated with individual values, not with the containers
+** used to hold those values.
+*/
+SQLITE_API const char *sqlite3_column_decltype(sqlite3_stmt*,int);
+SQLITE_API const void *sqlite3_column_decltype16(sqlite3_stmt*,int);
+
+/*
+** CAPI3REF: Evaluate An SQL Statement
+** METHOD: sqlite3_stmt
+**
+** After a [prepared statement] has been prepared using any of
+** [sqlite3_prepare_v2()], [sqlite3_prepare_v3()], [sqlite3_prepare16_v2()],
+** or [sqlite3_prepare16_v3()] or one of the legacy
+** interfaces [sqlite3_prepare()] or [sqlite3_prepare16()], this function
+** must be called one or more times to evaluate the statement.
+**
+** The details of the behavior of the sqlite3_step() interface depend
+** on whether the statement was prepared using the newer "vX" interfaces
+** [sqlite3_prepare_v3()], [sqlite3_prepare_v2()], [sqlite3_prepare16_v3()],
+** [sqlite3_prepare16_v2()] or the older legacy
+** interfaces [sqlite3_prepare()] and [sqlite3_prepare16()]. The use of the
+** new "vX" interface is recommended for new applications but the legacy
+** interface will continue to be supported.
+**
+** ^In the legacy interface, the return value will be either [SQLITE_BUSY],
+** [SQLITE_DONE], [SQLITE_ROW], [SQLITE_ERROR], or [SQLITE_MISUSE].
+** ^With the "v2" interface, any of the other [result codes] or
+** [extended result codes] might be returned as well.
+**
+** ^[SQLITE_BUSY] means that the database engine was unable to acquire the
+** database locks it needs to do its job. ^If the statement is a [COMMIT]
+** or occurs outside of an explicit transaction, then you can retry the
+** statement. If the statement is not a [COMMIT] and occurs within an
+** explicit transaction then you should rollback the transaction before
+** continuing.
+**
+** ^[SQLITE_DONE] means that the statement has finished executing
+** successfully. sqlite3_step() should not be called again on this virtual
+** machine without first calling [sqlite3_reset()] to reset the virtual
+** machine back to its initial state.
+**
+** ^If the SQL statement being executed returns any data, then [SQLITE_ROW]
+** is returned each time a new row of data is ready for processing by the
+** caller. The values may be accessed using the [column access functions].
+** sqlite3_step() is called again to retrieve the next row of data.
+**
+** ^[SQLITE_ERROR] means that a run-time error (such as a constraint
+** violation) has occurred. sqlite3_step() should not be called again on
+** the VM. More information may be found by calling [sqlite3_errmsg()].
+** ^With the legacy interface, a more specific error code (for example,
+** [SQLITE_INTERRUPT], [SQLITE_SCHEMA], [SQLITE_CORRUPT], and so forth)
+** can be obtained by calling [sqlite3_reset()] on the
+** [prepared statement]. ^In the "v2" interface,
+** the more specific error code is returned directly by sqlite3_step().
+**
+** [SQLITE_MISUSE] means that the this routine was called inappropriately.
+** Perhaps it was called on a [prepared statement] that has
+** already been [sqlite3_finalize | finalized] or on one that had
+** previously returned [SQLITE_ERROR] or [SQLITE_DONE]. Or it could
+** be the case that the same database connection is being used by two or
+** more threads at the same moment in time.
+**
+** For all versions of SQLite up to and including 3.6.23.1, a call to
+** [sqlite3_reset()] was required after sqlite3_step() returned anything
+** other than [SQLITE_ROW] before any subsequent invocation of
+** sqlite3_step(). Failure to reset the prepared statement using
+** [sqlite3_reset()] would result in an [SQLITE_MISUSE] return from
+** sqlite3_step(). But after [version 3.6.23.1] ([dateof:3.6.23.1],
+** sqlite3_step() began
+** calling [sqlite3_reset()] automatically in this circumstance rather
+** than returning [SQLITE_MISUSE]. This is not considered a compatibility
+** break because any application that ever receives an SQLITE_MISUSE error
+** is broken by definition. The [SQLITE_OMIT_AUTORESET] compile-time option
+** can be used to restore the legacy behavior.
+**
+** <b>Goofy Interface Alert:</b> In the legacy interface, the sqlite3_step()
+** API always returns a generic error code, [SQLITE_ERROR], following any
+** error other than [SQLITE_BUSY] and [SQLITE_MISUSE]. You must call
+** [sqlite3_reset()] or [sqlite3_finalize()] in order to find one of the
+** specific [error codes] that better describes the error.
+** We admit that this is a goofy design. The problem has been fixed
+** with the "v2" interface. If you prepare all of your SQL statements
+** using [sqlite3_prepare_v3()] or [sqlite3_prepare_v2()]
+** or [sqlite3_prepare16_v2()] or [sqlite3_prepare16_v3()] instead
+** of the legacy [sqlite3_prepare()] and [sqlite3_prepare16()] interfaces,
+** then the more specific [error codes] are returned directly
+** by sqlite3_step(). The use of the "vX" interfaces is recommended.
+*/
+SQLITE_API int sqlite3_step(sqlite3_stmt*);
+
+/*
+** CAPI3REF: Number of columns in a result set
+** METHOD: sqlite3_stmt
+**
+** ^The sqlite3_data_count(P) interface returns the number of columns in the
+** current row of the result set of [prepared statement] P.
+** ^If prepared statement P does not have results ready to return
+** (via calls to the [sqlite3_column_int | sqlite3_column()] family of
+** interfaces) then sqlite3_data_count(P) returns 0.
+** ^The sqlite3_data_count(P) routine also returns 0 if P is a NULL pointer.
+** ^The sqlite3_data_count(P) routine returns 0 if the previous call to
+** [sqlite3_step](P) returned [SQLITE_DONE]. ^The sqlite3_data_count(P)
+** will return non-zero if previous call to [sqlite3_step](P) returned
+** [SQLITE_ROW], except in the case of the [PRAGMA incremental_vacuum]
+** where it always returns zero since each step of that multi-step
+** pragma returns 0 columns of data.
+**
+** See also: [sqlite3_column_count()]
+*/
+SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);
+
+/*
+** CAPI3REF: Fundamental Datatypes
+** KEYWORDS: SQLITE_TEXT
+**
+** ^(Every value in SQLite has one of five fundamental datatypes:
+**
+** <ul>
+** <li> 64-bit signed integer
+** <li> 64-bit IEEE floating point number
+** <li> string
+** <li> BLOB
+** <li> NULL
+** </ul>)^
+**
+** These constants are codes for each of those types.
+**
+** Note that the SQLITE_TEXT constant was also used in SQLite version 2
+** for a completely different meaning. Software that links against both
+** SQLite version 2 and SQLite version 3 should use SQLITE3_TEXT, not
+** SQLITE_TEXT.
+*/
+#define SQLITE_INTEGER 1
+#define SQLITE_FLOAT 2
+#define SQLITE_BLOB 4
+#define SQLITE_NULL 5
+#ifdef SQLITE_TEXT
+# undef SQLITE_TEXT
+#else
+# define SQLITE_TEXT 3
+#endif
+#define SQLITE3_TEXT 3
+
+/*
+** CAPI3REF: Result Values From A Query
+** KEYWORDS: {column access functions}
+** METHOD: sqlite3_stmt
+**
+** <b>Summary:</b>
+** <blockquote><table border=0 cellpadding=0 cellspacing=0>
+** <tr><td><b>sqlite3_column_blob</b><td>&rarr;<td>BLOB result
+** <tr><td><b>sqlite3_column_double</b><td>&rarr;<td>REAL result
+** <tr><td><b>sqlite3_column_int</b><td>&rarr;<td>32-bit INTEGER result
+** <tr><td><b>sqlite3_column_int64</b><td>&rarr;<td>64-bit INTEGER result
+** <tr><td><b>sqlite3_column_text</b><td>&rarr;<td>UTF-8 TEXT result
+** <tr><td><b>sqlite3_column_text16</b><td>&rarr;<td>UTF-16 TEXT result
+** <tr><td><b>sqlite3_column_value</b><td>&rarr;<td>The result as an
+** [sqlite3_value|unprotected sqlite3_value] object.
+** <tr><td>&nbsp;<td>&nbsp;<td>&nbsp;
+** <tr><td><b>sqlite3_column_bytes</b><td>&rarr;<td>Size of a BLOB
+** or a UTF-8 TEXT result in bytes
+** <tr><td><b>sqlite3_column_bytes16&nbsp;&nbsp;</b>
+** <td>&rarr;&nbsp;&nbsp;<td>Size of UTF-16
+** TEXT in bytes
+** <tr><td><b>sqlite3_column_type</b><td>&rarr;<td>Default
+** datatype of the result
+** </table></blockquote>
+**
+** <b>Details:</b>
+**
+** ^These routines return information about a single column of the current
+** result row of a query. ^In every case the first argument is a pointer
+** to the [prepared statement] that is being evaluated (the [sqlite3_stmt*]
+** that was returned from [sqlite3_prepare_v2()] or one of its variants)
+** and the second argument is the index of the column for which information
+** should be returned. ^The leftmost column of the result set has the index 0.
+** ^The number of columns in the result can be determined using
+** [sqlite3_column_count()].
+**
+** If the SQL statement does not currently point to a valid row, or if the
+** column index is out of range, the result is undefined.
+** These routines may only be called when the most recent call to
+** [sqlite3_step()] has returned [SQLITE_ROW] and neither
+** [sqlite3_reset()] nor [sqlite3_finalize()] have been called subsequently.
+** If any of these routines are called after [sqlite3_reset()] or
+** [sqlite3_finalize()] or after [sqlite3_step()] has returned
+** something other than [SQLITE_ROW], the results are undefined.
+** If [sqlite3_step()] or [sqlite3_reset()] or [sqlite3_finalize()]
+** are called from a different thread while any of these routines
+** are pending, then the results are undefined.
+**
+** The first six interfaces (_blob, _double, _int, _int64, _text, and _text16)
+** each return the value of a result column in a specific data format. If
+** the result column is not initially in the requested format (for example,
+** if the query returns an integer but the sqlite3_column_text() interface
+** is used to extract the value) then an automatic type conversion is performed.
+**
+** ^The sqlite3_column_type() routine returns the
+** [SQLITE_INTEGER | datatype code] for the initial data type
+** of the result column. ^The returned value is one of [SQLITE_INTEGER],
+** [SQLITE_FLOAT], [SQLITE_TEXT], [SQLITE_BLOB], or [SQLITE_NULL].
+** The return value of sqlite3_column_type() can be used to decide which
+** of the first six interface should be used to extract the column value.
+** The value returned by sqlite3_column_type() is only meaningful if no
+** automatic type conversions have occurred for the value in question.
+** After a type conversion, the result of calling sqlite3_column_type()
+** is undefined, though harmless. Future
+** versions of SQLite may change the behavior of sqlite3_column_type()
+** following a type conversion.
+**
+** If the result is a BLOB or a TEXT string, then the sqlite3_column_bytes()
+** or sqlite3_column_bytes16() interfaces can be used to determine the size
+** of that BLOB or string.
+**
+** ^If the result is a BLOB or UTF-8 string then the sqlite3_column_bytes()
+** routine returns the number of bytes in that BLOB or string.
+** ^If the result is a UTF-16 string, then sqlite3_column_bytes() converts
+** the string to UTF-8 and then returns the number of bytes.
+** ^If the result is a numeric value then sqlite3_column_bytes() uses
+** [sqlite3_snprintf()] to convert that value to a UTF-8 string and returns
+** the number of bytes in that string.
+** ^If the result is NULL, then sqlite3_column_bytes() returns zero.
+**
+** ^If the result is a BLOB or UTF-16 string then the sqlite3_column_bytes16()
+** routine returns the number of bytes in that BLOB or string.
+** ^If the result is a UTF-8 string, then sqlite3_column_bytes16() converts
+** the string to UTF-16 and then returns the number of bytes.
+** ^If the result is a numeric value then sqlite3_column_bytes16() uses
+** [sqlite3_snprintf()] to convert that value to a UTF-16 string and returns
+** the number of bytes in that string.
+** ^If the result is NULL, then sqlite3_column_bytes16() returns zero.
+**
+** ^The values returned by [sqlite3_column_bytes()] and
+** [sqlite3_column_bytes16()] do not include the zero terminators at the end
+** of the string. ^For clarity: the values returned by
+** [sqlite3_column_bytes()] and [sqlite3_column_bytes16()] are the number of
+** bytes in the string, not the number of characters.
+**
+** ^Strings returned by sqlite3_column_text() and sqlite3_column_text16(),
+** even empty strings, are always zero-terminated. ^The return
+** value from sqlite3_column_blob() for a zero-length BLOB is a NULL pointer.
+**
+** <b>Warning:</b> ^The object returned by [sqlite3_column_value()] is an
+** [unprotected sqlite3_value] object. In a multithreaded environment,
+** an unprotected sqlite3_value object may only be used safely with
+** [sqlite3_bind_value()] and [sqlite3_result_value()].
+** If the [unprotected sqlite3_value] object returned by
+** [sqlite3_column_value()] is used in any other way, including calls
+** to routines like [sqlite3_value_int()], [sqlite3_value_text()],
+** or [sqlite3_value_bytes()], the behavior is not threadsafe.
+** Hence, the sqlite3_column_value() interface
+** is normally only useful within the implementation of
+** [application-defined SQL functions] or [virtual tables], not within
+** top-level application code.
+**
+** The these routines may attempt to convert the datatype of the result.
+** ^For example, if the internal representation is FLOAT and a text result
+** is requested, [sqlite3_snprintf()] is used internally to perform the
+** conversion automatically. ^(The following table details the conversions
+** that are applied:
+**
+** <blockquote>
+** <table border="1">
+** <tr><th> Internal<br>Type <th> Requested<br>Type <th> Conversion
+**
+** <tr><td> NULL <td> INTEGER <td> Result is 0
+** <tr><td> NULL <td> FLOAT <td> Result is 0.0
+** <tr><td> NULL <td> TEXT <td> Result is a NULL pointer
+** <tr><td> NULL <td> BLOB <td> Result is a NULL pointer
+** <tr><td> INTEGER <td> FLOAT <td> Convert from integer to float
+** <tr><td> INTEGER <td> TEXT <td> ASCII rendering of the integer
+** <tr><td> INTEGER <td> BLOB <td> Same as INTEGER->TEXT
+** <tr><td> FLOAT <td> INTEGER <td> [CAST] to INTEGER
+** <tr><td> FLOAT <td> TEXT <td> ASCII rendering of the float
+** <tr><td> FLOAT <td> BLOB <td> [CAST] to BLOB
+** <tr><td> TEXT <td> INTEGER <td> [CAST] to INTEGER
+** <tr><td> TEXT <td> FLOAT <td> [CAST] to REAL
+** <tr><td> TEXT <td> BLOB <td> No change
+** <tr><td> BLOB <td> INTEGER <td> [CAST] to INTEGER
+** <tr><td> BLOB <td> FLOAT <td> [CAST] to REAL
+** <tr><td> BLOB <td> TEXT <td> Add a zero terminator if needed
+** </table>
+** </blockquote>)^
+**
+** Note that when type conversions occur, pointers returned by prior
+** calls to sqlite3_column_blob(), sqlite3_column_text(), and/or
+** sqlite3_column_text16() may be invalidated.
+** Type conversions and pointer invalidations might occur
+** in the following cases:
+**
+** <ul>
+** <li> The initial content is a BLOB and sqlite3_column_text() or
+** sqlite3_column_text16() is called. A zero-terminator might
+** need to be added to the string.</li>
+** <li> The initial content is UTF-8 text and sqlite3_column_bytes16() or
+** sqlite3_column_text16() is called. The content must be converted
+** to UTF-16.</li>
+** <li> The initial content is UTF-16 text and sqlite3_column_bytes() or
+** sqlite3_column_text() is called. The content must be converted
+** to UTF-8.</li>
+** </ul>
+**
+** ^Conversions between UTF-16be and UTF-16le are always done in place and do
+** not invalidate a prior pointer, though of course the content of the buffer
+** that the prior pointer references will have been modified. Other kinds
+** of conversion are done in place when it is possible, but sometimes they
+** are not possible and in those cases prior pointers are invalidated.
+**
+** The safest policy is to invoke these routines
+** in one of the following ways:
+**
+** <ul>
+** <li>sqlite3_column_text() followed by sqlite3_column_bytes()</li>
+** <li>sqlite3_column_blob() followed by sqlite3_column_bytes()</li>
+** <li>sqlite3_column_text16() followed by sqlite3_column_bytes16()</li>
+** </ul>
+**
+** In other words, you should call sqlite3_column_text(),
+** sqlite3_column_blob(), or sqlite3_column_text16() first to force the result
+** into the desired format, then invoke sqlite3_column_bytes() or
+** sqlite3_column_bytes16() to find the size of the result. Do not mix calls
+** to sqlite3_column_text() or sqlite3_column_blob() with calls to
+** sqlite3_column_bytes16(), and do not mix calls to sqlite3_column_text16()
+** with calls to sqlite3_column_bytes().
+**
+** ^The pointers returned are valid until a type conversion occurs as
+** described above, or until [sqlite3_step()] or [sqlite3_reset()] or
+** [sqlite3_finalize()] is called. ^The memory space used to hold strings
+** and BLOBs is freed automatically. Do not pass the pointers returned
+** from [sqlite3_column_blob()], [sqlite3_column_text()], etc. into
+** [sqlite3_free()].
+**
+** As long as the input parameters are correct, these routines will only
+** fail if an out-of-memory error occurs during a format conversion.
+** Only the following subset of interfaces are subject to out-of-memory
+** errors:
+**
+** <ul>
+** <li> sqlite3_column_blob()
+** <li> sqlite3_column_text()
+** <li> sqlite3_column_text16()
+** <li> sqlite3_column_bytes()
+** <li> sqlite3_column_bytes16()
+** </ul>
+**
+** If an out-of-memory error occurs, then the return value from these
+** routines is the same as if the column had contained an SQL NULL value.
+** Valid SQL NULL returns can be distinguished from out-of-memory errors
+** by invoking the [sqlite3_errcode()] immediately after the suspect
+** return value is obtained and before any
+** other SQLite interface is called on the same [database connection].
+*/
+SQLITE_API const void *sqlite3_column_blob(sqlite3_stmt*, int iCol);
+SQLITE_API double sqlite3_column_double(sqlite3_stmt*, int iCol);
+SQLITE_API int sqlite3_column_int(sqlite3_stmt*, int iCol);
+SQLITE_API sqlite3_int64 sqlite3_column_int64(sqlite3_stmt*, int iCol);
+SQLITE_API const unsigned char *sqlite3_column_text(sqlite3_stmt*, int iCol);
+SQLITE_API const void *sqlite3_column_text16(sqlite3_stmt*, int iCol);
+SQLITE_API sqlite3_value *sqlite3_column_value(sqlite3_stmt*, int iCol);
+SQLITE_API int sqlite3_column_bytes(sqlite3_stmt*, int iCol);
+SQLITE_API int sqlite3_column_bytes16(sqlite3_stmt*, int iCol);
+SQLITE_API int sqlite3_column_type(sqlite3_stmt*, int iCol);
+
+/*
+** CAPI3REF: Destroy A Prepared Statement Object
+** DESTRUCTOR: sqlite3_stmt
+**
+** ^The sqlite3_finalize() function is called to delete a [prepared statement].
+** ^If the most recent evaluation of the statement encountered no errors
+** or if the statement is never been evaluated, then sqlite3_finalize() returns
+** SQLITE_OK. ^If the most recent evaluation of statement S failed, then
+** sqlite3_finalize(S) returns the appropriate [error code] or
+** [extended error code].
+**
+** ^The sqlite3_finalize(S) routine can be called at any point during
+** the life cycle of [prepared statement] S:
+** before statement S is ever evaluated, after
+** one or more calls to [sqlite3_reset()], or after any call
+** to [sqlite3_step()] regardless of whether or not the statement has
+** completed execution.
+**
+** ^Invoking sqlite3_finalize() on a NULL pointer is a harmless no-op.
+**
+** The application must finalize every [prepared statement] in order to avoid
+** resource leaks. It is a grievous error for the application to try to use
+** a prepared statement after it has been finalized. Any use of a prepared
+** statement after it has been finalized can result in undefined and
+** undesirable behavior such as segfaults and heap corruption.
+*/
+SQLITE_API int sqlite3_finalize(sqlite3_stmt *pStmt);
+
+/*
+** CAPI3REF: Reset A Prepared Statement Object
+** METHOD: sqlite3_stmt
+**
+** The sqlite3_reset() function is called to reset a [prepared statement]
+** object back to its initial state, ready to be re-executed.
+** ^Any SQL statement variables that had values bound to them using
+** the [sqlite3_bind_blob | sqlite3_bind_*() API] retain their values.
+** Use [sqlite3_clear_bindings()] to reset the bindings.
+**
+** ^The [sqlite3_reset(S)] interface resets the [prepared statement] S
+** back to the beginning of its program.
+**
+** ^If the most recent call to [sqlite3_step(S)] for the
+** [prepared statement] S returned [SQLITE_ROW] or [SQLITE_DONE],
+** or if [sqlite3_step(S)] has never before been called on S,
+** then [sqlite3_reset(S)] returns [SQLITE_OK].
+**
+** ^If the most recent call to [sqlite3_step(S)] for the
+** [prepared statement] S indicated an error, then
+** [sqlite3_reset(S)] returns an appropriate [error code].
+**
+** ^The [sqlite3_reset(S)] interface does not change the values
+** of any [sqlite3_bind_blob|bindings] on the [prepared statement] S.
+*/
+SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt);
+
+/*
+** CAPI3REF: Create Or Redefine SQL Functions
+** KEYWORDS: {function creation routines}
+** METHOD: sqlite3
+**
+** ^These functions (collectively known as "function creation routines")
+** are used to add SQL functions or aggregates or to redefine the behavior
+** of existing SQL functions or aggregates. The only differences between
+** the three "sqlite3_create_function*" routines are the text encoding
+** expected for the second parameter (the name of the function being
+** created) and the presence or absence of a destructor callback for
+** the application data pointer. Function sqlite3_create_window_function()
+** is similar, but allows the user to supply the extra callback functions
+** needed by [aggregate window functions].
+**
+** ^The first parameter is the [database connection] to which the SQL
+** function is to be added. ^If an application uses more than one database
+** connection then application-defined SQL functions must be added
+** to each database connection separately.
+**
+** ^The second parameter is the name of the SQL function to be created or
+** redefined. ^The length of the name is limited to 255 bytes in a UTF-8
+** representation, exclusive of the zero-terminator. ^Note that the name
+** length limit is in UTF-8 bytes, not characters nor UTF-16 bytes.
+** ^Any attempt to create a function with a longer name
+** will result in [SQLITE_MISUSE] being returned.
+**
+** ^The third parameter (nArg)
+** is the number of arguments that the SQL function or
+** aggregate takes. ^If this parameter is -1, then the SQL function or
+** aggregate may take any number of arguments between 0 and the limit
+** set by [sqlite3_limit]([SQLITE_LIMIT_FUNCTION_ARG]). If the third
+** parameter is less than -1 or greater than 127 then the behavior is
+** undefined.
+**
+** ^The fourth parameter, eTextRep, specifies what
+** [SQLITE_UTF8 | text encoding] this SQL function prefers for
+** its parameters. The application should set this parameter to
+** [SQLITE_UTF16LE] if the function implementation invokes
+** [sqlite3_value_text16le()] on an input, or [SQLITE_UTF16BE] if the
+** implementation invokes [sqlite3_value_text16be()] on an input, or
+** [SQLITE_UTF16] if [sqlite3_value_text16()] is used, or [SQLITE_UTF8]
+** otherwise. ^The same SQL function may be registered multiple times using
+** different preferred text encodings, with different implementations for
+** each encoding.
+** ^When multiple implementations of the same function are available, SQLite
+** will pick the one that involves the least amount of data conversion.
+**
+** ^The fourth parameter may optionally be ORed with [SQLITE_DETERMINISTIC]
+** to signal that the function will always return the same result given
+** the same inputs within a single SQL statement. Most SQL functions are
+** deterministic. The built-in [random()] SQL function is an example of a
+** function that is not deterministic. The SQLite query planner is able to
+** perform additional optimizations on deterministic functions, so use
+** of the [SQLITE_DETERMINISTIC] flag is recommended where possible.
+**
+** ^The fourth parameter may also optionally include the [SQLITE_DIRECTONLY]
+** flag, which if present prevents the function from being invoked from
+** within VIEWs, TRIGGERs, CHECK constraints, generated column expressions,
+** index expressions, or the WHERE clause of partial indexes.
+**
+** <span style="background-color:#ffff90;">
+** For best security, the [SQLITE_DIRECTONLY] flag is recommended for
+** all application-defined SQL functions that do not need to be
+** used inside of triggers, view, CHECK constraints, or other elements of
+** the database schema. This flags is especially recommended for SQL
+** functions that have side effects or reveal internal application state.
+** Without this flag, an attacker might be able to modify the schema of
+** a database file to include invocations of the function with parameters
+** chosen by the attacker, which the application will then execute when
+** the database file is opened and read.
+** </span>
+**
+** ^(The fifth parameter is an arbitrary pointer. The implementation of the
+** function can gain access to this pointer using [sqlite3_user_data()].)^
+**
+** ^The sixth, seventh and eighth parameters passed to the three
+** "sqlite3_create_function*" functions, xFunc, xStep and xFinal, are
+** pointers to C-language functions that implement the SQL function or
+** aggregate. ^A scalar SQL function requires an implementation of the xFunc
+** callback only; NULL pointers must be passed as the xStep and xFinal
+** parameters. ^An aggregate SQL function requires an implementation of xStep
+** and xFinal and NULL pointer must be passed for xFunc. ^To delete an existing
+** SQL function or aggregate, pass NULL pointers for all three function
+** callbacks.
+**
+** ^The sixth, seventh, eighth and ninth parameters (xStep, xFinal, xValue
+** and xInverse) passed to sqlite3_create_window_function are pointers to
+** C-language callbacks that implement the new function. xStep and xFinal
+** must both be non-NULL. xValue and xInverse may either both be NULL, in
+** which case a regular aggregate function is created, or must both be
+** non-NULL, in which case the new function may be used as either an aggregate
+** or aggregate window function. More details regarding the implementation
+** of aggregate window functions are
+** [user-defined window functions|available here].
+**
+** ^(If the final parameter to sqlite3_create_function_v2() or
+** sqlite3_create_window_function() is not NULL, then it is destructor for
+** the application data pointer. The destructor is invoked when the function
+** is deleted, either by being overloaded or when the database connection
+** closes.)^ ^The destructor is also invoked if the call to
+** sqlite3_create_function_v2() fails. ^When the destructor callback is
+** invoked, it is passed a single argument which is a copy of the application
+** data pointer which was the fifth parameter to sqlite3_create_function_v2().
+**
+** ^It is permitted to register multiple implementations of the same
+** functions with the same name but with either differing numbers of
+** arguments or differing preferred text encodings. ^SQLite will use
+** the implementation that most closely matches the way in which the
+** SQL function is used. ^A function implementation with a non-negative
+** nArg parameter is a better match than a function implementation with
+** a negative nArg. ^A function where the preferred text encoding
+** matches the database encoding is a better
+** match than a function where the encoding is different.
+** ^A function where the encoding difference is between UTF16le and UTF16be
+** is a closer match than a function where the encoding difference is
+** between UTF8 and UTF16.
+**
+** ^Built-in functions may be overloaded by new application-defined functions.
+**
+** ^An application-defined function is permitted to call other
+** SQLite interfaces. However, such calls must not
+** close the database connection nor finalize or reset the prepared
+** statement in which the function is running.
+*/
+SQLITE_API int sqlite3_create_function(
+ sqlite3 *db,
+ const char *zFunctionName,
+ int nArg,
+ int eTextRep,
+ void *pApp,
+ void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
+ void (*xStep)(sqlite3_context*,int,sqlite3_value**),
+ void (*xFinal)(sqlite3_context*)
+);
+SQLITE_API int sqlite3_create_function16(
+ sqlite3 *db,
+ const void *zFunctionName,
+ int nArg,
+ int eTextRep,
+ void *pApp,
+ void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
+ void (*xStep)(sqlite3_context*,int,sqlite3_value**),
+ void (*xFinal)(sqlite3_context*)
+);
+SQLITE_API int sqlite3_create_function_v2(
+ sqlite3 *db,
+ const char *zFunctionName,
+ int nArg,
+ int eTextRep,
+ void *pApp,
+ void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
+ void (*xStep)(sqlite3_context*,int,sqlite3_value**),
+ void (*xFinal)(sqlite3_context*),
+ void(*xDestroy)(void*)
+);
+SQLITE_API int sqlite3_create_window_function(
+ sqlite3 *db,
+ const char *zFunctionName,
+ int nArg,
+ int eTextRep,
+ void *pApp,
+ void (*xStep)(sqlite3_context*,int,sqlite3_value**),
+ void (*xFinal)(sqlite3_context*),
+ void (*xValue)(sqlite3_context*),
+ void (*xInverse)(sqlite3_context*,int,sqlite3_value**),
+ void(*xDestroy)(void*)
+);
+
+/*
+** CAPI3REF: Text Encodings
+**
+** These constant define integer codes that represent the various
+** text encodings supported by SQLite.
+*/
+#define SQLITE_UTF8 1 /* IMP: R-37514-35566 */
+#define SQLITE_UTF16LE 2 /* IMP: R-03371-37637 */
+#define SQLITE_UTF16BE 3 /* IMP: R-51971-34154 */
+#define SQLITE_UTF16 4 /* Use native byte order */
+#define SQLITE_ANY 5 /* Deprecated */
+#define SQLITE_UTF16_ALIGNED 8 /* sqlite3_create_collation only */
+
+/*
+** CAPI3REF: Function Flags
+**
+** These constants may be ORed together with the
+** [SQLITE_UTF8 | preferred text encoding] as the fourth argument
+** to [sqlite3_create_function()], [sqlite3_create_function16()], or
+** [sqlite3_create_function_v2()].
+**
+** <dl>
+** [[SQLITE_DETERMINISTIC]] <dt>SQLITE_DETERMINISTIC</dt><dd>
+** The SQLITE_DETERMINISTIC flag means that the new function always gives
+** the same output when the input parameters are the same.
+** The [abs|abs() function] is deterministic, for example, but
+** [randomblob|randomblob()] is not. Functions must
+** be deterministic in order to be used in certain contexts such as
+** with the WHERE clause of [partial indexes] or in [generated columns].
+** SQLite might also optimize deterministic functions by factoring them
+** out of inner loops.
+** </dd>
+**
+** [[SQLITE_DIRECTONLY]] <dt>SQLITE_DIRECTONLY</dt><dd>
+** The SQLITE_DIRECTONLY flag means that the function may only be invoked
+** from top-level SQL, and cannot be used in VIEWs or TRIGGERs nor in
+** schema structures such as [CHECK constraints], [DEFAULT clauses],
+** [expression indexes], [partial indexes], or [generated columns].
+** The SQLITE_DIRECTONLY flags is a security feature which is recommended
+** for all [application-defined SQL functions], and especially for functions
+** that have side-effects or that could potentially leak sensitive
+** information.
+** </dd>
+**
+** [[SQLITE_INNOCUOUS]] <dt>SQLITE_INNOCUOUS</dt><dd>
+** The SQLITE_INNOCUOUS flag means that the function is unlikely
+** to cause problems even if misused. An innocuous function should have
+** no side effects and should not depend on any values other than its
+** input parameters. The [abs|abs() function] is an example of an
+** innocuous function.
+** The [load_extension() SQL function] is not innocuous because of its
+** side effects.
+** <p> SQLITE_INNOCUOUS is similar to SQLITE_DETERMINISTIC, but is not
+** exactly the same. The [random|random() function] is an example of a
+** function that is innocuous but not deterministic.
+** <p>Some heightened security settings
+** ([SQLITE_DBCONFIG_TRUSTED_SCHEMA] and [PRAGMA trusted_schema=OFF])
+** disable the use of SQL functions inside views and triggers and in
+** schema structures such as [CHECK constraints], [DEFAULT clauses],
+** [expression indexes], [partial indexes], and [generated columns] unless
+** the function is tagged with SQLITE_INNOCUOUS. Most built-in functions
+** are innocuous. Developers are advised to avoid using the
+** SQLITE_INNOCUOUS flag for application-defined functions unless the
+** function has been carefully audited and found to be free of potentially
+** security-adverse side-effects and information-leaks.
+** </dd>
+**
+** [[SQLITE_SUBTYPE]] <dt>SQLITE_SUBTYPE</dt><dd>
+** The SQLITE_SUBTYPE flag indicates to SQLite that a function may call
+** [sqlite3_value_subtype()] to inspect the sub-types of its arguments.
+** Specifying this flag makes no difference for scalar or aggregate user
+** functions. However, if it is not specified for a user-defined window
+** function, then any sub-types belonging to arguments passed to the window
+** function may be discarded before the window function is called (i.e.
+** sqlite3_value_subtype() will always return 0).
+** </dd>
+** </dl>
+*/
+#define SQLITE_DETERMINISTIC 0x000000800
+#define SQLITE_DIRECTONLY 0x000080000
+#define SQLITE_SUBTYPE 0x000100000
+#define SQLITE_INNOCUOUS 0x000200000
+
+/*
+** CAPI3REF: Deprecated Functions
+** DEPRECATED
+**
+** These functions are [deprecated]. In order to maintain
+** backwards compatibility with older code, these functions continue
+** to be supported. However, new applications should avoid
+** the use of these functions. To encourage programmers to avoid
+** these functions, we will not explain what they do.
+*/
+#ifndef SQLITE_OMIT_DEPRECATED
+SQLITE_API SQLITE_DEPRECATED int sqlite3_aggregate_count(sqlite3_context*);
+SQLITE_API SQLITE_DEPRECATED int sqlite3_expired(sqlite3_stmt*);
+SQLITE_API SQLITE_DEPRECATED int sqlite3_transfer_bindings(sqlite3_stmt*, sqlite3_stmt*);
+SQLITE_API SQLITE_DEPRECATED int sqlite3_global_recover(void);
+SQLITE_API SQLITE_DEPRECATED void sqlite3_thread_cleanup(void);
+SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int64,int),
+ void*,sqlite3_int64);
+#endif
+
+/*
+** CAPI3REF: Obtaining SQL Values
+** METHOD: sqlite3_value
+**
+** <b>Summary:</b>
+** <blockquote><table border=0 cellpadding=0 cellspacing=0>
+** <tr><td><b>sqlite3_value_blob</b><td>&rarr;<td>BLOB value
+** <tr><td><b>sqlite3_value_double</b><td>&rarr;<td>REAL value
+** <tr><td><b>sqlite3_value_int</b><td>&rarr;<td>32-bit INTEGER value
+** <tr><td><b>sqlite3_value_int64</b><td>&rarr;<td>64-bit INTEGER value
+** <tr><td><b>sqlite3_value_pointer</b><td>&rarr;<td>Pointer value
+** <tr><td><b>sqlite3_value_text</b><td>&rarr;<td>UTF-8 TEXT value
+** <tr><td><b>sqlite3_value_text16</b><td>&rarr;<td>UTF-16 TEXT value in
+** the native byteorder
+** <tr><td><b>sqlite3_value_text16be</b><td>&rarr;<td>UTF-16be TEXT value
+** <tr><td><b>sqlite3_value_text16le</b><td>&rarr;<td>UTF-16le TEXT value
+** <tr><td>&nbsp;<td>&nbsp;<td>&nbsp;
+** <tr><td><b>sqlite3_value_bytes</b><td>&rarr;<td>Size of a BLOB
+** or a UTF-8 TEXT in bytes
+** <tr><td><b>sqlite3_value_bytes16&nbsp;&nbsp;</b>
+** <td>&rarr;&nbsp;&nbsp;<td>Size of UTF-16
+** TEXT in bytes
+** <tr><td><b>sqlite3_value_type</b><td>&rarr;<td>Default
+** datatype of the value
+** <tr><td><b>sqlite3_value_numeric_type&nbsp;&nbsp;</b>
+** <td>&rarr;&nbsp;&nbsp;<td>Best numeric datatype of the value
+** <tr><td><b>sqlite3_value_nochange&nbsp;&nbsp;</b>
+** <td>&rarr;&nbsp;&nbsp;<td>True if the column is unchanged in an UPDATE
+** against a virtual table.
+** <tr><td><b>sqlite3_value_frombind&nbsp;&nbsp;</b>
+** <td>&rarr;&nbsp;&nbsp;<td>True if value originated from a [bound parameter]
+** </table></blockquote>
+**
+** <b>Details:</b>
+**
+** These routines extract type, size, and content information from
+** [protected sqlite3_value] objects. Protected sqlite3_value objects
+** are used to pass parameter information into the functions that
+** implement [application-defined SQL functions] and [virtual tables].
+**
+** These routines work only with [protected sqlite3_value] objects.
+** Any attempt to use these routines on an [unprotected sqlite3_value]
+** is not threadsafe.
+**
+** ^These routines work just like the corresponding [column access functions]
+** except that these routines take a single [protected sqlite3_value] object
+** pointer instead of a [sqlite3_stmt*] pointer and an integer column number.
+**
+** ^The sqlite3_value_text16() interface extracts a UTF-16 string
+** in the native byte-order of the host machine. ^The
+** sqlite3_value_text16be() and sqlite3_value_text16le() interfaces
+** extract UTF-16 strings as big-endian and little-endian respectively.
+**
+** ^If [sqlite3_value] object V was initialized
+** using [sqlite3_bind_pointer(S,I,P,X,D)] or [sqlite3_result_pointer(C,P,X,D)]
+** and if X and Y are strings that compare equal according to strcmp(X,Y),
+** then sqlite3_value_pointer(V,Y) will return the pointer P. ^Otherwise,
+** sqlite3_value_pointer(V,Y) returns a NULL. The sqlite3_bind_pointer()
+** routine is part of the [pointer passing interface] added for SQLite 3.20.0.
+**
+** ^(The sqlite3_value_type(V) interface returns the
+** [SQLITE_INTEGER | datatype code] for the initial datatype of the
+** [sqlite3_value] object V. The returned value is one of [SQLITE_INTEGER],
+** [SQLITE_FLOAT], [SQLITE_TEXT], [SQLITE_BLOB], or [SQLITE_NULL].)^
+** Other interfaces might change the datatype for an sqlite3_value object.
+** For example, if the datatype is initially SQLITE_INTEGER and
+** sqlite3_value_text(V) is called to extract a text value for that
+** integer, then subsequent calls to sqlite3_value_type(V) might return
+** SQLITE_TEXT. Whether or not a persistent internal datatype conversion
+** occurs is undefined and may change from one release of SQLite to the next.
+**
+** ^(The sqlite3_value_numeric_type() interface attempts to apply
+** numeric affinity to the value. This means that an attempt is
+** made to convert the value to an integer or floating point. If
+** such a conversion is possible without loss of information (in other
+** words, if the value is a string that looks like a number)
+** then the conversion is performed. Otherwise no conversion occurs.
+** The [SQLITE_INTEGER | datatype] after conversion is returned.)^
+**
+** ^Within the [xUpdate] method of a [virtual table], the
+** sqlite3_value_nochange(X) interface returns true if and only if
+** the column corresponding to X is unchanged by the UPDATE operation
+** that the xUpdate method call was invoked to implement and if
+** and the prior [xColumn] method call that was invoked to extracted
+** the value for that column returned without setting a result (probably
+** because it queried [sqlite3_vtab_nochange()] and found that the column
+** was unchanging). ^Within an [xUpdate] method, any value for which
+** sqlite3_value_nochange(X) is true will in all other respects appear
+** to be a NULL value. If sqlite3_value_nochange(X) is invoked anywhere other
+** than within an [xUpdate] method call for an UPDATE statement, then
+** the return value is arbitrary and meaningless.
+**
+** ^The sqlite3_value_frombind(X) interface returns non-zero if the
+** value X originated from one of the [sqlite3_bind_int|sqlite3_bind()]
+** interfaces. ^If X comes from an SQL literal value, or a table column,
+** or an expression, then sqlite3_value_frombind(X) returns zero.
+**
+** Please pay particular attention to the fact that the pointer returned
+** from [sqlite3_value_blob()], [sqlite3_value_text()], or
+** [sqlite3_value_text16()] can be invalidated by a subsequent call to
+** [sqlite3_value_bytes()], [sqlite3_value_bytes16()], [sqlite3_value_text()],
+** or [sqlite3_value_text16()].
+**
+** These routines must be called from the same thread as
+** the SQL function that supplied the [sqlite3_value*] parameters.
+**
+** As long as the input parameter is correct, these routines can only
+** fail if an out-of-memory error occurs during a format conversion.
+** Only the following subset of interfaces are subject to out-of-memory
+** errors:
+**
+** <ul>
+** <li> sqlite3_value_blob()
+** <li> sqlite3_value_text()
+** <li> sqlite3_value_text16()
+** <li> sqlite3_value_text16le()
+** <li> sqlite3_value_text16be()
+** <li> sqlite3_value_bytes()
+** <li> sqlite3_value_bytes16()
+** </ul>
+**
+** If an out-of-memory error occurs, then the return value from these
+** routines is the same as if the column had contained an SQL NULL value.
+** Valid SQL NULL returns can be distinguished from out-of-memory errors
+** by invoking the [sqlite3_errcode()] immediately after the suspect
+** return value is obtained and before any
+** other SQLite interface is called on the same [database connection].
+*/
+SQLITE_API const void *sqlite3_value_blob(sqlite3_value*);
+SQLITE_API double sqlite3_value_double(sqlite3_value*);
+SQLITE_API int sqlite3_value_int(sqlite3_value*);
+SQLITE_API sqlite3_int64 sqlite3_value_int64(sqlite3_value*);
+SQLITE_API void *sqlite3_value_pointer(sqlite3_value*, const char*);
+SQLITE_API const unsigned char *sqlite3_value_text(sqlite3_value*);
+SQLITE_API const void *sqlite3_value_text16(sqlite3_value*);
+SQLITE_API const void *sqlite3_value_text16le(sqlite3_value*);
+SQLITE_API const void *sqlite3_value_text16be(sqlite3_value*);
+SQLITE_API int sqlite3_value_bytes(sqlite3_value*);
+SQLITE_API int sqlite3_value_bytes16(sqlite3_value*);
+SQLITE_API int sqlite3_value_type(sqlite3_value*);
+SQLITE_API int sqlite3_value_numeric_type(sqlite3_value*);
+SQLITE_API int sqlite3_value_nochange(sqlite3_value*);
+SQLITE_API int sqlite3_value_frombind(sqlite3_value*);
+
+/*
+** CAPI3REF: Finding The Subtype Of SQL Values
+** METHOD: sqlite3_value
+**
+** The sqlite3_value_subtype(V) function returns the subtype for
+** an [application-defined SQL function] argument V. The subtype
+** information can be used to pass a limited amount of context from
+** one SQL function to another. Use the [sqlite3_result_subtype()]
+** routine to set the subtype for the return value of an SQL function.
+*/
+SQLITE_API unsigned int sqlite3_value_subtype(sqlite3_value*);
+
+/*
+** CAPI3REF: Copy And Free SQL Values
+** METHOD: sqlite3_value
+**
+** ^The sqlite3_value_dup(V) interface makes a copy of the [sqlite3_value]
+** object D and returns a pointer to that copy. ^The [sqlite3_value] returned
+** is a [protected sqlite3_value] object even if the input is not.
+** ^The sqlite3_value_dup(V) interface returns NULL if V is NULL or if a
+** memory allocation fails.
+**
+** ^The sqlite3_value_free(V) interface frees an [sqlite3_value] object
+** previously obtained from [sqlite3_value_dup()]. ^If V is a NULL pointer
+** then sqlite3_value_free(V) is a harmless no-op.
+*/
+SQLITE_API sqlite3_value *sqlite3_value_dup(const sqlite3_value*);
+SQLITE_API void sqlite3_value_free(sqlite3_value*);
+
+/*
+** CAPI3REF: Obtain Aggregate Function Context
+** METHOD: sqlite3_context
+**
+** Implementations of aggregate SQL functions use this
+** routine to allocate memory for storing their state.
+**
+** ^The first time the sqlite3_aggregate_context(C,N) routine is called
+** for a particular aggregate function, SQLite allocates
+** N bytes of memory, zeroes out that memory, and returns a pointer
+** to the new memory. ^On second and subsequent calls to
+** sqlite3_aggregate_context() for the same aggregate function instance,
+** the same buffer is returned. Sqlite3_aggregate_context() is normally
+** called once for each invocation of the xStep callback and then one
+** last time when the xFinal callback is invoked. ^(When no rows match
+** an aggregate query, the xStep() callback of the aggregate function
+** implementation is never called and xFinal() is called exactly once.
+** In those cases, sqlite3_aggregate_context() might be called for the
+** first time from within xFinal().)^
+**
+** ^The sqlite3_aggregate_context(C,N) routine returns a NULL pointer
+** when first called if N is less than or equal to zero or if a memory
+** allocate error occurs.
+**
+** ^(The amount of space allocated by sqlite3_aggregate_context(C,N) is
+** determined by the N parameter on first successful call. Changing the
+** value of N in any subsequent call to sqlite3_aggregate_context() within
+** the same aggregate function instance will not resize the memory
+** allocation.)^ Within the xFinal callback, it is customary to set
+** N=0 in calls to sqlite3_aggregate_context(C,N) so that no
+** pointless memory allocations occur.
+**
+** ^SQLite automatically frees the memory allocated by
+** sqlite3_aggregate_context() when the aggregate query concludes.
+**
+** The first parameter must be a copy of the
+** [sqlite3_context | SQL function context] that is the first parameter
+** to the xStep or xFinal callback routine that implements the aggregate
+** function.
+**
+** This routine must be called from the same thread in which
+** the aggregate SQL function is running.
+*/
+SQLITE_API void *sqlite3_aggregate_context(sqlite3_context*, int nBytes);
+
+/*
+** CAPI3REF: User Data For Functions
+** METHOD: sqlite3_context
+**
+** ^The sqlite3_user_data() interface returns a copy of
+** the pointer that was the pUserData parameter (the 5th parameter)
+** of the [sqlite3_create_function()]
+** and [sqlite3_create_function16()] routines that originally
+** registered the application defined function.
+**
+** This routine must be called from the same thread in which
+** the application-defined function is running.
+*/
+SQLITE_API void *sqlite3_user_data(sqlite3_context*);
+
+/*
+** CAPI3REF: Database Connection For Functions
+** METHOD: sqlite3_context
+**
+** ^The sqlite3_context_db_handle() interface returns a copy of
+** the pointer to the [database connection] (the 1st parameter)
+** of the [sqlite3_create_function()]
+** and [sqlite3_create_function16()] routines that originally
+** registered the application defined function.
+*/
+SQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_context*);
+
+/*
+** CAPI3REF: Function Auxiliary Data
+** METHOD: sqlite3_context
+**
+** These functions may be used by (non-aggregate) SQL functions to
+** associate metadata with argument values. If the same value is passed to
+** multiple invocations of the same SQL function during query execution, under
+** some circumstances the associated metadata may be preserved. An example
+** of where this might be useful is in a regular-expression matching
+** function. The compiled version of the regular expression can be stored as
+** metadata associated with the pattern string.
+** Then as long as the pattern string remains the same,
+** the compiled regular expression can be reused on multiple
+** invocations of the same function.
+**
+** ^The sqlite3_get_auxdata(C,N) interface returns a pointer to the metadata
+** associated by the sqlite3_set_auxdata(C,N,P,X) function with the Nth argument
+** value to the application-defined function. ^N is zero for the left-most
+** function argument. ^If there is no metadata
+** associated with the function argument, the sqlite3_get_auxdata(C,N) interface
+** returns a NULL pointer.
+**
+** ^The sqlite3_set_auxdata(C,N,P,X) interface saves P as metadata for the N-th
+** argument of the application-defined function. ^Subsequent
+** calls to sqlite3_get_auxdata(C,N) return P from the most recent
+** sqlite3_set_auxdata(C,N,P,X) call if the metadata is still valid or
+** NULL if the metadata has been discarded.
+** ^After each call to sqlite3_set_auxdata(C,N,P,X) where X is not NULL,
+** SQLite will invoke the destructor function X with parameter P exactly
+** once, when the metadata is discarded.
+** SQLite is free to discard the metadata at any time, including: <ul>
+** <li> ^(when the corresponding function parameter changes)^, or
+** <li> ^(when [sqlite3_reset()] or [sqlite3_finalize()] is called for the
+** SQL statement)^, or
+** <li> ^(when sqlite3_set_auxdata() is invoked again on the same
+** parameter)^, or
+** <li> ^(during the original sqlite3_set_auxdata() call when a memory
+** allocation error occurs.)^ </ul>
+**
+** Note the last bullet in particular. The destructor X in
+** sqlite3_set_auxdata(C,N,P,X) might be called immediately, before the
+** sqlite3_set_auxdata() interface even returns. Hence sqlite3_set_auxdata()
+** should be called near the end of the function implementation and the
+** function implementation should not make any use of P after
+** sqlite3_set_auxdata() has been called.
+**
+** ^(In practice, metadata is preserved between function calls for
+** function parameters that are compile-time constants, including literal
+** values and [parameters] and expressions composed from the same.)^
+**
+** The value of the N parameter to these interfaces should be non-negative.
+** Future enhancements may make use of negative N values to define new
+** kinds of function caching behavior.
+**
+** These routines must be called from the same thread in which
+** the SQL function is running.
+*/
+SQLITE_API void *sqlite3_get_auxdata(sqlite3_context*, int N);
+SQLITE_API void sqlite3_set_auxdata(sqlite3_context*, int N, void*, void (*)(void*));
+
+
+/*
+** CAPI3REF: Constants Defining Special Destructor Behavior
+**
+** These are special values for the destructor that is passed in as the
+** final argument to routines like [sqlite3_result_blob()]. ^If the destructor
+** argument is SQLITE_STATIC, it means that the content pointer is constant
+** and will never change. It does not need to be destroyed. ^The
+** SQLITE_TRANSIENT value means that the content will likely change in
+** the near future and that SQLite should make its own private copy of
+** the content before returning.
+**
+** The typedef is necessary to work around problems in certain
+** C++ compilers.
+*/
+typedef void (*sqlite3_destructor_type)(void*);
+#define SQLITE_STATIC ((sqlite3_destructor_type)0)
+#define SQLITE_TRANSIENT ((sqlite3_destructor_type)-1)
+
+/*
+** CAPI3REF: Setting The Result Of An SQL Function
+** METHOD: sqlite3_context
+**
+** These routines are used by the xFunc or xFinal callbacks that
+** implement SQL functions and aggregates. See
+** [sqlite3_create_function()] and [sqlite3_create_function16()]
+** for additional information.
+**
+** These functions work very much like the [parameter binding] family of
+** functions used to bind values to host parameters in prepared statements.
+** Refer to the [SQL parameter] documentation for additional information.
+**
+** ^The sqlite3_result_blob() interface sets the result from
+** an application-defined function to be the BLOB whose content is pointed
+** to by the second parameter and which is N bytes long where N is the
+** third parameter.
+**
+** ^The sqlite3_result_zeroblob(C,N) and sqlite3_result_zeroblob64(C,N)
+** interfaces set the result of the application-defined function to be
+** a BLOB containing all zero bytes and N bytes in size.
+**
+** ^The sqlite3_result_double() interface sets the result from
+** an application-defined function to be a floating point value specified
+** by its 2nd argument.
+**
+** ^The sqlite3_result_error() and sqlite3_result_error16() functions
+** cause the implemented SQL function to throw an exception.
+** ^SQLite uses the string pointed to by the
+** 2nd parameter of sqlite3_result_error() or sqlite3_result_error16()
+** as the text of an error message. ^SQLite interprets the error
+** message string from sqlite3_result_error() as UTF-8. ^SQLite
+** interprets the string from sqlite3_result_error16() as UTF-16 using
+** the same [byte-order determination rules] as [sqlite3_bind_text16()].
+** ^If the third parameter to sqlite3_result_error()
+** or sqlite3_result_error16() is negative then SQLite takes as the error
+** message all text up through the first zero character.
+** ^If the third parameter to sqlite3_result_error() or
+** sqlite3_result_error16() is non-negative then SQLite takes that many
+** bytes (not characters) from the 2nd parameter as the error message.
+** ^The sqlite3_result_error() and sqlite3_result_error16()
+** routines make a private copy of the error message text before
+** they return. Hence, the calling function can deallocate or
+** modify the text after they return without harm.
+** ^The sqlite3_result_error_code() function changes the error code
+** returned by SQLite as a result of an error in a function. ^By default,
+** the error code is SQLITE_ERROR. ^A subsequent call to sqlite3_result_error()
+** or sqlite3_result_error16() resets the error code to SQLITE_ERROR.
+**
+** ^The sqlite3_result_error_toobig() interface causes SQLite to throw an
+** error indicating that a string or BLOB is too long to represent.
+**
+** ^The sqlite3_result_error_nomem() interface causes SQLite to throw an
+** error indicating that a memory allocation failed.
+**
+** ^The sqlite3_result_int() interface sets the return value
+** of the application-defined function to be the 32-bit signed integer
+** value given in the 2nd argument.
+** ^The sqlite3_result_int64() interface sets the return value
+** of the application-defined function to be the 64-bit signed integer
+** value given in the 2nd argument.
+**
+** ^The sqlite3_result_null() interface sets the return value
+** of the application-defined function to be NULL.
+**
+** ^The sqlite3_result_text(), sqlite3_result_text16(),
+** sqlite3_result_text16le(), and sqlite3_result_text16be() interfaces
+** set the return value of the application-defined function to be
+** a text string which is represented as UTF-8, UTF-16 native byte order,
+** UTF-16 little endian, or UTF-16 big endian, respectively.
+** ^The sqlite3_result_text64() interface sets the return value of an
+** application-defined function to be a text string in an encoding
+** specified by the fifth (and last) parameter, which must be one
+** of [SQLITE_UTF8], [SQLITE_UTF16], [SQLITE_UTF16BE], or [SQLITE_UTF16LE].
+** ^SQLite takes the text result from the application from
+** the 2nd parameter of the sqlite3_result_text* interfaces.
+** ^If the 3rd parameter to the sqlite3_result_text* interfaces
+** is negative, then SQLite takes result text from the 2nd parameter
+** through the first zero character.
+** ^If the 3rd parameter to the sqlite3_result_text* interfaces
+** is non-negative, then as many bytes (not characters) of the text
+** pointed to by the 2nd parameter are taken as the application-defined
+** function result. If the 3rd parameter is non-negative, then it
+** must be the byte offset into the string where the NUL terminator would
+** appear if the string where NUL terminated. If any NUL characters occur
+** in the string at a byte offset that is less than the value of the 3rd
+** parameter, then the resulting string will contain embedded NULs and the
+** result of expressions operating on strings with embedded NULs is undefined.
+** ^If the 4th parameter to the sqlite3_result_text* interfaces
+** or sqlite3_result_blob is a non-NULL pointer, then SQLite calls that
+** function as the destructor on the text or BLOB result when it has
+** finished using that result.
+** ^If the 4th parameter to the sqlite3_result_text* interfaces or to
+** sqlite3_result_blob is the special constant SQLITE_STATIC, then SQLite
+** assumes that the text or BLOB result is in constant space and does not
+** copy the content of the parameter nor call a destructor on the content
+** when it has finished using that result.
+** ^If the 4th parameter to the sqlite3_result_text* interfaces
+** or sqlite3_result_blob is the special constant SQLITE_TRANSIENT
+** then SQLite makes a copy of the result into space obtained
+** from [sqlite3_malloc()] before it returns.
+**
+** ^For the sqlite3_result_text16(), sqlite3_result_text16le(), and
+** sqlite3_result_text16be() routines, and for sqlite3_result_text64()
+** when the encoding is not UTF8, if the input UTF16 begins with a
+** byte-order mark (BOM, U+FEFF) then the BOM is removed from the
+** string and the rest of the string is interpreted according to the
+** byte-order specified by the BOM. ^The byte-order specified by
+** the BOM at the beginning of the text overrides the byte-order
+** specified by the interface procedure. ^So, for example, if
+** sqlite3_result_text16le() is invoked with text that begins
+** with bytes 0xfe, 0xff (a big-endian byte-order mark) then the
+** first two bytes of input are skipped and the remaining input
+** is interpreted as UTF16BE text.
+**
+** ^For UTF16 input text to the sqlite3_result_text16(),
+** sqlite3_result_text16be(), sqlite3_result_text16le(), and
+** sqlite3_result_text64() routines, if the text contains invalid
+** UTF16 characters, the invalid characters might be converted
+** into the unicode replacement character, U+FFFD.
+**
+** ^The sqlite3_result_value() interface sets the result of
+** the application-defined function to be a copy of the
+** [unprotected sqlite3_value] object specified by the 2nd parameter. ^The
+** sqlite3_result_value() interface makes a copy of the [sqlite3_value]
+** so that the [sqlite3_value] specified in the parameter may change or
+** be deallocated after sqlite3_result_value() returns without harm.
+** ^A [protected sqlite3_value] object may always be used where an
+** [unprotected sqlite3_value] object is required, so either
+** kind of [sqlite3_value] object can be used with this interface.
+**
+** ^The sqlite3_result_pointer(C,P,T,D) interface sets the result to an
+** SQL NULL value, just like [sqlite3_result_null(C)], except that it
+** also associates the host-language pointer P or type T with that
+** NULL value such that the pointer can be retrieved within an
+** [application-defined SQL function] using [sqlite3_value_pointer()].
+** ^If the D parameter is not NULL, then it is a pointer to a destructor
+** for the P parameter. ^SQLite invokes D with P as its only argument
+** when SQLite is finished with P. The T parameter should be a static
+** string and preferably a string literal. The sqlite3_result_pointer()
+** routine is part of the [pointer passing interface] added for SQLite 3.20.0.
+**
+** If these routines are called from within the different thread
+** than the one containing the application-defined function that received
+** the [sqlite3_context] pointer, the results are undefined.
+*/
+SQLITE_API void sqlite3_result_blob(sqlite3_context*, const void*, int, void(*)(void*));
+SQLITE_API void sqlite3_result_blob64(sqlite3_context*,const void*,
+ sqlite3_uint64,void(*)(void*));
+SQLITE_API void sqlite3_result_double(sqlite3_context*, double);
+SQLITE_API void sqlite3_result_error(sqlite3_context*, const char*, int);
+SQLITE_API void sqlite3_result_error16(sqlite3_context*, const void*, int);
+SQLITE_API void sqlite3_result_error_toobig(sqlite3_context*);
+SQLITE_API void sqlite3_result_error_nomem(sqlite3_context*);
+SQLITE_API void sqlite3_result_error_code(sqlite3_context*, int);
+SQLITE_API void sqlite3_result_int(sqlite3_context*, int);
+SQLITE_API void sqlite3_result_int64(sqlite3_context*, sqlite3_int64);
+SQLITE_API void sqlite3_result_null(sqlite3_context*);
+SQLITE_API void sqlite3_result_text(sqlite3_context*, const char*, int, void(*)(void*));
+SQLITE_API void sqlite3_result_text64(sqlite3_context*, const char*,sqlite3_uint64,
+ void(*)(void*), unsigned char encoding);
+SQLITE_API void sqlite3_result_text16(sqlite3_context*, const void*, int, void(*)(void*));
+SQLITE_API void sqlite3_result_text16le(sqlite3_context*, const void*, int,void(*)(void*));
+SQLITE_API void sqlite3_result_text16be(sqlite3_context*, const void*, int,void(*)(void*));
+SQLITE_API void sqlite3_result_value(sqlite3_context*, sqlite3_value*);
+SQLITE_API void sqlite3_result_pointer(sqlite3_context*, void*,const char*,void(*)(void*));
+SQLITE_API void sqlite3_result_zeroblob(sqlite3_context*, int n);
+SQLITE_API int sqlite3_result_zeroblob64(sqlite3_context*, sqlite3_uint64 n);
+
+
+/*
+** CAPI3REF: Setting The Subtype Of An SQL Function
+** METHOD: sqlite3_context
+**
+** The sqlite3_result_subtype(C,T) function causes the subtype of
+** the result from the [application-defined SQL function] with
+** [sqlite3_context] C to be the value T. Only the lower 8 bits
+** of the subtype T are preserved in current versions of SQLite;
+** higher order bits are discarded.
+** The number of subtype bytes preserved by SQLite might increase
+** in future releases of SQLite.
+*/
+SQLITE_API void sqlite3_result_subtype(sqlite3_context*,unsigned int);
+
+/*
+** CAPI3REF: Define New Collating Sequences
+** METHOD: sqlite3
+**
+** ^These functions add, remove, or modify a [collation] associated
+** with the [database connection] specified as the first argument.
+**
+** ^The name of the collation is a UTF-8 string
+** for sqlite3_create_collation() and sqlite3_create_collation_v2()
+** and a UTF-16 string in native byte order for sqlite3_create_collation16().
+** ^Collation names that compare equal according to [sqlite3_strnicmp()] are
+** considered to be the same name.
+**
+** ^(The third argument (eTextRep) must be one of the constants:
+** <ul>
+** <li> [SQLITE_UTF8],
+** <li> [SQLITE_UTF16LE],
+** <li> [SQLITE_UTF16BE],
+** <li> [SQLITE_UTF16], or
+** <li> [SQLITE_UTF16_ALIGNED].
+** </ul>)^
+** ^The eTextRep argument determines the encoding of strings passed
+** to the collating function callback, xCompare.
+** ^The [SQLITE_UTF16] and [SQLITE_UTF16_ALIGNED] values for eTextRep
+** force strings to be UTF16 with native byte order.
+** ^The [SQLITE_UTF16_ALIGNED] value for eTextRep forces strings to begin
+** on an even byte address.
+**
+** ^The fourth argument, pArg, is an application data pointer that is passed
+** through as the first argument to the collating function callback.
+**
+** ^The fifth argument, xCompare, is a pointer to the collating function.
+** ^Multiple collating functions can be registered using the same name but
+** with different eTextRep parameters and SQLite will use whichever
+** function requires the least amount of data transformation.
+** ^If the xCompare argument is NULL then the collating function is
+** deleted. ^When all collating functions having the same name are deleted,
+** that collation is no longer usable.
+**
+** ^The collating function callback is invoked with a copy of the pArg
+** application data pointer and with two strings in the encoding specified
+** by the eTextRep argument. The two integer parameters to the collating
+** function callback are the length of the two strings, in bytes. The collating
+** function must return an integer that is negative, zero, or positive
+** if the first string is less than, equal to, or greater than the second,
+** respectively. A collating function must always return the same answer
+** given the same inputs. If two or more collating functions are registered
+** to the same collation name (using different eTextRep values) then all
+** must give an equivalent answer when invoked with equivalent strings.
+** The collating function must obey the following properties for all
+** strings A, B, and C:
+**
+** <ol>
+** <li> If A==B then B==A.
+** <li> If A==B and B==C then A==C.
+** <li> If A&lt;B THEN B&gt;A.
+** <li> If A&lt;B and B&lt;C then A&lt;C.
+** </ol>
+**
+** If a collating function fails any of the above constraints and that
+** collating function is registered and used, then the behavior of SQLite
+** is undefined.
+**
+** ^The sqlite3_create_collation_v2() works like sqlite3_create_collation()
+** with the addition that the xDestroy callback is invoked on pArg when
+** the collating function is deleted.
+** ^Collating functions are deleted when they are overridden by later
+** calls to the collation creation functions or when the
+** [database connection] is closed using [sqlite3_close()].
+**
+** ^The xDestroy callback is <u>not</u> called if the
+** sqlite3_create_collation_v2() function fails. Applications that invoke
+** sqlite3_create_collation_v2() with a non-NULL xDestroy argument should
+** check the return code and dispose of the application data pointer
+** themselves rather than expecting SQLite to deal with it for them.
+** This is different from every other SQLite interface. The inconsistency
+** is unfortunate but cannot be changed without breaking backwards
+** compatibility.
+**
+** See also: [sqlite3_collation_needed()] and [sqlite3_collation_needed16()].
+*/
+SQLITE_API int sqlite3_create_collation(
+ sqlite3*,
+ const char *zName,
+ int eTextRep,
+ void *pArg,
+ int(*xCompare)(void*,int,const void*,int,const void*)
+);
+SQLITE_API int sqlite3_create_collation_v2(
+ sqlite3*,
+ const char *zName,
+ int eTextRep,
+ void *pArg,
+ int(*xCompare)(void*,int,const void*,int,const void*),
+ void(*xDestroy)(void*)
+);
+SQLITE_API int sqlite3_create_collation16(
+ sqlite3*,
+ const void *zName,
+ int eTextRep,
+ void *pArg,
+ int(*xCompare)(void*,int,const void*,int,const void*)
+);
+
+/*
+** CAPI3REF: Collation Needed Callbacks
+** METHOD: sqlite3
+**
+** ^To avoid having to register all collation sequences before a database
+** can be used, a single callback function may be registered with the
+** [database connection] to be invoked whenever an undefined collation
+** sequence is required.
+**
+** ^If the function is registered using the sqlite3_collation_needed() API,
+** then it is passed the names of undefined collation sequences as strings
+** encoded in UTF-8. ^If sqlite3_collation_needed16() is used,
+** the names are passed as UTF-16 in machine native byte order.
+** ^A call to either function replaces the existing collation-needed callback.
+**
+** ^(When the callback is invoked, the first argument passed is a copy
+** of the second argument to sqlite3_collation_needed() or
+** sqlite3_collation_needed16(). The second argument is the database
+** connection. The third argument is one of [SQLITE_UTF8], [SQLITE_UTF16BE],
+** or [SQLITE_UTF16LE], indicating the most desirable form of the collation
+** sequence function required. The fourth parameter is the name of the
+** required collation sequence.)^
+**
+** The callback function should register the desired collation using
+** [sqlite3_create_collation()], [sqlite3_create_collation16()], or
+** [sqlite3_create_collation_v2()].
+*/
+SQLITE_API int sqlite3_collation_needed(
+ sqlite3*,
+ void*,
+ void(*)(void*,sqlite3*,int eTextRep,const char*)
+);
+SQLITE_API int sqlite3_collation_needed16(
+ sqlite3*,
+ void*,
+ void(*)(void*,sqlite3*,int eTextRep,const void*)
+);
+
+#ifdef SQLITE_ENABLE_CEROD
+/*
+** Specify the activation key for a CEROD database. Unless
+** activated, none of the CEROD routines will work.
+*/
+SQLITE_API void sqlite3_activate_cerod(
+ const char *zPassPhrase /* Activation phrase */
+);
+#endif
+
+/*
+** CAPI3REF: Suspend Execution For A Short Time
+**
+** The sqlite3_sleep() function causes the current thread to suspend execution
+** for at least a number of milliseconds specified in its parameter.
+**
+** If the operating system does not support sleep requests with
+** millisecond time resolution, then the time will be rounded up to
+** the nearest second. The number of milliseconds of sleep actually
+** requested from the operating system is returned.
+**
+** ^SQLite implements this interface by calling the xSleep()
+** method of the default [sqlite3_vfs] object. If the xSleep() method
+** of the default VFS is not implemented correctly, or not implemented at
+** all, then the behavior of sqlite3_sleep() may deviate from the description
+** in the previous paragraphs.
+*/
+SQLITE_API int sqlite3_sleep(int);
+
+/*
+** CAPI3REF: Name Of The Folder Holding Temporary Files
+**
+** ^(If this global variable is made to point to a string which is
+** the name of a folder (a.k.a. directory), then all temporary files
+** created by SQLite when using a built-in [sqlite3_vfs | VFS]
+** will be placed in that directory.)^ ^If this variable
+** is a NULL pointer, then SQLite performs a search for an appropriate
+** temporary file directory.
+**
+** Applications are strongly discouraged from using this global variable.
+** It is required to set a temporary folder on Windows Runtime (WinRT).
+** But for all other platforms, it is highly recommended that applications
+** neither read nor write this variable. This global variable is a relic
+** that exists for backwards compatibility of legacy applications and should
+** be avoided in new projects.
+**
+** It is not safe to read or modify this variable in more than one
+** thread at a time. It is not safe to read or modify this variable
+** if a [database connection] is being used at the same time in a separate
+** thread.
+** It is intended that this variable be set once
+** as part of process initialization and before any SQLite interface
+** routines have been called and that this variable remain unchanged
+** thereafter.
+**
+** ^The [temp_store_directory pragma] may modify this variable and cause
+** it to point to memory obtained from [sqlite3_malloc]. ^Furthermore,
+** the [temp_store_directory pragma] always assumes that any string
+** that this variable points to is held in memory obtained from
+** [sqlite3_malloc] and the pragma may attempt to free that memory
+** using [sqlite3_free].
+** Hence, if this variable is modified directly, either it should be
+** made NULL or made to point to memory obtained from [sqlite3_malloc]
+** or else the use of the [temp_store_directory pragma] should be avoided.
+** Except when requested by the [temp_store_directory pragma], SQLite
+** does not free the memory that sqlite3_temp_directory points to. If
+** the application wants that memory to be freed, it must do
+** so itself, taking care to only do so after all [database connection]
+** objects have been destroyed.
+**
+** <b>Note to Windows Runtime users:</b> The temporary directory must be set
+** prior to calling [sqlite3_open] or [sqlite3_open_v2]. Otherwise, various
+** features that require the use of temporary files may fail. Here is an
+** example of how to do this using C++ with the Windows Runtime:
+**
+** <blockquote><pre>
+** LPCWSTR zPath = Windows::Storage::ApplicationData::Current->
+** &nbsp; TemporaryFolder->Path->Data();
+** char zPathBuf&#91;MAX_PATH + 1&#93;;
+** memset(zPathBuf, 0, sizeof(zPathBuf));
+** WideCharToMultiByte(CP_UTF8, 0, zPath, -1, zPathBuf, sizeof(zPathBuf),
+** &nbsp; NULL, NULL);
+** sqlite3_temp_directory = sqlite3_mprintf("%s", zPathBuf);
+** </pre></blockquote>
+*/
+SQLITE_API SQLITE_EXTERN char *sqlite3_temp_directory;
+
+/*
+** CAPI3REF: Name Of The Folder Holding Database Files
+**
+** ^(If this global variable is made to point to a string which is
+** the name of a folder (a.k.a. directory), then all database files
+** specified with a relative pathname and created or accessed by
+** SQLite when using a built-in windows [sqlite3_vfs | VFS] will be assumed
+** to be relative to that directory.)^ ^If this variable is a NULL
+** pointer, then SQLite assumes that all database files specified
+** with a relative pathname are relative to the current directory
+** for the process. Only the windows VFS makes use of this global
+** variable; it is ignored by the unix VFS.
+**
+** Changing the value of this variable while a database connection is
+** open can result in a corrupt database.
+**
+** It is not safe to read or modify this variable in more than one
+** thread at a time. It is not safe to read or modify this variable
+** if a [database connection] is being used at the same time in a separate
+** thread.
+** It is intended that this variable be set once
+** as part of process initialization and before any SQLite interface
+** routines have been called and that this variable remain unchanged
+** thereafter.
+**
+** ^The [data_store_directory pragma] may modify this variable and cause
+** it to point to memory obtained from [sqlite3_malloc]. ^Furthermore,
+** the [data_store_directory pragma] always assumes that any string
+** that this variable points to is held in memory obtained from
+** [sqlite3_malloc] and the pragma may attempt to free that memory
+** using [sqlite3_free].
+** Hence, if this variable is modified directly, either it should be
+** made NULL or made to point to memory obtained from [sqlite3_malloc]
+** or else the use of the [data_store_directory pragma] should be avoided.
+*/
+SQLITE_API SQLITE_EXTERN char *sqlite3_data_directory;
+
+/*
+** CAPI3REF: Win32 Specific Interface
+**
+** These interfaces are available only on Windows. The
+** [sqlite3_win32_set_directory] interface is used to set the value associated
+** with the [sqlite3_temp_directory] or [sqlite3_data_directory] variable, to
+** zValue, depending on the value of the type parameter. The zValue parameter
+** should be NULL to cause the previous value to be freed via [sqlite3_free];
+** a non-NULL value will be copied into memory obtained from [sqlite3_malloc]
+** prior to being used. The [sqlite3_win32_set_directory] interface returns
+** [SQLITE_OK] to indicate success, [SQLITE_ERROR] if the type is unsupported,
+** or [SQLITE_NOMEM] if memory could not be allocated. The value of the
+** [sqlite3_data_directory] variable is intended to act as a replacement for
+** the current directory on the sub-platforms of Win32 where that concept is
+** not present, e.g. WinRT and UWP. The [sqlite3_win32_set_directory8] and
+** [sqlite3_win32_set_directory16] interfaces behave exactly the same as the
+** sqlite3_win32_set_directory interface except the string parameter must be
+** UTF-8 or UTF-16, respectively.
+*/
+SQLITE_API int sqlite3_win32_set_directory(
+ unsigned long type, /* Identifier for directory being set or reset */
+ void *zValue /* New value for directory being set or reset */
+);
+SQLITE_API int sqlite3_win32_set_directory8(unsigned long type, const char *zValue);
+SQLITE_API int sqlite3_win32_set_directory16(unsigned long type, const void *zValue);
+
+/*
+** CAPI3REF: Win32 Directory Types
+**
+** These macros are only available on Windows. They define the allowed values
+** for the type argument to the [sqlite3_win32_set_directory] interface.
+*/
+#define SQLITE_WIN32_DATA_DIRECTORY_TYPE 1
+#define SQLITE_WIN32_TEMP_DIRECTORY_TYPE 2
+
+/*
+** CAPI3REF: Test For Auto-Commit Mode
+** KEYWORDS: {autocommit mode}
+** METHOD: sqlite3
+**
+** ^The sqlite3_get_autocommit() interface returns non-zero or
+** zero if the given database connection is or is not in autocommit mode,
+** respectively. ^Autocommit mode is on by default.
+** ^Autocommit mode is disabled by a [BEGIN] statement.
+** ^Autocommit mode is re-enabled by a [COMMIT] or [ROLLBACK].
+**
+** If certain kinds of errors occur on a statement within a multi-statement
+** transaction (errors including [SQLITE_FULL], [SQLITE_IOERR],
+** [SQLITE_NOMEM], [SQLITE_BUSY], and [SQLITE_INTERRUPT]) then the
+** transaction might be rolled back automatically. The only way to
+** find out whether SQLite automatically rolled back the transaction after
+** an error is to use this function.
+**
+** If another thread changes the autocommit status of the database
+** connection while this routine is running, then the return value
+** is undefined.
+*/
+SQLITE_API int sqlite3_get_autocommit(sqlite3*);
+
+/*
+** CAPI3REF: Find The Database Handle Of A Prepared Statement
+** METHOD: sqlite3_stmt
+**
+** ^The sqlite3_db_handle interface returns the [database connection] handle
+** to which a [prepared statement] belongs. ^The [database connection]
+** returned by sqlite3_db_handle is the same [database connection]
+** that was the first argument
+** to the [sqlite3_prepare_v2()] call (or its variants) that was used to
+** create the statement in the first place.
+*/
+SQLITE_API sqlite3 *sqlite3_db_handle(sqlite3_stmt*);
+
+/*
+** CAPI3REF: Return The Filename For A Database Connection
+** METHOD: sqlite3
+**
+** ^The sqlite3_db_filename(D,N) interface returns a pointer to the filename
+** associated with database N of connection D.
+** ^If there is no attached database N on the database
+** connection D, or if database N is a temporary or in-memory database, then
+** this function will return either a NULL pointer or an empty string.
+**
+** ^The string value returned by this routine is owned and managed by
+** the database connection. ^The value will be valid until the database N
+** is [DETACH]-ed or until the database connection closes.
+**
+** ^The filename returned by this function is the output of the
+** xFullPathname method of the [VFS]. ^In other words, the filename
+** will be an absolute pathname, even if the filename used
+** to open the database originally was a URI or relative pathname.
+**
+** If the filename pointer returned by this routine is not NULL, then it
+** can be used as the filename input parameter to these routines:
+** <ul>
+** <li> [sqlite3_uri_parameter()]
+** <li> [sqlite3_uri_boolean()]
+** <li> [sqlite3_uri_int64()]
+** <li> [sqlite3_filename_database()]
+** <li> [sqlite3_filename_journal()]
+** <li> [sqlite3_filename_wal()]
+** </ul>
+*/
+SQLITE_API const char *sqlite3_db_filename(sqlite3 *db, const char *zDbName);
+
+/*
+** CAPI3REF: Determine if a database is read-only
+** METHOD: sqlite3
+**
+** ^The sqlite3_db_readonly(D,N) interface returns 1 if the database N
+** of connection D is read-only, 0 if it is read/write, or -1 if N is not
+** the name of a database on connection D.
+*/
+SQLITE_API int sqlite3_db_readonly(sqlite3 *db, const char *zDbName);
+
+/*
+** CAPI3REF: Determine the transaction state of a database
+** METHOD: sqlite3
+**
+** ^The sqlite3_txn_state(D,S) interface returns the current
+** [transaction state] of schema S in database connection D. ^If S is NULL,
+** then the highest transaction state of any schema on database connection D
+** is returned. Transaction states are (in order of lowest to highest):
+** <ol>
+** <li value="0"> SQLITE_TXN_NONE
+** <li value="1"> SQLITE_TXN_READ
+** <li value="2"> SQLITE_TXN_WRITE
+** </ol>
+** ^If the S argument to sqlite3_txn_state(D,S) is not the name of
+** a valid schema, then -1 is returned.
+*/
+SQLITE_API int sqlite3_txn_state(sqlite3*,const char *zSchema);
+
+/*
+** CAPI3REF: Allowed return values from [sqlite3_txn_state()]
+** KEYWORDS: {transaction state}
+**
+** These constants define the current transaction state of a database file.
+** ^The [sqlite3_txn_state(D,S)] interface returns one of these
+** constants in order to describe the transaction state of schema S
+** in [database connection] D.
+**
+** <dl>
+** [[SQLITE_TXN_NONE]] <dt>SQLITE_TXN_NONE</dt>
+** <dd>The SQLITE_TXN_NONE state means that no transaction is currently
+** pending.</dd>
+**
+** [[SQLITE_TXN_READ]] <dt>SQLITE_TXN_READ</dt>
+** <dd>The SQLITE_TXN_READ state means that the database is currently
+** in a read transaction. Content has been read from the database file
+** but nothing in the database file has changed. The transaction state
+** will advanced to SQLITE_TXN_WRITE if any changes occur and there are
+** no other conflicting concurrent write transactions. The transaction
+** state will revert to SQLITE_TXN_NONE following a [ROLLBACK] or
+** [COMMIT].</dd>
+**
+** [[SQLITE_TXN_WRITE]] <dt>SQLITE_TXN_WRITE</dt>
+** <dd>The SQLITE_TXN_WRITE state means that the database is currently
+** in a write transaction. Content has been written to the database file
+** but has not yet committed. The transaction state will change to
+** to SQLITE_TXN_NONE at the next [ROLLBACK] or [COMMIT].</dd>
+*/
+#define SQLITE_TXN_NONE 0
+#define SQLITE_TXN_READ 1
+#define SQLITE_TXN_WRITE 2
+
+/*
+** CAPI3REF: Find the next prepared statement
+** METHOD: sqlite3
+**
+** ^This interface returns a pointer to the next [prepared statement] after
+** pStmt associated with the [database connection] pDb. ^If pStmt is NULL
+** then this interface returns a pointer to the first prepared statement
+** associated with the database connection pDb. ^If no prepared statement
+** satisfies the conditions of this routine, it returns NULL.
+**
+** The [database connection] pointer D in a call to
+** [sqlite3_next_stmt(D,S)] must refer to an open database
+** connection and in particular must not be a NULL pointer.
+*/
+SQLITE_API sqlite3_stmt *sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt);
+
+/*
+** CAPI3REF: Commit And Rollback Notification Callbacks
+** METHOD: sqlite3
+**
+** ^The sqlite3_commit_hook() interface registers a callback
+** function to be invoked whenever a transaction is [COMMIT | committed].
+** ^Any callback set by a previous call to sqlite3_commit_hook()
+** for the same database connection is overridden.
+** ^The sqlite3_rollback_hook() interface registers a callback
+** function to be invoked whenever a transaction is [ROLLBACK | rolled back].
+** ^Any callback set by a previous call to sqlite3_rollback_hook()
+** for the same database connection is overridden.
+** ^The pArg argument is passed through to the callback.
+** ^If the callback on a commit hook function returns non-zero,
+** then the commit is converted into a rollback.
+**
+** ^The sqlite3_commit_hook(D,C,P) and sqlite3_rollback_hook(D,C,P) functions
+** return the P argument from the previous call of the same function
+** on the same [database connection] D, or NULL for
+** the first call for each function on D.
+**
+** The commit and rollback hook callbacks are not reentrant.
+** The callback implementation must not do anything that will modify
+** the database connection that invoked the callback. Any actions
+** to modify the database connection must be deferred until after the
+** completion of the [sqlite3_step()] call that triggered the commit
+** or rollback hook in the first place.
+** Note that running any other SQL statements, including SELECT statements,
+** or merely calling [sqlite3_prepare_v2()] and [sqlite3_step()] will modify
+** the database connections for the meaning of "modify" in this paragraph.
+**
+** ^Registering a NULL function disables the callback.
+**
+** ^When the commit hook callback routine returns zero, the [COMMIT]
+** operation is allowed to continue normally. ^If the commit hook
+** returns non-zero, then the [COMMIT] is converted into a [ROLLBACK].
+** ^The rollback hook is invoked on a rollback that results from a commit
+** hook returning non-zero, just as it would be with any other rollback.
+**
+** ^For the purposes of this API, a transaction is said to have been
+** rolled back if an explicit "ROLLBACK" statement is executed, or
+** an error or constraint causes an implicit rollback to occur.
+** ^The rollback callback is not invoked if a transaction is
+** automatically rolled back because the database connection is closed.
+**
+** See also the [sqlite3_update_hook()] interface.
+*/
+SQLITE_API void *sqlite3_commit_hook(sqlite3*, int(*)(void*), void*);
+SQLITE_API void *sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*);
+
+/*
+** CAPI3REF: Data Change Notification Callbacks
+** METHOD: sqlite3
+**
+** ^The sqlite3_update_hook() interface registers a callback function
+** with the [database connection] identified by the first argument
+** to be invoked whenever a row is updated, inserted or deleted in
+** a [rowid table].
+** ^Any callback set by a previous call to this function
+** for the same database connection is overridden.
+**
+** ^The second argument is a pointer to the function to invoke when a
+** row is updated, inserted or deleted in a rowid table.
+** ^The first argument to the callback is a copy of the third argument
+** to sqlite3_update_hook().
+** ^The second callback argument is one of [SQLITE_INSERT], [SQLITE_DELETE],
+** or [SQLITE_UPDATE], depending on the operation that caused the callback
+** to be invoked.
+** ^The third and fourth arguments to the callback contain pointers to the
+** database and table name containing the affected row.
+** ^The final callback parameter is the [rowid] of the row.
+** ^In the case of an update, this is the [rowid] after the update takes place.
+**
+** ^(The update hook is not invoked when internal system tables are
+** modified (i.e. sqlite_sequence).)^
+** ^The update hook is not invoked when [WITHOUT ROWID] tables are modified.
+**
+** ^In the current implementation, the update hook
+** is not invoked when conflicting rows are deleted because of an
+** [ON CONFLICT | ON CONFLICT REPLACE] clause. ^Nor is the update hook
+** invoked when rows are deleted using the [truncate optimization].
+** The exceptions defined in this paragraph might change in a future
+** release of SQLite.
+**
+** The update hook implementation must not do anything that will modify
+** the database connection that invoked the update hook. Any actions
+** to modify the database connection must be deferred until after the
+** completion of the [sqlite3_step()] call that triggered the update hook.
+** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their
+** database connections for the meaning of "modify" in this paragraph.
+**
+** ^The sqlite3_update_hook(D,C,P) function
+** returns the P argument from the previous call
+** on the same [database connection] D, or NULL for
+** the first call on D.
+**
+** See also the [sqlite3_commit_hook()], [sqlite3_rollback_hook()],
+** and [sqlite3_preupdate_hook()] interfaces.
+*/
+SQLITE_API void *sqlite3_update_hook(
+ sqlite3*,
+ void(*)(void *,int ,char const *,char const *,sqlite3_int64),
+ void*
+);
+
+/*
+** CAPI3REF: Enable Or Disable Shared Pager Cache
+**
+** ^(This routine enables or disables the sharing of the database cache
+** and schema data structures between [database connection | connections]
+** to the same database. Sharing is enabled if the argument is true
+** and disabled if the argument is false.)^
+**
+** ^Cache sharing is enabled and disabled for an entire process.
+** This is a change as of SQLite [version 3.5.0] ([dateof:3.5.0]).
+** In prior versions of SQLite,
+** sharing was enabled or disabled for each thread separately.
+**
+** ^(The cache sharing mode set by this interface effects all subsequent
+** calls to [sqlite3_open()], [sqlite3_open_v2()], and [sqlite3_open16()].
+** Existing database connections continue to use the sharing mode
+** that was in effect at the time they were opened.)^
+**
+** ^(This routine returns [SQLITE_OK] if shared cache was enabled or disabled
+** successfully. An [error code] is returned otherwise.)^
+**
+** ^Shared cache is disabled by default. It is recommended that it stay
+** that way. In other words, do not use this routine. This interface
+** continues to be provided for historical compatibility, but its use is
+** discouraged. Any use of shared cache is discouraged. If shared cache
+** must be used, it is recommended that shared cache only be enabled for
+** individual database connections using the [sqlite3_open_v2()] interface
+** with the [SQLITE_OPEN_SHAREDCACHE] flag.
+**
+** Note: This method is disabled on MacOS X 10.7 and iOS version 5.0
+** and will always return SQLITE_MISUSE. On those systems,
+** shared cache mode should be enabled per-database connection via
+** [sqlite3_open_v2()] with [SQLITE_OPEN_SHAREDCACHE].
+**
+** This interface is threadsafe on processors where writing a
+** 32-bit integer is atomic.
+**
+** See Also: [SQLite Shared-Cache Mode]
+*/
+SQLITE_API int sqlite3_enable_shared_cache(int);
+
+/*
+** CAPI3REF: Attempt To Free Heap Memory
+**
+** ^The sqlite3_release_memory() interface attempts to free N bytes
+** of heap memory by deallocating non-essential memory allocations
+** held by the database library. Memory used to cache database
+** pages to improve performance is an example of non-essential memory.
+** ^sqlite3_release_memory() returns the number of bytes actually freed,
+** which might be more or less than the amount requested.
+** ^The sqlite3_release_memory() routine is a no-op returning zero
+** if SQLite is not compiled with [SQLITE_ENABLE_MEMORY_MANAGEMENT].
+**
+** See also: [sqlite3_db_release_memory()]
+*/
+SQLITE_API int sqlite3_release_memory(int);
+
+/*
+** CAPI3REF: Free Memory Used By A Database Connection
+** METHOD: sqlite3
+**
+** ^The sqlite3_db_release_memory(D) interface attempts to free as much heap
+** memory as possible from database connection D. Unlike the
+** [sqlite3_release_memory()] interface, this interface is in effect even
+** when the [SQLITE_ENABLE_MEMORY_MANAGEMENT] compile-time option is
+** omitted.
+**
+** See also: [sqlite3_release_memory()]
+*/
+SQLITE_API int sqlite3_db_release_memory(sqlite3*);
+
+/*
+** CAPI3REF: Impose A Limit On Heap Size
+**
+** These interfaces impose limits on the amount of heap memory that will be
+** by all database connections within a single process.
+**
+** ^The sqlite3_soft_heap_limit64() interface sets and/or queries the
+** soft limit on the amount of heap memory that may be allocated by SQLite.
+** ^SQLite strives to keep heap memory utilization below the soft heap
+** limit by reducing the number of pages held in the page cache
+** as heap memory usages approaches the limit.
+** ^The soft heap limit is "soft" because even though SQLite strives to stay
+** below the limit, it will exceed the limit rather than generate
+** an [SQLITE_NOMEM] error. In other words, the soft heap limit
+** is advisory only.
+**
+** ^The sqlite3_hard_heap_limit64(N) interface sets a hard upper bound of
+** N bytes on the amount of memory that will be allocated. ^The
+** sqlite3_hard_heap_limit64(N) interface is similar to
+** sqlite3_soft_heap_limit64(N) except that memory allocations will fail
+** when the hard heap limit is reached.
+**
+** ^The return value from both sqlite3_soft_heap_limit64() and
+** sqlite3_hard_heap_limit64() is the size of
+** the heap limit prior to the call, or negative in the case of an
+** error. ^If the argument N is negative
+** then no change is made to the heap limit. Hence, the current
+** size of heap limits can be determined by invoking
+** sqlite3_soft_heap_limit64(-1) or sqlite3_hard_heap_limit(-1).
+**
+** ^Setting the heap limits to zero disables the heap limiter mechanism.
+**
+** ^The soft heap limit may not be greater than the hard heap limit.
+** ^If the hard heap limit is enabled and if sqlite3_soft_heap_limit(N)
+** is invoked with a value of N that is greater than the hard heap limit,
+** the the soft heap limit is set to the value of the hard heap limit.
+** ^The soft heap limit is automatically enabled whenever the hard heap
+** limit is enabled. ^When sqlite3_hard_heap_limit64(N) is invoked and
+** the soft heap limit is outside the range of 1..N, then the soft heap
+** limit is set to N. ^Invoking sqlite3_soft_heap_limit64(0) when the
+** hard heap limit is enabled makes the soft heap limit equal to the
+** hard heap limit.
+**
+** The memory allocation limits can also be adjusted using
+** [PRAGMA soft_heap_limit] and [PRAGMA hard_heap_limit].
+**
+** ^(The heap limits are not enforced in the current implementation
+** if one or more of following conditions are true:
+**
+** <ul>
+** <li> The limit value is set to zero.
+** <li> Memory accounting is disabled using a combination of the
+** [sqlite3_config]([SQLITE_CONFIG_MEMSTATUS],...) start-time option and
+** the [SQLITE_DEFAULT_MEMSTATUS] compile-time option.
+** <li> An alternative page cache implementation is specified using
+** [sqlite3_config]([SQLITE_CONFIG_PCACHE2],...).
+** <li> The page cache allocates from its own memory pool supplied
+** by [sqlite3_config]([SQLITE_CONFIG_PAGECACHE],...) rather than
+** from the heap.
+** </ul>)^
+**
+** The circumstances under which SQLite will enforce the heap limits may
+** changes in future releases of SQLite.
+*/
+SQLITE_API sqlite3_int64 sqlite3_soft_heap_limit64(sqlite3_int64 N);
+SQLITE_API sqlite3_int64 sqlite3_hard_heap_limit64(sqlite3_int64 N);
+
+/*
+** CAPI3REF: Deprecated Soft Heap Limit Interface
+** DEPRECATED
+**
+** This is a deprecated version of the [sqlite3_soft_heap_limit64()]
+** interface. This routine is provided for historical compatibility
+** only. All new applications should use the
+** [sqlite3_soft_heap_limit64()] interface rather than this one.
+*/
+SQLITE_API SQLITE_DEPRECATED void sqlite3_soft_heap_limit(int N);
+
+
+/*
+** CAPI3REF: Extract Metadata About A Column Of A Table
+** METHOD: sqlite3
+**
+** ^(The sqlite3_table_column_metadata(X,D,T,C,....) routine returns
+** information about column C of table T in database D
+** on [database connection] X.)^ ^The sqlite3_table_column_metadata()
+** interface returns SQLITE_OK and fills in the non-NULL pointers in
+** the final five arguments with appropriate values if the specified
+** column exists. ^The sqlite3_table_column_metadata() interface returns
+** SQLITE_ERROR if the specified column does not exist.
+** ^If the column-name parameter to sqlite3_table_column_metadata() is a
+** NULL pointer, then this routine simply checks for the existence of the
+** table and returns SQLITE_OK if the table exists and SQLITE_ERROR if it
+** does not. If the table name parameter T in a call to
+** sqlite3_table_column_metadata(X,D,T,C,...) is NULL then the result is
+** undefined behavior.
+**
+** ^The column is identified by the second, third and fourth parameters to
+** this function. ^(The second parameter is either the name of the database
+** (i.e. "main", "temp", or an attached database) containing the specified
+** table or NULL.)^ ^If it is NULL, then all attached databases are searched
+** for the table using the same algorithm used by the database engine to
+** resolve unqualified table references.
+**
+** ^The third and fourth parameters to this function are the table and column
+** name of the desired column, respectively.
+**
+** ^Metadata is returned by writing to the memory locations passed as the 5th
+** and subsequent parameters to this function. ^Any of these arguments may be
+** NULL, in which case the corresponding element of metadata is omitted.
+**
+** ^(<blockquote>
+** <table border="1">
+** <tr><th> Parameter <th> Output<br>Type <th> Description
+**
+** <tr><td> 5th <td> const char* <td> Data type
+** <tr><td> 6th <td> const char* <td> Name of default collation sequence
+** <tr><td> 7th <td> int <td> True if column has a NOT NULL constraint
+** <tr><td> 8th <td> int <td> True if column is part of the PRIMARY KEY
+** <tr><td> 9th <td> int <td> True if column is [AUTOINCREMENT]
+** </table>
+** </blockquote>)^
+**
+** ^The memory pointed to by the character pointers returned for the
+** declaration type and collation sequence is valid until the next
+** call to any SQLite API function.
+**
+** ^If the specified table is actually a view, an [error code] is returned.
+**
+** ^If the specified column is "rowid", "oid" or "_rowid_" and the table
+** is not a [WITHOUT ROWID] table and an
+** [INTEGER PRIMARY KEY] column has been explicitly declared, then the output
+** parameters are set for the explicitly declared column. ^(If there is no
+** [INTEGER PRIMARY KEY] column, then the outputs
+** for the [rowid] are set as follows:
+**
+** <pre>
+** data type: "INTEGER"
+** collation sequence: "BINARY"
+** not null: 0
+** primary key: 1
+** auto increment: 0
+** </pre>)^
+**
+** ^This function causes all database schemas to be read from disk and
+** parsed, if that has not already been done, and returns an error if
+** any errors are encountered while loading the schema.
+*/
+SQLITE_API int sqlite3_table_column_metadata(
+ sqlite3 *db, /* Connection handle */
+ const char *zDbName, /* Database name or NULL */
+ const char *zTableName, /* Table name */
+ const char *zColumnName, /* Column name */
+ char const **pzDataType, /* OUTPUT: Declared data type */
+ char const **pzCollSeq, /* OUTPUT: Collation sequence name */
+ int *pNotNull, /* OUTPUT: True if NOT NULL constraint exists */
+ int *pPrimaryKey, /* OUTPUT: True if column part of PK */
+ int *pAutoinc /* OUTPUT: True if column is auto-increment */
+);
+
+/*
+** CAPI3REF: Load An Extension
+** METHOD: sqlite3
+**
+** ^This interface loads an SQLite extension library from the named file.
+**
+** ^The sqlite3_load_extension() interface attempts to load an
+** [SQLite extension] library contained in the file zFile. If
+** the file cannot be loaded directly, attempts are made to load
+** with various operating-system specific extensions added.
+** So for example, if "samplelib" cannot be loaded, then names like
+** "samplelib.so" or "samplelib.dylib" or "samplelib.dll" might
+** be tried also.
+**
+** ^The entry point is zProc.
+** ^(zProc may be 0, in which case SQLite will try to come up with an
+** entry point name on its own. It first tries "sqlite3_extension_init".
+** If that does not work, it constructs a name "sqlite3_X_init" where the
+** X is consists of the lower-case equivalent of all ASCII alphabetic
+** characters in the filename from the last "/" to the first following
+** "." and omitting any initial "lib".)^
+** ^The sqlite3_load_extension() interface returns
+** [SQLITE_OK] on success and [SQLITE_ERROR] if something goes wrong.
+** ^If an error occurs and pzErrMsg is not 0, then the
+** [sqlite3_load_extension()] interface shall attempt to
+** fill *pzErrMsg with error message text stored in memory
+** obtained from [sqlite3_malloc()]. The calling function
+** should free this memory by calling [sqlite3_free()].
+**
+** ^Extension loading must be enabled using
+** [sqlite3_enable_load_extension()] or
+** [sqlite3_db_config](db,[SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION],1,NULL)
+** prior to calling this API,
+** otherwise an error will be returned.
+**
+** <b>Security warning:</b> It is recommended that the
+** [SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION] method be used to enable only this
+** interface. The use of the [sqlite3_enable_load_extension()] interface
+** should be avoided. This will keep the SQL function [load_extension()]
+** disabled and prevent SQL injections from giving attackers
+** access to extension loading capabilities.
+**
+** See also the [load_extension() SQL function].
+*/
+SQLITE_API int sqlite3_load_extension(
+ sqlite3 *db, /* Load the extension into this database connection */
+ const char *zFile, /* Name of the shared library containing extension */
+ const char *zProc, /* Entry point. Derived from zFile if 0 */
+ char **pzErrMsg /* Put error message here if not 0 */
+);
+
+/*
+** CAPI3REF: Enable Or Disable Extension Loading
+** METHOD: sqlite3
+**
+** ^So as not to open security holes in older applications that are
+** unprepared to deal with [extension loading], and as a means of disabling
+** [extension loading] while evaluating user-entered SQL, the following API
+** is provided to turn the [sqlite3_load_extension()] mechanism on and off.
+**
+** ^Extension loading is off by default.
+** ^Call the sqlite3_enable_load_extension() routine with onoff==1
+** to turn extension loading on and call it with onoff==0 to turn
+** it back off again.
+**
+** ^This interface enables or disables both the C-API
+** [sqlite3_load_extension()] and the SQL function [load_extension()].
+** ^(Use [sqlite3_db_config](db,[SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION],..)
+** to enable or disable only the C-API.)^
+**
+** <b>Security warning:</b> It is recommended that extension loading
+** be enabled using the [SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION] method
+** rather than this interface, so the [load_extension()] SQL function
+** remains disabled. This will prevent SQL injections from giving attackers
+** access to extension loading capabilities.
+*/
+SQLITE_API int sqlite3_enable_load_extension(sqlite3 *db, int onoff);
+
+/*
+** CAPI3REF: Automatically Load Statically Linked Extensions
+**
+** ^This interface causes the xEntryPoint() function to be invoked for
+** each new [database connection] that is created. The idea here is that
+** xEntryPoint() is the entry point for a statically linked [SQLite extension]
+** that is to be automatically loaded into all new database connections.
+**
+** ^(Even though the function prototype shows that xEntryPoint() takes
+** no arguments and returns void, SQLite invokes xEntryPoint() with three
+** arguments and expects an integer result as if the signature of the
+** entry point where as follows:
+**
+** <blockquote><pre>
+** &nbsp; int xEntryPoint(
+** &nbsp; sqlite3 *db,
+** &nbsp; const char **pzErrMsg,
+** &nbsp; const struct sqlite3_api_routines *pThunk
+** &nbsp; );
+** </pre></blockquote>)^
+**
+** If the xEntryPoint routine encounters an error, it should make *pzErrMsg
+** point to an appropriate error message (obtained from [sqlite3_mprintf()])
+** and return an appropriate [error code]. ^SQLite ensures that *pzErrMsg
+** is NULL before calling the xEntryPoint(). ^SQLite will invoke
+** [sqlite3_free()] on *pzErrMsg after xEntryPoint() returns. ^If any
+** xEntryPoint() returns an error, the [sqlite3_open()], [sqlite3_open16()],
+** or [sqlite3_open_v2()] call that provoked the xEntryPoint() will fail.
+**
+** ^Calling sqlite3_auto_extension(X) with an entry point X that is already
+** on the list of automatic extensions is a harmless no-op. ^No entry point
+** will be called more than once for each database connection that is opened.
+**
+** See also: [sqlite3_reset_auto_extension()]
+** and [sqlite3_cancel_auto_extension()]
+*/
+SQLITE_API int sqlite3_auto_extension(void(*xEntryPoint)(void));
+
+/*
+** CAPI3REF: Cancel Automatic Extension Loading
+**
+** ^The [sqlite3_cancel_auto_extension(X)] interface unregisters the
+** initialization routine X that was registered using a prior call to
+** [sqlite3_auto_extension(X)]. ^The [sqlite3_cancel_auto_extension(X)]
+** routine returns 1 if initialization routine X was successfully
+** unregistered and it returns 0 if X was not on the list of initialization
+** routines.
+*/
+SQLITE_API int sqlite3_cancel_auto_extension(void(*xEntryPoint)(void));
+
+/*
+** CAPI3REF: Reset Automatic Extension Loading
+**
+** ^This interface disables all automatic extensions previously
+** registered using [sqlite3_auto_extension()].
+*/
+SQLITE_API void sqlite3_reset_auto_extension(void);
+
+/*
+** The interface to the virtual-table mechanism is currently considered
+** to be experimental. The interface might change in incompatible ways.
+** If this is a problem for you, do not use the interface at this time.
+**
+** When the virtual-table mechanism stabilizes, we will declare the
+** interface fixed, support it indefinitely, and remove this comment.
+*/
+
+/*
+** Structures used by the virtual table interface
+*/
+typedef struct sqlite3_vtab sqlite3_vtab;
+typedef struct sqlite3_index_info sqlite3_index_info;
+typedef struct sqlite3_vtab_cursor sqlite3_vtab_cursor;
+typedef struct sqlite3_module sqlite3_module;
+
+/*
+** CAPI3REF: Virtual Table Object
+** KEYWORDS: sqlite3_module {virtual table module}
+**
+** This structure, sometimes called a "virtual table module",
+** defines the implementation of a [virtual table].
+** This structure consists mostly of methods for the module.
+**
+** ^A virtual table module is created by filling in a persistent
+** instance of this structure and passing a pointer to that instance
+** to [sqlite3_create_module()] or [sqlite3_create_module_v2()].
+** ^The registration remains valid until it is replaced by a different
+** module or until the [database connection] closes. The content
+** of this structure must not change while it is registered with
+** any database connection.
+*/
+struct sqlite3_module {
+ int iVersion;
+ int (*xCreate)(sqlite3*, void *pAux,
+ int argc, const char *const*argv,
+ sqlite3_vtab **ppVTab, char**);
+ int (*xConnect)(sqlite3*, void *pAux,
+ int argc, const char *const*argv,
+ sqlite3_vtab **ppVTab, char**);
+ int (*xBestIndex)(sqlite3_vtab *pVTab, sqlite3_index_info*);
+ int (*xDisconnect)(sqlite3_vtab *pVTab);
+ int (*xDestroy)(sqlite3_vtab *pVTab);
+ int (*xOpen)(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor);
+ int (*xClose)(sqlite3_vtab_cursor*);
+ int (*xFilter)(sqlite3_vtab_cursor*, int idxNum, const char *idxStr,
+ int argc, sqlite3_value **argv);
+ int (*xNext)(sqlite3_vtab_cursor*);
+ int (*xEof)(sqlite3_vtab_cursor*);
+ int (*xColumn)(sqlite3_vtab_cursor*, sqlite3_context*, int);
+ int (*xRowid)(sqlite3_vtab_cursor*, sqlite3_int64 *pRowid);
+ int (*xUpdate)(sqlite3_vtab *, int, sqlite3_value **, sqlite3_int64 *);
+ int (*xBegin)(sqlite3_vtab *pVTab);
+ int (*xSync)(sqlite3_vtab *pVTab);
+ int (*xCommit)(sqlite3_vtab *pVTab);
+ int (*xRollback)(sqlite3_vtab *pVTab);
+ int (*xFindFunction)(sqlite3_vtab *pVtab, int nArg, const char *zName,
+ void (**pxFunc)(sqlite3_context*,int,sqlite3_value**),
+ void **ppArg);
+ int (*xRename)(sqlite3_vtab *pVtab, const char *zNew);
+ /* The methods above are in version 1 of the sqlite_module object. Those
+ ** below are for version 2 and greater. */
+ int (*xSavepoint)(sqlite3_vtab *pVTab, int);
+ int (*xRelease)(sqlite3_vtab *pVTab, int);
+ int (*xRollbackTo)(sqlite3_vtab *pVTab, int);
+ /* The methods above are in versions 1 and 2 of the sqlite_module object.
+ ** Those below are for version 3 and greater. */
+ int (*xShadowName)(const char*);
+};
+
+/*
+** CAPI3REF: Virtual Table Indexing Information
+** KEYWORDS: sqlite3_index_info
+**
+** The sqlite3_index_info structure and its substructures is used as part
+** of the [virtual table] interface to
+** pass information into and receive the reply from the [xBestIndex]
+** method of a [virtual table module]. The fields under **Inputs** are the
+** inputs to xBestIndex and are read-only. xBestIndex inserts its
+** results into the **Outputs** fields.
+**
+** ^(The aConstraint[] array records WHERE clause constraints of the form:
+**
+** <blockquote>column OP expr</blockquote>
+**
+** where OP is =, &lt;, &lt;=, &gt;, or &gt;=.)^ ^(The particular operator is
+** stored in aConstraint[].op using one of the
+** [SQLITE_INDEX_CONSTRAINT_EQ | SQLITE_INDEX_CONSTRAINT_ values].)^
+** ^(The index of the column is stored in
+** aConstraint[].iColumn.)^ ^(aConstraint[].usable is TRUE if the
+** expr on the right-hand side can be evaluated (and thus the constraint
+** is usable) and false if it cannot.)^
+**
+** ^The optimizer automatically inverts terms of the form "expr OP column"
+** and makes other simplifications to the WHERE clause in an attempt to
+** get as many WHERE clause terms into the form shown above as possible.
+** ^The aConstraint[] array only reports WHERE clause terms that are
+** relevant to the particular virtual table being queried.
+**
+** ^Information about the ORDER BY clause is stored in aOrderBy[].
+** ^Each term of aOrderBy records a column of the ORDER BY clause.
+**
+** The colUsed field indicates which columns of the virtual table may be
+** required by the current scan. Virtual table columns are numbered from
+** zero in the order in which they appear within the CREATE TABLE statement
+** passed to sqlite3_declare_vtab(). For the first 63 columns (columns 0-62),
+** the corresponding bit is set within the colUsed mask if the column may be
+** required by SQLite. If the table has at least 64 columns and any column
+** to the right of the first 63 is required, then bit 63 of colUsed is also
+** set. In other words, column iCol may be required if the expression
+** (colUsed & ((sqlite3_uint64)1 << (iCol>=63 ? 63 : iCol))) evaluates to
+** non-zero.
+**
+** The [xBestIndex] method must fill aConstraintUsage[] with information
+** about what parameters to pass to xFilter. ^If argvIndex>0 then
+** the right-hand side of the corresponding aConstraint[] is evaluated
+** and becomes the argvIndex-th entry in argv. ^(If aConstraintUsage[].omit
+** is true, then the constraint is assumed to be fully handled by the
+** virtual table and might not be checked again by the byte code.)^ ^(The
+** aConstraintUsage[].omit flag is an optimization hint. When the omit flag
+** is left in its default setting of false, the constraint will always be
+** checked separately in byte code. If the omit flag is change to true, then
+** the constraint may or may not be checked in byte code. In other words,
+** when the omit flag is true there is no guarantee that the constraint will
+** not be checked again using byte code.)^
+**
+** ^The idxNum and idxPtr values are recorded and passed into the
+** [xFilter] method.
+** ^[sqlite3_free()] is used to free idxPtr if and only if
+** needToFreeIdxPtr is true.
+**
+** ^The orderByConsumed means that output from [xFilter]/[xNext] will occur in
+** the correct order to satisfy the ORDER BY clause so that no separate
+** sorting step is required.
+**
+** ^The estimatedCost value is an estimate of the cost of a particular
+** strategy. A cost of N indicates that the cost of the strategy is similar
+** to a linear scan of an SQLite table with N rows. A cost of log(N)
+** indicates that the expense of the operation is similar to that of a
+** binary search on a unique indexed field of an SQLite table with N rows.
+**
+** ^The estimatedRows value is an estimate of the number of rows that
+** will be returned by the strategy.
+**
+** The xBestIndex method may optionally populate the idxFlags field with a
+** mask of SQLITE_INDEX_SCAN_* flags. Currently there is only one such flag -
+** SQLITE_INDEX_SCAN_UNIQUE. If the xBestIndex method sets this flag, SQLite
+** assumes that the strategy may visit at most one row.
+**
+** Additionally, if xBestIndex sets the SQLITE_INDEX_SCAN_UNIQUE flag, then
+** SQLite also assumes that if a call to the xUpdate() method is made as
+** part of the same statement to delete or update a virtual table row and the
+** implementation returns SQLITE_CONSTRAINT, then there is no need to rollback
+** any database changes. In other words, if the xUpdate() returns
+** SQLITE_CONSTRAINT, the database contents must be exactly as they were
+** before xUpdate was called. By contrast, if SQLITE_INDEX_SCAN_UNIQUE is not
+** set and xUpdate returns SQLITE_CONSTRAINT, any database changes made by
+** the xUpdate method are automatically rolled back by SQLite.
+**
+** IMPORTANT: The estimatedRows field was added to the sqlite3_index_info
+** structure for SQLite [version 3.8.2] ([dateof:3.8.2]).
+** If a virtual table extension is
+** used with an SQLite version earlier than 3.8.2, the results of attempting
+** to read or write the estimatedRows field are undefined (but are likely
+** to include crashing the application). The estimatedRows field should
+** therefore only be used if [sqlite3_libversion_number()] returns a
+** value greater than or equal to 3008002. Similarly, the idxFlags field
+** was added for [version 3.9.0] ([dateof:3.9.0]).
+** It may therefore only be used if
+** sqlite3_libversion_number() returns a value greater than or equal to
+** 3009000.
+*/
+struct sqlite3_index_info {
+ /* Inputs */
+ int nConstraint; /* Number of entries in aConstraint */
+ struct sqlite3_index_constraint {
+ int iColumn; /* Column constrained. -1 for ROWID */
+ unsigned char op; /* Constraint operator */
+ unsigned char usable; /* True if this constraint is usable */
+ int iTermOffset; /* Used internally - xBestIndex should ignore */
+ } *aConstraint; /* Table of WHERE clause constraints */
+ int nOrderBy; /* Number of terms in the ORDER BY clause */
+ struct sqlite3_index_orderby {
+ int iColumn; /* Column number */
+ unsigned char desc; /* True for DESC. False for ASC. */
+ } *aOrderBy; /* The ORDER BY clause */
+ /* Outputs */
+ struct sqlite3_index_constraint_usage {
+ int argvIndex; /* if >0, constraint is part of argv to xFilter */
+ unsigned char omit; /* Do not code a test for this constraint */
+ } *aConstraintUsage;
+ int idxNum; /* Number used to identify the index */
+ char *idxStr; /* String, possibly obtained from sqlite3_malloc */
+ int needToFreeIdxStr; /* Free idxStr using sqlite3_free() if true */
+ int orderByConsumed; /* True if output is already ordered */
+ double estimatedCost; /* Estimated cost of using this index */
+ /* Fields below are only available in SQLite 3.8.2 and later */
+ sqlite3_int64 estimatedRows; /* Estimated number of rows returned */
+ /* Fields below are only available in SQLite 3.9.0 and later */
+ int idxFlags; /* Mask of SQLITE_INDEX_SCAN_* flags */
+ /* Fields below are only available in SQLite 3.10.0 and later */
+ sqlite3_uint64 colUsed; /* Input: Mask of columns used by statement */
+};
+
+/*
+** CAPI3REF: Virtual Table Scan Flags
+**
+** Virtual table implementations are allowed to set the
+** [sqlite3_index_info].idxFlags field to some combination of
+** these bits.
+*/
+#define SQLITE_INDEX_SCAN_UNIQUE 1 /* Scan visits at most 1 row */
+
+/*
+** CAPI3REF: Virtual Table Constraint Operator Codes
+**
+** These macros define the allowed values for the
+** [sqlite3_index_info].aConstraint[].op field. Each value represents
+** an operator that is part of a constraint term in the wHERE clause of
+** a query that uses a [virtual table].
+*/
+#define SQLITE_INDEX_CONSTRAINT_EQ 2
+#define SQLITE_INDEX_CONSTRAINT_GT 4
+#define SQLITE_INDEX_CONSTRAINT_LE 8
+#define SQLITE_INDEX_CONSTRAINT_LT 16
+#define SQLITE_INDEX_CONSTRAINT_GE 32
+#define SQLITE_INDEX_CONSTRAINT_MATCH 64
+#define SQLITE_INDEX_CONSTRAINT_LIKE 65
+#define SQLITE_INDEX_CONSTRAINT_GLOB 66
+#define SQLITE_INDEX_CONSTRAINT_REGEXP 67
+#define SQLITE_INDEX_CONSTRAINT_NE 68
+#define SQLITE_INDEX_CONSTRAINT_ISNOT 69
+#define SQLITE_INDEX_CONSTRAINT_ISNOTNULL 70
+#define SQLITE_INDEX_CONSTRAINT_ISNULL 71
+#define SQLITE_INDEX_CONSTRAINT_IS 72
+#define SQLITE_INDEX_CONSTRAINT_FUNCTION 150
+
+/*
+** CAPI3REF: Register A Virtual Table Implementation
+** METHOD: sqlite3
+**
+** ^These routines are used to register a new [virtual table module] name.
+** ^Module names must be registered before
+** creating a new [virtual table] using the module and before using a
+** preexisting [virtual table] for the module.
+**
+** ^The module name is registered on the [database connection] specified
+** by the first parameter. ^The name of the module is given by the
+** second parameter. ^The third parameter is a pointer to
+** the implementation of the [virtual table module]. ^The fourth
+** parameter is an arbitrary client data pointer that is passed through
+** into the [xCreate] and [xConnect] methods of the virtual table module
+** when a new virtual table is be being created or reinitialized.
+**
+** ^The sqlite3_create_module_v2() interface has a fifth parameter which
+** is a pointer to a destructor for the pClientData. ^SQLite will
+** invoke the destructor function (if it is not NULL) when SQLite
+** no longer needs the pClientData pointer. ^The destructor will also
+** be invoked if the call to sqlite3_create_module_v2() fails.
+** ^The sqlite3_create_module()
+** interface is equivalent to sqlite3_create_module_v2() with a NULL
+** destructor.
+**
+** ^If the third parameter (the pointer to the sqlite3_module object) is
+** NULL then no new module is create and any existing modules with the
+** same name are dropped.
+**
+** See also: [sqlite3_drop_modules()]
+*/
+SQLITE_API int sqlite3_create_module(
+ sqlite3 *db, /* SQLite connection to register module with */
+ const char *zName, /* Name of the module */
+ const sqlite3_module *p, /* Methods for the module */
+ void *pClientData /* Client data for xCreate/xConnect */
+);
+SQLITE_API int sqlite3_create_module_v2(
+ sqlite3 *db, /* SQLite connection to register module with */
+ const char *zName, /* Name of the module */
+ const sqlite3_module *p, /* Methods for the module */
+ void *pClientData, /* Client data for xCreate/xConnect */
+ void(*xDestroy)(void*) /* Module destructor function */
+);
+
+/*
+** CAPI3REF: Remove Unnecessary Virtual Table Implementations
+** METHOD: sqlite3
+**
+** ^The sqlite3_drop_modules(D,L) interface removes all virtual
+** table modules from database connection D except those named on list L.
+** The L parameter must be either NULL or a pointer to an array of pointers
+** to strings where the array is terminated by a single NULL pointer.
+** ^If the L parameter is NULL, then all virtual table modules are removed.
+**
+** See also: [sqlite3_create_module()]
+*/
+SQLITE_API int sqlite3_drop_modules(
+ sqlite3 *db, /* Remove modules from this connection */
+ const char **azKeep /* Except, do not remove the ones named here */
+);
+
+/*
+** CAPI3REF: Virtual Table Instance Object
+** KEYWORDS: sqlite3_vtab
+**
+** Every [virtual table module] implementation uses a subclass
+** of this object to describe a particular instance
+** of the [virtual table]. Each subclass will
+** be tailored to the specific needs of the module implementation.
+** The purpose of this superclass is to define certain fields that are
+** common to all module implementations.
+**
+** ^Virtual tables methods can set an error message by assigning a
+** string obtained from [sqlite3_mprintf()] to zErrMsg. The method should
+** take care that any prior string is freed by a call to [sqlite3_free()]
+** prior to assigning a new string to zErrMsg. ^After the error message
+** is delivered up to the client application, the string will be automatically
+** freed by sqlite3_free() and the zErrMsg field will be zeroed.
+*/
+struct sqlite3_vtab {
+ const sqlite3_module *pModule; /* The module for this virtual table */
+ int nRef; /* Number of open cursors */
+ char *zErrMsg; /* Error message from sqlite3_mprintf() */
+ /* Virtual table implementations will typically add additional fields */
+};
+
+/*
+** CAPI3REF: Virtual Table Cursor Object
+** KEYWORDS: sqlite3_vtab_cursor {virtual table cursor}
+**
+** Every [virtual table module] implementation uses a subclass of the
+** following structure to describe cursors that point into the
+** [virtual table] and are used
+** to loop through the virtual table. Cursors are created using the
+** [sqlite3_module.xOpen | xOpen] method of the module and are destroyed
+** by the [sqlite3_module.xClose | xClose] method. Cursors are used
+** by the [xFilter], [xNext], [xEof], [xColumn], and [xRowid] methods
+** of the module. Each module implementation will define
+** the content of a cursor structure to suit its own needs.
+**
+** This superclass exists in order to define fields of the cursor that
+** are common to all implementations.
+*/
+struct sqlite3_vtab_cursor {
+ sqlite3_vtab *pVtab; /* Virtual table of this cursor */
+ /* Virtual table implementations will typically add additional fields */
+};
+
+/*
+** CAPI3REF: Declare The Schema Of A Virtual Table
+**
+** ^The [xCreate] and [xConnect] methods of a
+** [virtual table module] call this interface
+** to declare the format (the names and datatypes of the columns) of
+** the virtual tables they implement.
+*/
+SQLITE_API int sqlite3_declare_vtab(sqlite3*, const char *zSQL);
+
+/*
+** CAPI3REF: Overload A Function For A Virtual Table
+** METHOD: sqlite3
+**
+** ^(Virtual tables can provide alternative implementations of functions
+** using the [xFindFunction] method of the [virtual table module].
+** But global versions of those functions
+** must exist in order to be overloaded.)^
+**
+** ^(This API makes sure a global version of a function with a particular
+** name and number of parameters exists. If no such function exists
+** before this API is called, a new function is created.)^ ^The implementation
+** of the new function always causes an exception to be thrown. So
+** the new function is not good for anything by itself. Its only
+** purpose is to be a placeholder function that can be overloaded
+** by a [virtual table].
+*/
+SQLITE_API int sqlite3_overload_function(sqlite3*, const char *zFuncName, int nArg);
+
+/*
+** The interface to the virtual-table mechanism defined above (back up
+** to a comment remarkably similar to this one) is currently considered
+** to be experimental. The interface might change in incompatible ways.
+** If this is a problem for you, do not use the interface at this time.
+**
+** When the virtual-table mechanism stabilizes, we will declare the
+** interface fixed, support it indefinitely, and remove this comment.
+*/
+
+/*
+** CAPI3REF: A Handle To An Open BLOB
+** KEYWORDS: {BLOB handle} {BLOB handles}
+**
+** An instance of this object represents an open BLOB on which
+** [sqlite3_blob_open | incremental BLOB I/O] can be performed.
+** ^Objects of this type are created by [sqlite3_blob_open()]
+** and destroyed by [sqlite3_blob_close()].
+** ^The [sqlite3_blob_read()] and [sqlite3_blob_write()] interfaces
+** can be used to read or write small subsections of the BLOB.
+** ^The [sqlite3_blob_bytes()] interface returns the size of the BLOB in bytes.
+*/
+typedef struct sqlite3_blob sqlite3_blob;
+
+/*
+** CAPI3REF: Open A BLOB For Incremental I/O
+** METHOD: sqlite3
+** CONSTRUCTOR: sqlite3_blob
+**
+** ^(This interfaces opens a [BLOB handle | handle] to the BLOB located
+** in row iRow, column zColumn, table zTable in database zDb;
+** in other words, the same BLOB that would be selected by:
+**
+** <pre>
+** SELECT zColumn FROM zDb.zTable WHERE [rowid] = iRow;
+** </pre>)^
+**
+** ^(Parameter zDb is not the filename that contains the database, but
+** rather the symbolic name of the database. For attached databases, this is
+** the name that appears after the AS keyword in the [ATTACH] statement.
+** For the main database file, the database name is "main". For TEMP
+** tables, the database name is "temp".)^
+**
+** ^If the flags parameter is non-zero, then the BLOB is opened for read
+** and write access. ^If the flags parameter is zero, the BLOB is opened for
+** read-only access.
+**
+** ^(On success, [SQLITE_OK] is returned and the new [BLOB handle] is stored
+** in *ppBlob. Otherwise an [error code] is returned and, unless the error
+** code is SQLITE_MISUSE, *ppBlob is set to NULL.)^ ^This means that, provided
+** the API is not misused, it is always safe to call [sqlite3_blob_close()]
+** on *ppBlob after this function it returns.
+**
+** This function fails with SQLITE_ERROR if any of the following are true:
+** <ul>
+** <li> ^(Database zDb does not exist)^,
+** <li> ^(Table zTable does not exist within database zDb)^,
+** <li> ^(Table zTable is a WITHOUT ROWID table)^,
+** <li> ^(Column zColumn does not exist)^,
+** <li> ^(Row iRow is not present in the table)^,
+** <li> ^(The specified column of row iRow contains a value that is not
+** a TEXT or BLOB value)^,
+** <li> ^(Column zColumn is part of an index, PRIMARY KEY or UNIQUE
+** constraint and the blob is being opened for read/write access)^,
+** <li> ^([foreign key constraints | Foreign key constraints] are enabled,
+** column zColumn is part of a [child key] definition and the blob is
+** being opened for read/write access)^.
+** </ul>
+**
+** ^Unless it returns SQLITE_MISUSE, this function sets the
+** [database connection] error code and message accessible via
+** [sqlite3_errcode()] and [sqlite3_errmsg()] and related functions.
+**
+** A BLOB referenced by sqlite3_blob_open() may be read using the
+** [sqlite3_blob_read()] interface and modified by using
+** [sqlite3_blob_write()]. The [BLOB handle] can be moved to a
+** different row of the same table using the [sqlite3_blob_reopen()]
+** interface. However, the column, table, or database of a [BLOB handle]
+** cannot be changed after the [BLOB handle] is opened.
+**
+** ^(If the row that a BLOB handle points to is modified by an
+** [UPDATE], [DELETE], or by [ON CONFLICT] side-effects
+** then the BLOB handle is marked as "expired".
+** This is true if any column of the row is changed, even a column
+** other than the one the BLOB handle is open on.)^
+** ^Calls to [sqlite3_blob_read()] and [sqlite3_blob_write()] for
+** an expired BLOB handle fail with a return code of [SQLITE_ABORT].
+** ^(Changes written into a BLOB prior to the BLOB expiring are not
+** rolled back by the expiration of the BLOB. Such changes will eventually
+** commit if the transaction continues to completion.)^
+**
+** ^Use the [sqlite3_blob_bytes()] interface to determine the size of
+** the opened blob. ^The size of a blob may not be changed by this
+** interface. Use the [UPDATE] SQL command to change the size of a
+** blob.
+**
+** ^The [sqlite3_bind_zeroblob()] and [sqlite3_result_zeroblob()] interfaces
+** and the built-in [zeroblob] SQL function may be used to create a
+** zero-filled blob to read or write using the incremental-blob interface.
+**
+** To avoid a resource leak, every open [BLOB handle] should eventually
+** be released by a call to [sqlite3_blob_close()].
+**
+** See also: [sqlite3_blob_close()],
+** [sqlite3_blob_reopen()], [sqlite3_blob_read()],
+** [sqlite3_blob_bytes()], [sqlite3_blob_write()].
+*/
+SQLITE_API int sqlite3_blob_open(
+ sqlite3*,
+ const char *zDb,
+ const char *zTable,
+ const char *zColumn,
+ sqlite3_int64 iRow,
+ int flags,
+ sqlite3_blob **ppBlob
+);
+
+/*
+** CAPI3REF: Move a BLOB Handle to a New Row
+** METHOD: sqlite3_blob
+**
+** ^This function is used to move an existing [BLOB handle] so that it points
+** to a different row of the same database table. ^The new row is identified
+** by the rowid value passed as the second argument. Only the row can be
+** changed. ^The database, table and column on which the blob handle is open
+** remain the same. Moving an existing [BLOB handle] to a new row is
+** faster than closing the existing handle and opening a new one.
+**
+** ^(The new row must meet the same criteria as for [sqlite3_blob_open()] -
+** it must exist and there must be either a blob or text value stored in
+** the nominated column.)^ ^If the new row is not present in the table, or if
+** it does not contain a blob or text value, or if another error occurs, an
+** SQLite error code is returned and the blob handle is considered aborted.
+** ^All subsequent calls to [sqlite3_blob_read()], [sqlite3_blob_write()] or
+** [sqlite3_blob_reopen()] on an aborted blob handle immediately return
+** SQLITE_ABORT. ^Calling [sqlite3_blob_bytes()] on an aborted blob handle
+** always returns zero.
+**
+** ^This function sets the database handle error code and message.
+*/
+SQLITE_API int sqlite3_blob_reopen(sqlite3_blob *, sqlite3_int64);
+
+/*
+** CAPI3REF: Close A BLOB Handle
+** DESTRUCTOR: sqlite3_blob
+**
+** ^This function closes an open [BLOB handle]. ^(The BLOB handle is closed
+** unconditionally. Even if this routine returns an error code, the
+** handle is still closed.)^
+**
+** ^If the blob handle being closed was opened for read-write access, and if
+** the database is in auto-commit mode and there are no other open read-write
+** blob handles or active write statements, the current transaction is
+** committed. ^If an error occurs while committing the transaction, an error
+** code is returned and the transaction rolled back.
+**
+** Calling this function with an argument that is not a NULL pointer or an
+** open blob handle results in undefined behaviour. ^Calling this routine
+** with a null pointer (such as would be returned by a failed call to
+** [sqlite3_blob_open()]) is a harmless no-op. ^Otherwise, if this function
+** is passed a valid open blob handle, the values returned by the
+** sqlite3_errcode() and sqlite3_errmsg() functions are set before returning.
+*/
+SQLITE_API int sqlite3_blob_close(sqlite3_blob *);
+
+/*
+** CAPI3REF: Return The Size Of An Open BLOB
+** METHOD: sqlite3_blob
+**
+** ^Returns the size in bytes of the BLOB accessible via the
+** successfully opened [BLOB handle] in its only argument. ^The
+** incremental blob I/O routines can only read or overwriting existing
+** blob content; they cannot change the size of a blob.
+**
+** This routine only works on a [BLOB handle] which has been created
+** by a prior successful call to [sqlite3_blob_open()] and which has not
+** been closed by [sqlite3_blob_close()]. Passing any other pointer in
+** to this routine results in undefined and probably undesirable behavior.
+*/
+SQLITE_API int sqlite3_blob_bytes(sqlite3_blob *);
+
+/*
+** CAPI3REF: Read Data From A BLOB Incrementally
+** METHOD: sqlite3_blob
+**
+** ^(This function is used to read data from an open [BLOB handle] into a
+** caller-supplied buffer. N bytes of data are copied into buffer Z
+** from the open BLOB, starting at offset iOffset.)^
+**
+** ^If offset iOffset is less than N bytes from the end of the BLOB,
+** [SQLITE_ERROR] is returned and no data is read. ^If N or iOffset is
+** less than zero, [SQLITE_ERROR] is returned and no data is read.
+** ^The size of the blob (and hence the maximum value of N+iOffset)
+** can be determined using the [sqlite3_blob_bytes()] interface.
+**
+** ^An attempt to read from an expired [BLOB handle] fails with an
+** error code of [SQLITE_ABORT].
+**
+** ^(On success, sqlite3_blob_read() returns SQLITE_OK.
+** Otherwise, an [error code] or an [extended error code] is returned.)^
+**
+** This routine only works on a [BLOB handle] which has been created
+** by a prior successful call to [sqlite3_blob_open()] and which has not
+** been closed by [sqlite3_blob_close()]. Passing any other pointer in
+** to this routine results in undefined and probably undesirable behavior.
+**
+** See also: [sqlite3_blob_write()].
+*/
+SQLITE_API int sqlite3_blob_read(sqlite3_blob *, void *Z, int N, int iOffset);
+
+/*
+** CAPI3REF: Write Data Into A BLOB Incrementally
+** METHOD: sqlite3_blob
+**
+** ^(This function is used to write data into an open [BLOB handle] from a
+** caller-supplied buffer. N bytes of data are copied from the buffer Z
+** into the open BLOB, starting at offset iOffset.)^
+**
+** ^(On success, sqlite3_blob_write() returns SQLITE_OK.
+** Otherwise, an [error code] or an [extended error code] is returned.)^
+** ^Unless SQLITE_MISUSE is returned, this function sets the
+** [database connection] error code and message accessible via
+** [sqlite3_errcode()] and [sqlite3_errmsg()] and related functions.
+**
+** ^If the [BLOB handle] passed as the first argument was not opened for
+** writing (the flags parameter to [sqlite3_blob_open()] was zero),
+** this function returns [SQLITE_READONLY].
+**
+** This function may only modify the contents of the BLOB; it is
+** not possible to increase the size of a BLOB using this API.
+** ^If offset iOffset is less than N bytes from the end of the BLOB,
+** [SQLITE_ERROR] is returned and no data is written. The size of the
+** BLOB (and hence the maximum value of N+iOffset) can be determined
+** using the [sqlite3_blob_bytes()] interface. ^If N or iOffset are less
+** than zero [SQLITE_ERROR] is returned and no data is written.
+**
+** ^An attempt to write to an expired [BLOB handle] fails with an
+** error code of [SQLITE_ABORT]. ^Writes to the BLOB that occurred
+** before the [BLOB handle] expired are not rolled back by the
+** expiration of the handle, though of course those changes might
+** have been overwritten by the statement that expired the BLOB handle
+** or by other independent statements.
+**
+** This routine only works on a [BLOB handle] which has been created
+** by a prior successful call to [sqlite3_blob_open()] and which has not
+** been closed by [sqlite3_blob_close()]. Passing any other pointer in
+** to this routine results in undefined and probably undesirable behavior.
+**
+** See also: [sqlite3_blob_read()].
+*/
+SQLITE_API int sqlite3_blob_write(sqlite3_blob *, const void *z, int n, int iOffset);
+
+/*
+** CAPI3REF: Virtual File System Objects
+**
+** A virtual filesystem (VFS) is an [sqlite3_vfs] object
+** that SQLite uses to interact
+** with the underlying operating system. Most SQLite builds come with a
+** single default VFS that is appropriate for the host computer.
+** New VFSes can be registered and existing VFSes can be unregistered.
+** The following interfaces are provided.
+**
+** ^The sqlite3_vfs_find() interface returns a pointer to a VFS given its name.
+** ^Names are case sensitive.
+** ^Names are zero-terminated UTF-8 strings.
+** ^If there is no match, a NULL pointer is returned.
+** ^If zVfsName is NULL then the default VFS is returned.
+**
+** ^New VFSes are registered with sqlite3_vfs_register().
+** ^Each new VFS becomes the default VFS if the makeDflt flag is set.
+** ^The same VFS can be registered multiple times without injury.
+** ^To make an existing VFS into the default VFS, register it again
+** with the makeDflt flag set. If two different VFSes with the
+** same name are registered, the behavior is undefined. If a
+** VFS is registered with a name that is NULL or an empty string,
+** then the behavior is undefined.
+**
+** ^Unregister a VFS with the sqlite3_vfs_unregister() interface.
+** ^(If the default VFS is unregistered, another VFS is chosen as
+** the default. The choice for the new VFS is arbitrary.)^
+*/
+SQLITE_API sqlite3_vfs *sqlite3_vfs_find(const char *zVfsName);
+SQLITE_API int sqlite3_vfs_register(sqlite3_vfs*, int makeDflt);
+SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs*);
+
+/*
+** CAPI3REF: Mutexes
+**
+** The SQLite core uses these routines for thread
+** synchronization. Though they are intended for internal
+** use by SQLite, code that links against SQLite is
+** permitted to use any of these routines.
+**
+** The SQLite source code contains multiple implementations
+** of these mutex routines. An appropriate implementation
+** is selected automatically at compile-time. The following
+** implementations are available in the SQLite core:
+**
+** <ul>
+** <li> SQLITE_MUTEX_PTHREADS
+** <li> SQLITE_MUTEX_W32
+** <li> SQLITE_MUTEX_NOOP
+** </ul>
+**
+** The SQLITE_MUTEX_NOOP implementation is a set of routines
+** that does no real locking and is appropriate for use in
+** a single-threaded application. The SQLITE_MUTEX_PTHREADS and
+** SQLITE_MUTEX_W32 implementations are appropriate for use on Unix
+** and Windows.
+**
+** If SQLite is compiled with the SQLITE_MUTEX_APPDEF preprocessor
+** macro defined (with "-DSQLITE_MUTEX_APPDEF=1"), then no mutex
+** implementation is included with the library. In this case the
+** application must supply a custom mutex implementation using the
+** [SQLITE_CONFIG_MUTEX] option of the sqlite3_config() function
+** before calling sqlite3_initialize() or any other public sqlite3_
+** function that calls sqlite3_initialize().
+**
+** ^The sqlite3_mutex_alloc() routine allocates a new
+** mutex and returns a pointer to it. ^The sqlite3_mutex_alloc()
+** routine returns NULL if it is unable to allocate the requested
+** mutex. The argument to sqlite3_mutex_alloc() must one of these
+** integer constants:
+**
+** <ul>
+** <li> SQLITE_MUTEX_FAST
+** <li> SQLITE_MUTEX_RECURSIVE
+** <li> SQLITE_MUTEX_STATIC_MAIN
+** <li> SQLITE_MUTEX_STATIC_MEM
+** <li> SQLITE_MUTEX_STATIC_OPEN
+** <li> SQLITE_MUTEX_STATIC_PRNG
+** <li> SQLITE_MUTEX_STATIC_LRU
+** <li> SQLITE_MUTEX_STATIC_PMEM
+** <li> SQLITE_MUTEX_STATIC_APP1
+** <li> SQLITE_MUTEX_STATIC_APP2
+** <li> SQLITE_MUTEX_STATIC_APP3
+** <li> SQLITE_MUTEX_STATIC_VFS1
+** <li> SQLITE_MUTEX_STATIC_VFS2
+** <li> SQLITE_MUTEX_STATIC_VFS3
+** </ul>
+**
+** ^The first two constants (SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE)
+** cause sqlite3_mutex_alloc() to create
+** a new mutex. ^The new mutex is recursive when SQLITE_MUTEX_RECURSIVE
+** is used but not necessarily so when SQLITE_MUTEX_FAST is used.
+** The mutex implementation does not need to make a distinction
+** between SQLITE_MUTEX_RECURSIVE and SQLITE_MUTEX_FAST if it does
+** not want to. SQLite will only request a recursive mutex in
+** cases where it really needs one. If a faster non-recursive mutex
+** implementation is available on the host platform, the mutex subsystem
+** might return such a mutex in response to SQLITE_MUTEX_FAST.
+**
+** ^The other allowed parameters to sqlite3_mutex_alloc() (anything other
+** than SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE) each return
+** a pointer to a static preexisting mutex. ^Nine static mutexes are
+** used by the current version of SQLite. Future versions of SQLite
+** may add additional static mutexes. Static mutexes are for internal
+** use by SQLite only. Applications that use SQLite mutexes should
+** use only the dynamic mutexes returned by SQLITE_MUTEX_FAST or
+** SQLITE_MUTEX_RECURSIVE.
+**
+** ^Note that if one of the dynamic mutex parameters (SQLITE_MUTEX_FAST
+** or SQLITE_MUTEX_RECURSIVE) is used then sqlite3_mutex_alloc()
+** returns a different mutex on every call. ^For the static
+** mutex types, the same mutex is returned on every call that has
+** the same type number.
+**
+** ^The sqlite3_mutex_free() routine deallocates a previously
+** allocated dynamic mutex. Attempting to deallocate a static
+** mutex results in undefined behavior.
+**
+** ^The sqlite3_mutex_enter() and sqlite3_mutex_try() routines attempt
+** to enter a mutex. ^If another thread is already within the mutex,
+** sqlite3_mutex_enter() will block and sqlite3_mutex_try() will return
+** SQLITE_BUSY. ^The sqlite3_mutex_try() interface returns [SQLITE_OK]
+** upon successful entry. ^(Mutexes created using
+** SQLITE_MUTEX_RECURSIVE can be entered multiple times by the same thread.
+** In such cases, the
+** mutex must be exited an equal number of times before another thread
+** can enter.)^ If the same thread tries to enter any mutex other
+** than an SQLITE_MUTEX_RECURSIVE more than once, the behavior is undefined.
+**
+** ^(Some systems (for example, Windows 95) do not support the operation
+** implemented by sqlite3_mutex_try(). On those systems, sqlite3_mutex_try()
+** will always return SQLITE_BUSY. The SQLite core only ever uses
+** sqlite3_mutex_try() as an optimization so this is acceptable
+** behavior.)^
+**
+** ^The sqlite3_mutex_leave() routine exits a mutex that was
+** previously entered by the same thread. The behavior
+** is undefined if the mutex is not currently entered by the
+** calling thread or is not currently allocated.
+**
+** ^If the argument to sqlite3_mutex_enter(), sqlite3_mutex_try(), or
+** sqlite3_mutex_leave() is a NULL pointer, then all three routines
+** behave as no-ops.
+**
+** See also: [sqlite3_mutex_held()] and [sqlite3_mutex_notheld()].
+*/
+SQLITE_API sqlite3_mutex *sqlite3_mutex_alloc(int);
+SQLITE_API void sqlite3_mutex_free(sqlite3_mutex*);
+SQLITE_API void sqlite3_mutex_enter(sqlite3_mutex*);
+SQLITE_API int sqlite3_mutex_try(sqlite3_mutex*);
+SQLITE_API void sqlite3_mutex_leave(sqlite3_mutex*);
+
+/*
+** CAPI3REF: Mutex Methods Object
+**
+** An instance of this structure defines the low-level routines
+** used to allocate and use mutexes.
+**
+** Usually, the default mutex implementations provided by SQLite are
+** sufficient, however the application has the option of substituting a custom
+** implementation for specialized deployments or systems for which SQLite
+** does not provide a suitable implementation. In this case, the application
+** creates and populates an instance of this structure to pass
+** to sqlite3_config() along with the [SQLITE_CONFIG_MUTEX] option.
+** Additionally, an instance of this structure can be used as an
+** output variable when querying the system for the current mutex
+** implementation, using the [SQLITE_CONFIG_GETMUTEX] option.
+**
+** ^The xMutexInit method defined by this structure is invoked as
+** part of system initialization by the sqlite3_initialize() function.
+** ^The xMutexInit routine is called by SQLite exactly once for each
+** effective call to [sqlite3_initialize()].
+**
+** ^The xMutexEnd method defined by this structure is invoked as
+** part of system shutdown by the sqlite3_shutdown() function. The
+** implementation of this method is expected to release all outstanding
+** resources obtained by the mutex methods implementation, especially
+** those obtained by the xMutexInit method. ^The xMutexEnd()
+** interface is invoked exactly once for each call to [sqlite3_shutdown()].
+**
+** ^(The remaining seven methods defined by this structure (xMutexAlloc,
+** xMutexFree, xMutexEnter, xMutexTry, xMutexLeave, xMutexHeld and
+** xMutexNotheld) implement the following interfaces (respectively):
+**
+** <ul>
+** <li> [sqlite3_mutex_alloc()] </li>
+** <li> [sqlite3_mutex_free()] </li>
+** <li> [sqlite3_mutex_enter()] </li>
+** <li> [sqlite3_mutex_try()] </li>
+** <li> [sqlite3_mutex_leave()] </li>
+** <li> [sqlite3_mutex_held()] </li>
+** <li> [sqlite3_mutex_notheld()] </li>
+** </ul>)^
+**
+** The only difference is that the public sqlite3_XXX functions enumerated
+** above silently ignore any invocations that pass a NULL pointer instead
+** of a valid mutex handle. The implementations of the methods defined
+** by this structure are not required to handle this case. The results
+** of passing a NULL pointer instead of a valid mutex handle are undefined
+** (i.e. it is acceptable to provide an implementation that segfaults if
+** it is passed a NULL pointer).
+**
+** The xMutexInit() method must be threadsafe. It must be harmless to
+** invoke xMutexInit() multiple times within the same process and without
+** intervening calls to xMutexEnd(). Second and subsequent calls to
+** xMutexInit() must be no-ops.
+**
+** xMutexInit() must not use SQLite memory allocation ([sqlite3_malloc()]
+** and its associates). Similarly, xMutexAlloc() must not use SQLite memory
+** allocation for a static mutex. ^However xMutexAlloc() may use SQLite
+** memory allocation for a fast or recursive mutex.
+**
+** ^SQLite will invoke the xMutexEnd() method when [sqlite3_shutdown()] is
+** called, but only if the prior call to xMutexInit returned SQLITE_OK.
+** If xMutexInit fails in any way, it is expected to clean up after itself
+** prior to returning.
+*/
+typedef struct sqlite3_mutex_methods sqlite3_mutex_methods;
+struct sqlite3_mutex_methods {
+ int (*xMutexInit)(void);
+ int (*xMutexEnd)(void);
+ sqlite3_mutex *(*xMutexAlloc)(int);
+ void (*xMutexFree)(sqlite3_mutex *);
+ void (*xMutexEnter)(sqlite3_mutex *);
+ int (*xMutexTry)(sqlite3_mutex *);
+ void (*xMutexLeave)(sqlite3_mutex *);
+ int (*xMutexHeld)(sqlite3_mutex *);
+ int (*xMutexNotheld)(sqlite3_mutex *);
+};
+
+/*
+** CAPI3REF: Mutex Verification Routines
+**
+** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routines
+** are intended for use inside assert() statements. The SQLite core
+** never uses these routines except inside an assert() and applications
+** are advised to follow the lead of the core. The SQLite core only
+** provides implementations for these routines when it is compiled
+** with the SQLITE_DEBUG flag. External mutex implementations
+** are only required to provide these routines if SQLITE_DEBUG is
+** defined and if NDEBUG is not defined.
+**
+** These routines should return true if the mutex in their argument
+** is held or not held, respectively, by the calling thread.
+**
+** The implementation is not required to provide versions of these
+** routines that actually work. If the implementation does not provide working
+** versions of these routines, it should at least provide stubs that always
+** return true so that one does not get spurious assertion failures.
+**
+** If the argument to sqlite3_mutex_held() is a NULL pointer then
+** the routine should return 1. This seems counter-intuitive since
+** clearly the mutex cannot be held if it does not exist. But
+** the reason the mutex does not exist is because the build is not
+** using mutexes. And we do not want the assert() containing the
+** call to sqlite3_mutex_held() to fail, so a non-zero return is
+** the appropriate thing to do. The sqlite3_mutex_notheld()
+** interface should also return 1 when given a NULL pointer.
+*/
+#ifndef NDEBUG
+SQLITE_API int sqlite3_mutex_held(sqlite3_mutex*);
+SQLITE_API int sqlite3_mutex_notheld(sqlite3_mutex*);
+#endif
+
+/*
+** CAPI3REF: Mutex Types
+**
+** The [sqlite3_mutex_alloc()] interface takes a single argument
+** which is one of these integer constants.
+**
+** The set of static mutexes may change from one SQLite release to the
+** next. Applications that override the built-in mutex logic must be
+** prepared to accommodate additional static mutexes.
+*/
+#define SQLITE_MUTEX_FAST 0
+#define SQLITE_MUTEX_RECURSIVE 1
+#define SQLITE_MUTEX_STATIC_MAIN 2
+#define SQLITE_MUTEX_STATIC_MEM 3 /* sqlite3_malloc() */
+#define SQLITE_MUTEX_STATIC_MEM2 4 /* NOT USED */
+#define SQLITE_MUTEX_STATIC_OPEN 4 /* sqlite3BtreeOpen() */
+#define SQLITE_MUTEX_STATIC_PRNG 5 /* sqlite3_randomness() */
+#define SQLITE_MUTEX_STATIC_LRU 6 /* lru page list */
+#define SQLITE_MUTEX_STATIC_LRU2 7 /* NOT USED */
+#define SQLITE_MUTEX_STATIC_PMEM 7 /* sqlite3PageMalloc() */
+#define SQLITE_MUTEX_STATIC_APP1 8 /* For use by application */
+#define SQLITE_MUTEX_STATIC_APP2 9 /* For use by application */
+#define SQLITE_MUTEX_STATIC_APP3 10 /* For use by application */
+#define SQLITE_MUTEX_STATIC_VFS1 11 /* For use by built-in VFS */
+#define SQLITE_MUTEX_STATIC_VFS2 12 /* For use by extension VFS */
+#define SQLITE_MUTEX_STATIC_VFS3 13 /* For use by application VFS */
+
+/* Legacy compatibility: */
+#define SQLITE_MUTEX_STATIC_MASTER 2
+
+
+/*
+** CAPI3REF: Retrieve the mutex for a database connection
+** METHOD: sqlite3
+**
+** ^This interface returns a pointer the [sqlite3_mutex] object that
+** serializes access to the [database connection] given in the argument
+** when the [threading mode] is Serialized.
+** ^If the [threading mode] is Single-thread or Multi-thread then this
+** routine returns a NULL pointer.
+*/
+SQLITE_API sqlite3_mutex *sqlite3_db_mutex(sqlite3*);
+
+/*
+** CAPI3REF: Low-Level Control Of Database Files
+** METHOD: sqlite3
+** KEYWORDS: {file control}
+**
+** ^The [sqlite3_file_control()] interface makes a direct call to the
+** xFileControl method for the [sqlite3_io_methods] object associated
+** with a particular database identified by the second argument. ^The
+** name of the database is "main" for the main database or "temp" for the
+** TEMP database, or the name that appears after the AS keyword for
+** databases that are added using the [ATTACH] SQL command.
+** ^A NULL pointer can be used in place of "main" to refer to the
+** main database file.
+** ^The third and fourth parameters to this routine
+** are passed directly through to the second and third parameters of
+** the xFileControl method. ^The return value of the xFileControl
+** method becomes the return value of this routine.
+**
+** A few opcodes for [sqlite3_file_control()] are handled directly
+** by the SQLite core and never invoke the
+** sqlite3_io_methods.xFileControl method.
+** ^The [SQLITE_FCNTL_FILE_POINTER] value for the op parameter causes
+** a pointer to the underlying [sqlite3_file] object to be written into
+** the space pointed to by the 4th parameter. The
+** [SQLITE_FCNTL_JOURNAL_POINTER] works similarly except that it returns
+** the [sqlite3_file] object associated with the journal file instead of
+** the main database. The [SQLITE_FCNTL_VFS_POINTER] opcode returns
+** a pointer to the underlying [sqlite3_vfs] object for the file.
+** The [SQLITE_FCNTL_DATA_VERSION] returns the data version counter
+** from the pager.
+**
+** ^If the second parameter (zDbName) does not match the name of any
+** open database file, then SQLITE_ERROR is returned. ^This error
+** code is not remembered and will not be recalled by [sqlite3_errcode()]
+** or [sqlite3_errmsg()]. The underlying xFileControl method might
+** also return SQLITE_ERROR. There is no way to distinguish between
+** an incorrect zDbName and an SQLITE_ERROR return from the underlying
+** xFileControl method.
+**
+** See also: [file control opcodes]
+*/
+SQLITE_API int sqlite3_file_control(sqlite3*, const char *zDbName, int op, void*);
+
+/*
+** CAPI3REF: Testing Interface
+**
+** ^The sqlite3_test_control() interface is used to read out internal
+** state of SQLite and to inject faults into SQLite for testing
+** purposes. ^The first parameter is an operation code that determines
+** the number, meaning, and operation of all subsequent parameters.
+**
+** This interface is not for use by applications. It exists solely
+** for verifying the correct operation of the SQLite library. Depending
+** on how the SQLite library is compiled, this interface might not exist.
+**
+** The details of the operation codes, their meanings, the parameters
+** they take, and what they do are all subject to change without notice.
+** Unlike most of the SQLite API, this function is not guaranteed to
+** operate consistently from one release to the next.
+*/
+SQLITE_API int sqlite3_test_control(int op, ...);
+
+/*
+** CAPI3REF: Testing Interface Operation Codes
+**
+** These constants are the valid operation code parameters used
+** as the first argument to [sqlite3_test_control()].
+**
+** These parameters and their meanings are subject to change
+** without notice. These values are for testing purposes only.
+** Applications should not use any of these parameters or the
+** [sqlite3_test_control()] interface.
+*/
+#define SQLITE_TESTCTRL_FIRST 5
+#define SQLITE_TESTCTRL_PRNG_SAVE 5
+#define SQLITE_TESTCTRL_PRNG_RESTORE 6
+#define SQLITE_TESTCTRL_PRNG_RESET 7 /* NOT USED */
+#define SQLITE_TESTCTRL_BITVEC_TEST 8
+#define SQLITE_TESTCTRL_FAULT_INSTALL 9
+#define SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS 10
+#define SQLITE_TESTCTRL_PENDING_BYTE 11
+#define SQLITE_TESTCTRL_ASSERT 12
+#define SQLITE_TESTCTRL_ALWAYS 13
+#define SQLITE_TESTCTRL_RESERVE 14 /* NOT USED */
+#define SQLITE_TESTCTRL_OPTIMIZATIONS 15
+#define SQLITE_TESTCTRL_ISKEYWORD 16 /* NOT USED */
+#define SQLITE_TESTCTRL_SCRATCHMALLOC 17 /* NOT USED */
+#define SQLITE_TESTCTRL_INTERNAL_FUNCTIONS 17
+#define SQLITE_TESTCTRL_LOCALTIME_FAULT 18
+#define SQLITE_TESTCTRL_EXPLAIN_STMT 19 /* NOT USED */
+#define SQLITE_TESTCTRL_ONCE_RESET_THRESHOLD 19
+#define SQLITE_TESTCTRL_NEVER_CORRUPT 20
+#define SQLITE_TESTCTRL_VDBE_COVERAGE 21
+#define SQLITE_TESTCTRL_BYTEORDER 22
+#define SQLITE_TESTCTRL_ISINIT 23
+#define SQLITE_TESTCTRL_SORTER_MMAP 24
+#define SQLITE_TESTCTRL_IMPOSTER 25
+#define SQLITE_TESTCTRL_PARSER_COVERAGE 26
+#define SQLITE_TESTCTRL_RESULT_INTREAL 27
+#define SQLITE_TESTCTRL_PRNG_SEED 28
+#define SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS 29
+#define SQLITE_TESTCTRL_SEEK_COUNT 30
+#define SQLITE_TESTCTRL_LAST 30 /* Largest TESTCTRL */
+
+/*
+** CAPI3REF: SQL Keyword Checking
+**
+** These routines provide access to the set of SQL language keywords
+** recognized by SQLite. Applications can uses these routines to determine
+** whether or not a specific identifier needs to be escaped (for example,
+** by enclosing in double-quotes) so as not to confuse the parser.
+**
+** The sqlite3_keyword_count() interface returns the number of distinct
+** keywords understood by SQLite.
+**
+** The sqlite3_keyword_name(N,Z,L) interface finds the N-th keyword and
+** makes *Z point to that keyword expressed as UTF8 and writes the number
+** of bytes in the keyword into *L. The string that *Z points to is not
+** zero-terminated. The sqlite3_keyword_name(N,Z,L) routine returns
+** SQLITE_OK if N is within bounds and SQLITE_ERROR if not. If either Z
+** or L are NULL or invalid pointers then calls to
+** sqlite3_keyword_name(N,Z,L) result in undefined behavior.
+**
+** The sqlite3_keyword_check(Z,L) interface checks to see whether or not
+** the L-byte UTF8 identifier that Z points to is a keyword, returning non-zero
+** if it is and zero if not.
+**
+** The parser used by SQLite is forgiving. It is often possible to use
+** a keyword as an identifier as long as such use does not result in a
+** parsing ambiguity. For example, the statement
+** "CREATE TABLE BEGIN(REPLACE,PRAGMA,END);" is accepted by SQLite, and
+** creates a new table named "BEGIN" with three columns named
+** "REPLACE", "PRAGMA", and "END". Nevertheless, best practice is to avoid
+** using keywords as identifiers. Common techniques used to avoid keyword
+** name collisions include:
+** <ul>
+** <li> Put all identifier names inside double-quotes. This is the official
+** SQL way to escape identifier names.
+** <li> Put identifier names inside &#91;...&#93;. This is not standard SQL,
+** but it is what SQL Server does and so lots of programmers use this
+** technique.
+** <li> Begin every identifier with the letter "Z" as no SQL keywords start
+** with "Z".
+** <li> Include a digit somewhere in every identifier name.
+** </ul>
+**
+** Note that the number of keywords understood by SQLite can depend on
+** compile-time options. For example, "VACUUM" is not a keyword if
+** SQLite is compiled with the [-DSQLITE_OMIT_VACUUM] option. Also,
+** new keywords may be added to future releases of SQLite.
+*/
+SQLITE_API int sqlite3_keyword_count(void);
+SQLITE_API int sqlite3_keyword_name(int,const char**,int*);
+SQLITE_API int sqlite3_keyword_check(const char*,int);
+
+/*
+** CAPI3REF: Dynamic String Object
+** KEYWORDS: {dynamic string}
+**
+** An instance of the sqlite3_str object contains a dynamically-sized
+** string under construction.
+**
+** The lifecycle of an sqlite3_str object is as follows:
+** <ol>
+** <li> ^The sqlite3_str object is created using [sqlite3_str_new()].
+** <li> ^Text is appended to the sqlite3_str object using various
+** methods, such as [sqlite3_str_appendf()].
+** <li> ^The sqlite3_str object is destroyed and the string it created
+** is returned using the [sqlite3_str_finish()] interface.
+** </ol>
+*/
+typedef struct sqlite3_str sqlite3_str;
+
+/*
+** CAPI3REF: Create A New Dynamic String Object
+** CONSTRUCTOR: sqlite3_str
+**
+** ^The [sqlite3_str_new(D)] interface allocates and initializes
+** a new [sqlite3_str] object. To avoid memory leaks, the object returned by
+** [sqlite3_str_new()] must be freed by a subsequent call to
+** [sqlite3_str_finish(X)].
+**
+** ^The [sqlite3_str_new(D)] interface always returns a pointer to a
+** valid [sqlite3_str] object, though in the event of an out-of-memory
+** error the returned object might be a special singleton that will
+** silently reject new text, always return SQLITE_NOMEM from
+** [sqlite3_str_errcode()], always return 0 for
+** [sqlite3_str_length()], and always return NULL from
+** [sqlite3_str_finish(X)]. It is always safe to use the value
+** returned by [sqlite3_str_new(D)] as the sqlite3_str parameter
+** to any of the other [sqlite3_str] methods.
+**
+** The D parameter to [sqlite3_str_new(D)] may be NULL. If the
+** D parameter in [sqlite3_str_new(D)] is not NULL, then the maximum
+** length of the string contained in the [sqlite3_str] object will be
+** the value set for [sqlite3_limit](D,[SQLITE_LIMIT_LENGTH]) instead
+** of [SQLITE_MAX_LENGTH].
+*/
+SQLITE_API sqlite3_str *sqlite3_str_new(sqlite3*);
+
+/*
+** CAPI3REF: Finalize A Dynamic String
+** DESTRUCTOR: sqlite3_str
+**
+** ^The [sqlite3_str_finish(X)] interface destroys the sqlite3_str object X
+** and returns a pointer to a memory buffer obtained from [sqlite3_malloc64()]
+** that contains the constructed string. The calling application should
+** pass the returned value to [sqlite3_free()] to avoid a memory leak.
+** ^The [sqlite3_str_finish(X)] interface may return a NULL pointer if any
+** errors were encountered during construction of the string. ^The
+** [sqlite3_str_finish(X)] interface will also return a NULL pointer if the
+** string in [sqlite3_str] object X is zero bytes long.
+*/
+SQLITE_API char *sqlite3_str_finish(sqlite3_str*);
+
+/*
+** CAPI3REF: Add Content To A Dynamic String
+** METHOD: sqlite3_str
+**
+** These interfaces add content to an sqlite3_str object previously obtained
+** from [sqlite3_str_new()].
+**
+** ^The [sqlite3_str_appendf(X,F,...)] and
+** [sqlite3_str_vappendf(X,F,V)] interfaces uses the [built-in printf]
+** functionality of SQLite to append formatted text onto the end of
+** [sqlite3_str] object X.
+**
+** ^The [sqlite3_str_append(X,S,N)] method appends exactly N bytes from string S
+** onto the end of the [sqlite3_str] object X. N must be non-negative.
+** S must contain at least N non-zero bytes of content. To append a
+** zero-terminated string in its entirety, use the [sqlite3_str_appendall()]
+** method instead.
+**
+** ^The [sqlite3_str_appendall(X,S)] method appends the complete content of
+** zero-terminated string S onto the end of [sqlite3_str] object X.
+**
+** ^The [sqlite3_str_appendchar(X,N,C)] method appends N copies of the
+** single-byte character C onto the end of [sqlite3_str] object X.
+** ^This method can be used, for example, to add whitespace indentation.
+**
+** ^The [sqlite3_str_reset(X)] method resets the string under construction
+** inside [sqlite3_str] object X back to zero bytes in length.
+**
+** These methods do not return a result code. ^If an error occurs, that fact
+** is recorded in the [sqlite3_str] object and can be recovered by a
+** subsequent call to [sqlite3_str_errcode(X)].
+*/
+SQLITE_API void sqlite3_str_appendf(sqlite3_str*, const char *zFormat, ...);
+SQLITE_API void sqlite3_str_vappendf(sqlite3_str*, const char *zFormat, va_list);
+SQLITE_API void sqlite3_str_append(sqlite3_str*, const char *zIn, int N);
+SQLITE_API void sqlite3_str_appendall(sqlite3_str*, const char *zIn);
+SQLITE_API void sqlite3_str_appendchar(sqlite3_str*, int N, char C);
+SQLITE_API void sqlite3_str_reset(sqlite3_str*);
+
+/*
+** CAPI3REF: Status Of A Dynamic String
+** METHOD: sqlite3_str
+**
+** These interfaces return the current status of an [sqlite3_str] object.
+**
+** ^If any prior errors have occurred while constructing the dynamic string
+** in sqlite3_str X, then the [sqlite3_str_errcode(X)] method will return
+** an appropriate error code. ^The [sqlite3_str_errcode(X)] method returns
+** [SQLITE_NOMEM] following any out-of-memory error, or
+** [SQLITE_TOOBIG] if the size of the dynamic string exceeds
+** [SQLITE_MAX_LENGTH], or [SQLITE_OK] if there have been no errors.
+**
+** ^The [sqlite3_str_length(X)] method returns the current length, in bytes,
+** of the dynamic string under construction in [sqlite3_str] object X.
+** ^The length returned by [sqlite3_str_length(X)] does not include the
+** zero-termination byte.
+**
+** ^The [sqlite3_str_value(X)] method returns a pointer to the current
+** content of the dynamic string under construction in X. The value
+** returned by [sqlite3_str_value(X)] is managed by the sqlite3_str object X
+** and might be freed or altered by any subsequent method on the same
+** [sqlite3_str] object. Applications must not used the pointer returned
+** [sqlite3_str_value(X)] after any subsequent method call on the same
+** object. ^Applications may change the content of the string returned
+** by [sqlite3_str_value(X)] as long as they do not write into any bytes
+** outside the range of 0 to [sqlite3_str_length(X)] and do not read or
+** write any byte after any subsequent sqlite3_str method call.
+*/
+SQLITE_API int sqlite3_str_errcode(sqlite3_str*);
+SQLITE_API int sqlite3_str_length(sqlite3_str*);
+SQLITE_API char *sqlite3_str_value(sqlite3_str*);
+
+/*
+** CAPI3REF: SQLite Runtime Status
+**
+** ^These interfaces are used to retrieve runtime status information
+** about the performance of SQLite, and optionally to reset various
+** highwater marks. ^The first argument is an integer code for
+** the specific parameter to measure. ^(Recognized integer codes
+** are of the form [status parameters | SQLITE_STATUS_...].)^
+** ^The current value of the parameter is returned into *pCurrent.
+** ^The highest recorded value is returned in *pHighwater. ^If the
+** resetFlag is true, then the highest record value is reset after
+** *pHighwater is written. ^(Some parameters do not record the highest
+** value. For those parameters
+** nothing is written into *pHighwater and the resetFlag is ignored.)^
+** ^(Other parameters record only the highwater mark and not the current
+** value. For these latter parameters nothing is written into *pCurrent.)^
+**
+** ^The sqlite3_status() and sqlite3_status64() routines return
+** SQLITE_OK on success and a non-zero [error code] on failure.
+**
+** If either the current value or the highwater mark is too large to
+** be represented by a 32-bit integer, then the values returned by
+** sqlite3_status() are undefined.
+**
+** See also: [sqlite3_db_status()]
+*/
+SQLITE_API int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag);
+SQLITE_API int sqlite3_status64(
+ int op,
+ sqlite3_int64 *pCurrent,
+ sqlite3_int64 *pHighwater,
+ int resetFlag
+);
+
+
+/*
+** CAPI3REF: Status Parameters
+** KEYWORDS: {status parameters}
+**
+** These integer constants designate various run-time status parameters
+** that can be returned by [sqlite3_status()].
+**
+** <dl>
+** [[SQLITE_STATUS_MEMORY_USED]] ^(<dt>SQLITE_STATUS_MEMORY_USED</dt>
+** <dd>This parameter is the current amount of memory checked out
+** using [sqlite3_malloc()], either directly or indirectly. The
+** figure includes calls made to [sqlite3_malloc()] by the application
+** and internal memory usage by the SQLite library. Auxiliary page-cache
+** memory controlled by [SQLITE_CONFIG_PAGECACHE] is not included in
+** this parameter. The amount returned is the sum of the allocation
+** sizes as reported by the xSize method in [sqlite3_mem_methods].</dd>)^
+**
+** [[SQLITE_STATUS_MALLOC_SIZE]] ^(<dt>SQLITE_STATUS_MALLOC_SIZE</dt>
+** <dd>This parameter records the largest memory allocation request
+** handed to [sqlite3_malloc()] or [sqlite3_realloc()] (or their
+** internal equivalents). Only the value returned in the
+** *pHighwater parameter to [sqlite3_status()] is of interest.
+** The value written into the *pCurrent parameter is undefined.</dd>)^
+**
+** [[SQLITE_STATUS_MALLOC_COUNT]] ^(<dt>SQLITE_STATUS_MALLOC_COUNT</dt>
+** <dd>This parameter records the number of separate memory allocations
+** currently checked out.</dd>)^
+**
+** [[SQLITE_STATUS_PAGECACHE_USED]] ^(<dt>SQLITE_STATUS_PAGECACHE_USED</dt>
+** <dd>This parameter returns the number of pages used out of the
+** [pagecache memory allocator] that was configured using
+** [SQLITE_CONFIG_PAGECACHE]. The
+** value returned is in pages, not in bytes.</dd>)^
+**
+** [[SQLITE_STATUS_PAGECACHE_OVERFLOW]]
+** ^(<dt>SQLITE_STATUS_PAGECACHE_OVERFLOW</dt>
+** <dd>This parameter returns the number of bytes of page cache
+** allocation which could not be satisfied by the [SQLITE_CONFIG_PAGECACHE]
+** buffer and where forced to overflow to [sqlite3_malloc()]. The
+** returned value includes allocations that overflowed because they
+** where too large (they were larger than the "sz" parameter to
+** [SQLITE_CONFIG_PAGECACHE]) and allocations that overflowed because
+** no space was left in the page cache.</dd>)^
+**
+** [[SQLITE_STATUS_PAGECACHE_SIZE]] ^(<dt>SQLITE_STATUS_PAGECACHE_SIZE</dt>
+** <dd>This parameter records the largest memory allocation request
+** handed to the [pagecache memory allocator]. Only the value returned in the
+** *pHighwater parameter to [sqlite3_status()] is of interest.
+** The value written into the *pCurrent parameter is undefined.</dd>)^
+**
+** [[SQLITE_STATUS_SCRATCH_USED]] <dt>SQLITE_STATUS_SCRATCH_USED</dt>
+** <dd>No longer used.</dd>
+**
+** [[SQLITE_STATUS_SCRATCH_OVERFLOW]] ^(<dt>SQLITE_STATUS_SCRATCH_OVERFLOW</dt>
+** <dd>No longer used.</dd>
+**
+** [[SQLITE_STATUS_SCRATCH_SIZE]] <dt>SQLITE_STATUS_SCRATCH_SIZE</dt>
+** <dd>No longer used.</dd>
+**
+** [[SQLITE_STATUS_PARSER_STACK]] ^(<dt>SQLITE_STATUS_PARSER_STACK</dt>
+** <dd>The *pHighwater parameter records the deepest parser stack.
+** The *pCurrent value is undefined. The *pHighwater value is only
+** meaningful if SQLite is compiled with [YYTRACKMAXSTACKDEPTH].</dd>)^
+** </dl>
+**
+** New status parameters may be added from time to time.
+*/
+#define SQLITE_STATUS_MEMORY_USED 0
+#define SQLITE_STATUS_PAGECACHE_USED 1
+#define SQLITE_STATUS_PAGECACHE_OVERFLOW 2
+#define SQLITE_STATUS_SCRATCH_USED 3 /* NOT USED */
+#define SQLITE_STATUS_SCRATCH_OVERFLOW 4 /* NOT USED */
+#define SQLITE_STATUS_MALLOC_SIZE 5
+#define SQLITE_STATUS_PARSER_STACK 6
+#define SQLITE_STATUS_PAGECACHE_SIZE 7
+#define SQLITE_STATUS_SCRATCH_SIZE 8 /* NOT USED */
+#define SQLITE_STATUS_MALLOC_COUNT 9
+
+/*
+** CAPI3REF: Database Connection Status
+** METHOD: sqlite3
+**
+** ^This interface is used to retrieve runtime status information
+** about a single [database connection]. ^The first argument is the
+** database connection object to be interrogated. ^The second argument
+** is an integer constant, taken from the set of
+** [SQLITE_DBSTATUS options], that
+** determines the parameter to interrogate. The set of
+** [SQLITE_DBSTATUS options] is likely
+** to grow in future releases of SQLite.
+**
+** ^The current value of the requested parameter is written into *pCur
+** and the highest instantaneous value is written into *pHiwtr. ^If
+** the resetFlg is true, then the highest instantaneous value is
+** reset back down to the current value.
+**
+** ^The sqlite3_db_status() routine returns SQLITE_OK on success and a
+** non-zero [error code] on failure.
+**
+** See also: [sqlite3_status()] and [sqlite3_stmt_status()].
+*/
+SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int resetFlg);
+
+/*
+** CAPI3REF: Status Parameters for database connections
+** KEYWORDS: {SQLITE_DBSTATUS options}
+**
+** These constants are the available integer "verbs" that can be passed as
+** the second argument to the [sqlite3_db_status()] interface.
+**
+** New verbs may be added in future releases of SQLite. Existing verbs
+** might be discontinued. Applications should check the return code from
+** [sqlite3_db_status()] to make sure that the call worked.
+** The [sqlite3_db_status()] interface will return a non-zero error code
+** if a discontinued or unsupported verb is invoked.
+**
+** <dl>
+** [[SQLITE_DBSTATUS_LOOKASIDE_USED]] ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_USED</dt>
+** <dd>This parameter returns the number of lookaside memory slots currently
+** checked out.</dd>)^
+**
+** [[SQLITE_DBSTATUS_LOOKASIDE_HIT]] ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_HIT</dt>
+** <dd>This parameter returns the number of malloc attempts that were
+** satisfied using lookaside memory. Only the high-water value is meaningful;
+** the current value is always zero.)^
+**
+** [[SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE]]
+** ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE</dt>
+** <dd>This parameter returns the number malloc attempts that might have
+** been satisfied using lookaside memory but failed due to the amount of
+** memory requested being larger than the lookaside slot size.
+** Only the high-water value is meaningful;
+** the current value is always zero.)^
+**
+** [[SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL]]
+** ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL</dt>
+** <dd>This parameter returns the number malloc attempts that might have
+** been satisfied using lookaside memory but failed due to all lookaside
+** memory already being in use.
+** Only the high-water value is meaningful;
+** the current value is always zero.)^
+**
+** [[SQLITE_DBSTATUS_CACHE_USED]] ^(<dt>SQLITE_DBSTATUS_CACHE_USED</dt>
+** <dd>This parameter returns the approximate number of bytes of heap
+** memory used by all pager caches associated with the database connection.)^
+** ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_USED is always 0.
+**
+** [[SQLITE_DBSTATUS_CACHE_USED_SHARED]]
+** ^(<dt>SQLITE_DBSTATUS_CACHE_USED_SHARED</dt>
+** <dd>This parameter is similar to DBSTATUS_CACHE_USED, except that if a
+** pager cache is shared between two or more connections the bytes of heap
+** memory used by that pager cache is divided evenly between the attached
+** connections.)^ In other words, if none of the pager caches associated
+** with the database connection are shared, this request returns the same
+** value as DBSTATUS_CACHE_USED. Or, if one or more or the pager caches are
+** shared, the value returned by this call will be smaller than that returned
+** by DBSTATUS_CACHE_USED. ^The highwater mark associated with
+** SQLITE_DBSTATUS_CACHE_USED_SHARED is always 0.
+**
+** [[SQLITE_DBSTATUS_SCHEMA_USED]] ^(<dt>SQLITE_DBSTATUS_SCHEMA_USED</dt>
+** <dd>This parameter returns the approximate number of bytes of heap
+** memory used to store the schema for all databases associated
+** with the connection - main, temp, and any [ATTACH]-ed databases.)^
+** ^The full amount of memory used by the schemas is reported, even if the
+** schema memory is shared with other database connections due to
+** [shared cache mode] being enabled.
+** ^The highwater mark associated with SQLITE_DBSTATUS_SCHEMA_USED is always 0.
+**
+** [[SQLITE_DBSTATUS_STMT_USED]] ^(<dt>SQLITE_DBSTATUS_STMT_USED</dt>
+** <dd>This parameter returns the approximate number of bytes of heap
+** and lookaside memory used by all prepared statements associated with
+** the database connection.)^
+** ^The highwater mark associated with SQLITE_DBSTATUS_STMT_USED is always 0.
+** </dd>
+**
+** [[SQLITE_DBSTATUS_CACHE_HIT]] ^(<dt>SQLITE_DBSTATUS_CACHE_HIT</dt>
+** <dd>This parameter returns the number of pager cache hits that have
+** occurred.)^ ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_HIT
+** is always 0.
+** </dd>
+**
+** [[SQLITE_DBSTATUS_CACHE_MISS]] ^(<dt>SQLITE_DBSTATUS_CACHE_MISS</dt>
+** <dd>This parameter returns the number of pager cache misses that have
+** occurred.)^ ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_MISS
+** is always 0.
+** </dd>
+**
+** [[SQLITE_DBSTATUS_CACHE_WRITE]] ^(<dt>SQLITE_DBSTATUS_CACHE_WRITE</dt>
+** <dd>This parameter returns the number of dirty cache entries that have
+** been written to disk. Specifically, the number of pages written to the
+** wal file in wal mode databases, or the number of pages written to the
+** database file in rollback mode databases. Any pages written as part of
+** transaction rollback or database recovery operations are not included.
+** If an IO or other error occurs while writing a page to disk, the effect
+** on subsequent SQLITE_DBSTATUS_CACHE_WRITE requests is undefined.)^ ^The
+** highwater mark associated with SQLITE_DBSTATUS_CACHE_WRITE is always 0.
+** </dd>
+**
+** [[SQLITE_DBSTATUS_CACHE_SPILL]] ^(<dt>SQLITE_DBSTATUS_CACHE_SPILL</dt>
+** <dd>This parameter returns the number of dirty cache entries that have
+** been written to disk in the middle of a transaction due to the page
+** cache overflowing. Transactions are more efficient if they are written
+** to disk all at once. When pages spill mid-transaction, that introduces
+** additional overhead. This parameter can be used help identify
+** inefficiencies that can be resolved by increasing the cache size.
+** </dd>
+**
+** [[SQLITE_DBSTATUS_DEFERRED_FKS]] ^(<dt>SQLITE_DBSTATUS_DEFERRED_FKS</dt>
+** <dd>This parameter returns zero for the current value if and only if
+** all foreign key constraints (deferred or immediate) have been
+** resolved.)^ ^The highwater mark is always 0.
+** </dd>
+** </dl>
+*/
+#define SQLITE_DBSTATUS_LOOKASIDE_USED 0
+#define SQLITE_DBSTATUS_CACHE_USED 1
+#define SQLITE_DBSTATUS_SCHEMA_USED 2
+#define SQLITE_DBSTATUS_STMT_USED 3
+#define SQLITE_DBSTATUS_LOOKASIDE_HIT 4
+#define SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE 5
+#define SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL 6
+#define SQLITE_DBSTATUS_CACHE_HIT 7
+#define SQLITE_DBSTATUS_CACHE_MISS 8
+#define SQLITE_DBSTATUS_CACHE_WRITE 9
+#define SQLITE_DBSTATUS_DEFERRED_FKS 10
+#define SQLITE_DBSTATUS_CACHE_USED_SHARED 11
+#define SQLITE_DBSTATUS_CACHE_SPILL 12
+#define SQLITE_DBSTATUS_MAX 12 /* Largest defined DBSTATUS */
+
+
+/*
+** CAPI3REF: Prepared Statement Status
+** METHOD: sqlite3_stmt
+**
+** ^(Each prepared statement maintains various
+** [SQLITE_STMTSTATUS counters] that measure the number
+** of times it has performed specific operations.)^ These counters can
+** be used to monitor the performance characteristics of the prepared
+** statements. For example, if the number of table steps greatly exceeds
+** the number of table searches or result rows, that would tend to indicate
+** that the prepared statement is using a full table scan rather than
+** an index.
+**
+** ^(This interface is used to retrieve and reset counter values from
+** a [prepared statement]. The first argument is the prepared statement
+** object to be interrogated. The second argument
+** is an integer code for a specific [SQLITE_STMTSTATUS counter]
+** to be interrogated.)^
+** ^The current value of the requested counter is returned.
+** ^If the resetFlg is true, then the counter is reset to zero after this
+** interface call returns.
+**
+** See also: [sqlite3_status()] and [sqlite3_db_status()].
+*/
+SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
+
+/*
+** CAPI3REF: Status Parameters for prepared statements
+** KEYWORDS: {SQLITE_STMTSTATUS counter} {SQLITE_STMTSTATUS counters}
+**
+** These preprocessor macros define integer codes that name counter
+** values associated with the [sqlite3_stmt_status()] interface.
+** The meanings of the various counters are as follows:
+**
+** <dl>
+** [[SQLITE_STMTSTATUS_FULLSCAN_STEP]] <dt>SQLITE_STMTSTATUS_FULLSCAN_STEP</dt>
+** <dd>^This is the number of times that SQLite has stepped forward in
+** a table as part of a full table scan. Large numbers for this counter
+** may indicate opportunities for performance improvement through
+** careful use of indices.</dd>
+**
+** [[SQLITE_STMTSTATUS_SORT]] <dt>SQLITE_STMTSTATUS_SORT</dt>
+** <dd>^This is the number of sort operations that have occurred.
+** A non-zero value in this counter may indicate an opportunity to
+** improvement performance through careful use of indices.</dd>
+**
+** [[SQLITE_STMTSTATUS_AUTOINDEX]] <dt>SQLITE_STMTSTATUS_AUTOINDEX</dt>
+** <dd>^This is the number of rows inserted into transient indices that
+** were created automatically in order to help joins run faster.
+** A non-zero value in this counter may indicate an opportunity to
+** improvement performance by adding permanent indices that do not
+** need to be reinitialized each time the statement is run.</dd>
+**
+** [[SQLITE_STMTSTATUS_VM_STEP]] <dt>SQLITE_STMTSTATUS_VM_STEP</dt>
+** <dd>^This is the number of virtual machine operations executed
+** by the prepared statement if that number is less than or equal
+** to 2147483647. The number of virtual machine operations can be
+** used as a proxy for the total work done by the prepared statement.
+** If the number of virtual machine operations exceeds 2147483647
+** then the value returned by this statement status code is undefined.
+**
+** [[SQLITE_STMTSTATUS_REPREPARE]] <dt>SQLITE_STMTSTATUS_REPREPARE</dt>
+** <dd>^This is the number of times that the prepare statement has been
+** automatically regenerated due to schema changes or changes to
+** [bound parameters] that might affect the query plan.
+**
+** [[SQLITE_STMTSTATUS_RUN]] <dt>SQLITE_STMTSTATUS_RUN</dt>
+** <dd>^This is the number of times that the prepared statement has
+** been run. A single "run" for the purposes of this counter is one
+** or more calls to [sqlite3_step()] followed by a call to [sqlite3_reset()].
+** The counter is incremented on the first [sqlite3_step()] call of each
+** cycle.
+**
+** [[SQLITE_STMTSTATUS_MEMUSED]] <dt>SQLITE_STMTSTATUS_MEMUSED</dt>
+** <dd>^This is the approximate number of bytes of heap memory
+** used to store the prepared statement. ^This value is not actually
+** a counter, and so the resetFlg parameter to sqlite3_stmt_status()
+** is ignored when the opcode is SQLITE_STMTSTATUS_MEMUSED.
+** </dd>
+** </dl>
+*/
+#define SQLITE_STMTSTATUS_FULLSCAN_STEP 1
+#define SQLITE_STMTSTATUS_SORT 2
+#define SQLITE_STMTSTATUS_AUTOINDEX 3
+#define SQLITE_STMTSTATUS_VM_STEP 4
+#define SQLITE_STMTSTATUS_REPREPARE 5
+#define SQLITE_STMTSTATUS_RUN 6
+#define SQLITE_STMTSTATUS_MEMUSED 99
+
+/*
+** CAPI3REF: Custom Page Cache Object
+**
+** The sqlite3_pcache type is opaque. It is implemented by
+** the pluggable module. The SQLite core has no knowledge of
+** its size or internal structure and never deals with the
+** sqlite3_pcache object except by holding and passing pointers
+** to the object.
+**
+** See [sqlite3_pcache_methods2] for additional information.
+*/
+typedef struct sqlite3_pcache sqlite3_pcache;
+
+/*
+** CAPI3REF: Custom Page Cache Object
+**
+** The sqlite3_pcache_page object represents a single page in the
+** page cache. The page cache will allocate instances of this
+** object. Various methods of the page cache use pointers to instances
+** of this object as parameters or as their return value.
+**
+** See [sqlite3_pcache_methods2] for additional information.
+*/
+typedef struct sqlite3_pcache_page sqlite3_pcache_page;
+struct sqlite3_pcache_page {
+ void *pBuf; /* The content of the page */
+ void *pExtra; /* Extra information associated with the page */
+};
+
+/*
+** CAPI3REF: Application Defined Page Cache.
+** KEYWORDS: {page cache}
+**
+** ^(The [sqlite3_config]([SQLITE_CONFIG_PCACHE2], ...) interface can
+** register an alternative page cache implementation by passing in an
+** instance of the sqlite3_pcache_methods2 structure.)^
+** In many applications, most of the heap memory allocated by
+** SQLite is used for the page cache.
+** By implementing a
+** custom page cache using this API, an application can better control
+** the amount of memory consumed by SQLite, the way in which
+** that memory is allocated and released, and the policies used to
+** determine exactly which parts of a database file are cached and for
+** how long.
+**
+** The alternative page cache mechanism is an
+** extreme measure that is only needed by the most demanding applications.
+** The built-in page cache is recommended for most uses.
+**
+** ^(The contents of the sqlite3_pcache_methods2 structure are copied to an
+** internal buffer by SQLite within the call to [sqlite3_config]. Hence
+** the application may discard the parameter after the call to
+** [sqlite3_config()] returns.)^
+**
+** [[the xInit() page cache method]]
+** ^(The xInit() method is called once for each effective
+** call to [sqlite3_initialize()])^
+** (usually only once during the lifetime of the process). ^(The xInit()
+** method is passed a copy of the sqlite3_pcache_methods2.pArg value.)^
+** The intent of the xInit() method is to set up global data structures
+** required by the custom page cache implementation.
+** ^(If the xInit() method is NULL, then the
+** built-in default page cache is used instead of the application defined
+** page cache.)^
+**
+** [[the xShutdown() page cache method]]
+** ^The xShutdown() method is called by [sqlite3_shutdown()].
+** It can be used to clean up
+** any outstanding resources before process shutdown, if required.
+** ^The xShutdown() method may be NULL.
+**
+** ^SQLite automatically serializes calls to the xInit method,
+** so the xInit method need not be threadsafe. ^The
+** xShutdown method is only called from [sqlite3_shutdown()] so it does
+** not need to be threadsafe either. All other methods must be threadsafe
+** in multithreaded applications.
+**
+** ^SQLite will never invoke xInit() more than once without an intervening
+** call to xShutdown().
+**
+** [[the xCreate() page cache methods]]
+** ^SQLite invokes the xCreate() method to construct a new cache instance.
+** SQLite will typically create one cache instance for each open database file,
+** though this is not guaranteed. ^The
+** first parameter, szPage, is the size in bytes of the pages that must
+** be allocated by the cache. ^szPage will always a power of two. ^The
+** second parameter szExtra is a number of bytes of extra storage
+** associated with each page cache entry. ^The szExtra parameter will
+** a number less than 250. SQLite will use the
+** extra szExtra bytes on each page to store metadata about the underlying
+** database page on disk. The value passed into szExtra depends
+** on the SQLite version, the target platform, and how SQLite was compiled.
+** ^The third argument to xCreate(), bPurgeable, is true if the cache being
+** created will be used to cache database pages of a file stored on disk, or
+** false if it is used for an in-memory database. The cache implementation
+** does not have to do anything special based with the value of bPurgeable;
+** it is purely advisory. ^On a cache where bPurgeable is false, SQLite will
+** never invoke xUnpin() except to deliberately delete a page.
+** ^In other words, calls to xUnpin() on a cache with bPurgeable set to
+** false will always have the "discard" flag set to true.
+** ^Hence, a cache created with bPurgeable false will
+** never contain any unpinned pages.
+**
+** [[the xCachesize() page cache method]]
+** ^(The xCachesize() method may be called at any time by SQLite to set the
+** suggested maximum cache-size (number of pages stored by) the cache
+** instance passed as the first argument. This is the value configured using
+** the SQLite "[PRAGMA cache_size]" command.)^ As with the bPurgeable
+** parameter, the implementation is not required to do anything with this
+** value; it is advisory only.
+**
+** [[the xPagecount() page cache methods]]
+** The xPagecount() method must return the number of pages currently
+** stored in the cache, both pinned and unpinned.
+**
+** [[the xFetch() page cache methods]]
+** The xFetch() method locates a page in the cache and returns a pointer to
+** an sqlite3_pcache_page object associated with that page, or a NULL pointer.
+** The pBuf element of the returned sqlite3_pcache_page object will be a
+** pointer to a buffer of szPage bytes used to store the content of a
+** single database page. The pExtra element of sqlite3_pcache_page will be
+** a pointer to the szExtra bytes of extra storage that SQLite has requested
+** for each entry in the page cache.
+**
+** The page to be fetched is determined by the key. ^The minimum key value
+** is 1. After it has been retrieved using xFetch, the page is considered
+** to be "pinned".
+**
+** If the requested page is already in the page cache, then the page cache
+** implementation must return a pointer to the page buffer with its content
+** intact. If the requested page is not already in the cache, then the
+** cache implementation should use the value of the createFlag
+** parameter to help it determined what action to take:
+**
+** <table border=1 width=85% align=center>
+** <tr><th> createFlag <th> Behavior when page is not already in cache
+** <tr><td> 0 <td> Do not allocate a new page. Return NULL.
+** <tr><td> 1 <td> Allocate a new page if it easy and convenient to do so.
+** Otherwise return NULL.
+** <tr><td> 2 <td> Make every effort to allocate a new page. Only return
+** NULL if allocating a new page is effectively impossible.
+** </table>
+**
+** ^(SQLite will normally invoke xFetch() with a createFlag of 0 or 1. SQLite
+** will only use a createFlag of 2 after a prior call with a createFlag of 1
+** failed.)^ In between the xFetch() calls, SQLite may
+** attempt to unpin one or more cache pages by spilling the content of
+** pinned pages to disk and synching the operating system disk cache.
+**
+** [[the xUnpin() page cache method]]
+** ^xUnpin() is called by SQLite with a pointer to a currently pinned page
+** as its second argument. If the third parameter, discard, is non-zero,
+** then the page must be evicted from the cache.
+** ^If the discard parameter is
+** zero, then the page may be discarded or retained at the discretion of
+** page cache implementation. ^The page cache implementation
+** may choose to evict unpinned pages at any time.
+**
+** The cache must not perform any reference counting. A single
+** call to xUnpin() unpins the page regardless of the number of prior calls
+** to xFetch().
+**
+** [[the xRekey() page cache methods]]
+** The xRekey() method is used to change the key value associated with the
+** page passed as the second argument. If the cache
+** previously contains an entry associated with newKey, it must be
+** discarded. ^Any prior cache entry associated with newKey is guaranteed not
+** to be pinned.
+**
+** When SQLite calls the xTruncate() method, the cache must discard all
+** existing cache entries with page numbers (keys) greater than or equal
+** to the value of the iLimit parameter passed to xTruncate(). If any
+** of these pages are pinned, they are implicitly unpinned, meaning that
+** they can be safely discarded.
+**
+** [[the xDestroy() page cache method]]
+** ^The xDestroy() method is used to delete a cache allocated by xCreate().
+** All resources associated with the specified cache should be freed. ^After
+** calling the xDestroy() method, SQLite considers the [sqlite3_pcache*]
+** handle invalid, and will not use it with any other sqlite3_pcache_methods2
+** functions.
+**
+** [[the xShrink() page cache method]]
+** ^SQLite invokes the xShrink() method when it wants the page cache to
+** free up as much of heap memory as possible. The page cache implementation
+** is not obligated to free any memory, but well-behaved implementations should
+** do their best.
+*/
+typedef struct sqlite3_pcache_methods2 sqlite3_pcache_methods2;
+struct sqlite3_pcache_methods2 {
+ int iVersion;
+ void *pArg;
+ int (*xInit)(void*);
+ void (*xShutdown)(void*);
+ sqlite3_pcache *(*xCreate)(int szPage, int szExtra, int bPurgeable);
+ void (*xCachesize)(sqlite3_pcache*, int nCachesize);
+ int (*xPagecount)(sqlite3_pcache*);
+ sqlite3_pcache_page *(*xFetch)(sqlite3_pcache*, unsigned key, int createFlag);
+ void (*xUnpin)(sqlite3_pcache*, sqlite3_pcache_page*, int discard);
+ void (*xRekey)(sqlite3_pcache*, sqlite3_pcache_page*,
+ unsigned oldKey, unsigned newKey);
+ void (*xTruncate)(sqlite3_pcache*, unsigned iLimit);
+ void (*xDestroy)(sqlite3_pcache*);
+ void (*xShrink)(sqlite3_pcache*);
+};
+
+/*
+** This is the obsolete pcache_methods object that has now been replaced
+** by sqlite3_pcache_methods2. This object is not used by SQLite. It is
+** retained in the header file for backwards compatibility only.
+*/
+typedef struct sqlite3_pcache_methods sqlite3_pcache_methods;
+struct sqlite3_pcache_methods {
+ void *pArg;
+ int (*xInit)(void*);
+ void (*xShutdown)(void*);
+ sqlite3_pcache *(*xCreate)(int szPage, int bPurgeable);
+ void (*xCachesize)(sqlite3_pcache*, int nCachesize);
+ int (*xPagecount)(sqlite3_pcache*);
+ void *(*xFetch)(sqlite3_pcache*, unsigned key, int createFlag);
+ void (*xUnpin)(sqlite3_pcache*, void*, int discard);
+ void (*xRekey)(sqlite3_pcache*, void*, unsigned oldKey, unsigned newKey);
+ void (*xTruncate)(sqlite3_pcache*, unsigned iLimit);
+ void (*xDestroy)(sqlite3_pcache*);
+};
+
+
+/*
+** CAPI3REF: Online Backup Object
+**
+** The sqlite3_backup object records state information about an ongoing
+** online backup operation. ^The sqlite3_backup object is created by
+** a call to [sqlite3_backup_init()] and is destroyed by a call to
+** [sqlite3_backup_finish()].
+**
+** See Also: [Using the SQLite Online Backup API]
+*/
+typedef struct sqlite3_backup sqlite3_backup;
+
+/*
+** CAPI3REF: Online Backup API.
+**
+** The backup API copies the content of one database into another.
+** It is useful either for creating backups of databases or
+** for copying in-memory databases to or from persistent files.
+**
+** See Also: [Using the SQLite Online Backup API]
+**
+** ^SQLite holds a write transaction open on the destination database file
+** for the duration of the backup operation.
+** ^The source database is read-locked only while it is being read;
+** it is not locked continuously for the entire backup operation.
+** ^Thus, the backup may be performed on a live source database without
+** preventing other database connections from
+** reading or writing to the source database while the backup is underway.
+**
+** ^(To perform a backup operation:
+** <ol>
+** <li><b>sqlite3_backup_init()</b> is called once to initialize the
+** backup,
+** <li><b>sqlite3_backup_step()</b> is called one or more times to transfer
+** the data between the two databases, and finally
+** <li><b>sqlite3_backup_finish()</b> is called to release all resources
+** associated with the backup operation.
+** </ol>)^
+** There should be exactly one call to sqlite3_backup_finish() for each
+** successful call to sqlite3_backup_init().
+**
+** [[sqlite3_backup_init()]] <b>sqlite3_backup_init()</b>
+**
+** ^The D and N arguments to sqlite3_backup_init(D,N,S,M) are the
+** [database connection] associated with the destination database
+** and the database name, respectively.
+** ^The database name is "main" for the main database, "temp" for the
+** temporary database, or the name specified after the AS keyword in
+** an [ATTACH] statement for an attached database.
+** ^The S and M arguments passed to
+** sqlite3_backup_init(D,N,S,M) identify the [database connection]
+** and database name of the source database, respectively.
+** ^The source and destination [database connections] (parameters S and D)
+** must be different or else sqlite3_backup_init(D,N,S,M) will fail with
+** an error.
+**
+** ^A call to sqlite3_backup_init() will fail, returning NULL, if
+** there is already a read or read-write transaction open on the
+** destination database.
+**
+** ^If an error occurs within sqlite3_backup_init(D,N,S,M), then NULL is
+** returned and an error code and error message are stored in the
+** destination [database connection] D.
+** ^The error code and message for the failed call to sqlite3_backup_init()
+** can be retrieved using the [sqlite3_errcode()], [sqlite3_errmsg()], and/or
+** [sqlite3_errmsg16()] functions.
+** ^A successful call to sqlite3_backup_init() returns a pointer to an
+** [sqlite3_backup] object.
+** ^The [sqlite3_backup] object may be used with the sqlite3_backup_step() and
+** sqlite3_backup_finish() functions to perform the specified backup
+** operation.
+**
+** [[sqlite3_backup_step()]] <b>sqlite3_backup_step()</b>
+**
+** ^Function sqlite3_backup_step(B,N) will copy up to N pages between
+** the source and destination databases specified by [sqlite3_backup] object B.
+** ^If N is negative, all remaining source pages are copied.
+** ^If sqlite3_backup_step(B,N) successfully copies N pages and there
+** are still more pages to be copied, then the function returns [SQLITE_OK].
+** ^If sqlite3_backup_step(B,N) successfully finishes copying all pages
+** from source to destination, then it returns [SQLITE_DONE].
+** ^If an error occurs while running sqlite3_backup_step(B,N),
+** then an [error code] is returned. ^As well as [SQLITE_OK] and
+** [SQLITE_DONE], a call to sqlite3_backup_step() may return [SQLITE_READONLY],
+** [SQLITE_NOMEM], [SQLITE_BUSY], [SQLITE_LOCKED], or an
+** [SQLITE_IOERR_ACCESS | SQLITE_IOERR_XXX] extended error code.
+**
+** ^(The sqlite3_backup_step() might return [SQLITE_READONLY] if
+** <ol>
+** <li> the destination database was opened read-only, or
+** <li> the destination database is using write-ahead-log journaling
+** and the destination and source page sizes differ, or
+** <li> the destination database is an in-memory database and the
+** destination and source page sizes differ.
+** </ol>)^
+**
+** ^If sqlite3_backup_step() cannot obtain a required file-system lock, then
+** the [sqlite3_busy_handler | busy-handler function]
+** is invoked (if one is specified). ^If the
+** busy-handler returns non-zero before the lock is available, then
+** [SQLITE_BUSY] is returned to the caller. ^In this case the call to
+** sqlite3_backup_step() can be retried later. ^If the source
+** [database connection]
+** is being used to write to the source database when sqlite3_backup_step()
+** is called, then [SQLITE_LOCKED] is returned immediately. ^Again, in this
+** case the call to sqlite3_backup_step() can be retried later on. ^(If
+** [SQLITE_IOERR_ACCESS | SQLITE_IOERR_XXX], [SQLITE_NOMEM], or
+** [SQLITE_READONLY] is returned, then
+** there is no point in retrying the call to sqlite3_backup_step(). These
+** errors are considered fatal.)^ The application must accept
+** that the backup operation has failed and pass the backup operation handle
+** to the sqlite3_backup_finish() to release associated resources.
+**
+** ^The first call to sqlite3_backup_step() obtains an exclusive lock
+** on the destination file. ^The exclusive lock is not released until either
+** sqlite3_backup_finish() is called or the backup operation is complete
+** and sqlite3_backup_step() returns [SQLITE_DONE]. ^Every call to
+** sqlite3_backup_step() obtains a [shared lock] on the source database that
+** lasts for the duration of the sqlite3_backup_step() call.
+** ^Because the source database is not locked between calls to
+** sqlite3_backup_step(), the source database may be modified mid-way
+** through the backup process. ^If the source database is modified by an
+** external process or via a database connection other than the one being
+** used by the backup operation, then the backup will be automatically
+** restarted by the next call to sqlite3_backup_step(). ^If the source
+** database is modified by the using the same database connection as is used
+** by the backup operation, then the backup database is automatically
+** updated at the same time.
+**
+** [[sqlite3_backup_finish()]] <b>sqlite3_backup_finish()</b>
+**
+** When sqlite3_backup_step() has returned [SQLITE_DONE], or when the
+** application wishes to abandon the backup operation, the application
+** should destroy the [sqlite3_backup] by passing it to sqlite3_backup_finish().
+** ^The sqlite3_backup_finish() interfaces releases all
+** resources associated with the [sqlite3_backup] object.
+** ^If sqlite3_backup_step() has not yet returned [SQLITE_DONE], then any
+** active write-transaction on the destination database is rolled back.
+** The [sqlite3_backup] object is invalid
+** and may not be used following a call to sqlite3_backup_finish().
+**
+** ^The value returned by sqlite3_backup_finish is [SQLITE_OK] if no
+** sqlite3_backup_step() errors occurred, regardless or whether or not
+** sqlite3_backup_step() completed.
+** ^If an out-of-memory condition or IO error occurred during any prior
+** sqlite3_backup_step() call on the same [sqlite3_backup] object, then
+** sqlite3_backup_finish() returns the corresponding [error code].
+**
+** ^A return of [SQLITE_BUSY] or [SQLITE_LOCKED] from sqlite3_backup_step()
+** is not a permanent error and does not affect the return value of
+** sqlite3_backup_finish().
+**
+** [[sqlite3_backup_remaining()]] [[sqlite3_backup_pagecount()]]
+** <b>sqlite3_backup_remaining() and sqlite3_backup_pagecount()</b>
+**
+** ^The sqlite3_backup_remaining() routine returns the number of pages still
+** to be backed up at the conclusion of the most recent sqlite3_backup_step().
+** ^The sqlite3_backup_pagecount() routine returns the total number of pages
+** in the source database at the conclusion of the most recent
+** sqlite3_backup_step().
+** ^(The values returned by these functions are only updated by
+** sqlite3_backup_step(). If the source database is modified in a way that
+** changes the size of the source database or the number of pages remaining,
+** those changes are not reflected in the output of sqlite3_backup_pagecount()
+** and sqlite3_backup_remaining() until after the next
+** sqlite3_backup_step().)^
+**
+** <b>Concurrent Usage of Database Handles</b>
+**
+** ^The source [database connection] may be used by the application for other
+** purposes while a backup operation is underway or being initialized.
+** ^If SQLite is compiled and configured to support threadsafe database
+** connections, then the source database connection may be used concurrently
+** from within other threads.
+**
+** However, the application must guarantee that the destination
+** [database connection] is not passed to any other API (by any thread) after
+** sqlite3_backup_init() is called and before the corresponding call to
+** sqlite3_backup_finish(). SQLite does not currently check to see
+** if the application incorrectly accesses the destination [database connection]
+** and so no error code is reported, but the operations may malfunction
+** nevertheless. Use of the destination database connection while a
+** backup is in progress might also also cause a mutex deadlock.
+**
+** If running in [shared cache mode], the application must
+** guarantee that the shared cache used by the destination database
+** is not accessed while the backup is running. In practice this means
+** that the application must guarantee that the disk file being
+** backed up to is not accessed by any connection within the process,
+** not just the specific connection that was passed to sqlite3_backup_init().
+**
+** The [sqlite3_backup] object itself is partially threadsafe. Multiple
+** threads may safely make multiple concurrent calls to sqlite3_backup_step().
+** However, the sqlite3_backup_remaining() and sqlite3_backup_pagecount()
+** APIs are not strictly speaking threadsafe. If they are invoked at the
+** same time as another thread is invoking sqlite3_backup_step() it is
+** possible that they return invalid values.
+*/
+SQLITE_API sqlite3_backup *sqlite3_backup_init(
+ sqlite3 *pDest, /* Destination database handle */
+ const char *zDestName, /* Destination database name */
+ sqlite3 *pSource, /* Source database handle */
+ const char *zSourceName /* Source database name */
+);
+SQLITE_API int sqlite3_backup_step(sqlite3_backup *p, int nPage);
+SQLITE_API int sqlite3_backup_finish(sqlite3_backup *p);
+SQLITE_API int sqlite3_backup_remaining(sqlite3_backup *p);
+SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p);
+
+/*
+** CAPI3REF: Unlock Notification
+** METHOD: sqlite3
+**
+** ^When running in shared-cache mode, a database operation may fail with
+** an [SQLITE_LOCKED] error if the required locks on the shared-cache or
+** individual tables within the shared-cache cannot be obtained. See
+** [SQLite Shared-Cache Mode] for a description of shared-cache locking.
+** ^This API may be used to register a callback that SQLite will invoke
+** when the connection currently holding the required lock relinquishes it.
+** ^This API is only available if the library was compiled with the
+** [SQLITE_ENABLE_UNLOCK_NOTIFY] C-preprocessor symbol defined.
+**
+** See Also: [Using the SQLite Unlock Notification Feature].
+**
+** ^Shared-cache locks are released when a database connection concludes
+** its current transaction, either by committing it or rolling it back.
+**
+** ^When a connection (known as the blocked connection) fails to obtain a
+** shared-cache lock and SQLITE_LOCKED is returned to the caller, the
+** identity of the database connection (the blocking connection) that
+** has locked the required resource is stored internally. ^After an
+** application receives an SQLITE_LOCKED error, it may call the
+** sqlite3_unlock_notify() method with the blocked connection handle as
+** the first argument to register for a callback that will be invoked
+** when the blocking connections current transaction is concluded. ^The
+** callback is invoked from within the [sqlite3_step] or [sqlite3_close]
+** call that concludes the blocking connection's transaction.
+**
+** ^(If sqlite3_unlock_notify() is called in a multi-threaded application,
+** there is a chance that the blocking connection will have already
+** concluded its transaction by the time sqlite3_unlock_notify() is invoked.
+** If this happens, then the specified callback is invoked immediately,
+** from within the call to sqlite3_unlock_notify().)^
+**
+** ^If the blocked connection is attempting to obtain a write-lock on a
+** shared-cache table, and more than one other connection currently holds
+** a read-lock on the same table, then SQLite arbitrarily selects one of
+** the other connections to use as the blocking connection.
+**
+** ^(There may be at most one unlock-notify callback registered by a
+** blocked connection. If sqlite3_unlock_notify() is called when the
+** blocked connection already has a registered unlock-notify callback,
+** then the new callback replaces the old.)^ ^If sqlite3_unlock_notify() is
+** called with a NULL pointer as its second argument, then any existing
+** unlock-notify callback is canceled. ^The blocked connections
+** unlock-notify callback may also be canceled by closing the blocked
+** connection using [sqlite3_close()].
+**
+** The unlock-notify callback is not reentrant. If an application invokes
+** any sqlite3_xxx API functions from within an unlock-notify callback, a
+** crash or deadlock may be the result.
+**
+** ^Unless deadlock is detected (see below), sqlite3_unlock_notify() always
+** returns SQLITE_OK.
+**
+** <b>Callback Invocation Details</b>
+**
+** When an unlock-notify callback is registered, the application provides a
+** single void* pointer that is passed to the callback when it is invoked.
+** However, the signature of the callback function allows SQLite to pass
+** it an array of void* context pointers. The first argument passed to
+** an unlock-notify callback is a pointer to an array of void* pointers,
+** and the second is the number of entries in the array.
+**
+** When a blocking connection's transaction is concluded, there may be
+** more than one blocked connection that has registered for an unlock-notify
+** callback. ^If two or more such blocked connections have specified the
+** same callback function, then instead of invoking the callback function
+** multiple times, it is invoked once with the set of void* context pointers
+** specified by the blocked connections bundled together into an array.
+** This gives the application an opportunity to prioritize any actions
+** related to the set of unblocked database connections.
+**
+** <b>Deadlock Detection</b>
+**
+** Assuming that after registering for an unlock-notify callback a
+** database waits for the callback to be issued before taking any further
+** action (a reasonable assumption), then using this API may cause the
+** application to deadlock. For example, if connection X is waiting for
+** connection Y's transaction to be concluded, and similarly connection
+** Y is waiting on connection X's transaction, then neither connection
+** will proceed and the system may remain deadlocked indefinitely.
+**
+** To avoid this scenario, the sqlite3_unlock_notify() performs deadlock
+** detection. ^If a given call to sqlite3_unlock_notify() would put the
+** system in a deadlocked state, then SQLITE_LOCKED is returned and no
+** unlock-notify callback is registered. The system is said to be in
+** a deadlocked state if connection A has registered for an unlock-notify
+** callback on the conclusion of connection B's transaction, and connection
+** B has itself registered for an unlock-notify callback when connection
+** A's transaction is concluded. ^Indirect deadlock is also detected, so
+** the system is also considered to be deadlocked if connection B has
+** registered for an unlock-notify callback on the conclusion of connection
+** C's transaction, where connection C is waiting on connection A. ^Any
+** number of levels of indirection are allowed.
+**
+** <b>The "DROP TABLE" Exception</b>
+**
+** When a call to [sqlite3_step()] returns SQLITE_LOCKED, it is almost
+** always appropriate to call sqlite3_unlock_notify(). There is however,
+** one exception. When executing a "DROP TABLE" or "DROP INDEX" statement,
+** SQLite checks if there are any currently executing SELECT statements
+** that belong to the same connection. If there are, SQLITE_LOCKED is
+** returned. In this case there is no "blocking connection", so invoking
+** sqlite3_unlock_notify() results in the unlock-notify callback being
+** invoked immediately. If the application then re-attempts the "DROP TABLE"
+** or "DROP INDEX" query, an infinite loop might be the result.
+**
+** One way around this problem is to check the extended error code returned
+** by an sqlite3_step() call. ^(If there is a blocking connection, then the
+** extended error code is set to SQLITE_LOCKED_SHAREDCACHE. Otherwise, in
+** the special "DROP TABLE/INDEX" case, the extended error code is just
+** SQLITE_LOCKED.)^
+*/
+SQLITE_API int sqlite3_unlock_notify(
+ sqlite3 *pBlocked, /* Waiting connection */
+ void (*xNotify)(void **apArg, int nArg), /* Callback function to invoke */
+ void *pNotifyArg /* Argument to pass to xNotify */
+);
+
+
+/*
+** CAPI3REF: String Comparison
+**
+** ^The [sqlite3_stricmp()] and [sqlite3_strnicmp()] APIs allow applications
+** and extensions to compare the contents of two buffers containing UTF-8
+** strings in a case-independent fashion, using the same definition of "case
+** independence" that SQLite uses internally when comparing identifiers.
+*/
+SQLITE_API int sqlite3_stricmp(const char *, const char *);
+SQLITE_API int sqlite3_strnicmp(const char *, const char *, int);
+
+/*
+** CAPI3REF: String Globbing
+*
+** ^The [sqlite3_strglob(P,X)] interface returns zero if and only if
+** string X matches the [GLOB] pattern P.
+** ^The definition of [GLOB] pattern matching used in
+** [sqlite3_strglob(P,X)] is the same as for the "X GLOB P" operator in the
+** SQL dialect understood by SQLite. ^The [sqlite3_strglob(P,X)] function
+** is case sensitive.
+**
+** Note that this routine returns zero on a match and non-zero if the strings
+** do not match, the same as [sqlite3_stricmp()] and [sqlite3_strnicmp()].
+**
+** See also: [sqlite3_strlike()].
+*/
+SQLITE_API int sqlite3_strglob(const char *zGlob, const char *zStr);
+
+/*
+** CAPI3REF: String LIKE Matching
+*
+** ^The [sqlite3_strlike(P,X,E)] interface returns zero if and only if
+** string X matches the [LIKE] pattern P with escape character E.
+** ^The definition of [LIKE] pattern matching used in
+** [sqlite3_strlike(P,X,E)] is the same as for the "X LIKE P ESCAPE E"
+** operator in the SQL dialect understood by SQLite. ^For "X LIKE P" without
+** the ESCAPE clause, set the E parameter of [sqlite3_strlike(P,X,E)] to 0.
+** ^As with the LIKE operator, the [sqlite3_strlike(P,X,E)] function is case
+** insensitive - equivalent upper and lower case ASCII characters match
+** one another.
+**
+** ^The [sqlite3_strlike(P,X,E)] function matches Unicode characters, though
+** only ASCII characters are case folded.
+**
+** Note that this routine returns zero on a match and non-zero if the strings
+** do not match, the same as [sqlite3_stricmp()] and [sqlite3_strnicmp()].
+**
+** See also: [sqlite3_strglob()].
+*/
+SQLITE_API int sqlite3_strlike(const char *zGlob, const char *zStr, unsigned int cEsc);
+
+/*
+** CAPI3REF: Error Logging Interface
+**
+** ^The [sqlite3_log()] interface writes a message into the [error log]
+** established by the [SQLITE_CONFIG_LOG] option to [sqlite3_config()].
+** ^If logging is enabled, the zFormat string and subsequent arguments are
+** used with [sqlite3_snprintf()] to generate the final output string.
+**
+** The sqlite3_log() interface is intended for use by extensions such as
+** virtual tables, collating functions, and SQL functions. While there is
+** nothing to prevent an application from calling sqlite3_log(), doing so
+** is considered bad form.
+**
+** The zFormat string must not be NULL.
+**
+** To avoid deadlocks and other threading problems, the sqlite3_log() routine
+** will not use dynamically allocated memory. The log message is stored in
+** a fixed-length buffer on the stack. If the log message is longer than
+** a few hundred characters, it will be truncated to the length of the
+** buffer.
+*/
+SQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...);
+
+/*
+** CAPI3REF: Write-Ahead Log Commit Hook
+** METHOD: sqlite3
+**
+** ^The [sqlite3_wal_hook()] function is used to register a callback that
+** is invoked each time data is committed to a database in wal mode.
+**
+** ^(The callback is invoked by SQLite after the commit has taken place and
+** the associated write-lock on the database released)^, so the implementation
+** may read, write or [checkpoint] the database as required.
+**
+** ^The first parameter passed to the callback function when it is invoked
+** is a copy of the third parameter passed to sqlite3_wal_hook() when
+** registering the callback. ^The second is a copy of the database handle.
+** ^The third parameter is the name of the database that was written to -
+** either "main" or the name of an [ATTACH]-ed database. ^The fourth parameter
+** is the number of pages currently in the write-ahead log file,
+** including those that were just committed.
+**
+** The callback function should normally return [SQLITE_OK]. ^If an error
+** code is returned, that error will propagate back up through the
+** SQLite code base to cause the statement that provoked the callback
+** to report an error, though the commit will have still occurred. If the
+** callback returns [SQLITE_ROW] or [SQLITE_DONE], or if it returns a value
+** that does not correspond to any valid SQLite error code, the results
+** are undefined.
+**
+** A single database handle may have at most a single write-ahead log callback
+** registered at one time. ^Calling [sqlite3_wal_hook()] replaces any
+** previously registered write-ahead log callback. ^Note that the
+** [sqlite3_wal_autocheckpoint()] interface and the
+** [wal_autocheckpoint pragma] both invoke [sqlite3_wal_hook()] and will
+** overwrite any prior [sqlite3_wal_hook()] settings.
+*/
+SQLITE_API void *sqlite3_wal_hook(
+ sqlite3*,
+ int(*)(void *,sqlite3*,const char*,int),
+ void*
+);
+
+/*
+** CAPI3REF: Configure an auto-checkpoint
+** METHOD: sqlite3
+**
+** ^The [sqlite3_wal_autocheckpoint(D,N)] is a wrapper around
+** [sqlite3_wal_hook()] that causes any database on [database connection] D
+** to automatically [checkpoint]
+** after committing a transaction if there are N or
+** more frames in the [write-ahead log] file. ^Passing zero or
+** a negative value as the nFrame parameter disables automatic
+** checkpoints entirely.
+**
+** ^The callback registered by this function replaces any existing callback
+** registered using [sqlite3_wal_hook()]. ^Likewise, registering a callback
+** using [sqlite3_wal_hook()] disables the automatic checkpoint mechanism
+** configured by this function.
+**
+** ^The [wal_autocheckpoint pragma] can be used to invoke this interface
+** from SQL.
+**
+** ^Checkpoints initiated by this mechanism are
+** [sqlite3_wal_checkpoint_v2|PASSIVE].
+**
+** ^Every new [database connection] defaults to having the auto-checkpoint
+** enabled with a threshold of 1000 or [SQLITE_DEFAULT_WAL_AUTOCHECKPOINT]
+** pages. The use of this interface
+** is only necessary if the default setting is found to be suboptimal
+** for a particular application.
+*/
+SQLITE_API int sqlite3_wal_autocheckpoint(sqlite3 *db, int N);
+
+/*
+** CAPI3REF: Checkpoint a database
+** METHOD: sqlite3
+**
+** ^(The sqlite3_wal_checkpoint(D,X) is equivalent to
+** [sqlite3_wal_checkpoint_v2](D,X,[SQLITE_CHECKPOINT_PASSIVE],0,0).)^
+**
+** In brief, sqlite3_wal_checkpoint(D,X) causes the content in the
+** [write-ahead log] for database X on [database connection] D to be
+** transferred into the database file and for the write-ahead log to
+** be reset. See the [checkpointing] documentation for addition
+** information.
+**
+** This interface used to be the only way to cause a checkpoint to
+** occur. But then the newer and more powerful [sqlite3_wal_checkpoint_v2()]
+** interface was added. This interface is retained for backwards
+** compatibility and as a convenience for applications that need to manually
+** start a callback but which do not need the full power (and corresponding
+** complication) of [sqlite3_wal_checkpoint_v2()].
+*/
+SQLITE_API int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb);
+
+/*
+** CAPI3REF: Checkpoint a database
+** METHOD: sqlite3
+**
+** ^(The sqlite3_wal_checkpoint_v2(D,X,M,L,C) interface runs a checkpoint
+** operation on database X of [database connection] D in mode M. Status
+** information is written back into integers pointed to by L and C.)^
+** ^(The M parameter must be a valid [checkpoint mode]:)^
+**
+** <dl>
+** <dt>SQLITE_CHECKPOINT_PASSIVE<dd>
+** ^Checkpoint as many frames as possible without waiting for any database
+** readers or writers to finish, then sync the database file if all frames
+** in the log were checkpointed. ^The [busy-handler callback]
+** is never invoked in the SQLITE_CHECKPOINT_PASSIVE mode.
+** ^On the other hand, passive mode might leave the checkpoint unfinished
+** if there are concurrent readers or writers.
+**
+** <dt>SQLITE_CHECKPOINT_FULL<dd>
+** ^This mode blocks (it invokes the
+** [sqlite3_busy_handler|busy-handler callback]) until there is no
+** database writer and all readers are reading from the most recent database
+** snapshot. ^It then checkpoints all frames in the log file and syncs the
+** database file. ^This mode blocks new database writers while it is pending,
+** but new database readers are allowed to continue unimpeded.
+**
+** <dt>SQLITE_CHECKPOINT_RESTART<dd>
+** ^This mode works the same way as SQLITE_CHECKPOINT_FULL with the addition
+** that after checkpointing the log file it blocks (calls the
+** [busy-handler callback])
+** until all readers are reading from the database file only. ^This ensures
+** that the next writer will restart the log file from the beginning.
+** ^Like SQLITE_CHECKPOINT_FULL, this mode blocks new
+** database writer attempts while it is pending, but does not impede readers.
+**
+** <dt>SQLITE_CHECKPOINT_TRUNCATE<dd>
+** ^This mode works the same way as SQLITE_CHECKPOINT_RESTART with the
+** addition that it also truncates the log file to zero bytes just prior
+** to a successful return.
+** </dl>
+**
+** ^If pnLog is not NULL, then *pnLog is set to the total number of frames in
+** the log file or to -1 if the checkpoint could not run because
+** of an error or because the database is not in [WAL mode]. ^If pnCkpt is not
+** NULL,then *pnCkpt is set to the total number of checkpointed frames in the
+** log file (including any that were already checkpointed before the function
+** was called) or to -1 if the checkpoint could not run due to an error or
+** because the database is not in WAL mode. ^Note that upon successful
+** completion of an SQLITE_CHECKPOINT_TRUNCATE, the log file will have been
+** truncated to zero bytes and so both *pnLog and *pnCkpt will be set to zero.
+**
+** ^All calls obtain an exclusive "checkpoint" lock on the database file. ^If
+** any other process is running a checkpoint operation at the same time, the
+** lock cannot be obtained and SQLITE_BUSY is returned. ^Even if there is a
+** busy-handler configured, it will not be invoked in this case.
+**
+** ^The SQLITE_CHECKPOINT_FULL, RESTART and TRUNCATE modes also obtain the
+** exclusive "writer" lock on the database file. ^If the writer lock cannot be
+** obtained immediately, and a busy-handler is configured, it is invoked and
+** the writer lock retried until either the busy-handler returns 0 or the lock
+** is successfully obtained. ^The busy-handler is also invoked while waiting for
+** database readers as described above. ^If the busy-handler returns 0 before
+** the writer lock is obtained or while waiting for database readers, the
+** checkpoint operation proceeds from that point in the same way as
+** SQLITE_CHECKPOINT_PASSIVE - checkpointing as many frames as possible
+** without blocking any further. ^SQLITE_BUSY is returned in this case.
+**
+** ^If parameter zDb is NULL or points to a zero length string, then the
+** specified operation is attempted on all WAL databases [attached] to
+** [database connection] db. In this case the
+** values written to output parameters *pnLog and *pnCkpt are undefined. ^If
+** an SQLITE_BUSY error is encountered when processing one or more of the
+** attached WAL databases, the operation is still attempted on any remaining
+** attached databases and SQLITE_BUSY is returned at the end. ^If any other
+** error occurs while processing an attached database, processing is abandoned
+** and the error code is returned to the caller immediately. ^If no error
+** (SQLITE_BUSY or otherwise) is encountered while processing the attached
+** databases, SQLITE_OK is returned.
+**
+** ^If database zDb is the name of an attached database that is not in WAL
+** mode, SQLITE_OK is returned and both *pnLog and *pnCkpt set to -1. ^If
+** zDb is not NULL (or a zero length string) and is not the name of any
+** attached database, SQLITE_ERROR is returned to the caller.
+**
+** ^Unless it returns SQLITE_MISUSE,
+** the sqlite3_wal_checkpoint_v2() interface
+** sets the error information that is queried by
+** [sqlite3_errcode()] and [sqlite3_errmsg()].
+**
+** ^The [PRAGMA wal_checkpoint] command can be used to invoke this interface
+** from SQL.
+*/
+SQLITE_API int sqlite3_wal_checkpoint_v2(
+ sqlite3 *db, /* Database handle */
+ const char *zDb, /* Name of attached database (or NULL) */
+ int eMode, /* SQLITE_CHECKPOINT_* value */
+ int *pnLog, /* OUT: Size of WAL log in frames */
+ int *pnCkpt /* OUT: Total number of frames checkpointed */
+);
+
+/*
+** CAPI3REF: Checkpoint Mode Values
+** KEYWORDS: {checkpoint mode}
+**
+** These constants define all valid values for the "checkpoint mode" passed
+** as the third parameter to the [sqlite3_wal_checkpoint_v2()] interface.
+** See the [sqlite3_wal_checkpoint_v2()] documentation for details on the
+** meaning of each of these checkpoint modes.
+*/
+#define SQLITE_CHECKPOINT_PASSIVE 0 /* Do as much as possible w/o blocking */
+#define SQLITE_CHECKPOINT_FULL 1 /* Wait for writers, then checkpoint */
+#define SQLITE_CHECKPOINT_RESTART 2 /* Like FULL but wait for for readers */
+#define SQLITE_CHECKPOINT_TRUNCATE 3 /* Like RESTART but also truncate WAL */
+
+/*
+** CAPI3REF: Virtual Table Interface Configuration
+**
+** This function may be called by either the [xConnect] or [xCreate] method
+** of a [virtual table] implementation to configure
+** various facets of the virtual table interface.
+**
+** If this interface is invoked outside the context of an xConnect or
+** xCreate virtual table method then the behavior is undefined.
+**
+** In the call sqlite3_vtab_config(D,C,...) the D parameter is the
+** [database connection] in which the virtual table is being created and
+** which is passed in as the first argument to the [xConnect] or [xCreate]
+** method that is invoking sqlite3_vtab_config(). The C parameter is one
+** of the [virtual table configuration options]. The presence and meaning
+** of parameters after C depend on which [virtual table configuration option]
+** is used.
+*/
+SQLITE_API int sqlite3_vtab_config(sqlite3*, int op, ...);
+
+/*
+** CAPI3REF: Virtual Table Configuration Options
+** KEYWORDS: {virtual table configuration options}
+** KEYWORDS: {virtual table configuration option}
+**
+** These macros define the various options to the
+** [sqlite3_vtab_config()] interface that [virtual table] implementations
+** can use to customize and optimize their behavior.
+**
+** <dl>
+** [[SQLITE_VTAB_CONSTRAINT_SUPPORT]]
+** <dt>SQLITE_VTAB_CONSTRAINT_SUPPORT</dt>
+** <dd>Calls of the form
+** [sqlite3_vtab_config](db,SQLITE_VTAB_CONSTRAINT_SUPPORT,X) are supported,
+** where X is an integer. If X is zero, then the [virtual table] whose
+** [xCreate] or [xConnect] method invoked [sqlite3_vtab_config()] does not
+** support constraints. In this configuration (which is the default) if
+** a call to the [xUpdate] method returns [SQLITE_CONSTRAINT], then the entire
+** statement is rolled back as if [ON CONFLICT | OR ABORT] had been
+** specified as part of the users SQL statement, regardless of the actual
+** ON CONFLICT mode specified.
+**
+** If X is non-zero, then the virtual table implementation guarantees
+** that if [xUpdate] returns [SQLITE_CONSTRAINT], it will do so before
+** any modifications to internal or persistent data structures have been made.
+** If the [ON CONFLICT] mode is ABORT, FAIL, IGNORE or ROLLBACK, SQLite
+** is able to roll back a statement or database transaction, and abandon
+** or continue processing the current SQL statement as appropriate.
+** If the ON CONFLICT mode is REPLACE and the [xUpdate] method returns
+** [SQLITE_CONSTRAINT], SQLite handles this as if the ON CONFLICT mode
+** had been ABORT.
+**
+** Virtual table implementations that are required to handle OR REPLACE
+** must do so within the [xUpdate] method. If a call to the
+** [sqlite3_vtab_on_conflict()] function indicates that the current ON
+** CONFLICT policy is REPLACE, the virtual table implementation should
+** silently replace the appropriate rows within the xUpdate callback and
+** return SQLITE_OK. Or, if this is not possible, it may return
+** SQLITE_CONSTRAINT, in which case SQLite falls back to OR ABORT
+** constraint handling.
+** </dd>
+**
+** [[SQLITE_VTAB_DIRECTONLY]]<dt>SQLITE_VTAB_DIRECTONLY</dt>
+** <dd>Calls of the form
+** [sqlite3_vtab_config](db,SQLITE_VTAB_DIRECTONLY) from within the
+** the [xConnect] or [xCreate] methods of a [virtual table] implmentation
+** prohibits that virtual table from being used from within triggers and
+** views.
+** </dd>
+**
+** [[SQLITE_VTAB_INNOCUOUS]]<dt>SQLITE_VTAB_INNOCUOUS</dt>
+** <dd>Calls of the form
+** [sqlite3_vtab_config](db,SQLITE_VTAB_INNOCUOUS) from within the
+** the [xConnect] or [xCreate] methods of a [virtual table] implmentation
+** identify that virtual table as being safe to use from within triggers
+** and views. Conceptually, the SQLITE_VTAB_INNOCUOUS tag means that the
+** virtual table can do no serious harm even if it is controlled by a
+** malicious hacker. Developers should avoid setting the SQLITE_VTAB_INNOCUOUS
+** flag unless absolutely necessary.
+** </dd>
+** </dl>
+*/
+#define SQLITE_VTAB_CONSTRAINT_SUPPORT 1
+#define SQLITE_VTAB_INNOCUOUS 2
+#define SQLITE_VTAB_DIRECTONLY 3
+
+/*
+** CAPI3REF: Determine The Virtual Table Conflict Policy
+**
+** This function may only be called from within a call to the [xUpdate] method
+** of a [virtual table] implementation for an INSERT or UPDATE operation. ^The
+** value returned is one of [SQLITE_ROLLBACK], [SQLITE_IGNORE], [SQLITE_FAIL],
+** [SQLITE_ABORT], or [SQLITE_REPLACE], according to the [ON CONFLICT] mode
+** of the SQL statement that triggered the call to the [xUpdate] method of the
+** [virtual table].
+*/
+SQLITE_API int sqlite3_vtab_on_conflict(sqlite3 *);
+
+/*
+** CAPI3REF: Determine If Virtual Table Column Access Is For UPDATE
+**
+** If the sqlite3_vtab_nochange(X) routine is called within the [xColumn]
+** method of a [virtual table], then it might return true if the
+** column is being fetched as part of an UPDATE operation during which the
+** column value will not change. The virtual table implementation can use
+** this hint as permission to substitute a return value that is less
+** expensive to compute and that the corresponding
+** [xUpdate] method understands as a "no-change" value.
+**
+** If the [xColumn] method calls sqlite3_vtab_nochange() and finds that
+** the column is not changed by the UPDATE statement, then the xColumn
+** method can optionally return without setting a result, without calling
+** any of the [sqlite3_result_int|sqlite3_result_xxxxx() interfaces].
+** In that case, [sqlite3_value_nochange(X)] will return true for the
+** same column in the [xUpdate] method.
+**
+** The sqlite3_vtab_nochange() routine is an optimization. Virtual table
+** implementations should continue to give a correct answer even if the
+** sqlite3_vtab_nochange() interface were to always return false. In the
+** current implementation, the sqlite3_vtab_nochange() interface does always
+** returns false for the enhanced [UPDATE FROM] statement.
+*/
+SQLITE_API int sqlite3_vtab_nochange(sqlite3_context*);
+
+/*
+** CAPI3REF: Determine The Collation For a Virtual Table Constraint
+**
+** This function may only be called from within a call to the [xBestIndex]
+** method of a [virtual table].
+**
+** The first argument must be the sqlite3_index_info object that is the
+** first parameter to the xBestIndex() method. The second argument must be
+** an index into the aConstraint[] array belonging to the sqlite3_index_info
+** structure passed to xBestIndex. This function returns a pointer to a buffer
+** containing the name of the collation sequence for the corresponding
+** constraint.
+*/
+SQLITE_API SQLITE_EXPERIMENTAL const char *sqlite3_vtab_collation(sqlite3_index_info*,int);
+
+/*
+** CAPI3REF: Conflict resolution modes
+** KEYWORDS: {conflict resolution mode}
+**
+** These constants are returned by [sqlite3_vtab_on_conflict()] to
+** inform a [virtual table] implementation what the [ON CONFLICT] mode
+** is for the SQL statement being evaluated.
+**
+** Note that the [SQLITE_IGNORE] constant is also used as a potential
+** return value from the [sqlite3_set_authorizer()] callback and that
+** [SQLITE_ABORT] is also a [result code].
+*/
+#define SQLITE_ROLLBACK 1
+/* #define SQLITE_IGNORE 2 // Also used by sqlite3_authorizer() callback */
+#define SQLITE_FAIL 3
+/* #define SQLITE_ABORT 4 // Also an error code */
+#define SQLITE_REPLACE 5
+
+/*
+** CAPI3REF: Prepared Statement Scan Status Opcodes
+** KEYWORDS: {scanstatus options}
+**
+** The following constants can be used for the T parameter to the
+** [sqlite3_stmt_scanstatus(S,X,T,V)] interface. Each constant designates a
+** different metric for sqlite3_stmt_scanstatus() to return.
+**
+** When the value returned to V is a string, space to hold that string is
+** managed by the prepared statement S and will be automatically freed when
+** S is finalized.
+**
+** <dl>
+** [[SQLITE_SCANSTAT_NLOOP]] <dt>SQLITE_SCANSTAT_NLOOP</dt>
+** <dd>^The [sqlite3_int64] variable pointed to by the V parameter will be
+** set to the total number of times that the X-th loop has run.</dd>
+**
+** [[SQLITE_SCANSTAT_NVISIT]] <dt>SQLITE_SCANSTAT_NVISIT</dt>
+** <dd>^The [sqlite3_int64] variable pointed to by the V parameter will be set
+** to the total number of rows examined by all iterations of the X-th loop.</dd>
+**
+** [[SQLITE_SCANSTAT_EST]] <dt>SQLITE_SCANSTAT_EST</dt>
+** <dd>^The "double" variable pointed to by the V parameter will be set to the
+** query planner's estimate for the average number of rows output from each
+** iteration of the X-th loop. If the query planner's estimates was accurate,
+** then this value will approximate the quotient NVISIT/NLOOP and the
+** product of this value for all prior loops with the same SELECTID will
+** be the NLOOP value for the current loop.
+**
+** [[SQLITE_SCANSTAT_NAME]] <dt>SQLITE_SCANSTAT_NAME</dt>
+** <dd>^The "const char *" variable pointed to by the V parameter will be set
+** to a zero-terminated UTF-8 string containing the name of the index or table
+** used for the X-th loop.
+**
+** [[SQLITE_SCANSTAT_EXPLAIN]] <dt>SQLITE_SCANSTAT_EXPLAIN</dt>
+** <dd>^The "const char *" variable pointed to by the V parameter will be set
+** to a zero-terminated UTF-8 string containing the [EXPLAIN QUERY PLAN]
+** description for the X-th loop.
+**
+** [[SQLITE_SCANSTAT_SELECTID]] <dt>SQLITE_SCANSTAT_SELECT</dt>
+** <dd>^The "int" variable pointed to by the V parameter will be set to the
+** "select-id" for the X-th loop. The select-id identifies which query or
+** subquery the loop is part of. The main query has a select-id of zero.
+** The select-id is the same value as is output in the first column
+** of an [EXPLAIN QUERY PLAN] query.
+** </dl>
+*/
+#define SQLITE_SCANSTAT_NLOOP 0
+#define SQLITE_SCANSTAT_NVISIT 1
+#define SQLITE_SCANSTAT_EST 2
+#define SQLITE_SCANSTAT_NAME 3
+#define SQLITE_SCANSTAT_EXPLAIN 4
+#define SQLITE_SCANSTAT_SELECTID 5
+
+/*
+** CAPI3REF: Prepared Statement Scan Status
+** METHOD: sqlite3_stmt
+**
+** This interface returns information about the predicted and measured
+** performance for pStmt. Advanced applications can use this
+** interface to compare the predicted and the measured performance and
+** issue warnings and/or rerun [ANALYZE] if discrepancies are found.
+**
+** Since this interface is expected to be rarely used, it is only
+** available if SQLite is compiled using the [SQLITE_ENABLE_STMT_SCANSTATUS]
+** compile-time option.
+**
+** The "iScanStatusOp" parameter determines which status information to return.
+** The "iScanStatusOp" must be one of the [scanstatus options] or the behavior
+** of this interface is undefined.
+** ^The requested measurement is written into a variable pointed to by
+** the "pOut" parameter.
+** Parameter "idx" identifies the specific loop to retrieve statistics for.
+** Loops are numbered starting from zero. ^If idx is out of range - less than
+** zero or greater than or equal to the total number of loops used to implement
+** the statement - a non-zero value is returned and the variable that pOut
+** points to is unchanged.
+**
+** ^Statistics might not be available for all loops in all statements. ^In cases
+** where there exist loops with no available statistics, this function behaves
+** as if the loop did not exist - it returns non-zero and leave the variable
+** that pOut points to unchanged.
+**
+** See also: [sqlite3_stmt_scanstatus_reset()]
+*/
+SQLITE_API int sqlite3_stmt_scanstatus(
+ sqlite3_stmt *pStmt, /* Prepared statement for which info desired */
+ int idx, /* Index of loop to report on */
+ int iScanStatusOp, /* Information desired. SQLITE_SCANSTAT_* */
+ void *pOut /* Result written here */
+);
+
+/*
+** CAPI3REF: Zero Scan-Status Counters
+** METHOD: sqlite3_stmt
+**
+** ^Zero all [sqlite3_stmt_scanstatus()] related event counters.
+**
+** This API is only available if the library is built with pre-processor
+** symbol [SQLITE_ENABLE_STMT_SCANSTATUS] defined.
+*/
+SQLITE_API void sqlite3_stmt_scanstatus_reset(sqlite3_stmt*);
+
+/*
+** CAPI3REF: Flush caches to disk mid-transaction
+** METHOD: sqlite3
+**
+** ^If a write-transaction is open on [database connection] D when the
+** [sqlite3_db_cacheflush(D)] interface invoked, any dirty
+** pages in the pager-cache that are not currently in use are written out
+** to disk. A dirty page may be in use if a database cursor created by an
+** active SQL statement is reading from it, or if it is page 1 of a database
+** file (page 1 is always "in use"). ^The [sqlite3_db_cacheflush(D)]
+** interface flushes caches for all schemas - "main", "temp", and
+** any [attached] databases.
+**
+** ^If this function needs to obtain extra database locks before dirty pages
+** can be flushed to disk, it does so. ^If those locks cannot be obtained
+** immediately and there is a busy-handler callback configured, it is invoked
+** in the usual manner. ^If the required lock still cannot be obtained, then
+** the database is skipped and an attempt made to flush any dirty pages
+** belonging to the next (if any) database. ^If any databases are skipped
+** because locks cannot be obtained, but no other error occurs, this
+** function returns SQLITE_BUSY.
+**
+** ^If any other error occurs while flushing dirty pages to disk (for
+** example an IO error or out-of-memory condition), then processing is
+** abandoned and an SQLite [error code] is returned to the caller immediately.
+**
+** ^Otherwise, if no error occurs, [sqlite3_db_cacheflush()] returns SQLITE_OK.
+**
+** ^This function does not set the database handle error code or message
+** returned by the [sqlite3_errcode()] and [sqlite3_errmsg()] functions.
+*/
+SQLITE_API int sqlite3_db_cacheflush(sqlite3*);
+
+/*
+** CAPI3REF: The pre-update hook.
+** METHOD: sqlite3
+**
+** ^These interfaces are only available if SQLite is compiled using the
+** [SQLITE_ENABLE_PREUPDATE_HOOK] compile-time option.
+**
+** ^The [sqlite3_preupdate_hook()] interface registers a callback function
+** that is invoked prior to each [INSERT], [UPDATE], and [DELETE] operation
+** on a database table.
+** ^At most one preupdate hook may be registered at a time on a single
+** [database connection]; each call to [sqlite3_preupdate_hook()] overrides
+** the previous setting.
+** ^The preupdate hook is disabled by invoking [sqlite3_preupdate_hook()]
+** with a NULL pointer as the second parameter.
+** ^The third parameter to [sqlite3_preupdate_hook()] is passed through as
+** the first parameter to callbacks.
+**
+** ^The preupdate hook only fires for changes to real database tables; the
+** preupdate hook is not invoked for changes to [virtual tables] or to
+** system tables like sqlite_sequence or sqlite_stat1.
+**
+** ^The second parameter to the preupdate callback is a pointer to
+** the [database connection] that registered the preupdate hook.
+** ^The third parameter to the preupdate callback is one of the constants
+** [SQLITE_INSERT], [SQLITE_DELETE], or [SQLITE_UPDATE] to identify the
+** kind of update operation that is about to occur.
+** ^(The fourth parameter to the preupdate callback is the name of the
+** database within the database connection that is being modified. This
+** will be "main" for the main database or "temp" for TEMP tables or
+** the name given after the AS keyword in the [ATTACH] statement for attached
+** databases.)^
+** ^The fifth parameter to the preupdate callback is the name of the
+** table that is being modified.
+**
+** For an UPDATE or DELETE operation on a [rowid table], the sixth
+** parameter passed to the preupdate callback is the initial [rowid] of the
+** row being modified or deleted. For an INSERT operation on a rowid table,
+** or any operation on a WITHOUT ROWID table, the value of the sixth
+** parameter is undefined. For an INSERT or UPDATE on a rowid table the
+** seventh parameter is the final rowid value of the row being inserted
+** or updated. The value of the seventh parameter passed to the callback
+** function is not defined for operations on WITHOUT ROWID tables, or for
+** DELETE operations on rowid tables.
+**
+** The [sqlite3_preupdate_old()], [sqlite3_preupdate_new()],
+** [sqlite3_preupdate_count()], and [sqlite3_preupdate_depth()] interfaces
+** provide additional information about a preupdate event. These routines
+** may only be called from within a preupdate callback. Invoking any of
+** these routines from outside of a preupdate callback or with a
+** [database connection] pointer that is different from the one supplied
+** to the preupdate callback results in undefined and probably undesirable
+** behavior.
+**
+** ^The [sqlite3_preupdate_count(D)] interface returns the number of columns
+** in the row that is being inserted, updated, or deleted.
+**
+** ^The [sqlite3_preupdate_old(D,N,P)] interface writes into P a pointer to
+** a [protected sqlite3_value] that contains the value of the Nth column of
+** the table row before it is updated. The N parameter must be between 0
+** and one less than the number of columns or the behavior will be
+** undefined. This must only be used within SQLITE_UPDATE and SQLITE_DELETE
+** preupdate callbacks; if it is used by an SQLITE_INSERT callback then the
+** behavior is undefined. The [sqlite3_value] that P points to
+** will be destroyed when the preupdate callback returns.
+**
+** ^The [sqlite3_preupdate_new(D,N,P)] interface writes into P a pointer to
+** a [protected sqlite3_value] that contains the value of the Nth column of
+** the table row after it is updated. The N parameter must be between 0
+** and one less than the number of columns or the behavior will be
+** undefined. This must only be used within SQLITE_INSERT and SQLITE_UPDATE
+** preupdate callbacks; if it is used by an SQLITE_DELETE callback then the
+** behavior is undefined. The [sqlite3_value] that P points to
+** will be destroyed when the preupdate callback returns.
+**
+** ^The [sqlite3_preupdate_depth(D)] interface returns 0 if the preupdate
+** callback was invoked as a result of a direct insert, update, or delete
+** operation; or 1 for inserts, updates, or deletes invoked by top-level
+** triggers; or 2 for changes resulting from triggers called by top-level
+** triggers; and so forth.
+**
+** See also: [sqlite3_update_hook()]
+*/
+#if defined(SQLITE_ENABLE_PREUPDATE_HOOK)
+SQLITE_API void *sqlite3_preupdate_hook(
+ sqlite3 *db,
+ void(*xPreUpdate)(
+ void *pCtx, /* Copy of third arg to preupdate_hook() */
+ sqlite3 *db, /* Database handle */
+ int op, /* SQLITE_UPDATE, DELETE or INSERT */
+ char const *zDb, /* Database name */
+ char const *zName, /* Table name */
+ sqlite3_int64 iKey1, /* Rowid of row about to be deleted/updated */
+ sqlite3_int64 iKey2 /* New rowid value (for a rowid UPDATE) */
+ ),
+ void*
+);
+SQLITE_API int sqlite3_preupdate_old(sqlite3 *, int, sqlite3_value **);
+SQLITE_API int sqlite3_preupdate_count(sqlite3 *);
+SQLITE_API int sqlite3_preupdate_depth(sqlite3 *);
+SQLITE_API int sqlite3_preupdate_new(sqlite3 *, int, sqlite3_value **);
+#endif
+
+/*
+** CAPI3REF: Low-level system error code
+** METHOD: sqlite3
+**
+** ^Attempt to return the underlying operating system error code or error
+** number that caused the most recent I/O error or failure to open a file.
+** The return value is OS-dependent. For example, on unix systems, after
+** [sqlite3_open_v2()] returns [SQLITE_CANTOPEN], this interface could be
+** called to get back the underlying "errno" that caused the problem, such
+** as ENOSPC, EAUTH, EISDIR, and so forth.
+*/
+SQLITE_API int sqlite3_system_errno(sqlite3*);
+
+/*
+** CAPI3REF: Database Snapshot
+** KEYWORDS: {snapshot} {sqlite3_snapshot}
+**
+** An instance of the snapshot object records the state of a [WAL mode]
+** database for some specific point in history.
+**
+** In [WAL mode], multiple [database connections] that are open on the
+** same database file can each be reading a different historical version
+** of the database file. When a [database connection] begins a read
+** transaction, that connection sees an unchanging copy of the database
+** as it existed for the point in time when the transaction first started.
+** Subsequent changes to the database from other connections are not seen
+** by the reader until a new read transaction is started.
+**
+** The sqlite3_snapshot object records state information about an historical
+** version of the database file so that it is possible to later open a new read
+** transaction that sees that historical version of the database rather than
+** the most recent version.
+*/
+typedef struct sqlite3_snapshot {
+ unsigned char hidden[48];
+} sqlite3_snapshot;
+
+/*
+** CAPI3REF: Record A Database Snapshot
+** CONSTRUCTOR: sqlite3_snapshot
+**
+** ^The [sqlite3_snapshot_get(D,S,P)] interface attempts to make a
+** new [sqlite3_snapshot] object that records the current state of
+** schema S in database connection D. ^On success, the
+** [sqlite3_snapshot_get(D,S,P)] interface writes a pointer to the newly
+** created [sqlite3_snapshot] object into *P and returns SQLITE_OK.
+** If there is not already a read-transaction open on schema S when
+** this function is called, one is opened automatically.
+**
+** The following must be true for this function to succeed. If any of
+** the following statements are false when sqlite3_snapshot_get() is
+** called, SQLITE_ERROR is returned. The final value of *P is undefined
+** in this case.
+**
+** <ul>
+** <li> The database handle must not be in [autocommit mode].
+**
+** <li> Schema S of [database connection] D must be a [WAL mode] database.
+**
+** <li> There must not be a write transaction open on schema S of database
+** connection D.
+**
+** <li> One or more transactions must have been written to the current wal
+** file since it was created on disk (by any connection). This means
+** that a snapshot cannot be taken on a wal mode database with no wal
+** file immediately after it is first opened. At least one transaction
+** must be written to it first.
+** </ul>
+**
+** This function may also return SQLITE_NOMEM. If it is called with the
+** database handle in autocommit mode but fails for some other reason,
+** whether or not a read transaction is opened on schema S is undefined.
+**
+** The [sqlite3_snapshot] object returned from a successful call to
+** [sqlite3_snapshot_get()] must be freed using [sqlite3_snapshot_free()]
+** to avoid a memory leak.
+**
+** The [sqlite3_snapshot_get()] interface is only available when the
+** [SQLITE_ENABLE_SNAPSHOT] compile-time option is used.
+*/
+SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_get(
+ sqlite3 *db,
+ const char *zSchema,
+ sqlite3_snapshot **ppSnapshot
+);
+
+/*
+** CAPI3REF: Start a read transaction on an historical snapshot
+** METHOD: sqlite3_snapshot
+**
+** ^The [sqlite3_snapshot_open(D,S,P)] interface either starts a new read
+** transaction or upgrades an existing one for schema S of
+** [database connection] D such that the read transaction refers to
+** historical [snapshot] P, rather than the most recent change to the
+** database. ^The [sqlite3_snapshot_open()] interface returns SQLITE_OK
+** on success or an appropriate [error code] if it fails.
+**
+** ^In order to succeed, the database connection must not be in
+** [autocommit mode] when [sqlite3_snapshot_open(D,S,P)] is called. If there
+** is already a read transaction open on schema S, then the database handle
+** must have no active statements (SELECT statements that have been passed
+** to sqlite3_step() but not sqlite3_reset() or sqlite3_finalize()).
+** SQLITE_ERROR is returned if either of these conditions is violated, or
+** if schema S does not exist, or if the snapshot object is invalid.
+**
+** ^A call to sqlite3_snapshot_open() will fail to open if the specified
+** snapshot has been overwritten by a [checkpoint]. In this case
+** SQLITE_ERROR_SNAPSHOT is returned.
+**
+** If there is already a read transaction open when this function is
+** invoked, then the same read transaction remains open (on the same
+** database snapshot) if SQLITE_ERROR, SQLITE_BUSY or SQLITE_ERROR_SNAPSHOT
+** is returned. If another error code - for example SQLITE_PROTOCOL or an
+** SQLITE_IOERR error code - is returned, then the final state of the
+** read transaction is undefined. If SQLITE_OK is returned, then the
+** read transaction is now open on database snapshot P.
+**
+** ^(A call to [sqlite3_snapshot_open(D,S,P)] will fail if the
+** database connection D does not know that the database file for
+** schema S is in [WAL mode]. A database connection might not know
+** that the database file is in [WAL mode] if there has been no prior
+** I/O on that database connection, or if the database entered [WAL mode]
+** after the most recent I/O on the database connection.)^
+** (Hint: Run "[PRAGMA application_id]" against a newly opened
+** database connection in order to make it ready to use snapshots.)
+**
+** The [sqlite3_snapshot_open()] interface is only available when the
+** [SQLITE_ENABLE_SNAPSHOT] compile-time option is used.
+*/
+SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_open(
+ sqlite3 *db,
+ const char *zSchema,
+ sqlite3_snapshot *pSnapshot
+);
+
+/*
+** CAPI3REF: Destroy a snapshot
+** DESTRUCTOR: sqlite3_snapshot
+**
+** ^The [sqlite3_snapshot_free(P)] interface destroys [sqlite3_snapshot] P.
+** The application must eventually free every [sqlite3_snapshot] object
+** using this routine to avoid a memory leak.
+**
+** The [sqlite3_snapshot_free()] interface is only available when the
+** [SQLITE_ENABLE_SNAPSHOT] compile-time option is used.
+*/
+SQLITE_API SQLITE_EXPERIMENTAL void sqlite3_snapshot_free(sqlite3_snapshot*);
+
+/*
+** CAPI3REF: Compare the ages of two snapshot handles.
+** METHOD: sqlite3_snapshot
+**
+** The sqlite3_snapshot_cmp(P1, P2) interface is used to compare the ages
+** of two valid snapshot handles.
+**
+** If the two snapshot handles are not associated with the same database
+** file, the result of the comparison is undefined.
+**
+** Additionally, the result of the comparison is only valid if both of the
+** snapshot handles were obtained by calling sqlite3_snapshot_get() since the
+** last time the wal file was deleted. The wal file is deleted when the
+** database is changed back to rollback mode or when the number of database
+** clients drops to zero. If either snapshot handle was obtained before the
+** wal file was last deleted, the value returned by this function
+** is undefined.
+**
+** Otherwise, this API returns a negative value if P1 refers to an older
+** snapshot than P2, zero if the two handles refer to the same database
+** snapshot, and a positive value if P1 is a newer snapshot than P2.
+**
+** This interface is only available if SQLite is compiled with the
+** [SQLITE_ENABLE_SNAPSHOT] option.
+*/
+SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_cmp(
+ sqlite3_snapshot *p1,
+ sqlite3_snapshot *p2
+);
+
+/*
+** CAPI3REF: Recover snapshots from a wal file
+** METHOD: sqlite3_snapshot
+**
+** If a [WAL file] remains on disk after all database connections close
+** (either through the use of the [SQLITE_FCNTL_PERSIST_WAL] [file control]
+** or because the last process to have the database opened exited without
+** calling [sqlite3_close()]) and a new connection is subsequently opened
+** on that database and [WAL file], the [sqlite3_snapshot_open()] interface
+** will only be able to open the last transaction added to the WAL file
+** even though the WAL file contains other valid transactions.
+**
+** This function attempts to scan the WAL file associated with database zDb
+** of database handle db and make all valid snapshots available to
+** sqlite3_snapshot_open(). It is an error if there is already a read
+** transaction open on the database, or if the database is not a WAL mode
+** database.
+**
+** SQLITE_OK is returned if successful, or an SQLite error code otherwise.
+**
+** This interface is only available if SQLite is compiled with the
+** [SQLITE_ENABLE_SNAPSHOT] option.
+*/
+SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_snapshot_recover(sqlite3 *db, const char *zDb);
+
+/*
+** CAPI3REF: Serialize a database
+**
+** The sqlite3_serialize(D,S,P,F) interface returns a pointer to memory
+** that is a serialization of the S database on [database connection] D.
+** If P is not a NULL pointer, then the size of the database in bytes
+** is written into *P.
+**
+** For an ordinary on-disk database file, the serialization is just a
+** copy of the disk file. For an in-memory database or a "TEMP" database,
+** the serialization is the same sequence of bytes which would be written
+** to disk if that database where backed up to disk.
+**
+** The usual case is that sqlite3_serialize() copies the serialization of
+** the database into memory obtained from [sqlite3_malloc64()] and returns
+** a pointer to that memory. The caller is responsible for freeing the
+** returned value to avoid a memory leak. However, if the F argument
+** contains the SQLITE_SERIALIZE_NOCOPY bit, then no memory allocations
+** are made, and the sqlite3_serialize() function will return a pointer
+** to the contiguous memory representation of the database that SQLite
+** is currently using for that database, or NULL if the no such contiguous
+** memory representation of the database exists. A contiguous memory
+** representation of the database will usually only exist if there has
+** been a prior call to [sqlite3_deserialize(D,S,...)] with the same
+** values of D and S.
+** The size of the database is written into *P even if the
+** SQLITE_SERIALIZE_NOCOPY bit is set but no contiguous copy
+** of the database exists.
+**
+** A call to sqlite3_serialize(D,S,P,F) might return NULL even if the
+** SQLITE_SERIALIZE_NOCOPY bit is omitted from argument F if a memory
+** allocation error occurs.
+**
+** This interface is only available if SQLite is compiled with the
+** [SQLITE_ENABLE_DESERIALIZE] option.
+*/
+SQLITE_API unsigned char *sqlite3_serialize(
+ sqlite3 *db, /* The database connection */
+ const char *zSchema, /* Which DB to serialize. ex: "main", "temp", ... */
+ sqlite3_int64 *piSize, /* Write size of the DB here, if not NULL */
+ unsigned int mFlags /* Zero or more SQLITE_SERIALIZE_* flags */
+);
+
+/*
+** CAPI3REF: Flags for sqlite3_serialize
+**
+** Zero or more of the following constants can be OR-ed together for
+** the F argument to [sqlite3_serialize(D,S,P,F)].
+**
+** SQLITE_SERIALIZE_NOCOPY means that [sqlite3_serialize()] will return
+** a pointer to contiguous in-memory database that it is currently using,
+** without making a copy of the database. If SQLite is not currently using
+** a contiguous in-memory database, then this option causes
+** [sqlite3_serialize()] to return a NULL pointer. SQLite will only be
+** using a contiguous in-memory database if it has been initialized by a
+** prior call to [sqlite3_deserialize()].
+*/
+#define SQLITE_SERIALIZE_NOCOPY 0x001 /* Do no memory allocations */
+
+/*
+** CAPI3REF: Deserialize a database
+**
+** The sqlite3_deserialize(D,S,P,N,M,F) interface causes the
+** [database connection] D to disconnect from database S and then
+** reopen S as an in-memory database based on the serialization contained
+** in P. The serialized database P is N bytes in size. M is the size of
+** the buffer P, which might be larger than N. If M is larger than N, and
+** the SQLITE_DESERIALIZE_READONLY bit is not set in F, then SQLite is
+** permitted to add content to the in-memory database as long as the total
+** size does not exceed M bytes.
+**
+** If the SQLITE_DESERIALIZE_FREEONCLOSE bit is set in F, then SQLite will
+** invoke sqlite3_free() on the serialization buffer when the database
+** connection closes. If the SQLITE_DESERIALIZE_RESIZEABLE bit is set, then
+** SQLite will try to increase the buffer size using sqlite3_realloc64()
+** if writes on the database cause it to grow larger than M bytes.
+**
+** The sqlite3_deserialize() interface will fail with SQLITE_BUSY if the
+** database is currently in a read transaction or is involved in a backup
+** operation.
+**
+** If sqlite3_deserialize(D,S,P,N,M,F) fails for any reason and if the
+** SQLITE_DESERIALIZE_FREEONCLOSE bit is set in argument F, then
+** [sqlite3_free()] is invoked on argument P prior to returning.
+**
+** This interface is only available if SQLite is compiled with the
+** [SQLITE_ENABLE_DESERIALIZE] option.
+*/
+SQLITE_API int sqlite3_deserialize(
+ sqlite3 *db, /* The database connection */
+ const char *zSchema, /* Which DB to reopen with the deserialization */
+ unsigned char *pData, /* The serialized database content */
+ sqlite3_int64 szDb, /* Number bytes in the deserialization */
+ sqlite3_int64 szBuf, /* Total size of buffer pData[] */
+ unsigned mFlags /* Zero or more SQLITE_DESERIALIZE_* flags */
+);
+
+/*
+** CAPI3REF: Flags for sqlite3_deserialize()
+**
+** The following are allowed values for 6th argument (the F argument) to
+** the [sqlite3_deserialize(D,S,P,N,M,F)] interface.
+**
+** The SQLITE_DESERIALIZE_FREEONCLOSE means that the database serialization
+** in the P argument is held in memory obtained from [sqlite3_malloc64()]
+** and that SQLite should take ownership of this memory and automatically
+** free it when it has finished using it. Without this flag, the caller
+** is responsible for freeing any dynamically allocated memory.
+**
+** The SQLITE_DESERIALIZE_RESIZEABLE flag means that SQLite is allowed to
+** grow the size of the database using calls to [sqlite3_realloc64()]. This
+** flag should only be used if SQLITE_DESERIALIZE_FREEONCLOSE is also used.
+** Without this flag, the deserialized database cannot increase in size beyond
+** the number of bytes specified by the M parameter.
+**
+** The SQLITE_DESERIALIZE_READONLY flag means that the deserialized database
+** should be treated as read-only.
+*/
+#define SQLITE_DESERIALIZE_FREEONCLOSE 1 /* Call sqlite3_free() on close */
+#define SQLITE_DESERIALIZE_RESIZEABLE 2 /* Resize using sqlite3_realloc64() */
+#define SQLITE_DESERIALIZE_READONLY 4 /* Database is read-only */
+
+/*
+** Undo the hack that converts floating point types to integer for
+** builds on processors without floating point support.
+*/
+#ifdef SQLITE_OMIT_FLOATING_POINT
+# undef double
+#endif
+
+#ifdef __cplusplus
+} /* End of the 'extern "C"' block */
+#endif
+#endif /* SQLITE3_H */
+
+/******** Begin file sqlite3rtree.h *********/
+/*
+** 2010 August 30
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+*************************************************************************
+*/
+
+#ifndef _SQLITE3RTREE_H_
+#define _SQLITE3RTREE_H_
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct sqlite3_rtree_geometry sqlite3_rtree_geometry;
+typedef struct sqlite3_rtree_query_info sqlite3_rtree_query_info;
+
+/* The double-precision datatype used by RTree depends on the
+** SQLITE_RTREE_INT_ONLY compile-time option.
+*/
+#ifdef SQLITE_RTREE_INT_ONLY
+ typedef sqlite3_int64 sqlite3_rtree_dbl;
+#else
+ typedef double sqlite3_rtree_dbl;
+#endif
+
+/*
+** Register a geometry callback named zGeom that can be used as part of an
+** R-Tree geometry query as follows:
+**
+** SELECT ... FROM <rtree> WHERE <rtree col> MATCH $zGeom(... params ...)
+*/
+SQLITE_API int sqlite3_rtree_geometry_callback(
+ sqlite3 *db,
+ const char *zGeom,
+ int (*xGeom)(sqlite3_rtree_geometry*, int, sqlite3_rtree_dbl*,int*),
+ void *pContext
+);
+
+
+/*
+** A pointer to a structure of the following type is passed as the first
+** argument to callbacks registered using rtree_geometry_callback().
+*/
+struct sqlite3_rtree_geometry {
+ void *pContext; /* Copy of pContext passed to s_r_g_c() */
+ int nParam; /* Size of array aParam[] */
+ sqlite3_rtree_dbl *aParam; /* Parameters passed to SQL geom function */
+ void *pUser; /* Callback implementation user data */
+ void (*xDelUser)(void *); /* Called by SQLite to clean up pUser */
+};
+
+/*
+** Register a 2nd-generation geometry callback named zScore that can be
+** used as part of an R-Tree geometry query as follows:
+**
+** SELECT ... FROM <rtree> WHERE <rtree col> MATCH $zQueryFunc(... params ...)
+*/
+SQLITE_API int sqlite3_rtree_query_callback(
+ sqlite3 *db,
+ const char *zQueryFunc,
+ int (*xQueryFunc)(sqlite3_rtree_query_info*),
+ void *pContext,
+ void (*xDestructor)(void*)
+);
+
+
+/*
+** A pointer to a structure of the following type is passed as the
+** argument to scored geometry callback registered using
+** sqlite3_rtree_query_callback().
+**
+** Note that the first 5 fields of this structure are identical to
+** sqlite3_rtree_geometry. This structure is a subclass of
+** sqlite3_rtree_geometry.
+*/
+struct sqlite3_rtree_query_info {
+ void *pContext; /* pContext from when function registered */
+ int nParam; /* Number of function parameters */
+ sqlite3_rtree_dbl *aParam; /* value of function parameters */
+ void *pUser; /* callback can use this, if desired */
+ void (*xDelUser)(void*); /* function to free pUser */
+ sqlite3_rtree_dbl *aCoord; /* Coordinates of node or entry to check */
+ unsigned int *anQueue; /* Number of pending entries in the queue */
+ int nCoord; /* Number of coordinates */
+ int iLevel; /* Level of current node or entry */
+ int mxLevel; /* The largest iLevel value in the tree */
+ sqlite3_int64 iRowid; /* Rowid for current entry */
+ sqlite3_rtree_dbl rParentScore; /* Score of parent node */
+ int eParentWithin; /* Visibility of parent node */
+ int eWithin; /* OUT: Visibility */
+ sqlite3_rtree_dbl rScore; /* OUT: Write the score here */
+ /* The following fields are only available in 3.8.11 and later */
+ sqlite3_value **apSqlParam; /* Original SQL values of parameters */
+};
+
+/*
+** Allowed values for sqlite3_rtree_query.eWithin and .eParentWithin.
+*/
+#define NOT_WITHIN 0 /* Object completely outside of query region */
+#define PARTLY_WITHIN 1 /* Object partially overlaps query region */
+#define FULLY_WITHIN 2 /* Object fully contained within query region */
+
+
+#ifdef __cplusplus
+} /* end of the 'extern "C"' block */
+#endif
+
+#endif /* ifndef _SQLITE3RTREE_H_ */
+
+/******** End of sqlite3rtree.h *********/
+/******** Begin file sqlite3session.h *********/
+
+#if !defined(__SQLITESESSION_H_) && defined(SQLITE_ENABLE_SESSION)
+#define __SQLITESESSION_H_ 1
+
+/*
+** Make sure we can call this stuff from C++.
+*/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*
+** CAPI3REF: Session Object Handle
+**
+** An instance of this object is a [session] that can be used to
+** record changes to a database.
+*/
+typedef struct sqlite3_session sqlite3_session;
+
+/*
+** CAPI3REF: Changeset Iterator Handle
+**
+** An instance of this object acts as a cursor for iterating
+** over the elements of a [changeset] or [patchset].
+*/
+typedef struct sqlite3_changeset_iter sqlite3_changeset_iter;
+
+/*
+** CAPI3REF: Create A New Session Object
+** CONSTRUCTOR: sqlite3_session
+**
+** Create a new session object attached to database handle db. If successful,
+** a pointer to the new object is written to *ppSession and SQLITE_OK is
+** returned. If an error occurs, *ppSession is set to NULL and an SQLite
+** error code (e.g. SQLITE_NOMEM) is returned.
+**
+** It is possible to create multiple session objects attached to a single
+** database handle.
+**
+** Session objects created using this function should be deleted using the
+** [sqlite3session_delete()] function before the database handle that they
+** are attached to is itself closed. If the database handle is closed before
+** the session object is deleted, then the results of calling any session
+** module function, including [sqlite3session_delete()] on the session object
+** are undefined.
+**
+** Because the session module uses the [sqlite3_preupdate_hook()] API, it
+** is not possible for an application to register a pre-update hook on a
+** database handle that has one or more session objects attached. Nor is
+** it possible to create a session object attached to a database handle for
+** which a pre-update hook is already defined. The results of attempting
+** either of these things are undefined.
+**
+** The session object will be used to create changesets for tables in
+** database zDb, where zDb is either "main", or "temp", or the name of an
+** attached database. It is not an error if database zDb is not attached
+** to the database when the session object is created.
+*/
+SQLITE_API int sqlite3session_create(
+ sqlite3 *db, /* Database handle */
+ const char *zDb, /* Name of db (e.g. "main") */
+ sqlite3_session **ppSession /* OUT: New session object */
+);
+
+/*
+** CAPI3REF: Delete A Session Object
+** DESTRUCTOR: sqlite3_session
+**
+** Delete a session object previously allocated using
+** [sqlite3session_create()]. Once a session object has been deleted, the
+** results of attempting to use pSession with any other session module
+** function are undefined.
+**
+** Session objects must be deleted before the database handle to which they
+** are attached is closed. Refer to the documentation for
+** [sqlite3session_create()] for details.
+*/
+SQLITE_API void sqlite3session_delete(sqlite3_session *pSession);
+
+
+/*
+** CAPI3REF: Enable Or Disable A Session Object
+** METHOD: sqlite3_session
+**
+** Enable or disable the recording of changes by a session object. When
+** enabled, a session object records changes made to the database. When
+** disabled - it does not. A newly created session object is enabled.
+** Refer to the documentation for [sqlite3session_changeset()] for further
+** details regarding how enabling and disabling a session object affects
+** the eventual changesets.
+**
+** Passing zero to this function disables the session. Passing a value
+** greater than zero enables it. Passing a value less than zero is a
+** no-op, and may be used to query the current state of the session.
+**
+** The return value indicates the final state of the session object: 0 if
+** the session is disabled, or 1 if it is enabled.
+*/
+SQLITE_API int sqlite3session_enable(sqlite3_session *pSession, int bEnable);
+
+/*
+** CAPI3REF: Set Or Clear the Indirect Change Flag
+** METHOD: sqlite3_session
+**
+** Each change recorded by a session object is marked as either direct or
+** indirect. A change is marked as indirect if either:
+**
+** <ul>
+** <li> The session object "indirect" flag is set when the change is
+** made, or
+** <li> The change is made by an SQL trigger or foreign key action
+** instead of directly as a result of a users SQL statement.
+** </ul>
+**
+** If a single row is affected by more than one operation within a session,
+** then the change is considered indirect if all operations meet the criteria
+** for an indirect change above, or direct otherwise.
+**
+** This function is used to set, clear or query the session object indirect
+** flag. If the second argument passed to this function is zero, then the
+** indirect flag is cleared. If it is greater than zero, the indirect flag
+** is set. Passing a value less than zero does not modify the current value
+** of the indirect flag, and may be used to query the current state of the
+** indirect flag for the specified session object.
+**
+** The return value indicates the final state of the indirect flag: 0 if
+** it is clear, or 1 if it is set.
+*/
+SQLITE_API int sqlite3session_indirect(sqlite3_session *pSession, int bIndirect);
+
+/*
+** CAPI3REF: Attach A Table To A Session Object
+** METHOD: sqlite3_session
+**
+** If argument zTab is not NULL, then it is the name of a table to attach
+** to the session object passed as the first argument. All subsequent changes
+** made to the table while the session object is enabled will be recorded. See
+** documentation for [sqlite3session_changeset()] for further details.
+**
+** Or, if argument zTab is NULL, then changes are recorded for all tables
+** in the database. If additional tables are added to the database (by
+** executing "CREATE TABLE" statements) after this call is made, changes for
+** the new tables are also recorded.
+**
+** Changes can only be recorded for tables that have a PRIMARY KEY explicitly
+** defined as part of their CREATE TABLE statement. It does not matter if the
+** PRIMARY KEY is an "INTEGER PRIMARY KEY" (rowid alias) or not. The PRIMARY
+** KEY may consist of a single column, or may be a composite key.
+**
+** It is not an error if the named table does not exist in the database. Nor
+** is it an error if the named table does not have a PRIMARY KEY. However,
+** no changes will be recorded in either of these scenarios.
+**
+** Changes are not recorded for individual rows that have NULL values stored
+** in one or more of their PRIMARY KEY columns.
+**
+** SQLITE_OK is returned if the call completes without error. Or, if an error
+** occurs, an SQLite error code (e.g. SQLITE_NOMEM) is returned.
+**
+** <h3>Special sqlite_stat1 Handling</h3>
+**
+** As of SQLite version 3.22.0, the "sqlite_stat1" table is an exception to
+** some of the rules above. In SQLite, the schema of sqlite_stat1 is:
+** <pre>
+** &nbsp; CREATE TABLE sqlite_stat1(tbl,idx,stat)
+** </pre>
+**
+** Even though sqlite_stat1 does not have a PRIMARY KEY, changes are
+** recorded for it as if the PRIMARY KEY is (tbl,idx). Additionally, changes
+** are recorded for rows for which (idx IS NULL) is true. However, for such
+** rows a zero-length blob (SQL value X'') is stored in the changeset or
+** patchset instead of a NULL value. This allows such changesets to be
+** manipulated by legacy implementations of sqlite3changeset_invert(),
+** concat() and similar.
+**
+** The sqlite3changeset_apply() function automatically converts the
+** zero-length blob back to a NULL value when updating the sqlite_stat1
+** table. However, if the application calls sqlite3changeset_new(),
+** sqlite3changeset_old() or sqlite3changeset_conflict on a changeset
+** iterator directly (including on a changeset iterator passed to a
+** conflict-handler callback) then the X'' value is returned. The application
+** must translate X'' to NULL itself if required.
+**
+** Legacy (older than 3.22.0) versions of the sessions module cannot capture
+** changes made to the sqlite_stat1 table. Legacy versions of the
+** sqlite3changeset_apply() function silently ignore any modifications to the
+** sqlite_stat1 table that are part of a changeset or patchset.
+*/
+SQLITE_API int sqlite3session_attach(
+ sqlite3_session *pSession, /* Session object */
+ const char *zTab /* Table name */
+);
+
+/*
+** CAPI3REF: Set a table filter on a Session Object.
+** METHOD: sqlite3_session
+**
+** The second argument (xFilter) is the "filter callback". For changes to rows
+** in tables that are not attached to the Session object, the filter is called
+** to determine whether changes to the table's rows should be tracked or not.
+** If xFilter returns 0, changes are not tracked. Note that once a table is
+** attached, xFilter will not be called again.
+*/
+SQLITE_API void sqlite3session_table_filter(
+ sqlite3_session *pSession, /* Session object */
+ int(*xFilter)(
+ void *pCtx, /* Copy of third arg to _filter_table() */
+ const char *zTab /* Table name */
+ ),
+ void *pCtx /* First argument passed to xFilter */
+);
+
+/*
+** CAPI3REF: Generate A Changeset From A Session Object
+** METHOD: sqlite3_session
+**
+** Obtain a changeset containing changes to the tables attached to the
+** session object passed as the first argument. If successful,
+** set *ppChangeset to point to a buffer containing the changeset
+** and *pnChangeset to the size of the changeset in bytes before returning
+** SQLITE_OK. If an error occurs, set both *ppChangeset and *pnChangeset to
+** zero and return an SQLite error code.
+**
+** A changeset consists of zero or more INSERT, UPDATE and/or DELETE changes,
+** each representing a change to a single row of an attached table. An INSERT
+** change contains the values of each field of a new database row. A DELETE
+** contains the original values of each field of a deleted database row. An
+** UPDATE change contains the original values of each field of an updated
+** database row along with the updated values for each updated non-primary-key
+** column. It is not possible for an UPDATE change to represent a change that
+** modifies the values of primary key columns. If such a change is made, it
+** is represented in a changeset as a DELETE followed by an INSERT.
+**
+** Changes are not recorded for rows that have NULL values stored in one or
+** more of their PRIMARY KEY columns. If such a row is inserted or deleted,
+** no corresponding change is present in the changesets returned by this
+** function. If an existing row with one or more NULL values stored in
+** PRIMARY KEY columns is updated so that all PRIMARY KEY columns are non-NULL,
+** only an INSERT is appears in the changeset. Similarly, if an existing row
+** with non-NULL PRIMARY KEY values is updated so that one or more of its
+** PRIMARY KEY columns are set to NULL, the resulting changeset contains a
+** DELETE change only.
+**
+** The contents of a changeset may be traversed using an iterator created
+** using the [sqlite3changeset_start()] API. A changeset may be applied to
+** a database with a compatible schema using the [sqlite3changeset_apply()]
+** API.
+**
+** Within a changeset generated by this function, all changes related to a
+** single table are grouped together. In other words, when iterating through
+** a changeset or when applying a changeset to a database, all changes related
+** to a single table are processed before moving on to the next table. Tables
+** are sorted in the same order in which they were attached (or auto-attached)
+** to the sqlite3_session object. The order in which the changes related to
+** a single table are stored is undefined.
+**
+** Following a successful call to this function, it is the responsibility of
+** the caller to eventually free the buffer that *ppChangeset points to using
+** [sqlite3_free()].
+**
+** <h3>Changeset Generation</h3>
+**
+** Once a table has been attached to a session object, the session object
+** records the primary key values of all new rows inserted into the table.
+** It also records the original primary key and other column values of any
+** deleted or updated rows. For each unique primary key value, data is only
+** recorded once - the first time a row with said primary key is inserted,
+** updated or deleted in the lifetime of the session.
+**
+** There is one exception to the previous paragraph: when a row is inserted,
+** updated or deleted, if one or more of its primary key columns contain a
+** NULL value, no record of the change is made.
+**
+** The session object therefore accumulates two types of records - those
+** that consist of primary key values only (created when the user inserts
+** a new record) and those that consist of the primary key values and the
+** original values of other table columns (created when the users deletes
+** or updates a record).
+**
+** When this function is called, the requested changeset is created using
+** both the accumulated records and the current contents of the database
+** file. Specifically:
+**
+** <ul>
+** <li> For each record generated by an insert, the database is queried
+** for a row with a matching primary key. If one is found, an INSERT
+** change is added to the changeset. If no such row is found, no change
+** is added to the changeset.
+**
+** <li> For each record generated by an update or delete, the database is
+** queried for a row with a matching primary key. If such a row is
+** found and one or more of the non-primary key fields have been
+** modified from their original values, an UPDATE change is added to
+** the changeset. Or, if no such row is found in the table, a DELETE
+** change is added to the changeset. If there is a row with a matching
+** primary key in the database, but all fields contain their original
+** values, no change is added to the changeset.
+** </ul>
+**
+** This means, amongst other things, that if a row is inserted and then later
+** deleted while a session object is active, neither the insert nor the delete
+** will be present in the changeset. Or if a row is deleted and then later a
+** row with the same primary key values inserted while a session object is
+** active, the resulting changeset will contain an UPDATE change instead of
+** a DELETE and an INSERT.
+**
+** When a session object is disabled (see the [sqlite3session_enable()] API),
+** it does not accumulate records when rows are inserted, updated or deleted.
+** This may appear to have some counter-intuitive effects if a single row
+** is written to more than once during a session. For example, if a row
+** is inserted while a session object is enabled, then later deleted while
+** the same session object is disabled, no INSERT record will appear in the
+** changeset, even though the delete took place while the session was disabled.
+** Or, if one field of a row is updated while a session is disabled, and
+** another field of the same row is updated while the session is enabled, the
+** resulting changeset will contain an UPDATE change that updates both fields.
+*/
+SQLITE_API int sqlite3session_changeset(
+ sqlite3_session *pSession, /* Session object */
+ int *pnChangeset, /* OUT: Size of buffer at *ppChangeset */
+ void **ppChangeset /* OUT: Buffer containing changeset */
+);
+
+/*
+** CAPI3REF: Load The Difference Between Tables Into A Session
+** METHOD: sqlite3_session
+**
+** If it is not already attached to the session object passed as the first
+** argument, this function attaches table zTbl in the same manner as the
+** [sqlite3session_attach()] function. If zTbl does not exist, or if it
+** does not have a primary key, this function is a no-op (but does not return
+** an error).
+**
+** Argument zFromDb must be the name of a database ("main", "temp" etc.)
+** attached to the same database handle as the session object that contains
+** a table compatible with the table attached to the session by this function.
+** A table is considered compatible if it:
+**
+** <ul>
+** <li> Has the same name,
+** <li> Has the same set of columns declared in the same order, and
+** <li> Has the same PRIMARY KEY definition.
+** </ul>
+**
+** If the tables are not compatible, SQLITE_SCHEMA is returned. If the tables
+** are compatible but do not have any PRIMARY KEY columns, it is not an error
+** but no changes are added to the session object. As with other session
+** APIs, tables without PRIMARY KEYs are simply ignored.
+**
+** This function adds a set of changes to the session object that could be
+** used to update the table in database zFrom (call this the "from-table")
+** so that its content is the same as the table attached to the session
+** object (call this the "to-table"). Specifically:
+**
+** <ul>
+** <li> For each row (primary key) that exists in the to-table but not in
+** the from-table, an INSERT record is added to the session object.
+**
+** <li> For each row (primary key) that exists in the to-table but not in
+** the from-table, a DELETE record is added to the session object.
+**
+** <li> For each row (primary key) that exists in both tables, but features
+** different non-PK values in each, an UPDATE record is added to the
+** session.
+** </ul>
+**
+** To clarify, if this function is called and then a changeset constructed
+** using [sqlite3session_changeset()], then after applying that changeset to
+** database zFrom the contents of the two compatible tables would be
+** identical.
+**
+** It an error if database zFrom does not exist or does not contain the
+** required compatible table.
+**
+** If the operation is successful, SQLITE_OK is returned. Otherwise, an SQLite
+** error code. In this case, if argument pzErrMsg is not NULL, *pzErrMsg
+** may be set to point to a buffer containing an English language error
+** message. It is the responsibility of the caller to free this buffer using
+** sqlite3_free().
+*/
+SQLITE_API int sqlite3session_diff(
+ sqlite3_session *pSession,
+ const char *zFromDb,
+ const char *zTbl,
+ char **pzErrMsg
+);
+
+
+/*
+** CAPI3REF: Generate A Patchset From A Session Object
+** METHOD: sqlite3_session
+**
+** The differences between a patchset and a changeset are that:
+**
+** <ul>
+** <li> DELETE records consist of the primary key fields only. The
+** original values of other fields are omitted.
+** <li> The original values of any modified fields are omitted from
+** UPDATE records.
+** </ul>
+**
+** A patchset blob may be used with up to date versions of all
+** sqlite3changeset_xxx API functions except for sqlite3changeset_invert(),
+** which returns SQLITE_CORRUPT if it is passed a patchset. Similarly,
+** attempting to use a patchset blob with old versions of the
+** sqlite3changeset_xxx APIs also provokes an SQLITE_CORRUPT error.
+**
+** Because the non-primary key "old.*" fields are omitted, no
+** SQLITE_CHANGESET_DATA conflicts can be detected or reported if a patchset
+** is passed to the sqlite3changeset_apply() API. Other conflict types work
+** in the same way as for changesets.
+**
+** Changes within a patchset are ordered in the same way as for changesets
+** generated by the sqlite3session_changeset() function (i.e. all changes for
+** a single table are grouped together, tables appear in the order in which
+** they were attached to the session object).
+*/
+SQLITE_API int sqlite3session_patchset(
+ sqlite3_session *pSession, /* Session object */
+ int *pnPatchset, /* OUT: Size of buffer at *ppPatchset */
+ void **ppPatchset /* OUT: Buffer containing patchset */
+);
+
+/*
+** CAPI3REF: Test if a changeset has recorded any changes.
+**
+** Return non-zero if no changes to attached tables have been recorded by
+** the session object passed as the first argument. Otherwise, if one or
+** more changes have been recorded, return zero.
+**
+** Even if this function returns zero, it is possible that calling
+** [sqlite3session_changeset()] on the session handle may still return a
+** changeset that contains no changes. This can happen when a row in
+** an attached table is modified and then later on the original values
+** are restored. However, if this function returns non-zero, then it is
+** guaranteed that a call to sqlite3session_changeset() will return a
+** changeset containing zero changes.
+*/
+SQLITE_API int sqlite3session_isempty(sqlite3_session *pSession);
+
+/*
+** CAPI3REF: Create An Iterator To Traverse A Changeset
+** CONSTRUCTOR: sqlite3_changeset_iter
+**
+** Create an iterator used to iterate through the contents of a changeset.
+** If successful, *pp is set to point to the iterator handle and SQLITE_OK
+** is returned. Otherwise, if an error occurs, *pp is set to zero and an
+** SQLite error code is returned.
+**
+** The following functions can be used to advance and query a changeset
+** iterator created by this function:
+**
+** <ul>
+** <li> [sqlite3changeset_next()]
+** <li> [sqlite3changeset_op()]
+** <li> [sqlite3changeset_new()]
+** <li> [sqlite3changeset_old()]
+** </ul>
+**
+** It is the responsibility of the caller to eventually destroy the iterator
+** by passing it to [sqlite3changeset_finalize()]. The buffer containing the
+** changeset (pChangeset) must remain valid until after the iterator is
+** destroyed.
+**
+** Assuming the changeset blob was created by one of the
+** [sqlite3session_changeset()], [sqlite3changeset_concat()] or
+** [sqlite3changeset_invert()] functions, all changes within the changeset
+** that apply to a single table are grouped together. This means that when
+** an application iterates through a changeset using an iterator created by
+** this function, all changes that relate to a single table are visited
+** consecutively. There is no chance that the iterator will visit a change
+** the applies to table X, then one for table Y, and then later on visit
+** another change for table X.
+**
+** The behavior of sqlite3changeset_start_v2() and its streaming equivalent
+** may be modified by passing a combination of
+** [SQLITE_CHANGESETSTART_INVERT | supported flags] as the 4th parameter.
+**
+** Note that the sqlite3changeset_start_v2() API is still <b>experimental</b>
+** and therefore subject to change.
+*/
+SQLITE_API int sqlite3changeset_start(
+ sqlite3_changeset_iter **pp, /* OUT: New changeset iterator handle */
+ int nChangeset, /* Size of changeset blob in bytes */
+ void *pChangeset /* Pointer to blob containing changeset */
+);
+SQLITE_API int sqlite3changeset_start_v2(
+ sqlite3_changeset_iter **pp, /* OUT: New changeset iterator handle */
+ int nChangeset, /* Size of changeset blob in bytes */
+ void *pChangeset, /* Pointer to blob containing changeset */
+ int flags /* SESSION_CHANGESETSTART_* flags */
+);
+
+/*
+** CAPI3REF: Flags for sqlite3changeset_start_v2
+**
+** The following flags may passed via the 4th parameter to
+** [sqlite3changeset_start_v2] and [sqlite3changeset_start_v2_strm]:
+**
+** <dt>SQLITE_CHANGESETAPPLY_INVERT <dd>
+** Invert the changeset while iterating through it. This is equivalent to
+** inverting a changeset using sqlite3changeset_invert() before applying it.
+** It is an error to specify this flag with a patchset.
+*/
+#define SQLITE_CHANGESETSTART_INVERT 0x0002
+
+
+/*
+** CAPI3REF: Advance A Changeset Iterator
+** METHOD: sqlite3_changeset_iter
+**
+** This function may only be used with iterators created by the function
+** [sqlite3changeset_start()]. If it is called on an iterator passed to
+** a conflict-handler callback by [sqlite3changeset_apply()], SQLITE_MISUSE
+** is returned and the call has no effect.
+**
+** Immediately after an iterator is created by sqlite3changeset_start(), it
+** does not point to any change in the changeset. Assuming the changeset
+** is not empty, the first call to this function advances the iterator to
+** point to the first change in the changeset. Each subsequent call advances
+** the iterator to point to the next change in the changeset (if any). If
+** no error occurs and the iterator points to a valid change after a call
+** to sqlite3changeset_next() has advanced it, SQLITE_ROW is returned.
+** Otherwise, if all changes in the changeset have already been visited,
+** SQLITE_DONE is returned.
+**
+** If an error occurs, an SQLite error code is returned. Possible error
+** codes include SQLITE_CORRUPT (if the changeset buffer is corrupt) or
+** SQLITE_NOMEM.
+*/
+SQLITE_API int sqlite3changeset_next(sqlite3_changeset_iter *pIter);
+
+/*
+** CAPI3REF: Obtain The Current Operation From A Changeset Iterator
+** METHOD: sqlite3_changeset_iter
+**
+** The pIter argument passed to this function may either be an iterator
+** passed to a conflict-handler by [sqlite3changeset_apply()], or an iterator
+** created by [sqlite3changeset_start()]. In the latter case, the most recent
+** call to [sqlite3changeset_next()] must have returned [SQLITE_ROW]. If this
+** is not the case, this function returns [SQLITE_MISUSE].
+**
+** If argument pzTab is not NULL, then *pzTab is set to point to a
+** nul-terminated utf-8 encoded string containing the name of the table
+** affected by the current change. The buffer remains valid until either
+** sqlite3changeset_next() is called on the iterator or until the
+** conflict-handler function returns. If pnCol is not NULL, then *pnCol is
+** set to the number of columns in the table affected by the change. If
+** pbIndirect is not NULL, then *pbIndirect is set to true (1) if the change
+** is an indirect change, or false (0) otherwise. See the documentation for
+** [sqlite3session_indirect()] for a description of direct and indirect
+** changes. Finally, if pOp is not NULL, then *pOp is set to one of
+** [SQLITE_INSERT], [SQLITE_DELETE] or [SQLITE_UPDATE], depending on the
+** type of change that the iterator currently points to.
+**
+** If no error occurs, SQLITE_OK is returned. If an error does occur, an
+** SQLite error code is returned. The values of the output variables may not
+** be trusted in this case.
+*/
+SQLITE_API int sqlite3changeset_op(
+ sqlite3_changeset_iter *pIter, /* Iterator object */
+ const char **pzTab, /* OUT: Pointer to table name */
+ int *pnCol, /* OUT: Number of columns in table */
+ int *pOp, /* OUT: SQLITE_INSERT, DELETE or UPDATE */
+ int *pbIndirect /* OUT: True for an 'indirect' change */
+);
+
+/*
+** CAPI3REF: Obtain The Primary Key Definition Of A Table
+** METHOD: sqlite3_changeset_iter
+**
+** For each modified table, a changeset includes the following:
+**
+** <ul>
+** <li> The number of columns in the table, and
+** <li> Which of those columns make up the tables PRIMARY KEY.
+** </ul>
+**
+** This function is used to find which columns comprise the PRIMARY KEY of
+** the table modified by the change that iterator pIter currently points to.
+** If successful, *pabPK is set to point to an array of nCol entries, where
+** nCol is the number of columns in the table. Elements of *pabPK are set to
+** 0x01 if the corresponding column is part of the tables primary key, or
+** 0x00 if it is not.
+**
+** If argument pnCol is not NULL, then *pnCol is set to the number of columns
+** in the table.
+**
+** If this function is called when the iterator does not point to a valid
+** entry, SQLITE_MISUSE is returned and the output variables zeroed. Otherwise,
+** SQLITE_OK is returned and the output variables populated as described
+** above.
+*/
+SQLITE_API int sqlite3changeset_pk(
+ sqlite3_changeset_iter *pIter, /* Iterator object */
+ unsigned char **pabPK, /* OUT: Array of boolean - true for PK cols */
+ int *pnCol /* OUT: Number of entries in output array */
+);
+
+/*
+** CAPI3REF: Obtain old.* Values From A Changeset Iterator
+** METHOD: sqlite3_changeset_iter
+**
+** The pIter argument passed to this function may either be an iterator
+** passed to a conflict-handler by [sqlite3changeset_apply()], or an iterator
+** created by [sqlite3changeset_start()]. In the latter case, the most recent
+** call to [sqlite3changeset_next()] must have returned SQLITE_ROW.
+** Furthermore, it may only be called if the type of change that the iterator
+** currently points to is either [SQLITE_DELETE] or [SQLITE_UPDATE]. Otherwise,
+** this function returns [SQLITE_MISUSE] and sets *ppValue to NULL.
+**
+** Argument iVal must be greater than or equal to 0, and less than the number
+** of columns in the table affected by the current change. Otherwise,
+** [SQLITE_RANGE] is returned and *ppValue is set to NULL.
+**
+** If successful, this function sets *ppValue to point to a protected
+** sqlite3_value object containing the iVal'th value from the vector of
+** original row values stored as part of the UPDATE or DELETE change and
+** returns SQLITE_OK. The name of the function comes from the fact that this
+** is similar to the "old.*" columns available to update or delete triggers.
+**
+** If some other error occurs (e.g. an OOM condition), an SQLite error code
+** is returned and *ppValue is set to NULL.
+*/
+SQLITE_API int sqlite3changeset_old(
+ sqlite3_changeset_iter *pIter, /* Changeset iterator */
+ int iVal, /* Column number */
+ sqlite3_value **ppValue /* OUT: Old value (or NULL pointer) */
+);
+
+/*
+** CAPI3REF: Obtain new.* Values From A Changeset Iterator
+** METHOD: sqlite3_changeset_iter
+**
+** The pIter argument passed to this function may either be an iterator
+** passed to a conflict-handler by [sqlite3changeset_apply()], or an iterator
+** created by [sqlite3changeset_start()]. In the latter case, the most recent
+** call to [sqlite3changeset_next()] must have returned SQLITE_ROW.
+** Furthermore, it may only be called if the type of change that the iterator
+** currently points to is either [SQLITE_UPDATE] or [SQLITE_INSERT]. Otherwise,
+** this function returns [SQLITE_MISUSE] and sets *ppValue to NULL.
+**
+** Argument iVal must be greater than or equal to 0, and less than the number
+** of columns in the table affected by the current change. Otherwise,
+** [SQLITE_RANGE] is returned and *ppValue is set to NULL.
+**
+** If successful, this function sets *ppValue to point to a protected
+** sqlite3_value object containing the iVal'th value from the vector of
+** new row values stored as part of the UPDATE or INSERT change and
+** returns SQLITE_OK. If the change is an UPDATE and does not include
+** a new value for the requested column, *ppValue is set to NULL and
+** SQLITE_OK returned. The name of the function comes from the fact that
+** this is similar to the "new.*" columns available to update or delete
+** triggers.
+**
+** If some other error occurs (e.g. an OOM condition), an SQLite error code
+** is returned and *ppValue is set to NULL.
+*/
+SQLITE_API int sqlite3changeset_new(
+ sqlite3_changeset_iter *pIter, /* Changeset iterator */
+ int iVal, /* Column number */
+ sqlite3_value **ppValue /* OUT: New value (or NULL pointer) */
+);
+
+/*
+** CAPI3REF: Obtain Conflicting Row Values From A Changeset Iterator
+** METHOD: sqlite3_changeset_iter
+**
+** This function should only be used with iterator objects passed to a
+** conflict-handler callback by [sqlite3changeset_apply()] with either
+** [SQLITE_CHANGESET_DATA] or [SQLITE_CHANGESET_CONFLICT]. If this function
+** is called on any other iterator, [SQLITE_MISUSE] is returned and *ppValue
+** is set to NULL.
+**
+** Argument iVal must be greater than or equal to 0, and less than the number
+** of columns in the table affected by the current change. Otherwise,
+** [SQLITE_RANGE] is returned and *ppValue is set to NULL.
+**
+** If successful, this function sets *ppValue to point to a protected
+** sqlite3_value object containing the iVal'th value from the
+** "conflicting row" associated with the current conflict-handler callback
+** and returns SQLITE_OK.
+**
+** If some other error occurs (e.g. an OOM condition), an SQLite error code
+** is returned and *ppValue is set to NULL.
+*/
+SQLITE_API int sqlite3changeset_conflict(
+ sqlite3_changeset_iter *pIter, /* Changeset iterator */
+ int iVal, /* Column number */
+ sqlite3_value **ppValue /* OUT: Value from conflicting row */
+);
+
+/*
+** CAPI3REF: Determine The Number Of Foreign Key Constraint Violations
+** METHOD: sqlite3_changeset_iter
+**
+** This function may only be called with an iterator passed to an
+** SQLITE_CHANGESET_FOREIGN_KEY conflict handler callback. In this case
+** it sets the output variable to the total number of known foreign key
+** violations in the destination database and returns SQLITE_OK.
+**
+** In all other cases this function returns SQLITE_MISUSE.
+*/
+SQLITE_API int sqlite3changeset_fk_conflicts(
+ sqlite3_changeset_iter *pIter, /* Changeset iterator */
+ int *pnOut /* OUT: Number of FK violations */
+);
+
+
+/*
+** CAPI3REF: Finalize A Changeset Iterator
+** METHOD: sqlite3_changeset_iter
+**
+** This function is used to finalize an iterator allocated with
+** [sqlite3changeset_start()].
+**
+** This function should only be called on iterators created using the
+** [sqlite3changeset_start()] function. If an application calls this
+** function with an iterator passed to a conflict-handler by
+** [sqlite3changeset_apply()], [SQLITE_MISUSE] is immediately returned and the
+** call has no effect.
+**
+** If an error was encountered within a call to an sqlite3changeset_xxx()
+** function (for example an [SQLITE_CORRUPT] in [sqlite3changeset_next()] or an
+** [SQLITE_NOMEM] in [sqlite3changeset_new()]) then an error code corresponding
+** to that error is returned by this function. Otherwise, SQLITE_OK is
+** returned. This is to allow the following pattern (pseudo-code):
+**
+** <pre>
+** sqlite3changeset_start();
+** while( SQLITE_ROW==sqlite3changeset_next() ){
+** // Do something with change.
+** }
+** rc = sqlite3changeset_finalize();
+** if( rc!=SQLITE_OK ){
+** // An error has occurred
+** }
+** </pre>
+*/
+SQLITE_API int sqlite3changeset_finalize(sqlite3_changeset_iter *pIter);
+
+/*
+** CAPI3REF: Invert A Changeset
+**
+** This function is used to "invert" a changeset object. Applying an inverted
+** changeset to a database reverses the effects of applying the uninverted
+** changeset. Specifically:
+**
+** <ul>
+** <li> Each DELETE change is changed to an INSERT, and
+** <li> Each INSERT change is changed to a DELETE, and
+** <li> For each UPDATE change, the old.* and new.* values are exchanged.
+** </ul>
+**
+** This function does not change the order in which changes appear within
+** the changeset. It merely reverses the sense of each individual change.
+**
+** If successful, a pointer to a buffer containing the inverted changeset
+** is stored in *ppOut, the size of the same buffer is stored in *pnOut, and
+** SQLITE_OK is returned. If an error occurs, both *pnOut and *ppOut are
+** zeroed and an SQLite error code returned.
+**
+** It is the responsibility of the caller to eventually call sqlite3_free()
+** on the *ppOut pointer to free the buffer allocation following a successful
+** call to this function.
+**
+** WARNING/TODO: This function currently assumes that the input is a valid
+** changeset. If it is not, the results are undefined.
+*/
+SQLITE_API int sqlite3changeset_invert(
+ int nIn, const void *pIn, /* Input changeset */
+ int *pnOut, void **ppOut /* OUT: Inverse of input */
+);
+
+/*
+** CAPI3REF: Concatenate Two Changeset Objects
+**
+** This function is used to concatenate two changesets, A and B, into a
+** single changeset. The result is a changeset equivalent to applying
+** changeset A followed by changeset B.
+**
+** This function combines the two input changesets using an
+** sqlite3_changegroup object. Calling it produces similar results as the
+** following code fragment:
+**
+** <pre>
+** sqlite3_changegroup *pGrp;
+** rc = sqlite3_changegroup_new(&pGrp);
+** if( rc==SQLITE_OK ) rc = sqlite3changegroup_add(pGrp, nA, pA);
+** if( rc==SQLITE_OK ) rc = sqlite3changegroup_add(pGrp, nB, pB);
+** if( rc==SQLITE_OK ){
+** rc = sqlite3changegroup_output(pGrp, pnOut, ppOut);
+** }else{
+** *ppOut = 0;
+** *pnOut = 0;
+** }
+** </pre>
+**
+** Refer to the sqlite3_changegroup documentation below for details.
+*/
+SQLITE_API int sqlite3changeset_concat(
+ int nA, /* Number of bytes in buffer pA */
+ void *pA, /* Pointer to buffer containing changeset A */
+ int nB, /* Number of bytes in buffer pB */
+ void *pB, /* Pointer to buffer containing changeset B */
+ int *pnOut, /* OUT: Number of bytes in output changeset */
+ void **ppOut /* OUT: Buffer containing output changeset */
+);
+
+
+/*
+** CAPI3REF: Changegroup Handle
+**
+** A changegroup is an object used to combine two or more
+** [changesets] or [patchsets]
+*/
+typedef struct sqlite3_changegroup sqlite3_changegroup;
+
+/*
+** CAPI3REF: Create A New Changegroup Object
+** CONSTRUCTOR: sqlite3_changegroup
+**
+** An sqlite3_changegroup object is used to combine two or more changesets
+** (or patchsets) into a single changeset (or patchset). A single changegroup
+** object may combine changesets or patchsets, but not both. The output is
+** always in the same format as the input.
+**
+** If successful, this function returns SQLITE_OK and populates (*pp) with
+** a pointer to a new sqlite3_changegroup object before returning. The caller
+** should eventually free the returned object using a call to
+** sqlite3changegroup_delete(). If an error occurs, an SQLite error code
+** (i.e. SQLITE_NOMEM) is returned and *pp is set to NULL.
+**
+** The usual usage pattern for an sqlite3_changegroup object is as follows:
+**
+** <ul>
+** <li> It is created using a call to sqlite3changegroup_new().
+**
+** <li> Zero or more changesets (or patchsets) are added to the object
+** by calling sqlite3changegroup_add().
+**
+** <li> The result of combining all input changesets together is obtained
+** by the application via a call to sqlite3changegroup_output().
+**
+** <li> The object is deleted using a call to sqlite3changegroup_delete().
+** </ul>
+**
+** Any number of calls to add() and output() may be made between the calls to
+** new() and delete(), and in any order.
+**
+** As well as the regular sqlite3changegroup_add() and
+** sqlite3changegroup_output() functions, also available are the streaming
+** versions sqlite3changegroup_add_strm() and sqlite3changegroup_output_strm().
+*/
+SQLITE_API int sqlite3changegroup_new(sqlite3_changegroup **pp);
+
+/*
+** CAPI3REF: Add A Changeset To A Changegroup
+** METHOD: sqlite3_changegroup
+**
+** Add all changes within the changeset (or patchset) in buffer pData (size
+** nData bytes) to the changegroup.
+**
+** If the buffer contains a patchset, then all prior calls to this function
+** on the same changegroup object must also have specified patchsets. Or, if
+** the buffer contains a changeset, so must have the earlier calls to this
+** function. Otherwise, SQLITE_ERROR is returned and no changes are added
+** to the changegroup.
+**
+** Rows within the changeset and changegroup are identified by the values in
+** their PRIMARY KEY columns. A change in the changeset is considered to
+** apply to the same row as a change already present in the changegroup if
+** the two rows have the same primary key.
+**
+** Changes to rows that do not already appear in the changegroup are
+** simply copied into it. Or, if both the new changeset and the changegroup
+** contain changes that apply to a single row, the final contents of the
+** changegroup depends on the type of each change, as follows:
+**
+** <table border=1 style="margin-left:8ex;margin-right:8ex">
+** <tr><th style="white-space:pre">Existing Change </th>
+** <th style="white-space:pre">New Change </th>
+** <th>Output Change
+** <tr><td>INSERT <td>INSERT <td>
+** The new change is ignored. This case does not occur if the new
+** changeset was recorded immediately after the changesets already
+** added to the changegroup.
+** <tr><td>INSERT <td>UPDATE <td>
+** The INSERT change remains in the changegroup. The values in the
+** INSERT change are modified as if the row was inserted by the
+** existing change and then updated according to the new change.
+** <tr><td>INSERT <td>DELETE <td>
+** The existing INSERT is removed from the changegroup. The DELETE is
+** not added.
+** <tr><td>UPDATE <td>INSERT <td>
+** The new change is ignored. This case does not occur if the new
+** changeset was recorded immediately after the changesets already
+** added to the changegroup.
+** <tr><td>UPDATE <td>UPDATE <td>
+** The existing UPDATE remains within the changegroup. It is amended
+** so that the accompanying values are as if the row was updated once
+** by the existing change and then again by the new change.
+** <tr><td>UPDATE <td>DELETE <td>
+** The existing UPDATE is replaced by the new DELETE within the
+** changegroup.
+** <tr><td>DELETE <td>INSERT <td>
+** If one or more of the column values in the row inserted by the
+** new change differ from those in the row deleted by the existing
+** change, the existing DELETE is replaced by an UPDATE within the
+** changegroup. Otherwise, if the inserted row is exactly the same
+** as the deleted row, the existing DELETE is simply discarded.
+** <tr><td>DELETE <td>UPDATE <td>
+** The new change is ignored. This case does not occur if the new
+** changeset was recorded immediately after the changesets already
+** added to the changegroup.
+** <tr><td>DELETE <td>DELETE <td>
+** The new change is ignored. This case does not occur if the new
+** changeset was recorded immediately after the changesets already
+** added to the changegroup.
+** </table>
+**
+** If the new changeset contains changes to a table that is already present
+** in the changegroup, then the number of columns and the position of the
+** primary key columns for the table must be consistent. If this is not the
+** case, this function fails with SQLITE_SCHEMA. If the input changeset
+** appears to be corrupt and the corruption is detected, SQLITE_CORRUPT is
+** returned. Or, if an out-of-memory condition occurs during processing, this
+** function returns SQLITE_NOMEM. In all cases, if an error occurs the state
+** of the final contents of the changegroup is undefined.
+**
+** If no error occurs, SQLITE_OK is returned.
+*/
+SQLITE_API int sqlite3changegroup_add(sqlite3_changegroup*, int nData, void *pData);
+
+/*
+** CAPI3REF: Obtain A Composite Changeset From A Changegroup
+** METHOD: sqlite3_changegroup
+**
+** Obtain a buffer containing a changeset (or patchset) representing the
+** current contents of the changegroup. If the inputs to the changegroup
+** were themselves changesets, the output is a changeset. Or, if the
+** inputs were patchsets, the output is also a patchset.
+**
+** As with the output of the sqlite3session_changeset() and
+** sqlite3session_patchset() functions, all changes related to a single
+** table are grouped together in the output of this function. Tables appear
+** in the same order as for the very first changeset added to the changegroup.
+** If the second or subsequent changesets added to the changegroup contain
+** changes for tables that do not appear in the first changeset, they are
+** appended onto the end of the output changeset, again in the order in
+** which they are first encountered.
+**
+** If an error occurs, an SQLite error code is returned and the output
+** variables (*pnData) and (*ppData) are set to 0. Otherwise, SQLITE_OK
+** is returned and the output variables are set to the size of and a
+** pointer to the output buffer, respectively. In this case it is the
+** responsibility of the caller to eventually free the buffer using a
+** call to sqlite3_free().
+*/
+SQLITE_API int sqlite3changegroup_output(
+ sqlite3_changegroup*,
+ int *pnData, /* OUT: Size of output buffer in bytes */
+ void **ppData /* OUT: Pointer to output buffer */
+);
+
+/*
+** CAPI3REF: Delete A Changegroup Object
+** DESTRUCTOR: sqlite3_changegroup
+*/
+SQLITE_API void sqlite3changegroup_delete(sqlite3_changegroup*);
+
+/*
+** CAPI3REF: Apply A Changeset To A Database
+**
+** Apply a changeset or patchset to a database. These functions attempt to
+** update the "main" database attached to handle db with the changes found in
+** the changeset passed via the second and third arguments.
+**
+** The fourth argument (xFilter) passed to these functions is the "filter
+** callback". If it is not NULL, then for each table affected by at least one
+** change in the changeset, the filter callback is invoked with
+** the table name as the second argument, and a copy of the context pointer
+** passed as the sixth argument as the first. If the "filter callback"
+** returns zero, then no attempt is made to apply any changes to the table.
+** Otherwise, if the return value is non-zero or the xFilter argument to
+** is NULL, all changes related to the table are attempted.
+**
+** For each table that is not excluded by the filter callback, this function
+** tests that the target database contains a compatible table. A table is
+** considered compatible if all of the following are true:
+**
+** <ul>
+** <li> The table has the same name as the name recorded in the
+** changeset, and
+** <li> The table has at least as many columns as recorded in the
+** changeset, and
+** <li> The table has primary key columns in the same position as
+** recorded in the changeset.
+** </ul>
+**
+** If there is no compatible table, it is not an error, but none of the
+** changes associated with the table are applied. A warning message is issued
+** via the sqlite3_log() mechanism with the error code SQLITE_SCHEMA. At most
+** one such warning is issued for each table in the changeset.
+**
+** For each change for which there is a compatible table, an attempt is made
+** to modify the table contents according to the UPDATE, INSERT or DELETE
+** change. If a change cannot be applied cleanly, the conflict handler
+** function passed as the fifth argument to sqlite3changeset_apply() may be
+** invoked. A description of exactly when the conflict handler is invoked for
+** each type of change is below.
+**
+** Unlike the xFilter argument, xConflict may not be passed NULL. The results
+** of passing anything other than a valid function pointer as the xConflict
+** argument are undefined.
+**
+** Each time the conflict handler function is invoked, it must return one
+** of [SQLITE_CHANGESET_OMIT], [SQLITE_CHANGESET_ABORT] or
+** [SQLITE_CHANGESET_REPLACE]. SQLITE_CHANGESET_REPLACE may only be returned
+** if the second argument passed to the conflict handler is either
+** SQLITE_CHANGESET_DATA or SQLITE_CHANGESET_CONFLICT. If the conflict-handler
+** returns an illegal value, any changes already made are rolled back and
+** the call to sqlite3changeset_apply() returns SQLITE_MISUSE. Different
+** actions are taken by sqlite3changeset_apply() depending on the value
+** returned by each invocation of the conflict-handler function. Refer to
+** the documentation for the three
+** [SQLITE_CHANGESET_OMIT|available return values] for details.
+**
+** <dl>
+** <dt>DELETE Changes<dd>
+** For each DELETE change, the function checks if the target database
+** contains a row with the same primary key value (or values) as the
+** original row values stored in the changeset. If it does, and the values
+** stored in all non-primary key columns also match the values stored in
+** the changeset the row is deleted from the target database.
+**
+** If a row with matching primary key values is found, but one or more of
+** the non-primary key fields contains a value different from the original
+** row value stored in the changeset, the conflict-handler function is
+** invoked with [SQLITE_CHANGESET_DATA] as the second argument. If the
+** database table has more columns than are recorded in the changeset,
+** only the values of those non-primary key fields are compared against
+** the current database contents - any trailing database table columns
+** are ignored.
+**
+** If no row with matching primary key values is found in the database,
+** the conflict-handler function is invoked with [SQLITE_CHANGESET_NOTFOUND]
+** passed as the second argument.
+**
+** If the DELETE operation is attempted, but SQLite returns SQLITE_CONSTRAINT
+** (which can only happen if a foreign key constraint is violated), the
+** conflict-handler function is invoked with [SQLITE_CHANGESET_CONSTRAINT]
+** passed as the second argument. This includes the case where the DELETE
+** operation is attempted because an earlier call to the conflict handler
+** function returned [SQLITE_CHANGESET_REPLACE].
+**
+** <dt>INSERT Changes<dd>
+** For each INSERT change, an attempt is made to insert the new row into
+** the database. If the changeset row contains fewer fields than the
+** database table, the trailing fields are populated with their default
+** values.
+**
+** If the attempt to insert the row fails because the database already
+** contains a row with the same primary key values, the conflict handler
+** function is invoked with the second argument set to
+** [SQLITE_CHANGESET_CONFLICT].
+**
+** If the attempt to insert the row fails because of some other constraint
+** violation (e.g. NOT NULL or UNIQUE), the conflict handler function is
+** invoked with the second argument set to [SQLITE_CHANGESET_CONSTRAINT].
+** This includes the case where the INSERT operation is re-attempted because
+** an earlier call to the conflict handler function returned
+** [SQLITE_CHANGESET_REPLACE].
+**
+** <dt>UPDATE Changes<dd>
+** For each UPDATE change, the function checks if the target database
+** contains a row with the same primary key value (or values) as the
+** original row values stored in the changeset. If it does, and the values
+** stored in all modified non-primary key columns also match the values
+** stored in the changeset the row is updated within the target database.
+**
+** If a row with matching primary key values is found, but one or more of
+** the modified non-primary key fields contains a value different from an
+** original row value stored in the changeset, the conflict-handler function
+** is invoked with [SQLITE_CHANGESET_DATA] as the second argument. Since
+** UPDATE changes only contain values for non-primary key fields that are
+** to be modified, only those fields need to match the original values to
+** avoid the SQLITE_CHANGESET_DATA conflict-handler callback.
+**
+** If no row with matching primary key values is found in the database,
+** the conflict-handler function is invoked with [SQLITE_CHANGESET_NOTFOUND]
+** passed as the second argument.
+**
+** If the UPDATE operation is attempted, but SQLite returns
+** SQLITE_CONSTRAINT, the conflict-handler function is invoked with
+** [SQLITE_CHANGESET_CONSTRAINT] passed as the second argument.
+** This includes the case where the UPDATE operation is attempted after
+** an earlier call to the conflict handler function returned
+** [SQLITE_CHANGESET_REPLACE].
+** </dl>
+**
+** It is safe to execute SQL statements, including those that write to the
+** table that the callback related to, from within the xConflict callback.
+** This can be used to further customize the application's conflict
+** resolution strategy.
+**
+** All changes made by these functions are enclosed in a savepoint transaction.
+** If any other error (aside from a constraint failure when attempting to
+** write to the target database) occurs, then the savepoint transaction is
+** rolled back, restoring the target database to its original state, and an
+** SQLite error code returned.
+**
+** If the output parameters (ppRebase) and (pnRebase) are non-NULL and
+** the input is a changeset (not a patchset), then sqlite3changeset_apply_v2()
+** may set (*ppRebase) to point to a "rebase" that may be used with the
+** sqlite3_rebaser APIs buffer before returning. In this case (*pnRebase)
+** is set to the size of the buffer in bytes. It is the responsibility of the
+** caller to eventually free any such buffer using sqlite3_free(). The buffer
+** is only allocated and populated if one or more conflicts were encountered
+** while applying the patchset. See comments surrounding the sqlite3_rebaser
+** APIs for further details.
+**
+** The behavior of sqlite3changeset_apply_v2() and its streaming equivalent
+** may be modified by passing a combination of
+** [SQLITE_CHANGESETAPPLY_NOSAVEPOINT | supported flags] as the 9th parameter.
+**
+** Note that the sqlite3changeset_apply_v2() API is still <b>experimental</b>
+** and therefore subject to change.
+*/
+SQLITE_API int sqlite3changeset_apply(
+ sqlite3 *db, /* Apply change to "main" db of this handle */
+ int nChangeset, /* Size of changeset in bytes */
+ void *pChangeset, /* Changeset blob */
+ int(*xFilter)(
+ void *pCtx, /* Copy of sixth arg to _apply() */
+ const char *zTab /* Table name */
+ ),
+ int(*xConflict)(
+ void *pCtx, /* Copy of sixth arg to _apply() */
+ int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */
+ sqlite3_changeset_iter *p /* Handle describing change and conflict */
+ ),
+ void *pCtx /* First argument passed to xConflict */
+);
+SQLITE_API int sqlite3changeset_apply_v2(
+ sqlite3 *db, /* Apply change to "main" db of this handle */
+ int nChangeset, /* Size of changeset in bytes */
+ void *pChangeset, /* Changeset blob */
+ int(*xFilter)(
+ void *pCtx, /* Copy of sixth arg to _apply() */
+ const char *zTab /* Table name */
+ ),
+ int(*xConflict)(
+ void *pCtx, /* Copy of sixth arg to _apply() */
+ int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */
+ sqlite3_changeset_iter *p /* Handle describing change and conflict */
+ ),
+ void *pCtx, /* First argument passed to xConflict */
+ void **ppRebase, int *pnRebase, /* OUT: Rebase data */
+ int flags /* SESSION_CHANGESETAPPLY_* flags */
+);
+
+/*
+** CAPI3REF: Flags for sqlite3changeset_apply_v2
+**
+** The following flags may passed via the 9th parameter to
+** [sqlite3changeset_apply_v2] and [sqlite3changeset_apply_v2_strm]:
+**
+** <dl>
+** <dt>SQLITE_CHANGESETAPPLY_NOSAVEPOINT <dd>
+** Usually, the sessions module encloses all operations performed by
+** a single call to apply_v2() or apply_v2_strm() in a [SAVEPOINT]. The
+** SAVEPOINT is committed if the changeset or patchset is successfully
+** applied, or rolled back if an error occurs. Specifying this flag
+** causes the sessions module to omit this savepoint. In this case, if the
+** caller has an open transaction or savepoint when apply_v2() is called,
+** it may revert the partially applied changeset by rolling it back.
+**
+** <dt>SQLITE_CHANGESETAPPLY_INVERT <dd>
+** Invert the changeset before applying it. This is equivalent to inverting
+** a changeset using sqlite3changeset_invert() before applying it. It is
+** an error to specify this flag with a patchset.
+*/
+#define SQLITE_CHANGESETAPPLY_NOSAVEPOINT 0x0001
+#define SQLITE_CHANGESETAPPLY_INVERT 0x0002
+
+/*
+** CAPI3REF: Constants Passed To The Conflict Handler
+**
+** Values that may be passed as the second argument to a conflict-handler.
+**
+** <dl>
+** <dt>SQLITE_CHANGESET_DATA<dd>
+** The conflict handler is invoked with CHANGESET_DATA as the second argument
+** when processing a DELETE or UPDATE change if a row with the required
+** PRIMARY KEY fields is present in the database, but one or more other
+** (non primary-key) fields modified by the update do not contain the
+** expected "before" values.
+**
+** The conflicting row, in this case, is the database row with the matching
+** primary key.
+**
+** <dt>SQLITE_CHANGESET_NOTFOUND<dd>
+** The conflict handler is invoked with CHANGESET_NOTFOUND as the second
+** argument when processing a DELETE or UPDATE change if a row with the
+** required PRIMARY KEY fields is not present in the database.
+**
+** There is no conflicting row in this case. The results of invoking the
+** sqlite3changeset_conflict() API are undefined.
+**
+** <dt>SQLITE_CHANGESET_CONFLICT<dd>
+** CHANGESET_CONFLICT is passed as the second argument to the conflict
+** handler while processing an INSERT change if the operation would result
+** in duplicate primary key values.
+**
+** The conflicting row in this case is the database row with the matching
+** primary key.
+**
+** <dt>SQLITE_CHANGESET_FOREIGN_KEY<dd>
+** If foreign key handling is enabled, and applying a changeset leaves the
+** database in a state containing foreign key violations, the conflict
+** handler is invoked with CHANGESET_FOREIGN_KEY as the second argument
+** exactly once before the changeset is committed. If the conflict handler
+** returns CHANGESET_OMIT, the changes, including those that caused the
+** foreign key constraint violation, are committed. Or, if it returns
+** CHANGESET_ABORT, the changeset is rolled back.
+**
+** No current or conflicting row information is provided. The only function
+** it is possible to call on the supplied sqlite3_changeset_iter handle
+** is sqlite3changeset_fk_conflicts().
+**
+** <dt>SQLITE_CHANGESET_CONSTRAINT<dd>
+** If any other constraint violation occurs while applying a change (i.e.
+** a UNIQUE, CHECK or NOT NULL constraint), the conflict handler is
+** invoked with CHANGESET_CONSTRAINT as the second argument.
+**
+** There is no conflicting row in this case. The results of invoking the
+** sqlite3changeset_conflict() API are undefined.
+**
+** </dl>
+*/
+#define SQLITE_CHANGESET_DATA 1
+#define SQLITE_CHANGESET_NOTFOUND 2
+#define SQLITE_CHANGESET_CONFLICT 3
+#define SQLITE_CHANGESET_CONSTRAINT 4
+#define SQLITE_CHANGESET_FOREIGN_KEY 5
+
+/*
+** CAPI3REF: Constants Returned By The Conflict Handler
+**
+** A conflict handler callback must return one of the following three values.
+**
+** <dl>
+** <dt>SQLITE_CHANGESET_OMIT<dd>
+** If a conflict handler returns this value no special action is taken. The
+** change that caused the conflict is not applied. The session module
+** continues to the next change in the changeset.
+**
+** <dt>SQLITE_CHANGESET_REPLACE<dd>
+** This value may only be returned if the second argument to the conflict
+** handler was SQLITE_CHANGESET_DATA or SQLITE_CHANGESET_CONFLICT. If this
+** is not the case, any changes applied so far are rolled back and the
+** call to sqlite3changeset_apply() returns SQLITE_MISUSE.
+**
+** If CHANGESET_REPLACE is returned by an SQLITE_CHANGESET_DATA conflict
+** handler, then the conflicting row is either updated or deleted, depending
+** on the type of change.
+**
+** If CHANGESET_REPLACE is returned by an SQLITE_CHANGESET_CONFLICT conflict
+** handler, then the conflicting row is removed from the database and a
+** second attempt to apply the change is made. If this second attempt fails,
+** the original row is restored to the database before continuing.
+**
+** <dt>SQLITE_CHANGESET_ABORT<dd>
+** If this value is returned, any changes applied so far are rolled back
+** and the call to sqlite3changeset_apply() returns SQLITE_ABORT.
+** </dl>
+*/
+#define SQLITE_CHANGESET_OMIT 0
+#define SQLITE_CHANGESET_REPLACE 1
+#define SQLITE_CHANGESET_ABORT 2
+
+/*
+** CAPI3REF: Rebasing changesets
+** EXPERIMENTAL
+**
+** Suppose there is a site hosting a database in state S0. And that
+** modifications are made that move that database to state S1 and a
+** changeset recorded (the "local" changeset). Then, a changeset based
+** on S0 is received from another site (the "remote" changeset) and
+** applied to the database. The database is then in state
+** (S1+"remote"), where the exact state depends on any conflict
+** resolution decisions (OMIT or REPLACE) made while applying "remote".
+** Rebasing a changeset is to update it to take those conflict
+** resolution decisions into account, so that the same conflicts
+** do not have to be resolved elsewhere in the network.
+**
+** For example, if both the local and remote changesets contain an
+** INSERT of the same key on "CREATE TABLE t1(a PRIMARY KEY, b)":
+**
+** local: INSERT INTO t1 VALUES(1, 'v1');
+** remote: INSERT INTO t1 VALUES(1, 'v2');
+**
+** and the conflict resolution is REPLACE, then the INSERT change is
+** removed from the local changeset (it was overridden). Or, if the
+** conflict resolution was "OMIT", then the local changeset is modified
+** to instead contain:
+**
+** UPDATE t1 SET b = 'v2' WHERE a=1;
+**
+** Changes within the local changeset are rebased as follows:
+**
+** <dl>
+** <dt>Local INSERT<dd>
+** This may only conflict with a remote INSERT. If the conflict
+** resolution was OMIT, then add an UPDATE change to the rebased
+** changeset. Or, if the conflict resolution was REPLACE, add
+** nothing to the rebased changeset.
+**
+** <dt>Local DELETE<dd>
+** This may conflict with a remote UPDATE or DELETE. In both cases the
+** only possible resolution is OMIT. If the remote operation was a
+** DELETE, then add no change to the rebased changeset. If the remote
+** operation was an UPDATE, then the old.* fields of change are updated
+** to reflect the new.* values in the UPDATE.
+**
+** <dt>Local UPDATE<dd>
+** This may conflict with a remote UPDATE or DELETE. If it conflicts
+** with a DELETE, and the conflict resolution was OMIT, then the update
+** is changed into an INSERT. Any undefined values in the new.* record
+** from the update change are filled in using the old.* values from
+** the conflicting DELETE. Or, if the conflict resolution was REPLACE,
+** the UPDATE change is simply omitted from the rebased changeset.
+**
+** If conflict is with a remote UPDATE and the resolution is OMIT, then
+** the old.* values are rebased using the new.* values in the remote
+** change. Or, if the resolution is REPLACE, then the change is copied
+** into the rebased changeset with updates to columns also updated by
+** the conflicting remote UPDATE removed. If this means no columns would
+** be updated, the change is omitted.
+** </dl>
+**
+** A local change may be rebased against multiple remote changes
+** simultaneously. If a single key is modified by multiple remote
+** changesets, they are combined as follows before the local changeset
+** is rebased:
+**
+** <ul>
+** <li> If there has been one or more REPLACE resolutions on a
+** key, it is rebased according to a REPLACE.
+**
+** <li> If there have been no REPLACE resolutions on a key, then
+** the local changeset is rebased according to the most recent
+** of the OMIT resolutions.
+** </ul>
+**
+** Note that conflict resolutions from multiple remote changesets are
+** combined on a per-field basis, not per-row. This means that in the
+** case of multiple remote UPDATE operations, some fields of a single
+** local change may be rebased for REPLACE while others are rebased for
+** OMIT.
+**
+** In order to rebase a local changeset, the remote changeset must first
+** be applied to the local database using sqlite3changeset_apply_v2() and
+** the buffer of rebase information captured. Then:
+**
+** <ol>
+** <li> An sqlite3_rebaser object is created by calling
+** sqlite3rebaser_create().
+** <li> The new object is configured with the rebase buffer obtained from
+** sqlite3changeset_apply_v2() by calling sqlite3rebaser_configure().
+** If the local changeset is to be rebased against multiple remote
+** changesets, then sqlite3rebaser_configure() should be called
+** multiple times, in the same order that the multiple
+** sqlite3changeset_apply_v2() calls were made.
+** <li> Each local changeset is rebased by calling sqlite3rebaser_rebase().
+** <li> The sqlite3_rebaser object is deleted by calling
+** sqlite3rebaser_delete().
+** </ol>
+*/
+typedef struct sqlite3_rebaser sqlite3_rebaser;
+
+/*
+** CAPI3REF: Create a changeset rebaser object.
+** EXPERIMENTAL
+**
+** Allocate a new changeset rebaser object. If successful, set (*ppNew) to
+** point to the new object and return SQLITE_OK. Otherwise, if an error
+** occurs, return an SQLite error code (e.g. SQLITE_NOMEM) and set (*ppNew)
+** to NULL.
+*/
+SQLITE_API int sqlite3rebaser_create(sqlite3_rebaser **ppNew);
+
+/*
+** CAPI3REF: Configure a changeset rebaser object.
+** EXPERIMENTAL
+**
+** Configure the changeset rebaser object to rebase changesets according
+** to the conflict resolutions described by buffer pRebase (size nRebase
+** bytes), which must have been obtained from a previous call to
+** sqlite3changeset_apply_v2().
+*/
+SQLITE_API int sqlite3rebaser_configure(
+ sqlite3_rebaser*,
+ int nRebase, const void *pRebase
+);
+
+/*
+** CAPI3REF: Rebase a changeset
+** EXPERIMENTAL
+**
+** Argument pIn must point to a buffer containing a changeset nIn bytes
+** in size. This function allocates and populates a buffer with a copy
+** of the changeset rebased according to the configuration of the
+** rebaser object passed as the first argument. If successful, (*ppOut)
+** is set to point to the new buffer containing the rebased changeset and
+** (*pnOut) to its size in bytes and SQLITE_OK returned. It is the
+** responsibility of the caller to eventually free the new buffer using
+** sqlite3_free(). Otherwise, if an error occurs, (*ppOut) and (*pnOut)
+** are set to zero and an SQLite error code returned.
+*/
+SQLITE_API int sqlite3rebaser_rebase(
+ sqlite3_rebaser*,
+ int nIn, const void *pIn,
+ int *pnOut, void **ppOut
+);
+
+/*
+** CAPI3REF: Delete a changeset rebaser object.
+** EXPERIMENTAL
+**
+** Delete the changeset rebaser object and all associated resources. There
+** should be one call to this function for each successful invocation
+** of sqlite3rebaser_create().
+*/
+SQLITE_API void sqlite3rebaser_delete(sqlite3_rebaser *p);
+
+/*
+** CAPI3REF: Streaming Versions of API functions.
+**
+** The six streaming API xxx_strm() functions serve similar purposes to the
+** corresponding non-streaming API functions:
+**
+** <table border=1 style="margin-left:8ex;margin-right:8ex">
+** <tr><th>Streaming function<th>Non-streaming equivalent</th>
+** <tr><td>sqlite3changeset_apply_strm<td>[sqlite3changeset_apply]
+** <tr><td>sqlite3changeset_apply_strm_v2<td>[sqlite3changeset_apply_v2]
+** <tr><td>sqlite3changeset_concat_strm<td>[sqlite3changeset_concat]
+** <tr><td>sqlite3changeset_invert_strm<td>[sqlite3changeset_invert]
+** <tr><td>sqlite3changeset_start_strm<td>[sqlite3changeset_start]
+** <tr><td>sqlite3session_changeset_strm<td>[sqlite3session_changeset]
+** <tr><td>sqlite3session_patchset_strm<td>[sqlite3session_patchset]
+** </table>
+**
+** Non-streaming functions that accept changesets (or patchsets) as input
+** require that the entire changeset be stored in a single buffer in memory.
+** Similarly, those that return a changeset or patchset do so by returning
+** a pointer to a single large buffer allocated using sqlite3_malloc().
+** Normally this is convenient. However, if an application running in a
+** low-memory environment is required to handle very large changesets, the
+** large contiguous memory allocations required can become onerous.
+**
+** In order to avoid this problem, instead of a single large buffer, input
+** is passed to a streaming API functions by way of a callback function that
+** the sessions module invokes to incrementally request input data as it is
+** required. In all cases, a pair of API function parameters such as
+**
+** <pre>
+** &nbsp; int nChangeset,
+** &nbsp; void *pChangeset,
+** </pre>
+**
+** Is replaced by:
+**
+** <pre>
+** &nbsp; int (*xInput)(void *pIn, void *pData, int *pnData),
+** &nbsp; void *pIn,
+** </pre>
+**
+** Each time the xInput callback is invoked by the sessions module, the first
+** argument passed is a copy of the supplied pIn context pointer. The second
+** argument, pData, points to a buffer (*pnData) bytes in size. Assuming no
+** error occurs the xInput method should copy up to (*pnData) bytes of data
+** into the buffer and set (*pnData) to the actual number of bytes copied
+** before returning SQLITE_OK. If the input is completely exhausted, (*pnData)
+** should be set to zero to indicate this. Or, if an error occurs, an SQLite
+** error code should be returned. In all cases, if an xInput callback returns
+** an error, all processing is abandoned and the streaming API function
+** returns a copy of the error code to the caller.
+**
+** In the case of sqlite3changeset_start_strm(), the xInput callback may be
+** invoked by the sessions module at any point during the lifetime of the
+** iterator. If such an xInput callback returns an error, the iterator enters
+** an error state, whereby all subsequent calls to iterator functions
+** immediately fail with the same error code as returned by xInput.
+**
+** Similarly, streaming API functions that return changesets (or patchsets)
+** return them in chunks by way of a callback function instead of via a
+** pointer to a single large buffer. In this case, a pair of parameters such
+** as:
+**
+** <pre>
+** &nbsp; int *pnChangeset,
+** &nbsp; void **ppChangeset,
+** </pre>
+**
+** Is replaced by:
+**
+** <pre>
+** &nbsp; int (*xOutput)(void *pOut, const void *pData, int nData),
+** &nbsp; void *pOut
+** </pre>
+**
+** The xOutput callback is invoked zero or more times to return data to
+** the application. The first parameter passed to each call is a copy of the
+** pOut pointer supplied by the application. The second parameter, pData,
+** points to a buffer nData bytes in size containing the chunk of output
+** data being returned. If the xOutput callback successfully processes the
+** supplied data, it should return SQLITE_OK to indicate success. Otherwise,
+** it should return some other SQLite error code. In this case processing
+** is immediately abandoned and the streaming API function returns a copy
+** of the xOutput error code to the application.
+**
+** The sessions module never invokes an xOutput callback with the third
+** parameter set to a value less than or equal to zero. Other than this,
+** no guarantees are made as to the size of the chunks of data returned.
+*/
+SQLITE_API int sqlite3changeset_apply_strm(
+ sqlite3 *db, /* Apply change to "main" db of this handle */
+ int (*xInput)(void *pIn, void *pData, int *pnData), /* Input function */
+ void *pIn, /* First arg for xInput */
+ int(*xFilter)(
+ void *pCtx, /* Copy of sixth arg to _apply() */
+ const char *zTab /* Table name */
+ ),
+ int(*xConflict)(
+ void *pCtx, /* Copy of sixth arg to _apply() */
+ int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */
+ sqlite3_changeset_iter *p /* Handle describing change and conflict */
+ ),
+ void *pCtx /* First argument passed to xConflict */
+);
+SQLITE_API int sqlite3changeset_apply_v2_strm(
+ sqlite3 *db, /* Apply change to "main" db of this handle */
+ int (*xInput)(void *pIn, void *pData, int *pnData), /* Input function */
+ void *pIn, /* First arg for xInput */
+ int(*xFilter)(
+ void *pCtx, /* Copy of sixth arg to _apply() */
+ const char *zTab /* Table name */
+ ),
+ int(*xConflict)(
+ void *pCtx, /* Copy of sixth arg to _apply() */
+ int eConflict, /* DATA, MISSING, CONFLICT, CONSTRAINT */
+ sqlite3_changeset_iter *p /* Handle describing change and conflict */
+ ),
+ void *pCtx, /* First argument passed to xConflict */
+ void **ppRebase, int *pnRebase,
+ int flags
+);
+SQLITE_API int sqlite3changeset_concat_strm(
+ int (*xInputA)(void *pIn, void *pData, int *pnData),
+ void *pInA,
+ int (*xInputB)(void *pIn, void *pData, int *pnData),
+ void *pInB,
+ int (*xOutput)(void *pOut, const void *pData, int nData),
+ void *pOut
+);
+SQLITE_API int sqlite3changeset_invert_strm(
+ int (*xInput)(void *pIn, void *pData, int *pnData),
+ void *pIn,
+ int (*xOutput)(void *pOut, const void *pData, int nData),
+ void *pOut
+);
+SQLITE_API int sqlite3changeset_start_strm(
+ sqlite3_changeset_iter **pp,
+ int (*xInput)(void *pIn, void *pData, int *pnData),
+ void *pIn
+);
+SQLITE_API int sqlite3changeset_start_v2_strm(
+ sqlite3_changeset_iter **pp,
+ int (*xInput)(void *pIn, void *pData, int *pnData),
+ void *pIn,
+ int flags
+);
+SQLITE_API int sqlite3session_changeset_strm(
+ sqlite3_session *pSession,
+ int (*xOutput)(void *pOut, const void *pData, int nData),
+ void *pOut
+);
+SQLITE_API int sqlite3session_patchset_strm(
+ sqlite3_session *pSession,
+ int (*xOutput)(void *pOut, const void *pData, int nData),
+ void *pOut
+);
+SQLITE_API int sqlite3changegroup_add_strm(sqlite3_changegroup*,
+ int (*xInput)(void *pIn, void *pData, int *pnData),
+ void *pIn
+);
+SQLITE_API int sqlite3changegroup_output_strm(sqlite3_changegroup*,
+ int (*xOutput)(void *pOut, const void *pData, int nData),
+ void *pOut
+);
+SQLITE_API int sqlite3rebaser_rebase_strm(
+ sqlite3_rebaser *pRebaser,
+ int (*xInput)(void *pIn, void *pData, int *pnData),
+ void *pIn,
+ int (*xOutput)(void *pOut, const void *pData, int nData),
+ void *pOut
+);
+
+/*
+** CAPI3REF: Configure global parameters
+**
+** The sqlite3session_config() interface is used to make global configuration
+** changes to the sessions module in order to tune it to the specific needs
+** of the application.
+**
+** The sqlite3session_config() interface is not threadsafe. If it is invoked
+** while any other thread is inside any other sessions method then the
+** results are undefined. Furthermore, if it is invoked after any sessions
+** related objects have been created, the results are also undefined.
+**
+** The first argument to the sqlite3session_config() function must be one
+** of the SQLITE_SESSION_CONFIG_XXX constants defined below. The
+** interpretation of the (void*) value passed as the second parameter and
+** the effect of calling this function depends on the value of the first
+** parameter.
+**
+** <dl>
+** <dt>SQLITE_SESSION_CONFIG_STRMSIZE<dd>
+** By default, the sessions module streaming interfaces attempt to input
+** and output data in approximately 1 KiB chunks. This operand may be used
+** to set and query the value of this configuration setting. The pointer
+** passed as the second argument must point to a value of type (int).
+** If this value is greater than 0, it is used as the new streaming data
+** chunk size for both input and output. Before returning, the (int) value
+** pointed to by pArg is set to the final value of the streaming interface
+** chunk size.
+** </dl>
+**
+** This function returns SQLITE_OK if successful, or an SQLite error code
+** otherwise.
+*/
+SQLITE_API int sqlite3session_config(int op, void *pArg);
+
+/*
+** CAPI3REF: Values for sqlite3session_config().
+*/
+#define SQLITE_SESSION_CONFIG_STRMSIZE 1
+
+/*
+** Make sure we can call this stuff from C++.
+*/
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* !defined(__SQLITESESSION_H_) && defined(SQLITE_ENABLE_SESSION) */
+
+/******** End of sqlite3session.h *********/
+/******** Begin file fts5.h *********/
+/*
+** 2014 May 31
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+******************************************************************************
+**
+** Interfaces to extend FTS5. Using the interfaces defined in this file,
+** FTS5 may be extended with:
+**
+** * custom tokenizers, and
+** * custom auxiliary functions.
+*/
+
+
+#ifndef _FTS5_H
+#define _FTS5_H
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*************************************************************************
+** CUSTOM AUXILIARY FUNCTIONS
+**
+** Virtual table implementations may overload SQL functions by implementing
+** the sqlite3_module.xFindFunction() method.
+*/
+
+typedef struct Fts5ExtensionApi Fts5ExtensionApi;
+typedef struct Fts5Context Fts5Context;
+typedef struct Fts5PhraseIter Fts5PhraseIter;
+
+typedef void (*fts5_extension_function)(
+ const Fts5ExtensionApi *pApi, /* API offered by current FTS version */
+ Fts5Context *pFts, /* First arg to pass to pApi functions */
+ sqlite3_context *pCtx, /* Context for returning result/error */
+ int nVal, /* Number of values in apVal[] array */
+ sqlite3_value **apVal /* Array of trailing arguments */
+);
+
+struct Fts5PhraseIter {
+ const unsigned char *a;
+ const unsigned char *b;
+};
+
+/*
+** EXTENSION API FUNCTIONS
+**
+** xUserData(pFts):
+** Return a copy of the context pointer the extension function was
+** registered with.
+**
+** xColumnTotalSize(pFts, iCol, pnToken):
+** If parameter iCol is less than zero, set output variable *pnToken
+** to the total number of tokens in the FTS5 table. Or, if iCol is
+** non-negative but less than the number of columns in the table, return
+** the total number of tokens in column iCol, considering all rows in
+** the FTS5 table.
+**
+** If parameter iCol is greater than or equal to the number of columns
+** in the table, SQLITE_RANGE is returned. Or, if an error occurs (e.g.
+** an OOM condition or IO error), an appropriate SQLite error code is
+** returned.
+**
+** xColumnCount(pFts):
+** Return the number of columns in the table.
+**
+** xColumnSize(pFts, iCol, pnToken):
+** If parameter iCol is less than zero, set output variable *pnToken
+** to the total number of tokens in the current row. Or, if iCol is
+** non-negative but less than the number of columns in the table, set
+** *pnToken to the number of tokens in column iCol of the current row.
+**
+** If parameter iCol is greater than or equal to the number of columns
+** in the table, SQLITE_RANGE is returned. Or, if an error occurs (e.g.
+** an OOM condition or IO error), an appropriate SQLite error code is
+** returned.
+**
+** This function may be quite inefficient if used with an FTS5 table
+** created with the "columnsize=0" option.
+**
+** xColumnText:
+** This function attempts to retrieve the text of column iCol of the
+** current document. If successful, (*pz) is set to point to a buffer
+** containing the text in utf-8 encoding, (*pn) is set to the size in bytes
+** (not characters) of the buffer and SQLITE_OK is returned. Otherwise,
+** if an error occurs, an SQLite error code is returned and the final values
+** of (*pz) and (*pn) are undefined.
+**
+** xPhraseCount:
+** Returns the number of phrases in the current query expression.
+**
+** xPhraseSize:
+** Returns the number of tokens in phrase iPhrase of the query. Phrases
+** are numbered starting from zero.
+**
+** xInstCount:
+** Set *pnInst to the total number of occurrences of all phrases within
+** the query within the current row. Return SQLITE_OK if successful, or
+** an error code (i.e. SQLITE_NOMEM) if an error occurs.
+**
+** This API can be quite slow if used with an FTS5 table created with the
+** "detail=none" or "detail=column" option. If the FTS5 table is created
+** with either "detail=none" or "detail=column" and "content=" option
+** (i.e. if it is a contentless table), then this API always returns 0.
+**
+** xInst:
+** Query for the details of phrase match iIdx within the current row.
+** Phrase matches are numbered starting from zero, so the iIdx argument
+** should be greater than or equal to zero and smaller than the value
+** output by xInstCount().
+**
+** Usually, output parameter *piPhrase is set to the phrase number, *piCol
+** to the column in which it occurs and *piOff the token offset of the
+** first token of the phrase. Returns SQLITE_OK if successful, or an error
+** code (i.e. SQLITE_NOMEM) if an error occurs.
+**
+** This API can be quite slow if used with an FTS5 table created with the
+** "detail=none" or "detail=column" option.
+**
+** xRowid:
+** Returns the rowid of the current row.
+**
+** xTokenize:
+** Tokenize text using the tokenizer belonging to the FTS5 table.
+**
+** xQueryPhrase(pFts5, iPhrase, pUserData, xCallback):
+** This API function is used to query the FTS table for phrase iPhrase
+** of the current query. Specifically, a query equivalent to:
+**
+** ... FROM ftstable WHERE ftstable MATCH $p ORDER BY rowid
+**
+** with $p set to a phrase equivalent to the phrase iPhrase of the
+** current query is executed. Any column filter that applies to
+** phrase iPhrase of the current query is included in $p. For each
+** row visited, the callback function passed as the fourth argument
+** is invoked. The context and API objects passed to the callback
+** function may be used to access the properties of each matched row.
+** Invoking Api.xUserData() returns a copy of the pointer passed as
+** the third argument to pUserData.
+**
+** If the callback function returns any value other than SQLITE_OK, the
+** query is abandoned and the xQueryPhrase function returns immediately.
+** If the returned value is SQLITE_DONE, xQueryPhrase returns SQLITE_OK.
+** Otherwise, the error code is propagated upwards.
+**
+** If the query runs to completion without incident, SQLITE_OK is returned.
+** Or, if some error occurs before the query completes or is aborted by
+** the callback, an SQLite error code is returned.
+**
+**
+** xSetAuxdata(pFts5, pAux, xDelete)
+**
+** Save the pointer passed as the second argument as the extension function's
+** "auxiliary data". The pointer may then be retrieved by the current or any
+** future invocation of the same fts5 extension function made as part of
+** the same MATCH query using the xGetAuxdata() API.
+**
+** Each extension function is allocated a single auxiliary data slot for
+** each FTS query (MATCH expression). If the extension function is invoked
+** more than once for a single FTS query, then all invocations share a
+** single auxiliary data context.
+**
+** If there is already an auxiliary data pointer when this function is
+** invoked, then it is replaced by the new pointer. If an xDelete callback
+** was specified along with the original pointer, it is invoked at this
+** point.
+**
+** The xDelete callback, if one is specified, is also invoked on the
+** auxiliary data pointer after the FTS5 query has finished.
+**
+** If an error (e.g. an OOM condition) occurs within this function,
+** the auxiliary data is set to NULL and an error code returned. If the
+** xDelete parameter was not NULL, it is invoked on the auxiliary data
+** pointer before returning.
+**
+**
+** xGetAuxdata(pFts5, bClear)
+**
+** Returns the current auxiliary data pointer for the fts5 extension
+** function. See the xSetAuxdata() method for details.
+**
+** If the bClear argument is non-zero, then the auxiliary data is cleared
+** (set to NULL) before this function returns. In this case the xDelete,
+** if any, is not invoked.
+**
+**
+** xRowCount(pFts5, pnRow)
+**
+** This function is used to retrieve the total number of rows in the table.
+** In other words, the same value that would be returned by:
+**
+** SELECT count(*) FROM ftstable;
+**
+** xPhraseFirst()
+** This function is used, along with type Fts5PhraseIter and the xPhraseNext
+** method, to iterate through all instances of a single query phrase within
+** the current row. This is the same information as is accessible via the
+** xInstCount/xInst APIs. While the xInstCount/xInst APIs are more convenient
+** to use, this API may be faster under some circumstances. To iterate
+** through instances of phrase iPhrase, use the following code:
+**
+** Fts5PhraseIter iter;
+** int iCol, iOff;
+** for(pApi->xPhraseFirst(pFts, iPhrase, &iter, &iCol, &iOff);
+** iCol>=0;
+** pApi->xPhraseNext(pFts, &iter, &iCol, &iOff)
+** ){
+** // An instance of phrase iPhrase at offset iOff of column iCol
+** }
+**
+** The Fts5PhraseIter structure is defined above. Applications should not
+** modify this structure directly - it should only be used as shown above
+** with the xPhraseFirst() and xPhraseNext() API methods (and by
+** xPhraseFirstColumn() and xPhraseNextColumn() as illustrated below).
+**
+** This API can be quite slow if used with an FTS5 table created with the
+** "detail=none" or "detail=column" option. If the FTS5 table is created
+** with either "detail=none" or "detail=column" and "content=" option
+** (i.e. if it is a contentless table), then this API always iterates
+** through an empty set (all calls to xPhraseFirst() set iCol to -1).
+**
+** xPhraseNext()
+** See xPhraseFirst above.
+**
+** xPhraseFirstColumn()
+** This function and xPhraseNextColumn() are similar to the xPhraseFirst()
+** and xPhraseNext() APIs described above. The difference is that instead
+** of iterating through all instances of a phrase in the current row, these
+** APIs are used to iterate through the set of columns in the current row
+** that contain one or more instances of a specified phrase. For example:
+**
+** Fts5PhraseIter iter;
+** int iCol;
+** for(pApi->xPhraseFirstColumn(pFts, iPhrase, &iter, &iCol);
+** iCol>=0;
+** pApi->xPhraseNextColumn(pFts, &iter, &iCol)
+** ){
+** // Column iCol contains at least one instance of phrase iPhrase
+** }
+**
+** This API can be quite slow if used with an FTS5 table created with the
+** "detail=none" option. If the FTS5 table is created with either
+** "detail=none" "content=" option (i.e. if it is a contentless table),
+** then this API always iterates through an empty set (all calls to
+** xPhraseFirstColumn() set iCol to -1).
+**
+** The information accessed using this API and its companion
+** xPhraseFirstColumn() may also be obtained using xPhraseFirst/xPhraseNext
+** (or xInst/xInstCount). The chief advantage of this API is that it is
+** significantly more efficient than those alternatives when used with
+** "detail=column" tables.
+**
+** xPhraseNextColumn()
+** See xPhraseFirstColumn above.
+*/
+struct Fts5ExtensionApi {
+ int iVersion; /* Currently always set to 3 */
+
+ void *(*xUserData)(Fts5Context*);
+
+ int (*xColumnCount)(Fts5Context*);
+ int (*xRowCount)(Fts5Context*, sqlite3_int64 *pnRow);
+ int (*xColumnTotalSize)(Fts5Context*, int iCol, sqlite3_int64 *pnToken);
+
+ int (*xTokenize)(Fts5Context*,
+ const char *pText, int nText, /* Text to tokenize */
+ void *pCtx, /* Context passed to xToken() */
+ int (*xToken)(void*, int, const char*, int, int, int) /* Callback */
+ );
+
+ int (*xPhraseCount)(Fts5Context*);
+ int (*xPhraseSize)(Fts5Context*, int iPhrase);
+
+ int (*xInstCount)(Fts5Context*, int *pnInst);
+ int (*xInst)(Fts5Context*, int iIdx, int *piPhrase, int *piCol, int *piOff);
+
+ sqlite3_int64 (*xRowid)(Fts5Context*);
+ int (*xColumnText)(Fts5Context*, int iCol, const char **pz, int *pn);
+ int (*xColumnSize)(Fts5Context*, int iCol, int *pnToken);
+
+ int (*xQueryPhrase)(Fts5Context*, int iPhrase, void *pUserData,
+ int(*)(const Fts5ExtensionApi*,Fts5Context*,void*)
+ );
+ int (*xSetAuxdata)(Fts5Context*, void *pAux, void(*xDelete)(void*));
+ void *(*xGetAuxdata)(Fts5Context*, int bClear);
+
+ int (*xPhraseFirst)(Fts5Context*, int iPhrase, Fts5PhraseIter*, int*, int*);
+ void (*xPhraseNext)(Fts5Context*, Fts5PhraseIter*, int *piCol, int *piOff);
+
+ int (*xPhraseFirstColumn)(Fts5Context*, int iPhrase, Fts5PhraseIter*, int*);
+ void (*xPhraseNextColumn)(Fts5Context*, Fts5PhraseIter*, int *piCol);
+};
+
+/*
+** CUSTOM AUXILIARY FUNCTIONS
+*************************************************************************/
+
+/*************************************************************************
+** CUSTOM TOKENIZERS
+**
+** Applications may also register custom tokenizer types. A tokenizer
+** is registered by providing fts5 with a populated instance of the
+** following structure. All structure methods must be defined, setting
+** any member of the fts5_tokenizer struct to NULL leads to undefined
+** behaviour. The structure methods are expected to function as follows:
+**
+** xCreate:
+** This function is used to allocate and initialize a tokenizer instance.
+** A tokenizer instance is required to actually tokenize text.
+**
+** The first argument passed to this function is a copy of the (void*)
+** pointer provided by the application when the fts5_tokenizer object
+** was registered with FTS5 (the third argument to xCreateTokenizer()).
+** The second and third arguments are an array of nul-terminated strings
+** containing the tokenizer arguments, if any, specified following the
+** tokenizer name as part of the CREATE VIRTUAL TABLE statement used
+** to create the FTS5 table.
+**
+** The final argument is an output variable. If successful, (*ppOut)
+** should be set to point to the new tokenizer handle and SQLITE_OK
+** returned. If an error occurs, some value other than SQLITE_OK should
+** be returned. In this case, fts5 assumes that the final value of *ppOut
+** is undefined.
+**
+** xDelete:
+** This function is invoked to delete a tokenizer handle previously
+** allocated using xCreate(). Fts5 guarantees that this function will
+** be invoked exactly once for each successful call to xCreate().
+**
+** xTokenize:
+** This function is expected to tokenize the nText byte string indicated
+** by argument pText. pText may or may not be nul-terminated. The first
+** argument passed to this function is a pointer to an Fts5Tokenizer object
+** returned by an earlier call to xCreate().
+**
+** The second argument indicates the reason that FTS5 is requesting
+** tokenization of the supplied text. This is always one of the following
+** four values:
+**
+** <ul><li> <b>FTS5_TOKENIZE_DOCUMENT</b> - A document is being inserted into
+** or removed from the FTS table. The tokenizer is being invoked to
+** determine the set of tokens to add to (or delete from) the
+** FTS index.
+**
+** <li> <b>FTS5_TOKENIZE_QUERY</b> - A MATCH query is being executed
+** against the FTS index. The tokenizer is being called to tokenize
+** a bareword or quoted string specified as part of the query.
+**
+** <li> <b>(FTS5_TOKENIZE_QUERY | FTS5_TOKENIZE_PREFIX)</b> - Same as
+** FTS5_TOKENIZE_QUERY, except that the bareword or quoted string is
+** followed by a "*" character, indicating that the last token
+** returned by the tokenizer will be treated as a token prefix.
+**
+** <li> <b>FTS5_TOKENIZE_AUX</b> - The tokenizer is being invoked to
+** satisfy an fts5_api.xTokenize() request made by an auxiliary
+** function. Or an fts5_api.xColumnSize() request made by the same
+** on a columnsize=0 database.
+** </ul>
+**
+** For each token in the input string, the supplied callback xToken() must
+** be invoked. The first argument to it should be a copy of the pointer
+** passed as the second argument to xTokenize(). The third and fourth
+** arguments are a pointer to a buffer containing the token text, and the
+** size of the token in bytes. The 4th and 5th arguments are the byte offsets
+** of the first byte of and first byte immediately following the text from
+** which the token is derived within the input.
+**
+** The second argument passed to the xToken() callback ("tflags") should
+** normally be set to 0. The exception is if the tokenizer supports
+** synonyms. In this case see the discussion below for details.
+**
+** FTS5 assumes the xToken() callback is invoked for each token in the
+** order that they occur within the input text.
+**
+** If an xToken() callback returns any value other than SQLITE_OK, then
+** the tokenization should be abandoned and the xTokenize() method should
+** immediately return a copy of the xToken() return value. Or, if the
+** input buffer is exhausted, xTokenize() should return SQLITE_OK. Finally,
+** if an error occurs with the xTokenize() implementation itself, it
+** may abandon the tokenization and return any error code other than
+** SQLITE_OK or SQLITE_DONE.
+**
+** SYNONYM SUPPORT
+**
+** Custom tokenizers may also support synonyms. Consider a case in which a
+** user wishes to query for a phrase such as "first place". Using the
+** built-in tokenizers, the FTS5 query 'first + place' will match instances
+** of "first place" within the document set, but not alternative forms
+** such as "1st place". In some applications, it would be better to match
+** all instances of "first place" or "1st place" regardless of which form
+** the user specified in the MATCH query text.
+**
+** There are several ways to approach this in FTS5:
+**
+** <ol><li> By mapping all synonyms to a single token. In this case, using
+** the above example, this means that the tokenizer returns the
+** same token for inputs "first" and "1st". Say that token is in
+** fact "first", so that when the user inserts the document "I won
+** 1st place" entries are added to the index for tokens "i", "won",
+** "first" and "place". If the user then queries for '1st + place',
+** the tokenizer substitutes "first" for "1st" and the query works
+** as expected.
+**
+** <li> By querying the index for all synonyms of each query term
+** separately. In this case, when tokenizing query text, the
+** tokenizer may provide multiple synonyms for a single term
+** within the document. FTS5 then queries the index for each
+** synonym individually. For example, faced with the query:
+**
+** <codeblock>
+** ... MATCH 'first place'</codeblock>
+**
+** the tokenizer offers both "1st" and "first" as synonyms for the
+** first token in the MATCH query and FTS5 effectively runs a query
+** similar to:
+**
+** <codeblock>
+** ... MATCH '(first OR 1st) place'</codeblock>
+**
+** except that, for the purposes of auxiliary functions, the query
+** still appears to contain just two phrases - "(first OR 1st)"
+** being treated as a single phrase.
+**
+** <li> By adding multiple synonyms for a single term to the FTS index.
+** Using this method, when tokenizing document text, the tokenizer
+** provides multiple synonyms for each token. So that when a
+** document such as "I won first place" is tokenized, entries are
+** added to the FTS index for "i", "won", "first", "1st" and
+** "place".
+**
+** This way, even if the tokenizer does not provide synonyms
+** when tokenizing query text (it should not - to do so would be
+** inefficient), it doesn't matter if the user queries for
+** 'first + place' or '1st + place', as there are entries in the
+** FTS index corresponding to both forms of the first token.
+** </ol>
+**
+** Whether it is parsing document or query text, any call to xToken that
+** specifies a <i>tflags</i> argument with the FTS5_TOKEN_COLOCATED bit
+** is considered to supply a synonym for the previous token. For example,
+** when parsing the document "I won first place", a tokenizer that supports
+** synonyms would call xToken() 5 times, as follows:
+**
+** <codeblock>
+** xToken(pCtx, 0, "i", 1, 0, 1);
+** xToken(pCtx, 0, "won", 3, 2, 5);
+** xToken(pCtx, 0, "first", 5, 6, 11);
+** xToken(pCtx, FTS5_TOKEN_COLOCATED, "1st", 3, 6, 11);
+** xToken(pCtx, 0, "place", 5, 12, 17);
+**</codeblock>
+**
+** It is an error to specify the FTS5_TOKEN_COLOCATED flag the first time
+** xToken() is called. Multiple synonyms may be specified for a single token
+** by making multiple calls to xToken(FTS5_TOKEN_COLOCATED) in sequence.
+** There is no limit to the number of synonyms that may be provided for a
+** single token.
+**
+** In many cases, method (1) above is the best approach. It does not add
+** extra data to the FTS index or require FTS5 to query for multiple terms,
+** so it is efficient in terms of disk space and query speed. However, it
+** does not support prefix queries very well. If, as suggested above, the
+** token "first" is substituted for "1st" by the tokenizer, then the query:
+**
+** <codeblock>
+** ... MATCH '1s*'</codeblock>
+**
+** will not match documents that contain the token "1st" (as the tokenizer
+** will probably not map "1s" to any prefix of "first").
+**
+** For full prefix support, method (3) may be preferred. In this case,
+** because the index contains entries for both "first" and "1st", prefix
+** queries such as 'fi*' or '1s*' will match correctly. However, because
+** extra entries are added to the FTS index, this method uses more space
+** within the database.
+**
+** Method (2) offers a midpoint between (1) and (3). Using this method,
+** a query such as '1s*' will match documents that contain the literal
+** token "1st", but not "first" (assuming the tokenizer is not able to
+** provide synonyms for prefixes). However, a non-prefix query like '1st'
+** will match against "1st" and "first". This method does not require
+** extra disk space, as no extra entries are added to the FTS index.
+** On the other hand, it may require more CPU cycles to run MATCH queries,
+** as separate queries of the FTS index are required for each synonym.
+**
+** When using methods (2) or (3), it is important that the tokenizer only
+** provide synonyms when tokenizing document text (method (2)) or query
+** text (method (3)), not both. Doing so will not cause any errors, but is
+** inefficient.
+*/
+typedef struct Fts5Tokenizer Fts5Tokenizer;
+typedef struct fts5_tokenizer fts5_tokenizer;
+struct fts5_tokenizer {
+ int (*xCreate)(void*, const char **azArg, int nArg, Fts5Tokenizer **ppOut);
+ void (*xDelete)(Fts5Tokenizer*);
+ int (*xTokenize)(Fts5Tokenizer*,
+ void *pCtx,
+ int flags, /* Mask of FTS5_TOKENIZE_* flags */
+ const char *pText, int nText,
+ int (*xToken)(
+ void *pCtx, /* Copy of 2nd argument to xTokenize() */
+ int tflags, /* Mask of FTS5_TOKEN_* flags */
+ const char *pToken, /* Pointer to buffer containing token */
+ int nToken, /* Size of token in bytes */
+ int iStart, /* Byte offset of token within input text */
+ int iEnd /* Byte offset of end of token within input text */
+ )
+ );
+};
+
+/* Flags that may be passed as the third argument to xTokenize() */
+#define FTS5_TOKENIZE_QUERY 0x0001
+#define FTS5_TOKENIZE_PREFIX 0x0002
+#define FTS5_TOKENIZE_DOCUMENT 0x0004
+#define FTS5_TOKENIZE_AUX 0x0008
+
+/* Flags that may be passed by the tokenizer implementation back to FTS5
+** as the third argument to the supplied xToken callback. */
+#define FTS5_TOKEN_COLOCATED 0x0001 /* Same position as prev. token */
+
+/*
+** END OF CUSTOM TOKENIZERS
+*************************************************************************/
+
+/*************************************************************************
+** FTS5 EXTENSION REGISTRATION API
+*/
+typedef struct fts5_api fts5_api;
+struct fts5_api {
+ int iVersion; /* Currently always set to 2 */
+
+ /* Create a new tokenizer */
+ int (*xCreateTokenizer)(
+ fts5_api *pApi,
+ const char *zName,
+ void *pContext,
+ fts5_tokenizer *pTokenizer,
+ void (*xDestroy)(void*)
+ );
+
+ /* Find an existing tokenizer */
+ int (*xFindTokenizer)(
+ fts5_api *pApi,
+ const char *zName,
+ void **ppContext,
+ fts5_tokenizer *pTokenizer
+ );
+
+ /* Create a new auxiliary function */
+ int (*xCreateFunction)(
+ fts5_api *pApi,
+ const char *zName,
+ void *pContext,
+ fts5_extension_function xFunction,
+ void (*xDestroy)(void*)
+ );
+};
+
+/*
+** END OF REGISTRATION API
+*************************************************************************/
+
+#ifdef __cplusplus
+} /* end of the 'extern "C"' block */
+#endif
+
+#endif /* _FTS5_H */
+
+/******** End of fts5.h *********/
diff --git a/SQLiteStudio3/coreSQLiteStudio/db/sqlquery.cpp b/SQLiteStudio3/coreSQLiteStudio/db/sqlquery.cpp
index 94799d9..bef3ed8 100644
--- a/SQLiteStudio3/coreSQLiteStudio/db/sqlquery.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/db/sqlquery.cpp
@@ -116,7 +116,7 @@ void SqlQuery::setArgs(const QHash<QString, QVariant>& args)
}
-void RowIdConditionBuilder::setRowId(const RowId& rowId, Dialect dialect)
+void RowIdConditionBuilder::setRowId(const RowId& rowId)
{
static const QString argTempalate = QStringLiteral(":rowIdArg%1");
@@ -128,11 +128,11 @@ void RowIdConditionBuilder::setRowId(const RowId& rowId, Dialect dialect)
it.next();
arg = argTempalate.arg(i++);
queryArgs[arg] = it.value();
- conditions << wrapObjIfNeeded(it.key(), dialect) + " = " + arg;
+ conditions << wrapObjIfNeeded(it.key()) + " = " + arg;
}
}
-const QHash<QString, QVariant>& RowIdConditionBuilder::getQueryArgs()
+const QHash<QString, QVariant>& RowIdConditionBuilder::getQueryArgs() const
{
return queryArgs;
}
diff --git a/SQLiteStudio3/coreSQLiteStudio/db/sqlquery.h b/SQLiteStudio3/coreSQLiteStudio/db/sqlquery.h
index ed78d80..17bb464 100644
--- a/SQLiteStudio3/coreSQLiteStudio/db/sqlquery.h
+++ b/SQLiteStudio3/coreSQLiteStudio/db/sqlquery.h
@@ -304,8 +304,8 @@ class API_EXPORT SqlQuery
class API_EXPORT RowIdConditionBuilder
{
public:
- void setRowId(const RowId& rowId, Dialect dialect);
- const QHash<QString,QVariant>& getQueryArgs();
+ void setRowId(const RowId& rowId);
+ const QHash<QString,QVariant>& getQueryArgs() const;
QString build();
protected:
diff --git a/SQLiteStudio3/coreSQLiteStudio/db/stdsqlite3driver.h b/SQLiteStudio3/coreSQLiteStudio/db/stdsqlite3driver.h
index 94a0413..01894c2 100644
--- a/SQLiteStudio3/coreSQLiteStudio/db/stdsqlite3driver.h
+++ b/SQLiteStudio3/coreSQLiteStudio/db/stdsqlite3driver.h
@@ -53,6 +53,8 @@
static int open_v2(const char *a1, handle **a2, int a3, const char *a4) {return Prefix##sqlite3_open_v2(a1, a2, a3, a4);} \
static int finalize(stmt *arg) {return Prefix##sqlite3_finalize(arg);} \
static const char *errmsg(handle* arg) {return Prefix##sqlite3_errmsg(arg);} \
+ static const char *column_decltype(stmt* arg1, int arg2) {return Prefix##sqlite3_column_decltype(arg1, arg2);} \
+ static int column_type(stmt* arg1, int arg2) {return Prefix##sqlite3_column_type(arg1, arg2);} \
static int extended_errcode(handle* arg) {return Prefix##sqlite3_extended_errcode(arg);} \
static const void *column_blob(stmt* arg1, int arg2) {return Prefix##sqlite3_column_blob(arg1, arg2);} \
static int column_bytes(stmt* arg1, int arg2) {return Prefix##sqlite3_column_bytes(arg1, arg2);} \
@@ -61,11 +63,13 @@
static int64 column_int64(stmt* arg1, int arg2) {return Prefix##sqlite3_column_int64(arg1, arg2);} \
static const void *column_text16(stmt* arg1, int arg2) {return Prefix##sqlite3_column_text16(arg1, arg2);} \
static const char *column_name(stmt* arg1, int arg2) {return Prefix##sqlite3_column_name(arg1, arg2);} \
- static int column_type(stmt* arg1, int arg2) {return Prefix##sqlite3_column_type(arg1, arg2);} \
static int column_count(stmt* arg1) {return Prefix##sqlite3_column_count(arg1);} \
+ static const char *column_database_name(stmt* arg1, int arg2) {return Prefix##sqlite3_column_database_name(arg1, arg2);} \
+ static const char *column_table_name(stmt* arg1, int arg2) {return Prefix##sqlite3_column_table_name(arg1, arg2);} \
+ static const char *column_origin_name(stmt* arg1, int arg2) {return Prefix##sqlite3_column_origin_name(arg1, arg2);} \
static int changes(handle* arg) {return Prefix##sqlite3_changes(arg);} \
static int total_changes(handle* arg) {return Prefix##sqlite3_total_changes(arg);} \
- static int last_insert_rowid(handle* arg) {return Prefix##sqlite3_last_insert_rowid(arg);} \
+ static int64 last_insert_rowid(handle* arg) {return Prefix##sqlite3_last_insert_rowid(arg);} \
static int step(stmt* arg) {return Prefix##sqlite3_step(arg);} \
static int reset(stmt* arg) {return Prefix##sqlite3_reset(arg);} \
static int close(handle* arg) {return Prefix##sqlite3_close(arg);} \
diff --git a/SQLiteStudio3/coreSQLiteStudio/dbobjectorganizer.cpp b/SQLiteStudio3/coreSQLiteStudio/dbobjectorganizer.cpp
index 542668b..99110a0 100644
--- a/SQLiteStudio3/coreSQLiteStudio/dbobjectorganizer.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/dbobjectorganizer.cpp
@@ -4,7 +4,7 @@
#include "datatype.h"
#include "services/notifymanager.h"
#include "db/attachguard.h"
-#include "dbversionconverter.h"
+#include "common/compatibility.h"
#include <QDebug>
#include <QThreadPool>
@@ -30,23 +30,21 @@ DbObjectOrganizer::~DbObjectOrganizer()
{
safe_delete(srcResolver);
safe_delete(dstResolver);
- safe_delete(versionConverter);
}
void DbObjectOrganizer::init()
{
- versionConverter = new DbVersionConverter();
connect(this, SIGNAL(preparetionFinished()), this, SLOT(processPreparationFinished()));
}
void DbObjectOrganizer::copyObjectsToDb(Db* srcDb, const QStringList& objNames, Db* dstDb, bool includeData, bool includeIndexes, bool includeTriggers)
{
- copyOrMoveObjectsToDb(srcDb, objNames.toSet(), dstDb, includeData, includeIndexes, includeTriggers, false);
+ copyOrMoveObjectsToDb(srcDb, toSet(objNames), dstDb, includeData, includeIndexes, includeTriggers, false);
}
void DbObjectOrganizer::moveObjectsToDb(Db* srcDb, const QStringList& objNames, Db* dstDb, bool includeData, bool includeIndexes, bool includeTriggers)
{
- copyOrMoveObjectsToDb(srcDb, objNames.toSet(), dstDb, includeData, includeIndexes, includeTriggers, true);
+ copyOrMoveObjectsToDb(srcDb, toSet(objNames), dstDb, includeData, includeIndexes, includeTriggers, true);
}
void DbObjectOrganizer::interrupt()
@@ -94,7 +92,7 @@ void DbObjectOrganizer::reset()
srcTriggers.clear();
srcViews.clear();
renamed.clear();
- srcTable = QString::null;
+ srcTable = QString();
includeData = false;
includeIndexes = false;
includeTriggers = false;
@@ -102,7 +100,6 @@ void DbObjectOrganizer::reset()
referencedTables.clear();
diffListToConfirm.clear();
errorsToConfirm.clear();
- binaryColumns.clear();
safe_delete(srcResolver);
safe_delete(dstResolver);
interrupted = false;
@@ -155,7 +152,6 @@ void DbObjectOrganizer::processPreparation()
{
case SchemaResolver::TABLE:
srcTables << srcName;
- findBinaryColumns(srcName, allParsedObjects);
collectReferencedTables(srcName, allParsedObjects);
collectReferencedIndexes(srcName);
collectReferencedTriggersForTable(srcName);
@@ -174,7 +170,7 @@ void DbObjectOrganizer::processPreparation()
}
}
- if (referencedTables.size() > 0 && !execConfirmFunctionInMainThread(referencedTables.toList()))
+ if (referencedTables.size() > 0 && !execConfirmFunctionInMainThread(referencedTables.values()))
referencedTables.clear();
for (const QString& srcTable : referencedTables)
@@ -183,8 +179,6 @@ void DbObjectOrganizer::processPreparation()
collectReferencedTriggersForTable(srcTable);
}
- collectDiffs(details);
-
emit preparetionFinished();
}
@@ -396,7 +390,6 @@ bool DbObjectOrganizer::copyTableToDb(const QString& table)
ddl = srcResolver->getObjectDdl(table, SchemaResolver::TABLE);
}
- ddl = convertDdlToDstVersion(ddl);
if (ddl.trimmed() == ";") // empty query, result of ignored errors in UI
return true;
@@ -439,9 +432,8 @@ bool DbObjectOrganizer::copyTableToDb(const QString& table)
bool DbObjectOrganizer::copyDataAsMiddleware(const QString& table)
{
QStringList srcColumns = srcResolver->getTableColumns(srcTable);
- QString wrappedSrcTable = wrapObjIfNeeded(srcTable, srcDb->getDialect());
+ QString wrappedSrcTable = wrapObjIfNeeded(srcTable);
SqlQueryPtr results = srcDb->prepare("SELECT * FROM " + wrappedSrcTable);
- setupSqlite2Helper(results, table, srcColumns);
if (!results->execute())
{
notifyError(tr("Error while copying data for table %1: %2").arg(table).arg(results->getErrorText()));
@@ -452,7 +444,7 @@ bool DbObjectOrganizer::copyDataAsMiddleware(const QString& table)
for (int i = 0, total = srcColumns.size(); i < total; ++i)
argPlaceholderList << "?";
- QString wrappedDstTable = wrapObjIfNeeded(table, dstDb->getDialect());
+ QString wrappedDstTable = wrapObjIfNeeded(table);
QString sql = "INSERT INTO " + wrappedDstTable + " VALUES (" + argPlaceholderList.join(", ") + ")";
SqlQueryPtr insertQuery = dstDb->prepare(sql);
@@ -488,8 +480,8 @@ bool DbObjectOrganizer::copyDataAsMiddleware(const QString& table)
bool DbObjectOrganizer::copyDataUsingAttach(const QString& table)
{
- QString wrappedSrcTable = wrapObjIfNeeded(srcTable, srcDb->getDialect());
- QString wrappedDstTable = wrapObjIfNeeded(table, srcDb->getDialect());
+ QString wrappedSrcTable = wrapObjIfNeeded(srcTable);
+ QString wrappedDstTable = wrapObjIfNeeded(table);
SqlQueryPtr results = srcDb->exec("INSERT INTO " + attachName + "." + wrappedDstTable + " SELECT * FROM " + wrappedSrcTable);
if (results->isError())
{
@@ -499,23 +491,6 @@ bool DbObjectOrganizer::copyDataUsingAttach(const QString& table)
return true;
}
-void DbObjectOrganizer::setupSqlite2Helper(SqlQueryPtr query, const QString& table, const QStringList& colNames)
-{
- Sqlite2ColumnDataTypeHelper* sqlite2Helper = dynamic_cast<Sqlite2ColumnDataTypeHelper*>(query.data());
- if (sqlite2Helper && binaryColumns.contains(table))
- {
- int i = 0;
- QStringList binCols = binaryColumns[table];
- for (const QString& colName : colNames)
- {
- if (binCols.contains(colName))
- sqlite2Helper->setBinaryType(i);
-
- i++;
- }
- }
-}
-
void DbObjectOrganizer::dropTable(const QString& table)
{
dropObject(table, "TABLE");
@@ -528,7 +503,7 @@ void DbObjectOrganizer::dropView(const QString& view)
void DbObjectOrganizer::dropObject(const QString& name, const QString& type)
{
- QString wrappedSrcObj = wrapObjIfNeeded(name, srcDb->getDialect());
+ QString wrappedSrcObj = wrapObjIfNeeded(name);
SqlQueryPtr results = srcDb->exec("DROP " + type + " " + wrappedSrcObj);
if (results->isError())
{
@@ -555,29 +530,28 @@ bool DbObjectOrganizer::copyTriggerToDb(const QString& trigger)
bool DbObjectOrganizer::copySimpleObjectToDb(const QString& name, const QString& errorMessage)
{
QString ddl = srcResolver->getObjectDdl(name, SchemaResolver::ANY);
- QString convertedDdl = convertDdlToDstVersion(ddl);
- if (convertedDdl.trimmed() == ";") // empty query, result of ignored errors in UI
+ if (ddl.trimmed() == ";") // empty query, result of ignored errors in UI
return true;
SqlQueryPtr result;
if (!attachName.isNull())
{
- convertedDdl = prefixSimpleObjectWithAttachName(name, convertedDdl);
- if (convertedDdl.isNull())
+ ddl = prefixSimpleObjectWithAttachName(name, ddl);
+ if (ddl.isNull())
return false;
- result = srcDb->exec(convertedDdl);
+ result = srcDb->exec(ddl);
}
else
{
- result = dstDb->exec(convertedDdl);
+ result = dstDb->exec(ddl);
}
if (result->isError())
{
notifyError(errorMessage.arg(result->getErrorText()));
- qDebug() << "DDL that caused error in DbObjectOrganizer::copySimpleObjectToDb():" << ddl << "\nAfter converting:" << convertedDdl;
+ qDebug() << "DDL that caused error in DbObjectOrganizer::copySimpleObjectToDb():" << ddl;
return false;
}
@@ -586,53 +560,14 @@ bool DbObjectOrganizer::copySimpleObjectToDb(const QString& name, const QString&
QSet<QString> DbObjectOrganizer::resolveReferencedTables(const QString& table, const QList<SqliteCreateTablePtr>& parsedTables)
{
- QSet<QString> tables = SchemaResolver::getFkReferencingTables(table, parsedTables).toSet();
+ QSet<QString> tables = toSet(SchemaResolver::getFkReferencingTables(table, parsedTables));
for (const QString& fkTable : tables)
- tables += SchemaResolver::getFkReferencingTables(fkTable, parsedTables).toSet();
+ tables += toSet(SchemaResolver::getFkReferencingTables(fkTable, parsedTables));
tables.remove(table); // if it appeared somewhere in the references - we still don't need it here, it's the table we asked by in the first place
return tables;
}
-void DbObjectOrganizer::collectDiffs(const StrHash<SchemaResolver::ObjectDetails>& details)
-{
- if (srcDb->getVersion() == dstDb->getVersion())
- return;
-
-
- int dstVersion = dstDb->getVersion();
- QSet<QString> names = srcTables + srcViews + referencedTables + srcIndexes + srcTriggers;
- for (const QString& name : names)
- {
- if (!details.contains(name))
- {
- qCritical() << "Object named" << name << "not found in details when trying to prepare Diff for copying or moving object.";
- continue;
- }
-
- versionConverter->reset();
- if (dstVersion == 3)
- versionConverter->convert2To3(details[name].ddl);
- else
- versionConverter->convert3To2(details[name].ddl);
-
- diffListToConfirm += versionConverter->getDiffList();
- if (!versionConverter->getErrors().isEmpty())
- errorsToConfirm[name] = versionConverter->getErrors();
- }
-}
-
-QString DbObjectOrganizer::convertDdlToDstVersion(const QString& ddl)
-{
- if (srcDb->getVersion() == dstDb->getVersion())
- return ddl;
-
- if (dstDb->getVersion() == 3)
- return versionConverter->convert2To3(ddl);
- else
- return versionConverter->convert3To2(ddl);
-}
-
void DbObjectOrganizer::collectReferencedTables(const QString& table, const StrHash<SqliteQueryPtr>& allParsedObjects)
{
QList<SqliteCreateTablePtr> parsedTables;
@@ -654,50 +589,21 @@ void DbObjectOrganizer::collectReferencedTables(const QString& table, const StrH
void DbObjectOrganizer::collectReferencedIndexes(const QString& table)
{
- srcIndexes += srcResolver->getIndexesForTable(table).toSet();
+ srcIndexes += toSet(srcResolver->getIndexesForTable(table));
}
void DbObjectOrganizer::collectReferencedTriggersForTable(const QString& table)
{
- srcTriggers += srcResolver->getTriggersForTable(table).toSet();
+ srcTriggers += toSet(srcResolver->getTriggersForTable(table));
}
void DbObjectOrganizer::collectReferencedTriggersForView(const QString& view)
{
- srcTriggers += srcResolver->getTriggersForView(view).toSet();
-}
-
-void DbObjectOrganizer::findBinaryColumns(const QString& table, const StrHash<SqliteQueryPtr>& allParsedObjects)
-{
- if (!allParsedObjects.contains(table))
- {
- qWarning() << "Parsed objects don't have table" << table << "in DbObjectOrganizer::findBinaryColumns()";
- return;
- }
-
- SqliteQueryPtr query = allParsedObjects[table];
- SqliteCreateTablePtr createTable = query.dynamicCast<SqliteCreateTable>();
- if (!createTable)
- {
- qWarning() << "Not CreateTable in DbObjectOrganizer::findBinaryColumns()";
- return;
- }
-
- for (SqliteCreateTable::Column* column : createTable->columns)
- {
- if (!column->type)
- continue;
-
- if (DataType::isBinary(column->type->name))
- binaryColumns[table] << column->name;
- }
+ srcTriggers += toSet(srcResolver->getTriggersForView(view));
}
bool DbObjectOrganizer::setFkEnabled(bool enabled)
{
- if (dstDb->getVersion() == 2)
- return true;
-
SqlQueryPtr result = dstDb->exec(QString("PRAGMA foreign_keys = %1").arg(enabled ? "on" : "off"));
if (result->isError())
{
@@ -766,7 +672,7 @@ bool DbObjectOrganizer::execConfirmFunctionInMainThread(const QStringList& table
QString DbObjectOrganizer::prefixSimpleObjectWithAttachName(const QString& objName, const QString& ddl)
{
- Parser parser(srcDb->getDialect());
+ Parser parser;
if (!parser.parse(ddl))
{
qDebug() << "Parsing error while copying or moving object:" << objName << ", details:" << parser.getErrorString();
diff --git a/SQLiteStudio3/coreSQLiteStudio/dbobjectorganizer.h b/SQLiteStudio3/coreSQLiteStudio/dbobjectorganizer.h
index 42b258a..c8a1f97 100644
--- a/SQLiteStudio3/coreSQLiteStudio/dbobjectorganizer.h
+++ b/SQLiteStudio3/coreSQLiteStudio/dbobjectorganizer.h
@@ -12,7 +12,6 @@
#include <QHash>
class Db;
-class DbVersionConverter;
class API_EXPORT DbObjectOrganizer : public QObject, public QRunnable, public Interruptable
{
@@ -45,7 +44,7 @@ class API_EXPORT DbObjectOrganizer : public QObject, public QRunnable, public In
* while executing them on the target database (because of different database versions). User can cancel the process
* (in which case, the function should return false).
* @param conversionErrorsConfimFunction This function should display critical errors that occurred when tried to
- * convert SQL statements for target database (when it's of different version than source database). User
+ * convert SQL statements for target database. User
* can choose to proceed (with skipping problemating database objects), or cancel the process (in which case the function
* should return false).
*
@@ -87,8 +86,6 @@ class API_EXPORT DbObjectOrganizer : public QObject, public QRunnable, public In
bool copyTriggerToDb(const QString& trigger);
bool copySimpleObjectToDb(const QString& name, const QString& errorMessage);
QSet<QString> resolveReferencedTables(const QString& table, const QList<SqliteCreateTablePtr>& parsedTables);
- void collectDiffs(const StrHash<SchemaResolver::ObjectDetails>& details);
- QString convertDdlToDstVersion(const QString& ddl);
void collectReferencedTables(const QString& table, const StrHash<SqliteQueryPtr>& allParsedObjects);
void collectReferencedIndexes(const QString& table);
void collectReferencedTriggersForTable(const QString& table);
@@ -96,7 +93,6 @@ class API_EXPORT DbObjectOrganizer : public QObject, public QRunnable, public In
void findBinaryColumns(const QString& table, const StrHash<SqliteQueryPtr>& allParsedObjects);
bool copyDataAsMiddleware(const QString& table);
bool copyDataUsingAttach(const QString& table);
- void setupSqlite2Helper(SqlQueryPtr query, const QString& table, const QStringList& colNames);
void dropTable(const QString& table);
void dropView(const QString& view);
void dropObject(const QString& name, const QString& type);
@@ -125,7 +121,7 @@ class API_EXPORT DbObjectOrganizer : public QObject, public QRunnable, public In
QSet<QString> srcTriggers;
QHash<QString,QString> renamed;
QString srcTable;
- QHash<QString,QStringList> binaryColumns; // hints for SQLite 2 databases
+ QHash<QString,QStringList> binaryColumns;
bool includeData = false;
bool includeIndexes = false;
bool includeTriggers = false;
@@ -137,7 +133,6 @@ class API_EXPORT DbObjectOrganizer : public QObject, public QRunnable, public In
SchemaResolver* dstResolver = nullptr;
bool interrupted = false;
bool executing = false;
- DbVersionConverter* versionConverter = nullptr;
QMutex interruptMutex;
QMutex executingMutex;
QString attachName;
diff --git a/SQLiteStudio3/coreSQLiteStudio/dbversionconverter.cpp b/SQLiteStudio3/coreSQLiteStudio/dbversionconverter.cpp
deleted file mode 100644
index 0ef924d..0000000
--- a/SQLiteStudio3/coreSQLiteStudio/dbversionconverter.cpp
+++ /dev/null
@@ -1,1263 +0,0 @@
-#include "dbversionconverter.h"
-#include "schemaresolver.h"
-#include "common/global.h"
-#include "parser/ast/sqlitealtertable.h"
-#include "parser/ast/sqliteanalyze.h"
-#include "parser/ast/sqliteattach.h"
-#include "parser/ast/sqlitebegintrans.h"
-#include "parser/ast/sqlitecommittrans.h"
-#include "parser/ast/sqlitecopy.h"
-#include "parser/ast/sqlitecreatevirtualtable.h"
-#include "parser/ast/sqlitedelete.h"
-#include "parser/ast/sqlitedetach.h"
-#include "parser/ast/sqlitedropindex.h"
-#include "parser/ast/sqlitedroptable.h"
-#include "parser/ast/sqlitedroptrigger.h"
-#include "parser/ast/sqlitedropview.h"
-#include "parser/ast/sqliteemptyquery.h"
-#include "parser/ast/sqliteinsert.h"
-#include "parser/ast/sqlitepragma.h"
-#include "parser/ast/sqlitereindex.h"
-#include "parser/ast/sqliterelease.h"
-#include "parser/ast/sqliterollback.h"
-#include "parser/ast/sqlitesavepoint.h"
-#include "parser/ast/sqliteupdate.h"
-#include "parser/ast/sqlitevacuum.h"
-#include "parser/ast/sqliteupsert.h"
-#include "services/pluginmanager.h"
-#include "plugins/dbplugin.h"
-#include "services/dbmanager.h"
-#include <QDebug>
-#include <QDir>
-#include <QFile>
-#include <QtConcurrent/QtConcurrentRun>
-
-DbVersionConverter::DbVersionConverter()
-{
- connect(this, SIGNAL(askUserForConfirmation()), this, SLOT(confirmConversion()));
- connect(this, SIGNAL(conversionSuccessful()), this, SLOT(registerDbAfterSuccessfulConversion()));
-}
-
-DbVersionConverter::~DbVersionConverter()
-{
- safe_delete(fullConversionConfig);
- safe_delete(resolver);
-}
-
-void DbVersionConverter::convert(Dialect from, Dialect to, Db* srcDb, const QString& targetFile, const QString& targetName, ConversionConfimFunction confirmFunc,
- ConversionErrorsConfimFunction errorsConfirmFunc)
-{
- safe_delete(fullConversionConfig);
- fullConversionConfig = new FullConversionConfig;
- fullConversionConfig->from = from;
- fullConversionConfig->to = to;
- fullConversionConfig->srcDb = srcDb;
- fullConversionConfig->confirmFunc = confirmFunc;
- fullConversionConfig->errorsConfirmFunc = errorsConfirmFunc;
- fullConversionConfig->targetFile = targetFile;
- fullConversionConfig->targetName = targetName;
- QtConcurrent::run(this, &DbVersionConverter::fullConvertStep1);
-}
-
-void DbVersionConverter::convert(Dialect from, Dialect to, Db* db)
-{
- if (from == Dialect::Sqlite2 && to == Dialect::Sqlite3)
- convert2To3(db);
- else if (from == Dialect::Sqlite3 && to == Dialect::Sqlite2)
- convert3To2(db);
- else
- qCritical() << "Unsupported db conversion combination.";
-}
-
-void DbVersionConverter::convert3To2(Db* db)
-{
- reset();
- this->db = db;
- targetDialect = Dialect::Sqlite2;
- convertDb();
-}
-
-void DbVersionConverter::convert2To3(Db* db)
-{
- reset();
- this->db = db;
- targetDialect = Dialect::Sqlite3;
- convertDb();
-}
-
-QString DbVersionConverter::convert(Dialect from, Dialect to, const QString& sql)
-{
- if (from == Dialect::Sqlite2 && to == Dialect::Sqlite3)
- return convert2To3(sql);
- else if (from == Dialect::Sqlite3 && to == Dialect::Sqlite2)
- return convert3To2(sql);
- else
- {
- qCritical() << "Unsupported db conversion combination.";
- return QString();
- }
-}
-
-QString DbVersionConverter::convert3To2(const QString& sql)
-{
- QStringList result;
- for (SqliteQueryPtr query : parse(sql, Dialect::Sqlite3))
- result << convert3To2(query)->detokenize();
-
- return result.join("\n");
-}
-
-QString DbVersionConverter::convert2To3(const QString& sql)
-{
- QStringList result;
- for (SqliteQueryPtr query : parse(sql, Dialect::Sqlite2))
- result << convert2To3(query)->detokenize();
-
- return result.join("\n");
-}
-
-SqliteQueryPtr DbVersionConverter::convert(Dialect from, Dialect to, SqliteQueryPtr query)
-{
- if (from == Dialect::Sqlite2 && to == Dialect::Sqlite3)
- return convert2To3(query);
- else if (from == Dialect::Sqlite3 && to == Dialect::Sqlite2)
- return convert3To2(query);
- else
- {
- qCritical() << "Unsupported db conversion combination.";
- return SqliteQueryPtr();
- }
-}
-
-SqliteQueryPtr DbVersionConverter::convert3To2(SqliteQueryPtr query)
-{
- SqliteQueryPtr newQuery;
- switch (query->queryType)
- {
- case SqliteQueryType::AlterTable:
- errors << QObject::tr("SQLite %1 does not support '%2' statement.").arg("2", "ALTER TABLE");
- newQuery = SqliteEmptyQueryPtr::create();
- storeErrorDiff(query.data());
- break;
- case SqliteQueryType::Analyze:
- errors << QObject::tr("SQLite %1 does not support '%2' statement.").arg("2", "ANAYLZE");
- newQuery = SqliteEmptyQueryPtr::create();
- storeErrorDiff(query.data());
- break;
- case SqliteQueryType::Attach:
- newQuery = copyQuery<SqliteAttach>(query);
- break;
- case SqliteQueryType::BeginTrans:
- newQuery = copyQuery<SqliteBeginTrans>(query);
- break;
- case SqliteQueryType::CommitTrans:
- newQuery = copyQuery<SqliteCommitTrans>(query);
- break;
- case SqliteQueryType::Copy:
- qWarning() << "COPY query passed to DbVersionConverter::convertToVersion2(). SQLite3 query should not have COPY statement.";
- newQuery = copyQuery<SqliteCopy>(query);
- break;
- case SqliteQueryType::CreateIndex:
- newQuery = copyQuery<SqliteCreateIndex>(query);
- if (!modifyCreateIndexForVersion2(newQuery.dynamicCast<SqliteCreateIndex>().data()))
- {
- newQuery = SqliteEmptyQueryPtr::create();
- storeErrorDiff(query.data());
- }
- break;
- case SqliteQueryType::CreateTable:
- newQuery = copyQuery<SqliteCreateTable>(query);
- if (!modifyCreateTableForVersion2(newQuery.dynamicCast<SqliteCreateTable>().data()))
- {
- newQuery = SqliteEmptyQueryPtr::create();
- storeErrorDiff(query.data());
- }
- break;
- case SqliteQueryType::CreateTrigger:
- newQuery = copyQuery<SqliteCreateTrigger>(query);
- if (!modifyCreateTriggerForVersion2(newQuery.dynamicCast<SqliteCreateTrigger>().data()))
- {
- newQuery = SqliteEmptyQueryPtr::create();
- storeErrorDiff(query.data());
- }
- break;
- case SqliteQueryType::CreateView:
- newQuery = copyQuery<SqliteCreateView>(query);
- if (!modifyCreateViewForVersion2(newQuery.dynamicCast<SqliteCreateView>().data()))
- {
- newQuery = SqliteEmptyQueryPtr::create();
- storeErrorDiff(query.data());
- }
- break;
- case SqliteQueryType::CreateVirtualTable:
- newQuery = copyQuery<SqliteCreateVirtualTable>(query);
- if (!modifyVirtualTableForVesion2(newQuery, newQuery.dynamicCast<SqliteCreateVirtualTable>().data()))
- {
- errors << QObject::tr("SQLite %1 does not support '%2' statement.").arg("2", "CREATE VIRTUAL TABLE");
- newQuery = SqliteEmptyQueryPtr::create();
- storeErrorDiff(query.data());
- }
- else
- {
- errors << QObject::tr("SQLite %1 does not support '%2' statement, but the regular table can be created instead if you proceed.")
- .arg("2", "CREATE VIRTUAL TABLE");
- }
- break;
- case SqliteQueryType::Delete:
- newQuery = copyQuery<SqliteDelete>(query);
- if (!modifyDeleteForVersion2(newQuery.dynamicCast<SqliteDelete>().data()))
- {
- newQuery = SqliteEmptyQueryPtr::create();
- if (diffsForNonDDL)
- storeErrorDiff(query.data());
- }
- break;
- case SqliteQueryType::Detach:
- newQuery = copyQuery<SqliteDetach>(query);
- break;
- case SqliteQueryType::DropIndex:
- newQuery = copyQuery<SqliteDropIndex>(query);
- break;
- case SqliteQueryType::DropTable:
- newQuery = copyQuery<SqliteDropTable>(query);
- break;
- case SqliteQueryType::DropTrigger:
- newQuery = copyQuery<SqliteDropTrigger>(query);
- break;
- case SqliteQueryType::DropView:
- newQuery = copyQuery<SqliteDropView>(query);
- break;
- case SqliteQueryType::Insert:
- newQuery = copyQuery<SqliteInsert>(query);
- if (!modifyInsertForVersion2(newQuery.dynamicCast<SqliteInsert>().data()))
- {
- newQuery = SqliteEmptyQueryPtr::create();
- if (diffsForNonDDL)
- storeErrorDiff(query.data());
- }
- break;
- case SqliteQueryType::Pragma:
- newQuery = copyQuery<SqlitePragma>(query);
- break;
- case SqliteQueryType::Reindex:
- errors << QObject::tr("SQLite %1 does not support '%2' statement.").arg("2", "REINDEX");
- newQuery = SqliteEmptyQueryPtr::create();
- storeErrorDiff(query.data());
- break;
- case SqliteQueryType::Release:
- errors << QObject::tr("SQLite %1 does not support '%2' statement.").arg("2", "RELEASE");
- newQuery = SqliteEmptyQueryPtr::create();
- storeErrorDiff(query.data());
- break;
- case SqliteQueryType::Rollback:
- newQuery = copyQuery<SqliteRollback>(query);
- break;
- case SqliteQueryType::Savepoint:
- errors << QObject::tr("SQLite %1 does not support '%2' statement.").arg("2", "SAVEPOINT");
- newQuery = SqliteEmptyQueryPtr::create();
- storeErrorDiff(query.data());
- break;
- case SqliteQueryType::Select:
- {
- newQuery = copyQuery<SqliteSelect>(query);
- if (!modifySelectForVersion2(newQuery.dynamicCast<SqliteSelect>().data()))
- {
- newQuery = SqliteEmptyQueryPtr::create();
- if (diffsForNonDDL)
- storeErrorDiff(query.data());
- }
- break;
- }
- case SqliteQueryType::Update:
- newQuery = copyQuery<SqliteUpdate>(query);
- if (!modifyUpdateForVersion2(newQuery.dynamicCast<SqliteUpdate>().data()))
- {
- newQuery = SqliteEmptyQueryPtr::create();
- if (diffsForNonDDL)
- storeErrorDiff(query.data());
- }
- break;
- case SqliteQueryType::Vacuum:
- newQuery = copyQuery<SqliteVacuum>(query);
- break;
- case SqliteQueryType::UNDEFINED:
- qWarning() << "UNDEFINED query type passed to DbVersionConverter::convertToVersion2().";
- newQuery = SqliteEmptyQueryPtr::create();
- break;
- case SqliteQueryType::EMPTY:
- newQuery = copyQuery<SqliteEmptyQuery>(query);
- break;
- }
-
- if (!newQuery)
- {
- qCritical() << "Query type not matched in DbVersionConverter::convertToVersion2():" << static_cast<int>(query->queryType);
- return SqliteQueryPtr();
- }
-
- if (newQuery->queryType != SqliteQueryType::EMPTY)
- {
- newQuery->setSqliteDialect(Dialect::Sqlite2);
- newQueries << newQuery;
- }
-
- newQuery->rebuildTokens();
- return newQuery;
-}
-
-SqliteQueryPtr DbVersionConverter::convert2To3(SqliteQueryPtr query)
-{
- SqliteQueryPtr newQuery;
- switch (query->queryType)
- {
- case SqliteQueryType::AlterTable:
- newQuery = copyQuery<SqliteAlterTable>(query);
- qWarning() << "ALTER TABLE query passed to DbVersionConverter::convertToVersion3(). SQLite2 query should not have ALTER TABLE statement.";
- break;
- case SqliteQueryType::Analyze:
- newQuery = copyQuery<SqliteAnalyze>(query);
- qWarning() << "ANALYZE query passed to DbVersionConverter::convertToVersion3(). SQLite2 query should not have ANALYZE statement.";
- break;
- case SqliteQueryType::Attach:
- newQuery = copyQuery<SqliteAttach>(query);
- break;
- case SqliteQueryType::BeginTrans:
- newQuery = copyQuery<SqliteBeginTrans>(query);
- if (!modifyBeginTransForVersion3(newQuery.dynamicCast<SqliteBeginTrans>().data()))
- {
- newQuery = SqliteEmptyQueryPtr::create();
- storeErrorDiff(query.data());
- }
- break;
- case SqliteQueryType::CommitTrans:
- newQuery = copyQuery<SqliteCommitTrans>(query);
- break;
- case SqliteQueryType::Copy:
- errors << QObject::tr("SQLite %1 does not support '%2' statement.").arg("3", "COPY");
- newQuery = SqliteEmptyQueryPtr::create();
- storeErrorDiff(query.data());
- break;
- case SqliteQueryType::CreateIndex:
- newQuery = copyQuery<SqliteCreateIndex>(query);
- break;
- case SqliteQueryType::CreateTable:
- newQuery = copyQuery<SqliteCreateTable>(query);
- break;
- case SqliteQueryType::CreateTrigger:
- newQuery = copyQuery<SqliteCreateTrigger>(query);
- break;
- case SqliteQueryType::CreateView:
- newQuery = copyQuery<SqliteCreateView>(query);
- break;
- case SqliteQueryType::CreateVirtualTable:
- newQuery = copyQuery<SqliteCreateVirtualTable>(query);
- break;
- case SqliteQueryType::Delete:
- newQuery = copyQuery<SqliteDelete>(query);
- break;
- case SqliteQueryType::Detach:
- newQuery = copyQuery<SqliteDetach>(query);
- break;
- case SqliteQueryType::DropIndex:
- newQuery = copyQuery<SqliteDropIndex>(query);
- break;
- case SqliteQueryType::DropTable:
- newQuery = copyQuery<SqliteDropTable>(query);
- break;
- case SqliteQueryType::DropTrigger:
- newQuery = copyQuery<SqliteDropTrigger>(query);
- break;
- case SqliteQueryType::DropView:
- newQuery = copyQuery<SqliteDropView>(query);
- break;
- case SqliteQueryType::Insert:
- newQuery = copyQuery<SqliteInsert>(query);
- break;
- case SqliteQueryType::Pragma:
- newQuery = copyQuery<SqlitePragma>(query);
- break;
- case SqliteQueryType::Reindex:
- newQuery = copyQuery<SqliteReindex>(query);
- qWarning() << "REINDEX query passed to DbVersionConverter::convertToVersion3(). SQLite2 query should not have REINDEX statement.";
- break;
- case SqliteQueryType::Release:
- newQuery = copyQuery<SqliteRelease>(query);
- qWarning() << "RELEASE query passed to DbVersionConverter::convertToVersion3(). SQLite2 query should not have RELEASE statement.";
- break;
- case SqliteQueryType::Rollback:
- newQuery = copyQuery<SqliteRollback>(query);
- break;
- case SqliteQueryType::Savepoint:
- newQuery = copyQuery<SqliteSavepoint>(query);
- qWarning() << "SAVEPOINT query passed to DbVersionConverter::convertToVersion3(). SQLite2 query should not have SAVEPOINT statement.";
- break;
- case SqliteQueryType::Select:
- newQuery = copyQuery<SqliteSelect>(query);
- break;
- case SqliteQueryType::Update:
- newQuery = copyQuery<SqliteUpdate>(query);
- break;
- case SqliteQueryType::Vacuum:
- newQuery = copyQuery<SqliteVacuum>(query);
- break;
- case SqliteQueryType::UNDEFINED:
- qWarning() << "UNDEFINED query type passed to DbVersionConverter::convertToVersion3().";
- case SqliteQueryType::EMPTY:
- newQuery = copyQuery<SqliteEmptyQuery>(query);
- break;
- }
-
- if (!newQuery)
- {
- qCritical() << "Query type not matched in DbVersionConverter::convertToVersion3():" << static_cast<int>(query->queryType);
- return SqliteQueryPtr();
- }
-
- if (newQuery->queryType != SqliteQueryType::EMPTY)
- {
- newQuery->setSqliteDialect(Dialect::Sqlite2);
- newQueries << newQuery;
- }
- return newQuery;
-}
-
-QList<SqliteQueryPtr> DbVersionConverter::parse(const QString& sql, Dialect dialect)
-{
- Parser parser(dialect);
- if (!parser.parse(sql))
- {
- errors << QObject::tr("Could not parse statement: %1\nError details: %2").arg(sql, parser.getErrorString());
- return QList<SqliteQueryPtr>();
- }
-
- return parser.getQueries();
-}
-
-bool DbVersionConverter::modifySelectForVersion2(SqliteSelect* select)
-{
- if (select->with)
- {
- errors << QObject::tr("SQLite %1 does not support the '%2' clause. Cannot convert '%3' statement with that clause.").arg("2", "WITH", "SELECT");
- return false;
- }
-
- QString sql1 = getSqlForDiff(select);
-
- for (SqliteSelect::Core* core : select->coreSelects)
- {
- if (core->valuesMode)
- core->valuesMode = false;
- }
-
- if (!modifyAllIndexedColumnsForVersion2(select))
- return false;
-
- if (!modifyAllExprsForVersion2(select))
- return false;
-
- if (diffsForNonDDL)
- storeDiff(sql1, select);
-
- return true;
-}
-
-bool DbVersionConverter::modifyDeleteForVersion2(SqliteDelete* del)
-{
- if (del->with)
- {
- errors << QObject::tr("SQLite %1 does not support the '%2' clause. Cannot convert '%3' statement with that clause.").arg("2", "WITH", "DELETE");
- return false;
- }
-
- QString sql1 = getSqlForDiff(del);
-
- del->indexedBy = QString::null;
- del->indexedByKw = false;
- del->notIndexedKw = false;
-
- if (!modifyAllExprsForVersion2(del))
- return false;
-
- if (diffsForNonDDL)
- storeDiff(sql1, del);
-
- return true;
-}
-
-bool DbVersionConverter::modifyInsertForVersion2(SqliteInsert* insert)
-{
- if (insert->with)
- {
- errors << QObject::tr("SQLite %1 does not support the '%2' clause. Cannot convert '%3' statement with that clause.").arg("2", "WITH", "INSERT");
- return false;
- }
-
- if (insert->defaultValuesKw)
- {
- errors << QObject::tr("SQLite %1 does not support the '%2' clause in the '%3' statement.").arg("2", "DEFAULT VALUES", "INSERT");
- return false;
- }
-
- if (!insert->select)
- {
- qCritical() << "No SELECT substatement in INSERT when converting from SQLite 3 to 2.";
- return false;
- }
-
- QString sql1 = getSqlForDiff(insert);
-
- if (insert->upsert)
- safe_delete(insert->upsert);
-
- // Modifying SELECT deals with "VALUES" completely.
- if (!modifySelectForVersion2(insert->select))
- return false;
-
- if (!modifyAllExprsForVersion2(insert))
- return false;
-
- if (diffsForNonDDL)
- storeDiff(sql1, insert);
-
- return true;
-}
-
-bool DbVersionConverter::modifyUpdateForVersion2(SqliteUpdate* update)
-{
- if (update->with)
- {
- errors << QObject::tr("SQLite %1 does not support the '%2' clause. Cannot convert '%3' statement with that clause.").arg("2", "WITH", "UPDATE");
- return false;
- }
-
- QString sql1 = getSqlForDiff(update);
-
- if (!modifyAllExprsForVersion2(update))
- return false;
-
- update->indexedBy = QString::null;
- update->indexedByKw = false;
- update->notIndexedKw = false;
-
- if (diffsForNonDDL)
- storeDiff(sql1, update);
-
- return true;
-}
-
-bool DbVersionConverter::modifyCreateTableForVersion2(SqliteCreateTable* createTable)
-{
- QString sql1 = getSqlForDiff(createTable);
-
- if (!createTable->database.isNull())
- createTable->database = QString::null;
-
- // Subselect
- if (createTable->select)
- {
- if (!modifySelectForVersion2(createTable->select))
- return false;
- }
-
- // Table constraints
- QMutableListIterator<SqliteCreateTable::Constraint*> tableConstrIt(createTable->constraints);
- while (tableConstrIt.hasNext())
- {
- tableConstrIt.next();
- if (tableConstrIt.value()->type == SqliteCreateTable::Constraint::PRIMARY_KEY)
- tableConstrIt.value()->autoincrKw = false;
- }
-
- // Column constraints
- QMutableListIterator<SqliteCreateTable::Column*> tableColIt(createTable->columns);
- while (tableColIt.hasNext())
- {
- tableColIt.next();
- QMutableListIterator<SqliteCreateTable::Column::Constraint*> tableColConstrIt(tableColIt.value()->constraints);
- while (tableColConstrIt.hasNext())
- {
- tableColConstrIt.next();
- switch (tableColConstrIt.value()->type)
- {
- case SqliteCreateTable::Column::Constraint::COLLATE: // theoretically supported by SQLite2, but it raises error from SQLite2 when used
- case SqliteCreateTable::Column::Constraint::NAME_ONLY:
- {
- delete tableColConstrIt.value();
- tableColConstrIt.remove();
- break;
- }
- case SqliteCreateTable::Column::Constraint::DEFAULT:
- {
- if (!tableColConstrIt.value()->ctime.isNull())
- {
- delete tableColConstrIt.value();
- tableColConstrIt.remove();
- }
- else
- tableColConstrIt.value()->name = QString::null;
-
- break;
- }
- case SqliteCreateTable::Column::Constraint::PRIMARY_KEY:
- {
- tableColConstrIt.value()->autoincrKw = false;
- break;
- }
- case SqliteCreateTable::Column::Constraint::FOREIGN_KEY:
- {
- QMutableListIterator<SqliteForeignKey::Condition*> condIt(tableColConstrIt.value()->foreignKey->conditions);
- while (condIt.hasNext())
- {
- condIt.next();
- if (condIt.value()->reaction == SqliteForeignKey::Condition::NO_ACTION
- && condIt.value()->action != SqliteForeignKey::Condition::MATCH) // SQLite 2 has no "NO ACTION"
- {
- condIt.remove();
- }
- }
- break;
- }
- case SqliteCreateTable::Column::Constraint::NOT_NULL:
- case SqliteCreateTable::Column::Constraint::UNIQUE:
- case SqliteCreateTable::Column::Constraint::CHECK:
- case SqliteCreateTable::Column::Constraint::NULL_:
- case SqliteCreateTable::Column::Constraint::DEFERRABLE_ONLY:
- break;
- }
- }
- }
-
- if (!modifyAllIndexedColumnsForVersion2(createTable))
- return false;
-
- // WITHOUT ROWID
- if (!createTable->withOutRowId.isNull())
- createTable->withOutRowId = QString::null;
-
- storeDiff(sql1, createTable);
- return true;
-}
-
-bool DbVersionConverter::modifyCreateTriggerForVersion2(SqliteCreateTrigger* createTrigger)
-{
- QString sql = getSqlForDiff(createTrigger);
-
- if (!createTrigger->database.isNull())
- createTrigger->database = QString::null;
-
- for (SqliteQuery* query : createTrigger->queries)
- {
- switch (query->queryType)
- {
- case SqliteQueryType::Delete:
- {
- if (!modifyDeleteForVersion2(dynamic_cast<SqliteDelete*>(query)))
- return false;
-
- break;
- }
- case SqliteQueryType::Update:
- {
- if (!modifyUpdateForVersion2(dynamic_cast<SqliteUpdate*>(query)))
- return false;
-
- break;
- }
- case SqliteQueryType::Insert:
- {
- if (!modifyInsertForVersion2(dynamic_cast<SqliteInsert*>(query)))
- return false;
-
- break;
- }
- case SqliteQueryType::Select:
- {
- if (!modifySelectForVersion2(dynamic_cast<SqliteSelect*>(query)))
- return false;
-
- break;
- }
- default:
- qWarning() << "Unexpected query type in trigger:" << sqliteQueryTypeToString(query->queryType);
- break;
- }
- }
-
- storeDiff(sql, createTrigger);
- return true;
-}
-
-bool DbVersionConverter::modifyCreateIndexForVersion2(SqliteCreateIndex* createIndex)
-{
- QString sql1 = getSqlForDiff(createIndex);
-
- if (!createIndex->database.isNull())
- createIndex->database = QString::null;
-
- if (createIndex->where)
- {
- delete createIndex->where;
- createIndex->where = nullptr;
- }
-
- if (!modifyAllIndexedColumnsForVersion2(createIndex->indexedColumns))
- return false;
-
- storeDiff(sql1, createIndex);
- return true;
-}
-
-bool DbVersionConverter::modifyCreateViewForVersion2(SqliteCreateView* createView)
-{
- QString sql1 = getSqlForDiff(createView);
-
- if (!createView->database.isNull())
- createView->database = QString::null;
-
- if (!modifySelectForVersion2(createView->select))
- return false;
-
- storeDiff(sql1, createView);
- return true;
-}
-
-bool DbVersionConverter::modifyVirtualTableForVesion2(SqliteQueryPtr& query, SqliteCreateVirtualTable* createVirtualTable)
-{
- if (!resolver)
- return false;
-
- SqliteCreateTablePtr createTable = resolver->resolveVirtualTableAsRegularTable(createVirtualTable->database, createVirtualTable->table);
- if (!createTable)
- return false;
-
- QString sql = getSqlForDiff(createVirtualTable);
- storeDiff(sql, createTable.data());
-
- query = createTable.dynamicCast<SqliteQuery>();
- return true;
-}
-
-bool DbVersionConverter::modifyAllExprsForVersion2(SqliteStatement* stmt)
-{
- QList<SqliteExpr*> allExprs = stmt->getAllTypedStatements<SqliteExpr>();
- for (SqliteExpr* expr : allExprs)
- {
- if (!modifySingleExprForVersion2(expr))
- return false;
- }
- return true;
-}
-
-bool DbVersionConverter::modifySingleExprForVersion2(SqliteExpr* expr)
-{
- switch (expr->mode)
- {
- case SqliteExpr::Mode::null:
- case SqliteExpr::Mode::LITERAL_VALUE:
- case SqliteExpr::Mode::BIND_PARAM:
- case SqliteExpr::Mode::ID:
- case SqliteExpr::Mode::UNARY_OP:
- case SqliteExpr::Mode::BINARY_OP:
- case SqliteExpr::Mode::FUNCTION:
- case SqliteExpr::Mode::SUB_EXPR:
- case SqliteExpr::Mode::LIKE:
- case SqliteExpr::Mode::NULL_:
- case SqliteExpr::Mode::NOTNULL:
- case SqliteExpr::Mode::IS:
- case SqliteExpr::Mode::BETWEEN:
- case SqliteExpr::Mode::CASE:
- case SqliteExpr::Mode::RAISE:
- break;
- case SqliteExpr::Mode::CTIME:
- errors << QObject::tr("SQLite %1 does not support current date or time clauses in expressions.").arg("2");
- return false;
- case SqliteExpr::Mode::ROW_VALUE:
- errors << QObject::tr("SQLite %1 does not support row value clauses in expressions.").arg("2");
- return false;
- case SqliteExpr::Mode::IN:
- case SqliteExpr::Mode::SUB_SELECT:
- {
- if (!modifySelectForVersion2(expr->select))
- return false;
-
- break;
- }
- case SqliteExpr::Mode::CAST:
- errors << QObject::tr("SQLite %1 does not support '%2' clause in expressions.").arg("2", "CAST");
- return false;
- case SqliteExpr::Mode::EXISTS:
- errors << QObject::tr("SQLite %1 does not support '%2' clause in expressions.").arg("2", "EXISTS");
- return false;
- case SqliteExpr::Mode::COLLATE:
- {
- if (dynamic_cast<SqliteOrderBy*>(expr->parentStatement()))
- {
- // This is the only case when SQLite2 parser puts this mode into expression, that is for sortorder
- break;
- }
- else
- {
- errors << QObject::tr("SQLite %1 does not support '%2' clause in expressions.").arg("2", "COLLATE");
- return false;
- }
- }
- }
- return true;
-}
-
-bool DbVersionConverter::modifyAllIndexedColumnsForVersion2(SqliteStatement* stmt)
-{
- QList<SqliteIndexedColumn*> columns = stmt->getAllTypedStatements<SqliteIndexedColumn>();
- return modifyAllIndexedColumnsForVersion2(columns);
-
-}
-
-bool DbVersionConverter::modifySingleIndexedColumnForVersion2(SqliteExtendedIndexedColumn* idxCol)
-{
- if (!idxCol->getCollation().isNull())
- idxCol->clearCollation();
-
- return true;
-}
-
-bool DbVersionConverter::modifyBeginTransForVersion3(SqliteBeginTrans* begin)
-{
- QString sql1 = getSqlForDiff(begin);
- begin->onConflict = SqliteConflictAlgo::null;
- storeDiff(sql1, begin);
- return true;
-}
-
-bool DbVersionConverter::modifyCreateTableForVersion3(SqliteCreateTable* createTable)
-{
- QString sql1 = getSqlForDiff(createTable);
-
- // Column constraints
- QMutableListIterator<SqliteCreateTable::Column*> tableColIt(createTable->columns);
- while (tableColIt.hasNext())
- {
- tableColIt.next();
- QMutableListIterator<SqliteCreateTable::Column::Constraint*> tableColConstrIt(tableColIt.value()->constraints);
- while (tableColConstrIt.hasNext())
- {
- tableColConstrIt.next();
- switch (tableColConstrIt.value()->type)
- {
- case SqliteCreateTable::Column::Constraint::CHECK:
- {
- tableColConstrIt.value()->onConflict = SqliteConflictAlgo::null;
- break;
- }
- case SqliteCreateTable::Column::Constraint::NAME_ONLY:
- case SqliteCreateTable::Column::Constraint::DEFAULT:
- case SqliteCreateTable::Column::Constraint::PRIMARY_KEY:
- case SqliteCreateTable::Column::Constraint::NOT_NULL:
- case SqliteCreateTable::Column::Constraint::UNIQUE:
- case SqliteCreateTable::Column::Constraint::COLLATE:
- case SqliteCreateTable::Column::Constraint::FOREIGN_KEY:
- case SqliteCreateTable::Column::Constraint::NULL_:
- case SqliteCreateTable::Column::Constraint::DEFERRABLE_ONLY:
- break;
- }
- }
- }
-
- storeDiff(sql1, createTable);
- return true;
-}
-
-QString DbVersionConverter::getSqlForDiff(SqliteStatement* stmt)
-{
- stmt->rebuildTokens();
- return stmt->detokenize();
-}
-
-void DbVersionConverter::storeDiff(const QString& sql1, SqliteStatement* stmt)
-{
- stmt->rebuildTokens();
- QString sql2 = stmt->detokenize();
- if (sql1 != sql2)
- diffList << QPair<QString,QString>(sql1, sql2);
-}
-
-void DbVersionConverter::storeErrorDiff(SqliteStatement* stmt)
-{
- stmt->rebuildTokens();
- diffList << QPair<QString,QString>(stmt->detokenize(), "");
-}
-
-void DbVersionConverter::reset()
-{
- db = nullptr;
- targetDialect = Dialect::Sqlite3;
- diffList.clear();
- newQueries.clear();
- errors.clear();
- safe_delete(resolver);
-}
-
-QList<Dialect> DbVersionConverter::getSupportedVersions() const
-{
- QList<Dialect> versions;
- for (Db* db : getAllPossibleDbInstances())
- {
- versions << db->getDialect();
- delete db;
- }
- return versions;
-}
-
-QStringList DbVersionConverter::getSupportedVersionNames() const
-{
- QStringList versions;
- for (Db* db : getAllPossibleDbInstances())
- {
- versions << db->getTypeLabel();
- delete db;
- }
- return versions;
-}
-
-void DbVersionConverter::fullConvertStep1()
-{
- convert(fullConversionConfig->from, fullConversionConfig->to, fullConversionConfig->srcDb);
- emit askUserForConfirmation();
-}
-
-void DbVersionConverter::fullConvertStep2()
-{
- QFile outputFile(fullConversionConfig->targetFile);
- if (outputFile.exists() && !outputFile.remove())
- {
- emit conversionFailed(tr("Target file exists, but could not be overwritten."));
- return;
- }
-
- Db* db = nullptr;
- Db* tmpDb = nullptr;
- for (DbPlugin* plugin : PLUGINS->getLoadedPlugins<DbPlugin>())
- {
- tmpDb = plugin->getInstance("", ":memory:", QHash<QString,QVariant>());
- if (tmpDb && tmpDb->initAfterCreated() && tmpDb->getDialect() == fullConversionConfig->to)
- db = plugin->getInstance(fullConversionConfig->targetName, fullConversionConfig->targetFile, QHash<QString,QVariant>());
-
- safe_delete(tmpDb);
- if (db)
- break;
- }
-
- if (!db)
- {
- emit conversionFailed(tr("Could not find proper database plugin to create target database."));
- return;
- }
-
- if (checkForInterrupted(db, false))
- return;
-
- if (!db->open())
- {
- emit conversionFailed(db->getErrorText());
- return;
- }
-
- if (!db->begin())
- {
- conversionError(db, db->getErrorText());
- return;
- }
-
- QStringList tables;
- if (!fullConvertCreateObjectsStep1(db, tables))
- return; // error handled inside
-
- if (checkForInterrupted(db, true))
- return;
-
- if (!fullConvertCopyData(db, tables))
- return; // error handled inside
-
- if (checkForInterrupted(db, true))
- return;
-
- if (!fullConvertCreateObjectsStep2(db))
- return; // error handled inside
-
- if (checkForInterrupted(db, true))
- return;
-
- if (!db->commit())
- {
- conversionError(db, db->getErrorText());
- return;
- }
- emit conversionSuccessful();
-}
-
-bool DbVersionConverter::fullConvertCreateObjectsStep1(Db* db, QStringList& tables)
-{
- SqlQueryPtr result;
- SqliteCreateTablePtr createTable;
- for (const SqliteQueryPtr& query : getConverted())
- {
- // Triggers and indexes are created in step2, after data was copied, to avoid invoking triggers
- // and speed up copying data.
- if (query->queryType == SqliteQueryType::CreateTrigger || query->queryType == SqliteQueryType::CreateIndex)
- continue;
-
- createTable = query.dynamicCast<SqliteCreateTable>();
- if (!createTable.isNull())
- tables << createTable->table;
-
- result = db->exec(query->detokenize());
- if (result->isError())
- {
- conversionError(db, result->getErrorText());
- return false;
- }
- }
- return true;
-}
-
-bool DbVersionConverter::fullConvertCreateObjectsStep2(Db* db)
-{
- SqlQueryPtr result;
- for (const SqliteQueryPtr& query : getConverted())
- {
- // Creating only triggers and indexes
- if (query->queryType != SqliteQueryType::CreateTrigger && query->queryType != SqliteQueryType::CreateIndex)
- continue;
-
- result = db->exec(query->detokenize());
- if (result->isError())
- {
- conversionError(db, result->getErrorText());
- return false;
- }
-
- if (checkForInterrupted(db, true))
- return false;
- }
- return true;
-}
-
-bool DbVersionConverter::fullConvertCopyData(Db* db, const QStringList& tables)
-{
- static const QString selectSql = QStringLiteral("SELECT * FROM %1;");
- static const QString insertSql = QStringLiteral("INSERT INTO %1 VALUES (%2);");
-
- Dialect srcDialect = fullConversionConfig->srcDb->getDialect();
- Dialect trgDialect = db->getDialect();
- QString srcTable;
- QString trgTable;
- SqlQueryPtr result;
- SqlQueryPtr dataResult;
- SqlResultsRowPtr resultsRow;
- int i = 1;
- for (const QString& table : tables)
- {
- // Select data
- srcTable = wrapObjIfNeeded(table, srcDialect);
- trgTable = wrapObjIfNeeded(table, trgDialect);
- dataResult = fullConversionConfig->srcDb->exec(selectSql.arg(srcTable));
- if (dataResult->isError())
- {
- conversionError(db, dataResult->getErrorText());
- return false;
- }
-
- if (checkForInterrupted(db, true))
- return false;
-
- // Copy row by row
- i = 1;
- while (dataResult->hasNext())
- {
- // Get row
- resultsRow = dataResult->next();
- if (dataResult->isError())
- {
- conversionError(db, dataResult->getErrorText());
- return false;
- }
-
- // Insert row
- result = db->exec(insertSql.arg(trgTable, generateQueryPlaceholders(resultsRow->valueList().size())), resultsRow->valueList());
- if (result->isError())
- {
- conversionError(db, result->getErrorText());
- return false;
- }
-
- if (i++ % 100 == 0 && checkForInterrupted(db, true))
- return false;
- }
- }
-
- return true;
-}
-
-bool DbVersionConverter::checkForInterrupted(Db* db, bool rollback)
-{
- if (isInterrupted())
- {
- conversionInterrupted(db, rollback);
- return true;
- }
- return false;
-}
-
-QList<Db*> DbVersionConverter::getAllPossibleDbInstances() const
-{
- QList<Db*> dbList;
- Db* db = nullptr;
- for (DbPlugin* plugin : PLUGINS->getLoadedPlugins<DbPlugin>())
- {
- db = plugin->getInstance("", ":memory:", QHash<QString,QVariant>());
- if (!db || !db->initAfterCreated())
- continue;
-
- dbList << db;
- }
- return dbList;
-}
-
-QString DbVersionConverter::generateQueryPlaceholders(int argCount)
-{
- QStringList args;
- for (int i = 0; i < argCount; i++)
- args << "?";
-
- return args.join(", ");
-}
-
-void DbVersionConverter::sortConverted()
-{
- qSort(newQueries.begin(), newQueries.end(), [](const SqliteQueryPtr& q1, const SqliteQueryPtr& q2) -> bool
- {
- if (!q1 || !q2)
- {
- if (!q1)
- return false;
- else
- return true;
- }
- if (q1->queryType == q2->queryType)
- return false;
-
- if (q1->queryType == SqliteQueryType::CreateTable)
- return true;
-
- if (q1->queryType == SqliteQueryType::CreateView && q2->queryType != SqliteQueryType::CreateTable)
- return true;
-
- return false;
- });
-}
-
-void DbVersionConverter::setInterrupted(bool value)
-{
- QMutexLocker locker(&interruptMutex);
- interrupted = value;
-}
-
-bool DbVersionConverter::isInterrupted()
-{
- QMutexLocker locker(&interruptMutex);
- return interrupted;
-}
-
-void DbVersionConverter::conversionInterrupted(Db* db, bool rollback)
-{
- emit conversionAborted();
- if (rollback)
- db->rollback();
-
- db->close();
-
- QFile file(fullConversionConfig->targetFile);
- if (file.exists())
- file.remove();
-}
-
-void DbVersionConverter::conversionError(Db* db, const QString& errMsg)
-{
- emit conversionFailed(tr("Error while converting database: %1").arg(errMsg));
- db->rollback();
- db->close();
-
- QFile file(fullConversionConfig->targetFile);
- if (file.exists())
- file.remove();
-}
-
-void DbVersionConverter::confirmConversion()
-{
- if (!errors.isEmpty() && !fullConversionConfig->errorsConfirmFunc(errors))
- {
- emit conversionAborted();
- return;
- }
-
- if (!diffList.isEmpty() && !fullConversionConfig->confirmFunc(diffList))
- {
- emit conversionAborted();
- return;
- }
-
- QtConcurrent::run(this, &DbVersionConverter::fullConvertStep2);
-}
-
-void DbVersionConverter::registerDbAfterSuccessfulConversion()
-{
- DBLIST->addDb(fullConversionConfig->targetName, fullConversionConfig->targetFile);
-}
-
-void DbVersionConverter::interrupt()
-{
- setInterrupted(true);
-}
-
-const QList<QPair<QString, QString> >& DbVersionConverter::getDiffList() const
-{
- return diffList;
-}
-
-const QSet<QString>& DbVersionConverter::getErrors() const
-{
- return errors;
-}
-
-const QList<SqliteQueryPtr>&DbVersionConverter::getConverted() const
-{
- return newQueries;
-}
-
-QStringList DbVersionConverter::getConvertedSqls() const
-{
- QStringList sqls;
- for (SqliteQueryPtr query : newQueries)
- sqls << query->detokenize();
-
- return sqls;
-}
-
-void DbVersionConverter::convertDb()
-{
- resolver = new SchemaResolver(db);
- resolver->setIgnoreSystemObjects(true);
- StrHash<SqliteQueryPtr> parsedObjects = resolver->getAllParsedObjects();
- for (SqliteQueryPtr query : parsedObjects.values())
- {
- switch (targetDialect)
- {
- case Dialect::Sqlite2:
- convert3To2(query);
- break;
- case Dialect::Sqlite3:
- convert2To3(query);
- break;
- }
- }
- sortConverted();
-}
diff --git a/SQLiteStudio3/coreSQLiteStudio/dbversionconverter.h b/SQLiteStudio3/coreSQLiteStudio/dbversionconverter.h
deleted file mode 100644
index 5fafc93..0000000
--- a/SQLiteStudio3/coreSQLiteStudio/dbversionconverter.h
+++ /dev/null
@@ -1,160 +0,0 @@
-#ifndef DBVERSIONCONVERTER_H
-#define DBVERSIONCONVERTER_H
-
-#include "parser/ast/sqlitequery.h"
-#include "parser/ast/sqliteorderby.h"
-#include <QList>
-#include <QStringList>
-#include <QPair>
-#include <QMutex>
-
-class Db;
-class SchemaResolver;
-class SqliteCreateTable;
-class SqliteCreateTrigger;
-class SqliteCreateIndex;
-class SqliteCreateView;
-class SqliteCreateVirtualTable;
-class SqliteIndexedColumn;
-class SqliteSelect;
-class SqliteDelete;
-class SqliteUpdate;
-class SqliteInsert;
-class SqliteExpr;
-class SqliteBeginTrans;
-
-class API_EXPORT DbVersionConverter : public QObject
-{
- Q_OBJECT
-
- public:
- typedef std::function<bool(const QList<QPair<QString,QString>>& diffs)> ConversionConfimFunction;
- typedef std::function<bool(const QSet<QString>& errors)> ConversionErrorsConfimFunction;
-
- DbVersionConverter();
- virtual ~DbVersionConverter();
-
- void convert(Dialect from, Dialect to, Db* srcDb, const QString& targetFile, const QString& targetName, ConversionConfimFunction confirmFunc,
- ConversionErrorsConfimFunction errorsConfirmFunc);
- void convert(Dialect from, Dialect to, Db* db);
- void convert3To2(Db* db);
- void convert2To3(Db* db);
- QString convert(Dialect from, Dialect to, const QString& sql);
- QString convert3To2(const QString& sql);
- QString convert2To3(const QString& sql);
- SqliteQueryPtr convert(Dialect from, Dialect to, SqliteQueryPtr query);
- SqliteQueryPtr convert3To2(SqliteQueryPtr query);
- SqliteQueryPtr convert2To3(SqliteQueryPtr query);
-
- const QList<QPair<QString, QString> >& getDiffList() const;
- const QSet<QString>& getErrors() const;
- const QList<SqliteQueryPtr>& getConverted() const;
- QStringList getConvertedSqls() const;
- void reset();
- QList<Dialect> getSupportedVersions() const;
- QStringList getSupportedVersionNames() const;
-
- private:
- struct FullConversionConfig
- {
- Dialect from;
- Dialect to;
- Db* srcDb = nullptr;
- QString targetFile;
- QString targetName;
- ConversionConfimFunction confirmFunc = nullptr;
- ConversionErrorsConfimFunction errorsConfirmFunc = nullptr;
- };
-
- void fullConvertStep1();
- void fullConvertStep2();
- bool fullConvertCreateObjectsStep1(Db* db, QStringList& tables);
- bool fullConvertCreateObjectsStep2(Db* db);
- bool fullConvertCopyData(Db* db, const QStringList& tables);
- bool checkForInterrupted(Db* db, bool rollback);
- void convertDb();
- QList<SqliteQueryPtr> parse(const QString& sql, Dialect dialect);
- bool modifySelectForVersion2(SqliteSelect* select);
- bool modifyDeleteForVersion2(SqliteDelete* del);
- bool modifyInsertForVersion2(SqliteInsert* insert);
- bool modifyUpdateForVersion2(SqliteUpdate* update);
- bool modifyCreateTableForVersion2(SqliteCreateTable* createTable);
- bool modifyCreateTriggerForVersion2(SqliteCreateTrigger* createTrigger);
- bool modifyCreateIndexForVersion2(SqliteCreateIndex* createIndex);
- bool modifyCreateViewForVersion2(SqliteCreateView* createView);
- bool modifyVirtualTableForVesion2(SqliteQueryPtr& query, SqliteCreateVirtualTable* createVirtualTable);
- bool modifyAllExprsForVersion2(SqliteStatement* stmt);
- bool modifySingleExprForVersion2(SqliteExpr* expr);
- bool modifyAllIndexedColumnsForVersion2(SqliteStatement* stmt);
- bool modifySingleIndexedColumnForVersion2(SqliteExtendedIndexedColumn* idxCol);
- bool modifyBeginTransForVersion3(SqliteBeginTrans* begin);
- bool modifyCreateTableForVersion3(SqliteCreateTable* createTable);
- QString getSqlForDiff(SqliteStatement* stmt);
- void storeDiff(const QString& sql1, SqliteStatement* stmt);
- void storeErrorDiff(SqliteStatement* stmt);
- QList<Db*> getAllPossibleDbInstances() const;
- QString generateQueryPlaceholders(int argCount);
- void sortConverted();
- void setInterrupted(bool value);
- bool isInterrupted();
- void conversionInterrupted(Db* db, bool rollback);
-
- template <class T>
- bool modifyAllIndexedColumnsForVersion2(const QList<T*> columns)
- {
- for (T* idxCol : columns)
- {
- if (!modifySingleIndexedColumnForVersion2(idxCol))
- return false;
- }
- return true;
- }
-
-
- template <class T>
- QSharedPointer<T> copyQuery(SqliteQueryPtr query)
- {
- return QSharedPointer<T>::create(*(query.dynamicCast<T>().data()));
- }
-
- Db* db = nullptr;
- Dialect targetDialect = Dialect::Sqlite3;
- SchemaResolver* resolver = nullptr;
- QList<QPair<QString,QString>> diffList;
- QSet<QString> errors;
- QList<SqliteQueryPtr> newQueries;
- FullConversionConfig* fullConversionConfig = nullptr;
- bool interrupted = false;
- QMutex interruptMutex;
-
- /**
- * @brief Whether to include non-DDL statements in diff list.
- *
- * The non-DDL statements are INSERTs, SELECTs, etc.
- * Normally, for DB conversion we only care about DDL modifications,
- * that is for CREATE statements. Other statements may appear inside of
- * triggers or views, but we don't need their diffs separately.
- *
- * This variable is not used currently, but may be in future,
- * when for example individual INSERT statement would need to be converted.
- * Right now there's no such need, but it would be pity to remove the code
- * from that non-DDL statements.
- */
- bool diffsForNonDDL = false;
-
- private slots:
- void conversionError(Db* db, const QString& errMsg);
- void confirmConversion();
- void registerDbAfterSuccessfulConversion();
-
- public slots:
- void interrupt();
-
- signals:
- void askUserForConfirmation();
- void conversionSuccessful();
- void conversionAborted();
- void conversionFailed(const QString& errorMsg);
-};
-
-#endif // DBVERSIONCONVERTER_H
diff --git a/SQLiteStudio3/coreSQLiteStudio/ddlhistorymodel.cpp b/SQLiteStudio3/coreSQLiteStudio/ddlhistorymodel.cpp
index 9df3f81..bee3452 100644
--- a/SQLiteStudio3/coreSQLiteStudio/ddlhistorymodel.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/ddlhistorymodel.cpp
@@ -1,5 +1,6 @@
#include "ddlhistorymodel.h"
#include "querymodel.h"
+#include "common/compatibility.h"
#include <QSet>
#include <QDebug>
@@ -50,8 +51,8 @@ QStringList DdlHistoryModel::getDbNames() const
for (int row = 0; row < rowCount(); row++)
dbNames << data(index(row, 0)).toString();
- QStringList nameList = dbNames.toList();
- qSort(nameList);
+ QStringList nameList = dbNames.values();
+ ::sSort(nameList);
return nameList;
}
diff --git a/SQLiteStudio3/coreSQLiteStudio/dialect.h b/SQLiteStudio3/coreSQLiteStudio/dialect.h
deleted file mode 100644
index f78b16a..0000000
--- a/SQLiteStudio3/coreSQLiteStudio/dialect.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef DIALECT_H
-#define DIALECT_H
-
-enum class Dialect : int
-{
- Sqlite3 = 0,
- Sqlite2 = 1
-};
-
-#endif // DIALECT_H
diff --git a/SQLiteStudio3/coreSQLiteStudio/diff/diff_match_patch.cpp b/SQLiteStudio3/coreSQLiteStudio/diff/diff_match_patch.cpp
index aa5765a..176e919 100644
--- a/SQLiteStudio3/coreSQLiteStudio/diff/diff_match_patch.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/diff/diff_match_patch.cpp
@@ -2042,7 +2042,13 @@ QList<Patch> diff_match_patch::patch_fromText(const QString &textline) {
if (textline.isEmpty()) {
return patches;
}
- QStringList text = textline.split("\n", QString::SkipEmptyParts);
+ QStringList text = textline.split("\n",
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
+ Qt::SkipEmptyParts
+#else
+ QString::SkipEmptyParts
+#endif
+ );
Patch patch;
QRegExp patchHeader("^@@ -(\\d+),?(\\d*) \\+(\\d+),?(\\d*) @@$");
char sign;
diff --git a/SQLiteStudio3/coreSQLiteStudio/exportworker.cpp b/SQLiteStudio3/coreSQLiteStudio/exportworker.cpp
index bc34bd0..8a59495 100644
--- a/SQLiteStudio3/coreSQLiteStudio/exportworker.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/exportworker.cpp
@@ -5,6 +5,7 @@
#include "common/utils_sql.h"
#include "common/utils.h"
#include "db/sqlresultsrow.h"
+#include "common/compatibility.h"
#include <QMutexLocker>
#include <QDebug>
@@ -85,7 +86,7 @@ void ExportWorker::prepareExportTable(Db* db, const QString& database, const QSt
void ExportWorker::prepareParser()
{
safe_delete(parser);
- parser = new Parser(db->getDialect());
+ parser = new Parser();
}
void ExportWorker::interrupt()
@@ -189,7 +190,7 @@ QHash<ExportManager::ExportProviderFlag, QVariant> ExportWorker::getProviderData
{
QStringList wrappedCols;
for (const QueryExecutor::ResultColumnPtr& col : executor->getResultColumns())
- wrappedCols << colLengthTpl.arg(wrapObjIfNeeded(col->displayName, db->getDialect()));
+ wrappedCols << colLengthTpl.arg(wrapObjIfNeeded(col->displayName));
executor->exec(colLengthSql.arg(wrappedCols.join(", "), query));
SqlQueryPtr results = executor->getResults();
@@ -581,7 +582,7 @@ QList<ExportManager::ExportObjectPtr> ExportWorker::collectDbObjects(QString* er
objectsToExport << exportObj;
}
- qSort(objectsToExport.begin(), objectsToExport.end(), [](ExportManager::ExportObjectPtr obj1, ExportManager::ExportObjectPtr obj2) -> bool
+ sSort(objectsToExport, [](ExportManager::ExportObjectPtr obj1, ExportManager::ExportObjectPtr obj2) -> bool
{
if (obj1->type == obj2->type)
return obj1->name.compare(obj2->name, Qt::CaseInsensitive) < 0;
@@ -602,7 +603,7 @@ void ExportWorker::queryTableDataToExport(Db* db, const QString& table, SqlQuery
if (config->exportData)
{
- QString wrappedTable = wrapObjIfNeeded(table, db->getDialect());
+ QString wrappedTable = wrapObjIfNeeded(table);
dataPtr = db->exec(sql.arg(wrappedTable));
if (dataPtr->isError() && !errorMessage->isNull())
*errorMessage = tr("Error while reading data to export from table %1: %2").arg(table, dataPtr->getErrorText());
@@ -623,7 +624,7 @@ void ExportWorker::queryTableDataToExport(Db* db, const QString& table, SqlQuery
{
QStringList wrappedCols;
for (const QString& col : dataPtr->getColumnNames())
- wrappedCols << colLengthTpl.arg(wrapObjIfNeeded(col, db->getDialect()));
+ wrappedCols << colLengthTpl.arg(wrapObjIfNeeded(col));
SqlQueryPtr colLengthQuery = db->exec(colLengthSql.arg(wrappedCols.join(", "), wrappedTable));
if (colLengthQuery->isError())
diff --git a/SQLiteStudio3/coreSQLiteStudio/impl/dbattacherimpl.cpp b/SQLiteStudio3/coreSQLiteStudio/impl/dbattacherimpl.cpp
index 59f4ac5..9547cd1 100644
--- a/SQLiteStudio3/coreSQLiteStudio/impl/dbattacherimpl.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/impl/dbattacherimpl.cpp
@@ -9,12 +9,11 @@
DbAttacherImpl::DbAttacherImpl(Db* db)
{
this->db = db;
- dialect = db->getDialect();
}
bool DbAttacherImpl::attachDatabases(const QString& query)
{
- Parser parser(dialect);
+ Parser parser;
if (!parser.parse(query))
return false;
@@ -89,7 +88,7 @@ QHash<QString, TokenList> DbAttacherImpl::groupDbTokens(const TokenList& dbToken
QString strippedName;
for (TokenPtr token : dbTokens)
{
- strippedName = stripObjName(token->value, dialect);
+ strippedName = stripObjName(token->value);
if (!nameToDbMap.contains(strippedName, Qt::CaseInsensitive))
continue;
@@ -129,7 +128,7 @@ QHash<TokenPtr, TokenPtr> DbAttacherImpl::getTokenMapping(const TokenList& dbTok
TokenPtr dstToken;
for (TokenPtr srcToken : dbTokens)
{
- strippedName = stripObjName(srcToken->value, dialect);
+ strippedName = stripObjName(srcToken->value);
if (strippedName.compare("main", Qt::CaseInsensitive) == 0 ||
strippedName.compare("temp", Qt::CaseInsensitive) == 0)
continue;
diff --git a/SQLiteStudio3/coreSQLiteStudio/impl/dbattacherimpl.h b/SQLiteStudio3/coreSQLiteStudio/impl/dbattacherimpl.h
index 6fbe6c8..13ca021 100644
--- a/SQLiteStudio3/coreSQLiteStudio/impl/dbattacherimpl.h
+++ b/SQLiteStudio3/coreSQLiteStudio/impl/dbattacherimpl.h
@@ -81,7 +81,6 @@ class DbAttacherImpl : public DbAttacher
QList<SqliteQueryPtr> queries;
Db* db = nullptr;
- Dialect dialect;
BiStrHash dbNameToAttach;
StrHash<Db*> nameToDbMap;
bool mainDbNameUsed = false;
diff --git a/SQLiteStudio3/coreSQLiteStudio/importworker.cpp b/SQLiteStudio3/coreSQLiteStudio/importworker.cpp
index 1496571..19cbd07 100644
--- a/SQLiteStudio3/coreSQLiteStudio/importworker.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/importworker.cpp
@@ -14,7 +14,7 @@ void ImportWorker::run()
{
if (!plugin->beforeImport(*config))
{
- emit finished(false);
+ emit finished(false, 0);
return;
}
@@ -39,7 +39,8 @@ void ImportWorker::run()
return;
}
- if (!importData())
+ int rowCount = 0;
+ if (!importData(rowCount))
{
if (!config->skipTransaction)
db->rollback();
@@ -60,7 +61,7 @@ void ImportWorker::run()
emit createdTable(db, table);
plugin->afterImport();
- emit finished(true);
+ emit finished(true, rowCount);
}
void ImportWorker::interrupt()
@@ -83,13 +84,12 @@ void ImportWorker::error(const QString& err)
{
notifyError(err);
plugin->afterImport();
- emit finished(false);
+ emit finished(false, 0);
}
bool ImportWorker::prepareTable()
{
QStringList finalColumns;
- Dialect dialect = db->getDialect();
SchemaResolver resolver(db);
tableColumns = resolver.getTableColumns(table);
@@ -114,11 +114,11 @@ bool ImportWorker::prepareTable()
{
QStringList colDefs;
for (int i = 0; i < columnsFromPlugin.size(); i++)
- colDefs << (wrapObjIfNeeded(columnsFromPlugin[i], dialect) + " " + columnTypesFromPlugin[i]).trimmed();
+ colDefs << (wrapObjIfNeeded(columnsFromPlugin[i]) + " " + columnTypesFromPlugin[i]).trimmed();
static const QString ddl = QStringLiteral("CREATE TABLE %1 (%2)");
Db::Flags flags = config->skipTransaction ? Db::Flag::NO_LOCK : Db::Flag::NONE;
- SqlQueryPtr result = db->exec(ddl.arg(wrapObjIfNeeded(table, dialect), colDefs.join(", ")), flags);
+ SqlQueryPtr result = db->exec(ddl.arg(wrapObjIfNeeded(table), colDefs.join(", ")), flags);
if (result->isError())
{
error(tr("Could not create table to import to: %1").arg(result->getErrorText()));
@@ -134,11 +134,11 @@ bool ImportWorker::prepareTable()
return false;
}
- targetColumns = wrapObjNamesIfNeeded(finalColumns, dialect);
+ targetColumns = wrapObjNamesIfNeeded(finalColumns);
return true;
}
-bool ImportWorker::importData()
+bool ImportWorker::importData(int& rowCount)
{
static const QString insertTemplate = QStringLiteral("INSERT INTO %1 VALUES (%2)");
@@ -147,11 +147,11 @@ bool ImportWorker::importData()
for (int i = 0; i < colCount; i++)
valList << "?";
- QString theInsert = insertTemplate.arg(wrapObjIfNeeded(table, db->getDialect()), valList.join(", "));
+ QString theInsert = insertTemplate.arg(wrapObjIfNeeded(table), valList.join(", "));
SqlQueryPtr query = db->prepare(theInsert);
query->setFlags(Db::Flag::SKIP_DROP_DETECTION|Db::Flag::SKIP_PARAM_COUNTING|Db::Flag::NO_LOCK);
- int rowCnt = 0;
+ rowCount = 0;
QList<QVariant> row;
while ((row = plugin->next()).size() > 0)
{
@@ -166,11 +166,11 @@ bool ImportWorker::importData()
{
if (config->ignoreErrors)
{
- qDebug() << "Could not import data row number" << (rowCnt+1) << ". The row was ignored. Problem details:"
+ qDebug() << "Could not import data row number" << (rowCount+1) << ". The row was ignored. Problem details:"
<< query->getErrorText();
notifyWarn(tr("Could not import data row number %1. The row was ignored. Problem details: %2")
- .arg(QString::number(rowCnt + 1), query->getErrorText()));
+ .arg(QString::number(rowCount + 1), query->getErrorText()));
}
else
{
@@ -179,12 +179,12 @@ bool ImportWorker::importData()
}
}
- if ((rowCnt % 100) == 0 && isInterrupted())
+ if ((rowCount % 100) == 0 && isInterrupted())
{
error(tr("Error while importing data: %1").arg(tr("Interrupted.", "import process status update")));
return false;
}
- rowCnt++;
+ rowCount++;
}
return true;
diff --git a/SQLiteStudio3/coreSQLiteStudio/importworker.h b/SQLiteStudio3/coreSQLiteStudio/importworker.h
index 562ceea..c0912f6 100644
--- a/SQLiteStudio3/coreSQLiteStudio/importworker.h
+++ b/SQLiteStudio3/coreSQLiteStudio/importworker.h
@@ -18,7 +18,7 @@ class ImportWorker : public QObject, public QRunnable
void readPluginColumns();
void error(const QString& err);
bool prepareTable();
- bool importData();
+ bool importData(int& rowCount);
bool isInterrupted();
ImportPlugin* plugin = nullptr;
@@ -38,7 +38,7 @@ class ImportWorker : public QObject, public QRunnable
signals:
void createdTable(Db* db, const QString& table);
- void finished(bool result);
+ void finished(bool result, int rowCount);
};
#endif // IMPORTWORKER_H
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitealtertable.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitealtertable.cpp
index 49763a5..5ca593f 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitealtertable.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitealtertable.cpp
@@ -106,7 +106,7 @@ TokenList SqliteAlterTable::rebuildTokensFromContents()
builder.withKeyword("ALTER").withSpace().withKeyword("TABLE").withSpace();
if (!database.isNull())
- builder.withOther(database, dialect).withOperator(".");
+ builder.withOther(database).withOperator(".");
builder.withOther(table).withSpace();
@@ -120,7 +120,7 @@ TokenList SqliteAlterTable::rebuildTokensFromContents()
}
else if (!newName.isNull())
{
- builder.withKeyword("RENAME").withSpace().withKeyword("TO").withSpace().withOther(newName, dialect);
+ builder.withKeyword("RENAME").withSpace().withKeyword("TO").withSpace().withOther(newName);
}
builder.withOperator(";");
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitealtertable.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitealtertable.h
index 360db45..fbac3fe 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitealtertable.h
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitealtertable.h
@@ -34,9 +34,9 @@ class API_EXPORT SqliteAlterTable : public SqliteQuery
public:
Command command = Command::null;
- QString newName = QString::null;
- QString database = QString::null;
- QString table = QString::null;
+ QString newName = QString();
+ QString database = QString();
+ QString table = QString();
bool columnKw = false;
SqliteCreateTable::Column* newColumn = nullptr;
};
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteanalyze.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteanalyze.cpp
index 30396c1..4e79f3d 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteanalyze.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteanalyze.cpp
@@ -73,7 +73,7 @@ TokenList SqliteAnalyze::rebuildTokensFromContents()
builder.withKeyword("ANALYZE").withSpace();
if (!database.isNull())
- builder.withOther(database, dialect).withOperator(".");
+ builder.withOther(database).withOperator(".");
builder.withOther(table).withOperator(";");
return builder.build();
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteanalyze.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteanalyze.h
index 194e4c9..a786621 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteanalyze.h
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteanalyze.h
@@ -12,8 +12,8 @@ class API_EXPORT SqliteAnalyze : public SqliteQuery
SqliteAnalyze(const QString& name1, const QString& name2);
SqliteStatement* clone();
- QString database = QString::null;
- QString table = QString::null;
+ QString database = QString();
+ QString table = QString();
protected:
QStringList getTablesInStatement();
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitebegintrans.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitebegintrans.cpp
index 00ec9ac..899f8bb 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitebegintrans.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitebegintrans.cpp
@@ -9,7 +9,7 @@ SqliteBeginTrans::SqliteBeginTrans()
}
SqliteBeginTrans::SqliteBeginTrans(const SqliteBeginTrans& other) :
- SqliteQuery(other), onConflict(other.onConflict), name(other.name), transactionKw(other.transactionKw), type(other.type)
+ SqliteQuery(other), name(other.name), transactionKw(other.transactionKw), type(other.type)
{
}
@@ -21,9 +21,8 @@ SqliteBeginTrans::SqliteBeginTrans(SqliteBeginTrans::Type type, bool transaction
this->name = name;
}
-SqliteBeginTrans::SqliteBeginTrans(bool transactionKw, const QString &name, SqliteConflictAlgo onConflict)
+SqliteBeginTrans::SqliteBeginTrans(bool transactionKw, const QString &name)
{
- this->onConflict = onConflict;
this->transactionKw = transactionKw;
this->name = name;
}
@@ -62,10 +61,10 @@ TokenList SqliteBeginTrans::rebuildTokensFromContents()
{
builder.withSpace().withKeyword("TRANSACTION");
if (!name.isNull())
- builder.withSpace().withOther(name, dialect);
+ builder.withSpace().withOther(name);
}
- builder.withConflict(onConflict).withOperator(";");
+ builder.withOperator(";");
return builder.build();
}
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitebegintrans.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitebegintrans.h
index 48f5b37..b16b6c0 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitebegintrans.h
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitebegintrans.h
@@ -19,10 +19,9 @@ class API_EXPORT SqliteBeginTrans : public SqliteQuery
SqliteBeginTrans();
SqliteBeginTrans(const SqliteBeginTrans& other);
SqliteBeginTrans(Type type, bool transactionKw, const QString& name);
- SqliteBeginTrans(bool transactionKw, const QString& name, SqliteConflictAlgo onConflict);
+ SqliteBeginTrans(bool transactionKw, const QString& name);
SqliteStatement* clone();
- SqliteConflictAlgo onConflict = SqliteConflictAlgo::null; // sqlite2 only
QString name; // in docs sqlite2 only, but in gramma it's also sqlite3
bool transactionKw = false;
Type type = Type::null; // sqlite3 only
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecolumntype.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecolumntype.cpp
index 2c48119..5872ab1 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecolumntype.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecolumntype.cpp
@@ -1,6 +1,7 @@
#include "sqlitecolumntype.h"
#include "parser/statementtokenbuilder.h"
#include "common/utils_sql.h"
+#include "parser/lexer.h"
SqliteColumnType::SqliteColumnType()
{
@@ -50,7 +51,7 @@ TokenList SqliteColumnType::rebuildTokensFromContents()
if (name.isEmpty())
return TokenList();
- builder.withOther(name);
+ TokenList resultTokens = Lexer::tokenize(name);
if (!scale.isNull())
{
@@ -79,7 +80,7 @@ TokenList SqliteColumnType::rebuildTokensFromContents()
builder.withParRight();
}
- return builder.build();
+ return resultTokens + builder.build();
}
DataType SqliteColumnType::toDataType() const
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecolumntype.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecolumntype.h
index fc87b6b..f003f9f 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecolumntype.h
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecolumntype.h
@@ -20,7 +20,7 @@ class API_EXPORT SqliteColumnType : public SqliteStatement
TokenList rebuildTokensFromContents();
DataType toDataType() const;
- QString name = QString::null;
+ QString name = QString();
QVariant scale = QVariant(); // first size number
QVariant precision = QVariant(); // second size number
};
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecommittrans.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecommittrans.cpp
index 2b1b707..4f8de49 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecommittrans.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecommittrans.cpp
@@ -39,7 +39,7 @@ TokenList SqliteCommitTrans::rebuildTokensFromContents()
{
builder.withSpace().withKeyword("TRANSACTION");
if (!name.isNull())
- builder.withSpace().withOther(name, dialect);
+ builder.withSpace().withOther(name);
}
builder.withOperator(";");
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecommittrans.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecommittrans.h
index ec418a6..b5557a7 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecommittrans.h
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecommittrans.h
@@ -13,7 +13,7 @@ class API_EXPORT SqliteCommitTrans : public SqliteQuery
SqliteStatement* clone();
bool endKw = false;
- QString name = QString::null;
+ QString name = QString();
bool transactionKw = false;
protected:
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteconflictalgo.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteconflictalgo.cpp
index 56fb42d..2246979 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteconflictalgo.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteconflictalgo.cpp
@@ -32,6 +32,6 @@ QString sqliteConflictAlgo(SqliteConflictAlgo value)
case SqliteConflictAlgo::REPLACE:
return "REPLACE";
default:
- return QString::null;
+ return QString();
}
}
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecopy.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecopy.cpp
index 0d9ed9f..c3ff500 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecopy.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecopy.cpp
@@ -79,9 +79,9 @@ TokenList SqliteCopy::rebuildTokensFromContents()
builder.withKeyword("OR").withSpace().withKeyword(sqliteConflictAlgo(onConflict)).withSpace();
if (!database.isNull())
- builder.withOther(database, dialect).withSpace();
+ builder.withOther(database).withSpace();
- builder.withOther(table, dialect).withSpace().withKeyword("FROM").withSpace().withString(file);
+ builder.withOther(table).withSpace().withKeyword("FROM").withSpace().withString(file);
if (!delimiter.isNull())
builder.withSpace().withKeyword("USING").withSpace().withKeyword("DELIMITERS").withSpace().withString(delimiter);
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecopy.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecopy.h
index ff586df..1e4b5b7 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecopy.h
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecopy.h
@@ -9,14 +9,14 @@ class API_EXPORT SqliteCopy : public SqliteQuery
public:
SqliteCopy();
SqliteCopy(const SqliteCopy& other);
- SqliteCopy(SqliteConflictAlgo onConflict, const QString& name1, const QString& name2, const QString& name3, const QString& delim = QString::null);
+ SqliteCopy(SqliteConflictAlgo onConflict, const QString& name1, const QString& name2, const QString& name3, const QString& delim = QString());
SqliteStatement* clone();
SqliteConflictAlgo onConflict = SqliteConflictAlgo::null;
- QString database = QString::null;
- QString table = QString::null;
- QString file = QString::null;
- QString delimiter = QString::null;
+ QString database = QString();
+ QString table = QString();
+ QString file = QString();
+ QString delimiter = QString();
protected:
QStringList getTablesInStatement();
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreateindex.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreateindex.cpp
index 5c11ff5..b747c33 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreateindex.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreateindex.cpp
@@ -17,32 +17,10 @@ SqliteCreateIndex::SqliteCreateIndex(const SqliteCreateIndex& other) :
DEEP_COPY_COLLECTION(SqliteOrderBy, indexedColumns);
}
-SqliteCreateIndex::SqliteCreateIndex(bool unique, bool ifNotExists, const QString& name1, const QString& name2, const QString& name3, const QList<SqliteIndexedColumn*>& columns, SqliteConflictAlgo onConflict)
- : SqliteCreateIndex()
-{
- // Constructor for SQLite 2
- uniqueKw = unique;
- ifNotExistsKw = ifNotExists;
-
- index = name1;
-
- if (!name3.isNull())
- {
- database = name2;
- table = name3;
- }
- else
- table = name2;
-
- this->onConflict = onConflict;
- this->indexedColumns = toOrderColumns(columns);
-}
-
SqliteCreateIndex::SqliteCreateIndex(bool unique, bool ifNotExists, const QString& name1, const QString& name2, const QString& name3,
const QList<SqliteOrderBy*>& columns, SqliteExpr* where)
: SqliteCreateIndex()
{
- // Constructor for SQLite 3
uniqueKw = unique;
ifNotExistsKw = ifNotExists;
@@ -89,18 +67,12 @@ QStringList SqliteCreateIndex::getDatabasesInStatement()
TokenList SqliteCreateIndex::getTableTokensInStatement()
{
- if (dialect == Dialect::Sqlite2)
- return getObjectTokenListFromNmDbnm("nm2", "dbnm");
- else
- return getTokenListFromNamedKey("nm2");
+ return getTokenListFromNamedKey("nm2");
}
TokenList SqliteCreateIndex::getDatabaseTokensInStatement()
{
- if (dialect == Dialect::Sqlite2)
- return getDbTokenListFromNmDbnm("nm2", "dbnm");
- else
- return getDbTokenListFromNmDbnm();
+ return getDbTokenListFromNmDbnm();
}
QList<SqliteStatement::FullObject> SqliteCreateIndex::getFullObjectsInStatement()
@@ -109,14 +81,9 @@ QList<SqliteStatement::FullObject> SqliteCreateIndex::getFullObjectsInStatement(
// Table object
FullObject fullObj;
- if (dialect == Dialect::Sqlite2)
- fullObj = getFullObjectFromNmDbnm(FullObject::TABLE, "nm2", "dbnm");
- else
- {
- TokenList tableTokens = getTokenListFromNamedKey("nm2");
- if (tableTokens.size() > 0)
- fullObj = getFullObject(FullObject::TABLE, TokenPtr(), tableTokens[0]);
- }
+ TokenList tableTokens = getTokenListFromNamedKey("nm2");
+ if (tableTokens.size() > 0)
+ fullObj = getFullObject(FullObject::TABLE, TokenPtr(), tableTokens[0]);
if (fullObj.isValid())
result << fullObj;
@@ -130,14 +97,10 @@ QList<SqliteStatement::FullObject> SqliteCreateIndex::getFullObjectsInStatement(
}
// Index object
- if (dialect == Dialect::Sqlite2)
- {
- TokenList tableTokens = getTokenListFromNamedKey("nm");
- if (tableTokens.size() > 0)
- fullObj = getFullObject(FullObject::INDEX, TokenPtr(), tableTokens[0]);
- }
- else
- fullObj = getFullObjectFromNmDbnm(FullObject::INDEX, "nm", "dbnm");
+ fullObj = getFullObjectFromNmDbnm(FullObject::INDEX, "nm", "dbnm");
+
+ if (fullObj.isValid())
+ result << fullObj;
return result;
}
@@ -155,28 +118,11 @@ TokenList SqliteCreateIndex::rebuildTokensFromContents()
if (ifNotExistsKw)
builder.withKeyword("IF").withSpace().withKeyword("NOT").withSpace().withKeyword("EXISTS").withSpace();
- if (dialect == Dialect::Sqlite2)
- {
- builder.withOther(index, dialect).withSpace().withKeyword("ON").withSpace();
-
- if (!database.isNull())
- builder.withOther(database, dialect).withOperator(".");
-
- builder.withOther(table, dialect).withSpace();
- builder.withParLeft().withStatementList(indexedColumns).withParRight();
-
-
- if (onConflict != SqliteConflictAlgo::null)
- builder.withSpace().withKeyword(sqliteConflictAlgo(onConflict));
- }
- else
- {
- if (!database.isNull())
- builder.withOther(database, dialect).withOperator(".");
+ if (!database.isNull())
+ builder.withOther(database).withOperator(".");
- builder.withOther(index, dialect).withSpace().withKeyword("ON").withSpace().withOther(table, dialect).withSpace().withParLeft()
- .withStatementList(indexedColumns).withParRight();
- }
+ builder.withOther(index).withSpace().withKeyword("ON").withSpace().withOther(table).withSpace().withParLeft()
+ .withStatementList(indexedColumns).withParRight();
if (where)
builder.withSpace().withKeyword("WHERE").withStatement(where);
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreateindex.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreateindex.h
index 033a663..870ed17 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreateindex.h
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreateindex.h
@@ -33,10 +33,9 @@ class API_EXPORT SqliteCreateIndex : public SqliteQuery, public SqliteTableRelat
bool uniqueKw = false;
bool ifNotExistsKw = false;
QList<SqliteOrderBy*> indexedColumns;
- // The database refers to index name in Sqlite3, but in Sqlite2 it refers to the table.
- QString database = QString::null;
- QString index = QString::null;
- QString table = QString::null;
+ QString database = QString();
+ QString index = QString();
+ QString table = QString();
SqliteConflictAlgo onConflict = SqliteConflictAlgo::null;
SqliteExpr* where = nullptr;
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreatetable.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreatetable.cpp
index eb4ae85..d82270e 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreatetable.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreatetable.cpp
@@ -3,6 +3,8 @@
#include "common/utils_sql.h"
#include "common/global.h"
+const QRegExp SqliteCreateTable::Column::GENERATED_ALWAYS_REGEXP = QRegExp("GENERATED\\s+ALWAYS");
+
SqliteCreateTable::SqliteCreateTable()
{
queryType = SqliteQueryType::CreateTable;
@@ -219,10 +221,10 @@ TokenList SqliteCreateTable::rebuildTokensFromContents()
builder.withSpace().withKeyword("IF").withSpace().withKeyword("NOT").withSpace().withKeyword("EXISTS");
builder.withSpace();
- if (dialect == Dialect::Sqlite3 && !database.isNull())
- builder.withOther(database, dialect).withOperator(".");
+ if (!database.isNull())
+ builder.withOther(database).withOperator(".");
- builder.withOther(table, dialect);
+ builder.withOther(table);
if (select)
builder.withSpace().withKeyword("AS").withSpace().withStatement(select);
@@ -267,8 +269,9 @@ SqliteCreateTable::Column::Constraint::Constraint()
SqliteCreateTable::Column::Constraint::Constraint(const SqliteCreateTable::Column::Constraint& other) :
SqliteStatement(other), type(other.type), name(other.name), sortOrder(other.sortOrder), onConflict(other.onConflict),
- autoincrKw(other.autoincrKw), literalValue(other.literalValue), literalNull(other.literalNull), ctime(other.ctime), id(other.id),
- collationName(other.collationName), deferrable(other.deferrable), initially(other.initially)
+ autoincrKw(other.autoincrKw), generatedKw(other.generatedKw), literalValue(other.literalValue), literalNull(other.literalNull),
+ ctime(other.ctime), id(other.id), collationName(other.collationName), generatedType(other.generatedType),
+ deferrable(other.deferrable), initially(other.initially)
{
DEEP_COPY_FIELD(SqliteExpr, expr);
DEEP_COPY_FIELD(SqliteForeignKey, foreignKey);
@@ -283,6 +286,30 @@ SqliteStatement* SqliteCreateTable::Column::Constraint::clone()
return new SqliteCreateTable::Column::Constraint(*this);
}
+QString SqliteCreateTable::Column::Constraint::toString(SqliteCreateTable::Column::Constraint::GeneratedType type)
+{
+ switch (type) {
+ case SqliteCreateTable::Column::Constraint::GeneratedType::STORED:
+ return "STORED";
+ case SqliteCreateTable::Column::Constraint::GeneratedType::VIRTUAL:
+ return "VIRTUAL";
+ case SqliteCreateTable::Column::Constraint::GeneratedType::null:
+ break;
+ }
+ return QString();
+}
+
+SqliteCreateTable::Column::Constraint::GeneratedType SqliteCreateTable::Column::Constraint::generatedTypeFrom(const QString& type)
+{
+ QString upType = type.toUpper();
+ if (upType == "STORED")
+ return GeneratedType::STORED;
+ else if (upType == "VIRTUAL")
+ return GeneratedType::VIRTUAL;
+ else
+ return GeneratedType::null;
+}
+
void SqliteCreateTable::Column::Constraint::initDefNameOnly(const QString &name)
{
this->type = SqliteCreateTable::Column::Constraint::NAME_ONLY;
@@ -404,6 +431,14 @@ void SqliteCreateTable::Column::Constraint::initColl(const QString &name)
this->collationName = name;
}
+void SqliteCreateTable::Column::Constraint::initGeneratedAs(SqliteExpr* expr, bool genKw, const QString& type)
+{
+ this->type = SqliteCreateTable::Column::Constraint::GENERATED;
+ this->expr = expr;
+ this->generatedKw = genKw;
+ this->generatedType = generatedTypeFrom(type);
+}
+
QString SqliteCreateTable::Column::Constraint::typeString() const
{
switch (type)
@@ -418,6 +453,8 @@ QString SqliteCreateTable::Column::Constraint::typeString() const
return "CHECK";
case SqliteCreateTable::Column::Constraint::DEFAULT:
return "DEFAULT";
+ case SqliteCreateTable::Column::Constraint::GENERATED:
+ return "GENERATED";
case SqliteCreateTable::Column::Constraint::COLLATE:
return "COLLATE";
case SqliteCreateTable::Column::Constraint::FOREIGN_KEY:
@@ -427,7 +464,7 @@ QString SqliteCreateTable::Column::Constraint::typeString() const
case SqliteCreateTable::Column::Constraint::DEFERRABLE_ONLY:
break;
}
- return QString::null;
+ return QString();
}
SqliteCreateTable::Constraint::Constraint()
@@ -551,9 +588,9 @@ QString SqliteCreateTable::Constraint::typeString() const
case SqliteCreateTable::Constraint::FOREIGN_KEY:
return "FOREIGN KEY";
case SqliteCreateTable::Constraint::NAME_ONLY:
- return QString::null;
+ return QString();
}
- return QString::null;
+ return QString();
}
TokenList SqliteCreateTable::Constraint::rebuildTokensFromContents()
@@ -561,7 +598,7 @@ TokenList SqliteCreateTable::Constraint::rebuildTokensFromContents()
StatementTokenBuilder builder;
if (!name.isNull())
- builder.withKeyword("CONSTRAINT").withSpace().withOther(name, dialect).withSpace();
+ builder.withKeyword("CONSTRAINT").withSpace().withOther(name).withSpace();
switch (type)
{
@@ -694,6 +731,33 @@ QList<SqliteCreateTable::Column::Constraint*> SqliteCreateTable::Column::getFore
return results;
}
+void SqliteCreateTable::Column::fixTypeVsGeneratedAs()
+{
+ // This is a workaround for lemon parser taking "GENERATED ALWAYS" as part of the typename,
+ // despite 2 days effort of forcing proper precedense to parse it as part of a constraint.
+ // Lemon keeps reducing these 2 keywords into the typename by using fallback of GENERATED & ALWAYS to ID,
+ // regardless of rule order and explicit precedence. By throwing the GENERATED keyword out of the fallback list,
+ // we would make the syntax incompatible with official SQLite syntax, which allows usage of GENERATED as ID.
+ // I've tried to use more recent Lemon parser, but it's different a lot from current one and it is no longer possible
+ // to collect tokens parsed per rule (needed tor SqliteStatement's tokens & tokenMap). At least not in the way
+ // that it used to be so far.
+ // This is the last resort to make it right.
+ // This method is called from parser rule that reduces column definition (rule "column(X)").
+ Constraint* generatedConstr = getConstraint(Constraint::GENERATED);
+ if (generatedConstr && !generatedConstr->generatedKw && type && type->name.toUpper().contains(GENERATED_ALWAYS_REGEXP))
+ {
+ type->name.replace(GENERATED_ALWAYS_REGEXP, "");
+ type->tokens = type->rebuildTokensFromContents();
+ type->tokensMap["typename"] = type->tokens;
+ generatedConstr->generatedKw = true;
+ }
+}
+
+void SqliteCreateTable::Column::evaluatePostParsing()
+{
+ fixTypeVsGeneratedAs();
+}
+
QStringList SqliteCreateTable::Column::getColumnsInStatement()
{
return getStrListFromValue(name);
@@ -707,7 +771,7 @@ TokenList SqliteCreateTable::Column::getColumnTokensInStatement()
TokenList SqliteCreateTable::Column::rebuildTokensFromContents()
{
StatementTokenBuilder builder;
- builder.withOther(name, dialect).withStatement(type).withStatementList(constraints, "");
+ builder.withOther(name).withStatement(type).withStatementList(constraints, "");
return builder.build();
}
@@ -715,7 +779,7 @@ TokenList SqliteCreateTable::Column::Constraint::rebuildTokensFromContents()
{
StatementTokenBuilder builder;
if (!name.isNull())
- builder.withKeyword("CONSTRAINT").withSpace().withOther(name, dialect).withSpace();
+ builder.withKeyword("CONSTRAINT").withSpace().withOther(name).withSpace();
switch (type)
{
@@ -746,7 +810,7 @@ TokenList SqliteCreateTable::Column::Constraint::rebuildTokensFromContents()
{
builder.withKeyword("DEFAULT").withSpace();
if (!id.isNull())
- builder.withOther(id, dialect);
+ builder.withOther(id);
else if (!ctime.isNull())
builder.withKeyword(ctime.toUpper());
else if (expr)
@@ -760,7 +824,7 @@ TokenList SqliteCreateTable::Column::Constraint::rebuildTokensFromContents()
}
case SqliteCreateTable::Column::Constraint::COLLATE:
{
- builder.withKeyword("COLLATE").withSpace().withOther(collationName, dialect);
+ builder.withKeyword("COLLATE").withSpace().withOther(collationName);
break;
}
case SqliteCreateTable::Column::Constraint::FOREIGN_KEY:
@@ -768,6 +832,17 @@ TokenList SqliteCreateTable::Column::Constraint::rebuildTokensFromContents()
builder.withStatement(foreignKey);
break;
}
+ case SqliteCreateTable::Column::Constraint::GENERATED:
+ {
+ if (generatedKw)
+ builder.withKeyword("GENERATED").withSpace().withKeyword("ALWAYS").withSpace();
+
+ builder.withKeyword("AS").withSpace().withParLeft().withStatement(expr).withParRight();
+ if (generatedType != GeneratedType::null)
+ builder.withSpace().withOther(toString(generatedType), false);
+
+ break;
+ }
case SqliteCreateTable::Column::Constraint::NULL_:
case SqliteCreateTable::Column::Constraint::NAME_ONLY:
case SqliteCreateTable::Column::Constraint::DEFERRABLE_ONLY:
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreatetable.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreatetable.h
index 74f4fce..d34688c 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreatetable.h
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreatetable.h
@@ -13,6 +13,7 @@
#include "sqliteddlwithdbcontext.h"
#include <QVariant>
#include <QList>
+#include <QRegExp>
class API_EXPORT SqliteCreateTable : public SqliteQuery, public SqliteDdlWithDbContext
{
@@ -34,16 +35,27 @@ class API_EXPORT SqliteCreateTable : public SqliteQuery, public SqliteDdlWithDbC
DEFAULT,
COLLATE,
FOREIGN_KEY,
+ GENERATED,
NULL_, // not officially supported
NAME_ONLY, // unofficial, because of bizarre sqlite grammar
DEFERRABLE_ONLY // unofficial, because of bizarre sqlite grammar
};
+ enum class GeneratedType
+ {
+ STORED,
+ VIRTUAL,
+ null
+ };
+
Constraint();
Constraint(const Constraint& other);
~Constraint();
SqliteStatement* clone();
+ static QString toString(GeneratedType type);
+ static GeneratedType generatedTypeFrom(const QString& type);
+
void initDefNameOnly(const QString& name);
void initDefId(const QString& id);
void initDefTerm(const QVariant& value, bool minus = false);
@@ -59,19 +71,22 @@ class API_EXPORT SqliteCreateTable : public SqliteQuery, public SqliteDdlWithDbC
void initFk(const QString& table, const QList<SqliteIndexedColumn*>& indexedColumns, const QList<SqliteForeignKey::Condition*>& conditions);
void initDefer(SqliteInitially initially, SqliteDeferrable deferrable);
void initColl(const QString& name);
+ void initGeneratedAs(SqliteExpr* expr, bool genKw, const QString& type);
QString typeString() const;
Type type;
- QString name = QString::null;
+ QString name = QString();
SqliteSortOrder sortOrder = SqliteSortOrder::null;
SqliteConflictAlgo onConflict = SqliteConflictAlgo::null;
bool autoincrKw = false;
+ bool generatedKw = false;
SqliteExpr* expr = nullptr;
QVariant literalValue;
bool literalNull = false;
QString ctime;
QString id;
- QString collationName = QString::null;
+ QString collationName = QString();
+ GeneratedType generatedType = GeneratedType::null;
SqliteForeignKey* foreignKey = nullptr;
protected:
@@ -96,8 +111,10 @@ class API_EXPORT SqliteCreateTable : public SqliteQuery, public SqliteDdlWithDbC
Constraint* getConstraint(Constraint::Type type) const;
QList<Constraint*> getConstraints(Constraint::Type type) const;
QList<Constraint*> getForeignKeysByTable(const QString& foreignTable) const;
+ void fixTypeVsGeneratedAs();
+ void evaluatePostParsing();
- QString name = QString::null;
+ QString name = QString();
SqliteColumnType* type = nullptr;
QList<Constraint*> constraints;
@@ -106,12 +123,15 @@ class API_EXPORT SqliteCreateTable : public SqliteQuery, public SqliteDdlWithDbC
* Used to remember original name when column was edited and the name was changed.
* It's defined in the constructor to the same value as the name member.
*/
- QString originalName = QString::null;
+ QString originalName = QString();
protected:
QStringList getColumnsInStatement();
TokenList getColumnTokensInStatement();
TokenList rebuildTokensFromContents();
+
+ private:
+ static const QRegExp GENERATED_ALWAYS_REGEXP;
};
typedef QSharedPointer<Column> ColumnPtr;
@@ -149,7 +169,7 @@ class API_EXPORT SqliteCreateTable : public SqliteQuery, public SqliteDdlWithDbC
QString typeString() const;
Type type;
- QString name = QString::null;
+ QString name = QString();
bool autoincrKw = false; // not in docs, but needs to be supported
SqliteConflictAlgo onConflict = SqliteConflictAlgo::null;
SqliteForeignKey* foreignKey = nullptr;
@@ -189,12 +209,12 @@ class API_EXPORT SqliteCreateTable : public SqliteQuery, public SqliteDdlWithDbC
bool ifNotExistsKw = false;
bool tempKw = false;
bool temporaryKw = false;
- QString database = QString::null;
- QString table = QString::null;
+ QString database = QString();
+ QString table = QString();
QList<Column*> columns;
QList<Constraint*> constraints;
SqliteSelect* select = nullptr;
- QString withOutRowId = QString::null;
+ QString withOutRowId = QString();
protected:
QStringList getTablesInStatement();
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreatetrigger.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreatetrigger.cpp
index 001dd2d..3f2c4e3 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreatetrigger.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreatetrigger.cpp
@@ -126,7 +126,7 @@ QString SqliteCreateTrigger::time(SqliteCreateTrigger::Time eventTime)
case SqliteCreateTrigger::Time::null:
break;
}
- return QString::null;
+ return QString();
}
SqliteCreateTrigger::Time SqliteCreateTrigger::time(const QString& eventTime)
@@ -154,7 +154,7 @@ QString SqliteCreateTrigger::scopeToString(SqliteCreateTrigger::Scope scope)
case SqliteCreateTrigger::Scope::null:
break;
}
- return QString::null;
+ return QString();
}
SqliteCreateTrigger::Scope SqliteCreateTrigger::stringToScope(const QString& scope)
@@ -180,18 +180,12 @@ QStringList SqliteCreateTrigger::getDatabasesInStatement()
TokenList SqliteCreateTrigger::getTableTokensInStatement()
{
- if (dialect == Dialect::Sqlite2)
- return getObjectTokenListFromNmDbnm("nm2", "dbnm");
- else
- return getTokenListFromNamedKey("nm2");
+ return getTokenListFromNamedKey("nm2");
}
TokenList SqliteCreateTrigger::getDatabaseTokensInStatement()
{
- if (dialect == Dialect::Sqlite2)
- return getDbTokenListFromNmDbnm("nm2", "dbnm");
- else
- return getDbTokenListFromNmDbnm();
+ return getDbTokenListFromNmDbnm();
}
QList<SqliteStatement::FullObject> SqliteCreateTrigger::getFullObjectsInStatement()
@@ -200,14 +194,9 @@ QList<SqliteStatement::FullObject> SqliteCreateTrigger::getFullObjectsInStatemen
// Table object
FullObject fullObj;
- if (dialect == Dialect::Sqlite2)
- fullObj = getFullObjectFromNmDbnm(FullObject::TABLE, "nm2", "dbnm");
- else
- {
- TokenList tableTokens = getTokenListFromNamedKey("nm2");
- if (tableTokens.size() > 0)
- fullObj = getFullObject(FullObject::TABLE, TokenPtr(), tableTokens[0]);
- }
+ TokenList tableTokens = getTokenListFromNamedKey("nm2");
+ if (tableTokens.size() > 0)
+ fullObj = getFullObject(FullObject::TABLE, TokenPtr(), tableTokens[0]);
if (fullObj.isValid())
result << fullObj;
@@ -221,14 +210,9 @@ QList<SqliteStatement::FullObject> SqliteCreateTrigger::getFullObjectsInStatemen
}
// Trigger object
- if (dialect == Dialect::Sqlite2)
- {
- TokenList tableTokens = getTokenListFromNamedKey("nm");
- if (tableTokens.size() > 0)
- fullObj = getFullObject(FullObject::TRIGGER, TokenPtr(), tableTokens[0]);
- }
- else
- fullObj = getFullObjectFromNmDbnm(FullObject::TRIGGER, "nm", "dbnm");
+ fullObj = getFullObjectFromNmDbnm(FullObject::TRIGGER, "nm", "dbnm");
+ if (fullObj.isValid())
+ result << fullObj;
return result;
}
@@ -299,7 +283,7 @@ QString SqliteCreateTrigger::Event::typeToString(SqliteCreateTrigger::Event::Typ
case SqliteCreateTrigger::Event::null:
break;
}
- return QString::null;
+ return QString();
}
SqliteCreateTrigger::Event::Type SqliteCreateTrigger::Event::stringToType(const QString& type)
@@ -333,10 +317,10 @@ TokenList SqliteCreateTrigger::rebuildTokensFromContents()
if (ifNotExistsKw)
builder.withKeyword("IF").withSpace().withKeyword("NOT").withSpace().withKeyword("EXISTS").withSpace();
- if (dialect == Dialect::Sqlite3 && !database.isNull())
- builder.withOther(database, dialect).withOperator(".");
+ if (!database.isNull())
+ builder.withOther(database).withOperator(".");
- builder.withOther(trigger, dialect).withSpace();
+ builder.withOther(trigger).withSpace();
switch (eventTime)
{
case Time::BEFORE:
@@ -353,10 +337,7 @@ TokenList SqliteCreateTrigger::rebuildTokensFromContents()
}
builder.withStatement(event).withSpace().withKeyword("ON").withSpace();
- if (dialect == Dialect::Sqlite2 && !database.isNull())
- builder.withOther(database, dialect).withOperator(".");
-
- builder.withOther(table, dialect).withSpace();
+ builder.withOther(table).withSpace();
switch (scope)
{
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreatetrigger.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreatetrigger.h
index 2ccf876..ac7b81f 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreatetrigger.h
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreatetrigger.h
@@ -70,10 +70,9 @@ class API_EXPORT SqliteCreateTrigger : public SqliteQuery, public SqliteTableRel
bool tempKw = false;
bool temporaryKw = false;
bool ifNotExistsKw = false;
- // The database refers to the trigger name in Sqlite3, but in Sqlite2 it refers to the table.
- QString database = QString::null;
- QString trigger = QString::null;
- QString table = QString::null; // can also be a view name
+ QString database = QString();
+ QString trigger = QString();
+ QString table = QString(); // can also be a view name
Event* event = nullptr;
Time eventTime = Time::null;
Scope scope = Scope::null;
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreateview.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreateview.cpp
index fe638db..f5b54e7 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreateview.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreateview.cpp
@@ -67,10 +67,7 @@ QStringList SqliteCreateView::getDatabasesInStatement()
TokenList SqliteCreateView::getDatabaseTokensInStatement()
{
- if (dialect == Dialect::Sqlite3)
- return getDbTokenListFromFullname();
- else
- return TokenList();
+ return getDbTokenListFromFullname();
}
QList<SqliteStatement::FullObject> SqliteCreateView::getFullObjectsInStatement()
@@ -78,28 +75,17 @@ QList<SqliteStatement::FullObject> SqliteCreateView::getFullObjectsInStatement()
QList<FullObject> result;
// View object
- FullObject fullObj;
- if (dialect == Dialect::Sqlite3)
- fullObj = getFullObjectFromFullname(FullObject::VIEW);
- else
- {
- TokenList tokens = getTokenListFromNamedKey("nm");
- if (tokens.size() > 0)
- fullObj = getFullObject(FullObject::VIEW, TokenPtr(), tokens[0]);
- }
+ FullObject fullObj = getFullObjectFromFullname(FullObject::VIEW);
if (fullObj.isValid())
result << fullObj;
// Db object
- if (dialect == Dialect::Sqlite3)
+ fullObj = getFirstDbFullObject();
+ if (fullObj.isValid())
{
- fullObj = getFirstDbFullObject();
- if (fullObj.isValid())
- {
- result << fullObj;
- dbTokenForFullObjects = fullObj.database;
- }
+ result << fullObj;
+ dbTokenForFullObjects = fullObj.database;
}
return result;
@@ -119,10 +105,10 @@ TokenList SqliteCreateView::rebuildTokensFromContents()
if (ifNotExists)
builder.withKeyword("IF").withSpace().withKeyword("NOT").withSpace().withKeyword("EXISTS").withSpace();
- if (dialect == Dialect::Sqlite3 && !database.isNull())
- builder.withOther(database, dialect).withOperator(".");
+ if (!database.isNull())
+ builder.withOther(database).withOperator(".");
- builder.withOther(view, dialect).withSpace();
+ builder.withOther(view).withSpace();
if (columns.size() > 0)
builder.withParLeft().withStatementList<SqliteIndexedColumn>(columns).withParRight().withSpace();
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreateview.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreateview.h
index 1f46d5e..74f6b91 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreateview.h
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreateview.h
@@ -25,8 +25,8 @@ class API_EXPORT SqliteCreateView : public SqliteQuery, public SqliteDdlWithDbCo
bool tempKw = false;
bool temporaryKw = false;
bool ifNotExists = false;
- QString database = QString::null;
- QString view = QString::null;
+ QString database = QString();
+ QString view = QString();
SqliteSelect* select = nullptr;
QList<SqliteIndexedColumn*> columns;
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreatevirtualtable.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreatevirtualtable.cpp
index 1d98c8d..3f1639a 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreatevirtualtable.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreatevirtualtable.cpp
@@ -97,9 +97,9 @@ TokenList SqliteCreateVirtualTable::rebuildTokensFromContents()
builder.withKeyword("IF").withSpace().withKeyword("NOT").withSpace().withKeyword("EXISTS").withSpace();
if (!database.isNull())
- builder.withOther(database, dialect).withOperator(".");
+ builder.withOther(database).withOperator(".");
- builder.withKeyword("USING").withSpace().withOther(module, dialect);
+ builder.withKeyword("USING").withSpace().withOther(module);
if (!args.isEmpty())
{
builder.withSpace();
@@ -109,7 +109,7 @@ TokenList SqliteCreateVirtualTable::rebuildTokensFromContents()
if (i > 0)
builder.withOperator(",").withSpace();
- builder.withTokens(Lexer::tokenize(arg, Dialect::Sqlite3));
+ builder.withTokens(Lexer::tokenize(arg));
i++;
}
}
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreatevirtualtable.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreatevirtualtable.h
index cb2d231..28f91ce 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreatevirtualtable.h
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitecreatevirtualtable.h
@@ -31,9 +31,9 @@ class API_EXPORT SqliteCreateVirtualTable : public SqliteQuery
public:
bool ifNotExistsKw = false;
- QString database = QString::null;
- QString table = QString::null;
- QString module = QString::null;
+ QString database = QString();
+ QString table = QString();
+ QString module = QString();
QList<QString> args;
};
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedeferrable.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedeferrable.cpp
index 4ef4d51..50b7de2 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedeferrable.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedeferrable.cpp
@@ -11,7 +11,7 @@ QString sqliteDeferrable(SqliteDeferrable deferrable)
case SqliteDeferrable::null:
break;
}
- return QString::null;
+ return QString();
}
SqliteDeferrable sqliteDeferrable(const QString& deferrable)
@@ -38,7 +38,7 @@ QString sqliteInitially(SqliteInitially initially)
case SqliteInitially::null:
break;
}
- return QString::null;
+ return QString();
}
SqliteInitially sqliteInitially(const QString& initially)
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedelete.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedelete.cpp
index 6026de3..dd4d7cb 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedelete.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedelete.cpp
@@ -119,12 +119,12 @@ TokenList SqliteDelete::rebuildTokensFromContents()
builder.withKeyword("DELETE").withSpace().withKeyword("FROM").withSpace();
if (!database.isNull())
- builder.withOther(database, dialect).withOperator(".");
+ builder.withOther(database).withOperator(".");
- builder.withOther(table, dialect);
+ builder.withOther(table);
if (indexedByKw)
- builder.withSpace().withKeyword("INDEXED").withSpace().withKeyword("BY").withSpace().withOther(indexedBy, dialect);
+ builder.withSpace().withKeyword("INDEXED").withSpace().withKeyword("BY").withSpace().withOther(indexedBy);
else if (notIndexedKw)
builder.withSpace().withKeyword("NOT").withSpace().withKeyword("INDEXED");
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedelete.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedelete.h
index 90e1385..5d24619 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedelete.h
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedelete.h
@@ -31,11 +31,11 @@ class API_EXPORT SqliteDelete : public SqliteQuery
void init(const QString& name1, const QString& name2, SqliteExpr* where, SqliteWith* with);
public:
- QString database = QString::null;
- QString table = QString::null;
+ QString database = QString();
+ QString table = QString();
bool indexedByKw = false;
bool notIndexedKw = false;
- QString indexedBy = QString::null;
+ QString indexedBy = QString();
SqliteExpr* where = nullptr;
SqliteWith* with = nullptr;
};
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedropindex.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedropindex.cpp
index 2e39312..8d5f878 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedropindex.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedropindex.cpp
@@ -70,7 +70,7 @@ TokenList SqliteDropIndex::rebuildTokensFromContents()
builder.withKeyword("IF").withSpace().withKeyword("EXISTS").withSpace();
if (!database.isNull())
- builder.withOther(database, dialect).withOperator(".");
+ builder.withOther(database).withOperator(".");
builder.withOther(index).withOperator(";");
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedropindex.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedropindex.h
index 9ce7065..4f4364a 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedropindex.h
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedropindex.h
@@ -14,8 +14,8 @@ class API_EXPORT SqliteDropIndex : public SqliteQuery
SqliteStatement* clone();
bool ifExistsKw = false;
- QString database = QString::null;
- QString index = QString::null;
+ QString database = QString();
+ QString index = QString();
protected:
QStringList getDatabasesInStatement();
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedroptable.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedroptable.cpp
index c4fc02d..f567cc0 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedroptable.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedroptable.cpp
@@ -78,7 +78,7 @@ TokenList SqliteDropTable::rebuildTokensFromContents()
builder.withKeyword("IF").withSpace().withKeyword("EXISTS").withSpace();
if (!database.isNull())
- builder.withOther(database, dialect).withOperator(".");
+ builder.withOther(database).withOperator(".");
builder.withOther(table).withOperator(";");
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedroptable.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedroptable.h
index edc4da4..58706b2 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedroptable.h
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedroptable.h
@@ -14,8 +14,8 @@ class API_EXPORT SqliteDropTable : public SqliteQuery
SqliteStatement* clone();
bool ifExistsKw = false;
- QString database = QString::null;
- QString table = QString::null;
+ QString database = QString();
+ QString table = QString();
protected:
QStringList getTablesInStatement();
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedroptrigger.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedroptrigger.cpp
index 8921af3..9794ed4 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedroptrigger.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedroptrigger.cpp
@@ -71,7 +71,7 @@ TokenList SqliteDropTrigger::rebuildTokensFromContents()
builder.withKeyword("IF").withSpace().withKeyword("EXISTS").withSpace();
if (!database.isNull())
- builder.withOther(database, dialect).withOperator(".");
+ builder.withOther(database).withOperator(".");
builder.withOther(trigger).withOperator(";");
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedroptrigger.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedroptrigger.h
index 5221959..316af98 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedroptrigger.h
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedroptrigger.h
@@ -14,8 +14,8 @@ class API_EXPORT SqliteDropTrigger : public SqliteQuery
SqliteStatement* clone();
bool ifExistsKw = false;
- QString database = QString::null;
- QString trigger = QString::null;
+ QString database = QString();
+ QString trigger = QString();
protected:
QStringList getDatabasesInStatement();
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedropview.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedropview.cpp
index b992e98..423b1da 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedropview.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedropview.cpp
@@ -34,17 +34,11 @@ SqliteStatement*SqliteDropView::clone()
QStringList SqliteDropView::getDatabasesInStatement()
{
- if (dialect == Dialect::Sqlite2)
- return QStringList();
-
return getStrListFromValue(database);
}
TokenList SqliteDropView::getDatabaseTokensInStatement()
{
- if (dialect == Dialect::Sqlite2)
- return TokenList();
-
return getDbTokenListFromFullname();
}
@@ -77,7 +71,7 @@ TokenList SqliteDropView::rebuildTokensFromContents()
builder.withKeyword("IF").withSpace().withKeyword("EXISTS").withSpace();
if (!database.isNull())
- builder.withOther(database, dialect).withOperator(".");
+ builder.withOther(database).withOperator(".");
builder.withOther(view).withOperator(";");
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedropview.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedropview.h
index 853ccef..2f0882c 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedropview.h
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitedropview.h
@@ -14,8 +14,8 @@ class API_EXPORT SqliteDropView : public SqliteQuery
SqliteStatement* clone();
bool ifExistsKw = false;
- QString database = QString::null;
- QString view = QString::null;
+ QString database = QString();
+ QString view = QString();
protected:
QStringList getDatabasesInStatement();
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteexpr.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteexpr.cpp
index d17205a..e2c79ea 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteexpr.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteexpr.cpp
@@ -2,6 +2,7 @@
#include "sqliteraise.h"
#include "sqliteselect.h"
#include "sqlitecolumntype.h"
+#include "sqlitefilterover.h"
#include "parser/statementtokenbuilder.h"
#include "common/utils_sql.h"
#include "common/global.h"
@@ -25,6 +26,7 @@ SqliteExpr::SqliteExpr(const SqliteExpr& other) :
DEEP_COPY_COLLECTION(SqliteExpr, exprList);
DEEP_COPY_FIELD(SqliteSelect, select);
DEEP_COPY_FIELD(SqliteRaise, raiseFunction);
+ DEEP_COPY_FIELD(SqliteFilterOver, filterOver);
}
SqliteExpr::~SqliteExpr()
@@ -59,7 +61,7 @@ QString SqliteExpr::likeOp(SqliteExpr::LikeOp value)
case SqliteExpr::LikeOp::MATCH:
return "MATCH";
default:
- return QString::null;
+ return QString();
}
}
@@ -87,7 +89,7 @@ QString SqliteExpr::notNullOp(SqliteExpr::NotNull value)
case SqliteExpr::NotNull::NOTNULL:
return "NOTNULL";
default:
- return QString::null;
+ return QString();
}
}
@@ -168,10 +170,7 @@ void SqliteExpr::initFunction(const QString& fnName, int distinct, const QList<S
mode = SqliteExpr::Mode::FUNCTION;
function = fnName;
this->exprList = exprList;
- if (distinct == 1)
- distinctKw = true;
- else if (distinct == 2)
- allKw = true;
+ initDistinct(distinct);
for (SqliteExpr* expr : exprList)
expr->setParent(this);
@@ -184,6 +183,32 @@ void SqliteExpr::initFunction(const QString& fnName, bool star)
this->star = star;
}
+void SqliteExpr::initWindowFunction(const QString& fnName, int distinct, const QList<SqliteExpr*>& exprList, SqliteFilterOver* filterOver)
+{
+ mode = SqliteExpr::Mode::WINDOW_FUNCTION;
+ this->function = fnName;
+ this->exprList = exprList;
+ initDistinct(distinct);
+ this->filterOver = filterOver;
+
+ for (SqliteExpr* expr : exprList)
+ expr->setParent(this);
+
+ if (filterOver)
+ filterOver->setParent(this);
+}
+
+void SqliteExpr::initWindowFunction(const QString& fnName, SqliteFilterOver* filterOver)
+{
+ mode = SqliteExpr::Mode::WINDOW_FUNCTION;
+ this->function = fnName;
+ this->star = true;
+ this->filterOver = filterOver;
+
+ if (filterOver)
+ filterOver->setParent(this);
+}
+
void SqliteExpr::initBinOp(SqliteExpr *expr1, const QString& op, SqliteExpr *expr2)
{
mode = SqliteExpr::Mode::BINARY_OP;
@@ -363,6 +388,36 @@ void SqliteExpr::detectDoubleQuotes(bool recursively)
}
}
+bool SqliteExpr::replace(SqliteExpr* toBeReplaced, SqliteExpr* replaceWith)
+{
+ if (expr1 == toBeReplaced)
+ {
+ expr1 = replaceWith;
+ return true;
+ }
+
+ if (expr2 == toBeReplaced)
+ {
+ expr2 = replaceWith;
+ return true;
+ }
+
+ if (expr3 == toBeReplaced)
+ {
+ expr3 = replaceWith;
+ return true;
+ }
+
+ int idx = exprList.indexOf(toBeReplaced);
+ if (idx > -1)
+ {
+ exprList.replace(idx, replaceWith);
+ return true;
+ }
+
+ return false;
+}
+
QStringList SqliteExpr::getColumnsInStatement()
{
return getStrListFromValue(column);
@@ -498,6 +553,8 @@ TokenList SqliteExpr::rebuildTokensFromContents()
builder.withOther(function).withParLeft();
if (distinctKw)
builder.withKeyword("DISTINCT");
+ else if (allKw)
+ builder.withKeyword("DISTINCT");
if (star)
builder.withOperator("*").withParRight();
@@ -505,6 +562,20 @@ TokenList SqliteExpr::rebuildTokensFromContents()
builder.withStatementList(exprList).withParRight();
break;
+ case SqliteExpr::Mode::WINDOW_FUNCTION:
+ builder.withOther(function).withParLeft();
+ if (distinctKw)
+ builder.withKeyword("DISTINCT");
+ else if (allKw)
+ builder.withKeyword("DISTINCT");
+
+ if (star)
+ builder.withOperator("*").withParRight();
+ else
+ builder.withStatementList(exprList).withParRight();
+
+ builder.withSpace().withStatement(filterOver);
+ break;
case SqliteExpr::Mode::SUB_EXPR:
builder.withParLeft().withStatement(expr1).withParRight();
break;
@@ -513,7 +584,7 @@ TokenList SqliteExpr::rebuildTokensFromContents()
.withStatement(columnType).withParRight();
break;
case SqliteExpr::Mode::COLLATE:
- builder.withStatement(expr1).withSpace().withKeyword("COLLATE").withSpace().withOther(collation, dialect);
+ builder.withStatement(expr1).withSpace().withKeyword("COLLATE").withSpace().withOther(collation);
break;
case SqliteExpr::Mode::LIKE:
builder.withTokens(rebuildLike());
@@ -562,15 +633,15 @@ TokenList SqliteExpr::rebuildId()
{
StatementTokenBuilder builder;
if (!database.isNull())
- builder.withOther(database, dialect).withOperator(".");
+ builder.withOther(database).withOperator(".");
if (!table.isNull())
- builder.withOther(table, dialect).withOperator(".");
+ builder.withOther(table).withOperator(".");
if (table.isNull() && possibleDoubleQuotedString)
- builder.withStringPossiblyOther(column, dialect);
+ builder.withStringPossiblyOther(column);
else
- builder.withOther(column, dialect);
+ builder.withOther(column);
return builder.build();
}
@@ -652,9 +723,9 @@ TokenList SqliteExpr::rebuildIn()
else
{
if (!database.isNull())
- builder.withOther(database, dialect).withOperator(".");
+ builder.withOther(database).withOperator(".");
- builder.withOther(table, dialect);
+ builder.withOther(table);
}
return builder.build();
}
@@ -686,3 +757,11 @@ TokenList SqliteExpr::rebuildCase()
builder.withKeyword("END");
return builder.build();
}
+
+void SqliteExpr::initDistinct(int distinct)
+{
+ if (distinct == 1)
+ distinctKw = true;
+ else if (distinct == 2)
+ allKw = true;
+}
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteexpr.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteexpr.h
index c65a8e2..ef4c7da 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteexpr.h
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteexpr.h
@@ -6,6 +6,7 @@
#include <QVariant>
#include <QList>
+class SqliteFilterOver;
class SqliteSelect;
class SqliteColumnType;
class SqliteRaise;
@@ -26,7 +27,7 @@ class API_EXPORT SqliteExpr : public SqliteStatement
SUB_EXPR,
ROW_VALUE,
CAST,
- COLLATE, // in Sqlite2 exists only in expr of sortlist
+ COLLATE,
LIKE,
NULL_,
NOTNULL,
@@ -36,7 +37,8 @@ class API_EXPORT SqliteExpr : public SqliteStatement
EXISTS,
CASE,
SUB_SELECT,
- RAISE
+ RAISE,
+ WINDOW_FUNCTION
};
enum class NotNull
@@ -79,6 +81,8 @@ class API_EXPORT SqliteExpr : public SqliteStatement
void initCast(SqliteExpr* expr, SqliteColumnType* type);
void initFunction(const QString& fnName, int distinct, const QList<SqliteExpr*>& exprList);
void initFunction(const QString& fnName, bool star = false);
+ void initWindowFunction(const QString& fnName, int distinct, const QList<SqliteExpr*>& exprList, SqliteFilterOver* filterOver);
+ void initWindowFunction(const QString& fnName, SqliteFilterOver* filterOver);
void initBinOp(SqliteExpr* expr1, const QString& op, SqliteExpr* expr2);
void initUnaryOp(SqliteExpr* expr, const QString& op);
void initLike(SqliteExpr* expr1, bool notKw, SqliteExpr::LikeOp likeOp, SqliteExpr* expr2, SqliteExpr* expr3 = nullptr);
@@ -91,27 +95,29 @@ class API_EXPORT SqliteExpr : public SqliteStatement
void initExists(SqliteSelect* select);
void initSubSelect(SqliteSelect* select);
void initCase(SqliteExpr* expr1, const QList<SqliteExpr*>& exprList, SqliteExpr* expr2);
- void initRaise(const QString& type, const QString& text = QString::null);
+ void initRaise(const QString& type, const QString& text = QString());
void detectDoubleQuotes(bool recursively = true);
+ bool replace(SqliteExpr* toBeReplaced, SqliteExpr* replaceWith);
Mode mode = Mode::null;
QVariant literalValue = QVariant();
bool literalNull = false;
- QString bindParam = QString::null;
- QString database = QString::null;
- QString table = QString::null;
- QString column = QString::null;
- QString unaryOp = QString::null;
- QString binaryOp = QString::null;
- QString function = QString::null;
- QString collation = QString::null;
- QString ctime = QString::null;
+ QString bindParam = QString();
+ QString database = QString();
+ QString table = QString();
+ QString column = QString();
+ QString unaryOp = QString();
+ QString binaryOp = QString();
+ QString function = QString();
+ QString collation = QString();
+ QString ctime = QString();
SqliteColumnType* columnType = nullptr;
SqliteExpr* expr1 = nullptr;
SqliteExpr* expr2 = nullptr;
SqliteExpr* expr3 = nullptr;
QList<SqliteExpr*> exprList;
SqliteSelect* select = nullptr;
+ SqliteFilterOver* filterOver = nullptr;
bool distinctKw = false;
bool allKw = false; // alias for DISTINCT as for sqlite3 grammar
bool star = false;
@@ -141,6 +147,7 @@ class API_EXPORT SqliteExpr : public SqliteStatement
TokenList rebuildBetween();
TokenList rebuildIn();
TokenList rebuildCase();
+ void initDistinct(int distinct);
};
typedef QSharedPointer<SqliteExpr> SqliteExprPtr;
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitefilterover.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitefilterover.cpp
new file mode 100644
index 0000000..08b4f88
--- /dev/null
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitefilterover.cpp
@@ -0,0 +1,138 @@
+#include "sqlitefilterover.h"
+#include "sqliteexpr.h"
+#include "parser/statementtokenbuilder.h"
+#include "common/global.h"
+
+SqliteFilterOver::SqliteFilterOver()
+{
+
+}
+
+SqliteFilterOver::~SqliteFilterOver()
+{
+}
+
+SqliteFilterOver::SqliteFilterOver(const SqliteFilterOver& other) :
+ SqliteStatement(other)
+{
+ DEEP_COPY_FIELD(Filter, filter);
+ DEEP_COPY_FIELD(Over, over);
+}
+
+SqliteFilterOver::SqliteFilterOver(SqliteFilterOver::Filter* filter, SqliteFilterOver::Over* over)
+{
+ this->filter = filter;
+ this->over = over;
+
+ if (filter)
+ filter->setParent(this);
+
+ if (over)
+ over->setParent(this);
+}
+
+SqliteStatement* SqliteFilterOver::clone()
+{
+ return new SqliteFilterOver(*this);
+}
+
+TokenList SqliteFilterOver::rebuildTokensFromContents()
+{
+ StatementTokenBuilder builder;
+
+ if (filter)
+ builder.withStatement(filter);
+
+ if (filter || over)
+ builder.withSpace();
+
+ if (over)
+ builder.withStatement(over);
+
+ return builder.build();
+}
+
+SqliteFilterOver::Over::Over()
+{
+}
+
+SqliteFilterOver::Over::Over(const SqliteFilterOver::Over& other) :
+ SqliteStatement(other), name(other.name), mode(other.mode)
+{
+ DEEP_COPY_FIELD(SqliteWindowDefinition::Window, window);
+}
+
+SqliteFilterOver::Over::~Over()
+{
+}
+
+SqliteFilterOver::Over::Over(SqliteWindowDefinition::Window* window)
+{
+ this->mode = Mode::WINDOW;
+ this->window = window;
+ if (window)
+ window->setParent(this);
+}
+
+SqliteFilterOver::Over::Over(const QString& name)
+{
+ this->mode = Mode::NAME;
+ this->name = name;
+}
+
+SqliteStatement* SqliteFilterOver::Over::clone()
+{
+ return new SqliteFilterOver::Over(*this);
+}
+
+TokenList SqliteFilterOver::Over::rebuildTokensFromContents()
+{
+ StatementTokenBuilder builder;
+
+ builder.withKeyword("OVER").withSpace();
+
+ switch (mode)
+ {
+ case SqliteFilterOver::Over::Mode::WINDOW:
+ builder.withParLeft().withStatement(window).withParRight();
+ break;
+ case SqliteFilterOver::Over::Mode::NAME:
+ builder.withOther(name);
+ break;
+ }
+
+ return builder.build();
+}
+
+
+SqliteFilterOver::Filter::Filter(SqliteExpr* expr)
+{
+ this->expr = expr;
+ if (expr)
+ expr->setParent(this);
+}
+
+SqliteFilterOver::Filter::Filter(const SqliteFilterOver::Filter& other) :
+ SqliteStatement(other)
+{
+ DEEP_COPY_FIELD(SqliteExpr, expr);
+}
+
+SqliteStatement* SqliteFilterOver::Filter::clone()
+{
+ return new SqliteFilterOver::Filter(*this);
+}
+
+TokenList SqliteFilterOver::Filter::rebuildTokensFromContents()
+{
+ StatementTokenBuilder builder;
+
+ builder.withKeyword("FILTER").withSpace().withParLeft().withKeyword("WHERE").withSpace().withStatement(expr).withParRight();
+
+ return builder.build();
+}
+
+
+SqliteFilterOver::Filter::~Filter()
+{
+}
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitefilterover.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitefilterover.h
new file mode 100644
index 0000000..3f023d9
--- /dev/null
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitefilterover.h
@@ -0,0 +1,65 @@
+#ifndef SQLITEFILTEROVER_H
+#define SQLITEFILTEROVER_H
+
+#include "sqlitestatement.h"
+#include "sqlitewindowdefinition.h"
+
+class SqliteFilterOver : public SqliteStatement
+{
+ public:
+ class Over : public SqliteStatement
+ {
+ public:
+ enum class Mode
+ {
+ WINDOW,
+ NAME
+ };
+
+ Over();
+ Over(const Over& other);
+ ~Over();
+ Over(SqliteWindowDefinition::Window* window);
+ Over(const QString& name);
+
+ SqliteStatement* clone();
+
+ SqliteWindowDefinition::Window* window = nullptr;
+ QString name = QString();
+ Mode mode = Mode::WINDOW;
+
+ protected:
+ TokenList rebuildTokensFromContents();
+ };
+
+ class Filter : public SqliteStatement
+ {
+ public:
+ Filter();
+ Filter(const Filter& other);
+ ~Filter();
+ Filter(SqliteExpr* expr);
+
+ SqliteStatement* clone();
+
+ SqliteExpr* expr;
+
+ protected:
+ TokenList rebuildTokensFromContents();
+ };
+
+ SqliteFilterOver();
+ ~SqliteFilterOver();
+ SqliteFilterOver(const SqliteFilterOver& other);
+ SqliteFilterOver(Filter* filter, Over* over);
+
+ SqliteStatement* clone();
+
+ Filter* filter = nullptr;
+ Over* over = nullptr;
+
+ protected:
+ TokenList rebuildTokensFromContents();
+};
+
+#endif // SQLITEFILTEROVER_H
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteforeignkey.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteforeignkey.cpp
index 9a29db2..9bfd56c 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteforeignkey.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteforeignkey.cpp
@@ -35,7 +35,7 @@ QString SqliteForeignKey::Condition::toString(SqliteForeignKey::Condition::React
case SqliteForeignKey::Condition::NO_ACTION:
return "NO ACTION";
}
- return QString::null;
+ return QString();
}
SqliteForeignKey::Condition::Reaction SqliteForeignKey::Condition::toEnum(const QString& reaction)
@@ -115,7 +115,7 @@ TokenList SqliteForeignKey::rebuildTokensFromContents()
{
StatementTokenBuilder builder;
- builder.withKeyword("REFERENCES").withSpace().withOther(foreignTable, dialect);
+ builder.withKeyword("REFERENCES").withSpace().withOther(foreignTable);
if (indexedColumns.size() > 0)
builder.withSpace().withParLeft().withStatementList(indexedColumns).withParRight();
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteforeignkey.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteforeignkey.h
index 18e0bcb..62dd84d 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteforeignkey.h
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteforeignkey.h
@@ -41,7 +41,7 @@ class API_EXPORT SqliteForeignKey : public SqliteStatement
SqliteStatement* clone();
Action action;
- QString name = QString::null;
+ QString name = QString();
Reaction reaction = NO_ACTION;
protected:
@@ -57,7 +57,7 @@ class API_EXPORT SqliteForeignKey : public SqliteStatement
SqliteStatement* clone();
- QString foreignTable = QString::null;
+ QString foreignTable = QString();
QList<SqliteIndexedColumn*> indexedColumns;
QList<Condition*> conditions;
SqliteDeferrable deferrable = SqliteDeferrable::null; // Those two are for table constraint only,
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteindexedcolumn.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteindexedcolumn.cpp
index 142af06..54ebc89 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteindexedcolumn.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteindexedcolumn.cpp
@@ -58,9 +58,9 @@ TokenList SqliteIndexedColumn::getColumnTokensInStatement()
TokenList SqliteIndexedColumn::rebuildTokensFromContents()
{
StatementTokenBuilder builder;
- builder.withOther(name, dialect);
+ builder.withOther(name);
if (!collate.isNull())
- builder.withSpace().withKeyword("COLLATE").withSpace().withOther(collate, dialect);
+ builder.withSpace().withKeyword("COLLATE").withSpace().withOther(collate);
builder.withSortOrder(sortOrder);
return builder.build();
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteindexedcolumn.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteindexedcolumn.h
index c0fe680..34cf4a4 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteindexedcolumn.h
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteindexedcolumn.h
@@ -21,9 +21,9 @@ class API_EXPORT SqliteIndexedColumn : public SqliteStatement, public SqliteExte
QString getCollation() const;
void clearCollation();
- QString name = QString::null;
+ QString name = QString();
SqliteSortOrder sortOrder = SqliteSortOrder::null;
- QString collate = QString::null;
+ QString collate = QString();
protected:
QStringList getColumnsInStatement();
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteinsert.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteinsert.cpp
index e48cffb..906b385 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteinsert.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteinsert.cpp
@@ -191,9 +191,9 @@ TokenList SqliteInsert::rebuildTokensFromContents()
builder.withKeyword("INTO").withSpace();
if (!database.isNull())
- builder.withOther(database, dialect).withOperator(".");
+ builder.withOther(database).withOperator(".");
- builder.withOther(table, dialect).withSpace();
+ builder.withOther(table).withSpace();
if (defaultValuesKw)
{
@@ -202,7 +202,7 @@ TokenList SqliteInsert::rebuildTokensFromContents()
else
{
if (columnNames.size() > 0)
- builder.withParLeft().withOtherList(columnNames, dialect).withParRight().withSpace();
+ builder.withParLeft().withOtherList(columnNames).withParRight().withSpace();
if (select)
{
@@ -210,10 +210,6 @@ TokenList SqliteInsert::rebuildTokensFromContents()
if (upsert)
builder.withSpace().withStatement(upsert);
}
- else if (dialect == Dialect::Sqlite2) // Sqlite2 uses classic single row values
- {
- builder.withKeyword("VALUES").withSpace().withParLeft().withStatementList(values).withParRight();
- }
}
builder.withOperator(";");
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteinsert.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteinsert.h
index 2ee4965..40581cd 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteinsert.h
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteinsert.h
@@ -45,8 +45,8 @@ class API_EXPORT SqliteInsert : public SqliteQuery
bool replaceKw = false;
bool defaultValuesKw = false;
SqliteConflictAlgo onConflict = SqliteConflictAlgo::null;
- QString database = QString::null;
- QString table = QString::null;
+ QString database = QString();
+ QString table = QString();
QStringList columnNames;
QList<SqliteExpr*> values;
SqliteSelect* select = nullptr;
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitenulls.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitenulls.cpp
new file mode 100644
index 0000000..46102a9
--- /dev/null
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitenulls.cpp
@@ -0,0 +1,26 @@
+#include "sqlitenulls.h"
+
+
+SqliteNulls sqliteNulls(const QString& value)
+{
+ if (value == "NULLS FIRST")
+ return SqliteNulls::FIRST;
+ else if (value == "NULLS LAST")
+ return SqliteNulls::LAST;
+ else
+ return SqliteNulls::null;
+}
+
+QString sqliteNulls(SqliteNulls value)
+{
+ switch (value)
+ {
+ case SqliteNulls::FIRST:
+ return "FIRST";
+ case SqliteNulls::LAST:
+ return "LAST";
+ case SqliteNulls::null:
+ break;
+ }
+ return QString();
+}
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitenulls.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitenulls.h
new file mode 100644
index 0000000..3553eae
--- /dev/null
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitenulls.h
@@ -0,0 +1,17 @@
+#ifndef SQLITENULLS_H
+#define SQLITENULLS_H
+
+#include "coreSQLiteStudio_global.h"
+#include <QString>
+
+enum class SqliteNulls
+{
+ FIRST,
+ LAST,
+ null
+};
+
+API_EXPORT SqliteNulls sqliteNulls(const QString& value);
+API_EXPORT QString sqliteNulls(SqliteNulls value);
+
+#endif // SQLITENULLS_H
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteorderby.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteorderby.cpp
index 8eb7b46..732c0a2 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteorderby.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteorderby.cpp
@@ -2,21 +2,23 @@
#include "sqliteexpr.h"
#include "parser/statementtokenbuilder.h"
#include "common/global.h"
+#include <QDebug>
SqliteOrderBy::SqliteOrderBy()
{
}
SqliteOrderBy::SqliteOrderBy(const SqliteOrderBy& other) :
- SqliteStatement(other), order(other.order)
+ SqliteStatement(other), order(other.order), nulls(other.nulls)
{
DEEP_COPY_FIELD(SqliteExpr, expr);
}
-SqliteOrderBy::SqliteOrderBy(SqliteExpr *expr, SqliteSortOrder order)
+SqliteOrderBy::SqliteOrderBy(SqliteExpr *expr, SqliteSortOrder order, SqliteNulls nulls)
{
this->expr = expr;
this->order = order;
+ this->nulls = nulls;
if (expr)
expr->setParent(this);
}
@@ -44,7 +46,7 @@ QString SqliteOrderBy::getColumnName() const
return expr->column;
if (expr->mode == SqliteExpr::Mode::COLLATE && expr->expr1 && expr->expr1->mode == SqliteExpr::Mode::ID)
- return expr->expr1->literalValue.toString();
+ return expr->expr1->column;
return QString();
}
@@ -107,9 +109,66 @@ TokenList SqliteOrderBy::rebuildTokensFromContents()
if (order != SqliteSortOrder::null)
builder.withSpace().withKeyword(sqliteSortOrder(order));
+ if (nulls != SqliteNulls::null)
+ builder.withSpace().withKeyword("NULLS").withSpace().withKeyword(sqliteNulls(nulls));
+
return builder.build();
}
+void SqliteOrderBy::evaluatePostParsing()
+{
+ pullLastCollationAsOuterExpr();
+}
+
+void SqliteOrderBy::pullLastCollationAsOuterExpr()
+{
+ /*
+ * If the order statement is like: columnName + 2 COLLATE BINARY ASC
+ * then the COLLATE is associated with the "2" subexpr, instead of the most outer expr.
+ * Looks like SQLite's parser does the same, but they don't care about the depth as we do here.
+ * Therefore if we idenfity this case, we need to pull the inner expr to outside.
+ */
+ TokenPtr collateToken = expr->tokens.findLast(Token::KEYWORD, "COLLATE", Qt::CaseInsensitive);
+ if (collateToken.isNull())
+ return;
+
+ int lastCollateIdx = expr->tokens.indexOf(collateToken);
+ if (expr->tokens.mid(lastCollateIdx).filterWhiteSpaces().size() != 2)
+ return;
+
+ // This is the case. We need to pull the expr to the top level.
+ SqliteStatement* stmt = expr->findStatementWithToken(collateToken);
+ SqliteExpr* collateExpr = dynamic_cast<SqliteExpr*>(stmt);
+ if (!collateExpr)
+ {
+ qCritical() << "Could not cast statement to SqliteExpr, even though it's identified as COLLATE expr. The actual contents:"
+ << collateExpr->detokenize();
+ return;
+ }
+
+ if (collateExpr == expr)
+ return; // it's already the top-level expr, we're fine.
+
+ SqliteExpr* parentExpr = dynamic_cast<SqliteExpr*>(collateExpr->parentStatement());
+ if (!parentExpr)
+ {
+ qCritical() << "Could not cast parent statement to SqliteExpr, even though parent of COLLATE should be another expr at this stage."
+ << "The qobject type of parent:" << collateExpr->parentStatement()->metaObject()->className();
+ return;
+ }
+
+ // Take out COLLATE from its current place
+ collateExpr->expr1->setParent(parentExpr); // New parent of COLLATE's expr is now parent of COLLATE
+ parentExpr->replace(collateExpr, collateExpr->expr1); // New child expr of COLLATE's parent is now child of COLLATE
+
+ // Put it at top level
+ collateExpr->expr1 = expr; // COLLATE's child is set to the old top level expr
+ expr->setParent(collateExpr); // Old top level expr gets COLLATE as parent
+ expr = collateExpr; // New top level is now COLLATE
+ collateExpr->setParent(this); // COLLATE's new parent is this
+
+ rebuildTokens();
+}
void SqliteOrderBy::clearCollation()
{
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteorderby.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteorderby.h
index 4f75c78..4f05d50 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteorderby.h
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteorderby.h
@@ -3,6 +3,7 @@
#include "sqlitestatement.h"
#include "sqlitesortorder.h"
+#include "sqlitenulls.h"
#include "sqliteextendedindexedcolumn.h"
class SqliteExpr;
@@ -12,7 +13,7 @@ class API_EXPORT SqliteOrderBy : public SqliteStatement, public SqliteExtendedIn
public:
SqliteOrderBy();
SqliteOrderBy(const SqliteOrderBy& other);
- SqliteOrderBy(SqliteExpr* expr, SqliteSortOrder order);
+ SqliteOrderBy(SqliteExpr* expr, SqliteSortOrder order, SqliteNulls nulls);
~SqliteOrderBy();
SqliteStatement* clone();
@@ -26,9 +27,14 @@ class API_EXPORT SqliteOrderBy : public SqliteStatement, public SqliteExtendedIn
SqliteExpr* expr = nullptr;
SqliteSortOrder order = SqliteSortOrder::null;
+ SqliteNulls nulls = SqliteNulls::null;
protected:
TokenList rebuildTokensFromContents();
+ void evaluatePostParsing();
+
+ private:
+ void pullLastCollationAsOuterExpr();
};
typedef QSharedPointer<SqliteOrderBy> SqliteOrderByPtr;
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitepragma.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitepragma.cpp
index 4660e4f..4d13d36 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitepragma.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitepragma.cpp
@@ -53,7 +53,7 @@ QStringList SqlitePragma::getDatabasesInStatement()
TokenList SqlitePragma::getDatabaseTokensInStatement()
{
- if (dialect == Dialect::Sqlite2 || database.isNull())
+ if (database.isNull())
return TokenList();
return getTokenListFromNamedKey("nm");
@@ -62,7 +62,7 @@ TokenList SqlitePragma::getDatabaseTokensInStatement()
QList<SqliteStatement::FullObject> SqlitePragma::getFullObjectsInStatement()
{
QList<FullObject> result;
- if (dialect == Dialect::Sqlite2 || database.isNull())
+ if (database.isNull())
return result;
// Db object
@@ -94,9 +94,9 @@ TokenList SqlitePragma::rebuildTokensFromContents()
builder.withKeyword("PRAGMA").withSpace();
if (!database.isNull())
- builder.withOther(database, dialect).withOperator(".");
+ builder.withOther(database).withOperator(".");
- builder.withOther(pragmaName, dialect);
+ builder.withOther(pragmaName);
if (equalsOp)
builder.withSpace().withOperator("=").withSpace().withLiteralValue(value);
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitepragma.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitepragma.h
index 364a16f..8d75ae4 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitepragma.h
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitepragma.h
@@ -29,8 +29,8 @@ class API_EXPORT SqlitePragma : public SqliteQuery
void initName(const QString& name1, const QString& name2);
public:
- QString database = QString::null;
- QString pragmaName = QString::null;
+ QString database = QString();
+ QString pragmaName = QString();
QVariant value = QVariant();
bool equalsOp = false;
bool parenthesis = false;
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitequerytype.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitequerytype.cpp
index c369e0e..1c04ca6 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitequerytype.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitequerytype.cpp
@@ -61,6 +61,44 @@ QString sqliteQueryTypeToString(const SqliteQueryType& type)
case SqliteQueryType::Vacuum:
return "Vacuum";
default:
- return QString::null;
+ return QString();
+ }
+}
+
+bool isDataReturningQuery(const SqliteQueryType& type)
+{
+ switch (type)
+ {
+ case SqliteQueryType::Select:
+ case SqliteQueryType::Pragma:
+ return true;
+ case SqliteQueryType::UNDEFINED:
+ case SqliteQueryType::EMPTY:
+ case SqliteQueryType::AlterTable:
+ case SqliteQueryType::Analyze:
+ case SqliteQueryType::Attach:
+ case SqliteQueryType::BeginTrans:
+ case SqliteQueryType::CommitTrans:
+ case SqliteQueryType::Copy:
+ case SqliteQueryType::CreateIndex:
+ case SqliteQueryType::CreateTable:
+ case SqliteQueryType::CreateTrigger:
+ case SqliteQueryType::CreateView:
+ case SqliteQueryType::CreateVirtualTable:
+ case SqliteQueryType::Delete:
+ case SqliteQueryType::Detach:
+ case SqliteQueryType::DropIndex:
+ case SqliteQueryType::DropTable:
+ case SqliteQueryType::DropTrigger:
+ case SqliteQueryType::DropView:
+ case SqliteQueryType::Insert:
+ case SqliteQueryType::Reindex:
+ case SqliteQueryType::Release:
+ case SqliteQueryType::Rollback:
+ case SqliteQueryType::Savepoint:
+ case SqliteQueryType::Update:
+ case SqliteQueryType::Vacuum:
+ default:
+ return false;
}
}
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitequerytype.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitequerytype.h
index 763fcfa..9326bf4 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitequerytype.h
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitequerytype.h
@@ -37,5 +37,6 @@ enum class SqliteQueryType
};
QString API_EXPORT sqliteQueryTypeToString(const SqliteQueryType& type);
+bool API_EXPORT isDataReturningQuery(const SqliteQueryType& type);
#endif // SQLITEQUERYTYPE_H
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteraise.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteraise.cpp
index b606baa..1e385b9 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteraise.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteraise.cpp
@@ -54,7 +54,7 @@ QString SqliteRaise::raiseType(SqliteRaise::Type value)
case SqliteRaise::Type::FAIL:
return "FAIL";
default:
- return QString::null;
+ return QString();
}
}
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteraise.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteraise.h
index 1b844f8..2330867 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteraise.h
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteraise.h
@@ -27,7 +27,7 @@ class API_EXPORT SqliteRaise : public SqliteStatement
static QString raiseType(Type value);
Type type = Type::null;
- QString message = QString::null;
+ QString message = QString();
protected:
TokenList rebuildTokensFromContents();
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitereindex.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitereindex.cpp
index 6f863f9..daf8893 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitereindex.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitereindex.cpp
@@ -74,7 +74,7 @@ TokenList SqliteReindex::rebuildTokensFromContents()
builder.withTokens(SqliteQuery::rebuildTokensFromContents());
builder.withKeyword("REINDEX");
if (!database.isNull())
- builder.withOther(database, dialect).withOperator(".");
+ builder.withOther(database).withOperator(".");
builder.withOther(table).withOperator(";");
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitereindex.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitereindex.h
index 642b5bf..2fe05d5 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitereindex.h
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitereindex.h
@@ -14,8 +14,8 @@ class API_EXPORT SqliteReindex : public SqliteQuery
SqliteStatement* clone();
- QString database = QString::null;
- QString table = QString::null;
+ QString database = QString();
+ QString table = QString();
protected:
QStringList getTablesInStatement();
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliterelease.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliterelease.cpp
index f71d61c..8eb53c0 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliterelease.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliterelease.cpp
@@ -33,7 +33,7 @@ TokenList SqliteRelease::rebuildTokensFromContents()
if (savepointKw)
builder.withKeyword("SAVEPOINT").withSpace();
- builder.withOther(name, dialect).withOperator(";");
+ builder.withOther(name).withOperator(";");
return builder.build();
}
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliterelease.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliterelease.h
index d115669..64008f3 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliterelease.h
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliterelease.h
@@ -14,7 +14,7 @@ class API_EXPORT SqliteRelease : public SqliteQuery
SqliteStatement* clone();
- QString name = QString::null;
+ QString name = QString();
bool savepointKw = false;
protected:
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliterollback.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliterollback.cpp
index b21b6ae..3af6b8c 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliterollback.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliterollback.cpp
@@ -50,7 +50,7 @@ TokenList SqliteRollback::rebuildTokensFromContents()
if (savepointKw)
builder.withKeyword("SAVEPOINT").withSpace();
- builder.withOther(name, dialect);
+ builder.withOther(name);
}
builder.withOperator(";");
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliterollback.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliterollback.h
index 1dc1574..6adc4c0 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliterollback.h
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliterollback.h
@@ -17,7 +17,7 @@ class API_EXPORT SqliteRollback : public SqliteQuery
bool transactionKw = false;
bool toKw = false;
bool savepointKw = false;
- QString name = QString::null;
+ QString name = QString();
protected:
TokenList rebuildTokensFromContents();
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitesavepoint.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitesavepoint.cpp
index 1ac50cd..e7bd451 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitesavepoint.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitesavepoint.cpp
@@ -28,6 +28,6 @@ TokenList SqliteSavepoint::rebuildTokensFromContents()
{
StatementTokenBuilder builder;
builder.withTokens(SqliteQuery::rebuildTokensFromContents());
- builder.withKeyword("SAVEPOINT").withSpace().withOther(name, dialect).withOperator(";");
+ builder.withKeyword("SAVEPOINT").withSpace().withOther(name).withOperator(";");
return builder.build();
}
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitesavepoint.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitesavepoint.h
index bd75c76..f1ec356 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitesavepoint.h
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitesavepoint.h
@@ -14,7 +14,7 @@ class API_EXPORT SqliteSavepoint : public SqliteQuery
SqliteStatement* clone();
- QString name = QString::null;
+ QString name = QString();
protected:
TokenList rebuildTokensFromContents();
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteselect.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteselect.cpp
index 8038cb6..e0439d2 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteselect.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteselect.cpp
@@ -3,6 +3,7 @@
#include "parser/statementtokenbuilder.h"
#include "common/global.h"
#include "sqlitewith.h"
+#include "sqlitewindowdefinition.h"
#include <QSet>
SqliteSelect::SqliteSelect()
@@ -66,7 +67,7 @@ SqliteSelect* SqliteSelect::append(SqliteSelect* select, SqliteSelect::CompoundO
resColList.clear();
for (SqliteExpr* value : singleValues)
{
- resCol = new Core::ResultColumn(value, false, QString::null);
+ resCol = new Core::ResultColumn(value, false, QString());
value->detectDoubleQuotes(); // invoke explicitly before rebuilding tokens not to lose this information
resCol->rebuildTokens();
resCol->setParent(core);
@@ -97,7 +98,7 @@ QString SqliteSelect::compoundOperator(SqliteSelect::CompoundOperator op)
case SqliteSelect::CompoundOperator::null:
break;
}
- return QString::null;
+ return QString();
}
SqliteSelect::CompoundOperator SqliteSelect::compoundOperator(const QString& op)
@@ -142,11 +143,21 @@ SqliteSelect::Core::Core(const SqliteSelect::Core& other) :
DEEP_COPY_FIELD(SqliteExpr, where);
DEEP_COPY_FIELD(SqliteExpr, having);
DEEP_COPY_COLLECTION(SqliteExpr, groupBy);
+ DEEP_COPY_COLLECTION(SqliteWindowDefinition, windows);
DEEP_COPY_COLLECTION(SqliteOrderBy, orderBy);
DEEP_COPY_FIELD(SqliteLimit, limit);
}
-SqliteSelect::Core::Core(int distinct, const QList<ResultColumn *> &resCols, SqliteSelect::Core::JoinSource *src, SqliteExpr *where, const QList<SqliteExpr *> &groupBy, SqliteExpr *having, const QList<SqliteOrderBy*>& orderBy, SqliteLimit* limit)
+SqliteSelect::Core::Core(int distinct, const QList<ResultColumn*>& resCols, JoinSource* src,
+ SqliteExpr* where, const QList<SqliteExpr*>& groupBy, SqliteExpr* having,
+ const QList<SqliteOrderBy*>& orderBy, SqliteLimit* limit) :
+ Core(distinct, resCols, src, where, groupBy, having, QList<SqliteWindowDefinition*>(), orderBy, limit)
+{
+}
+
+SqliteSelect::Core::Core(int distinct, const QList<ResultColumn *> &resCols, JoinSource *src,
+ SqliteExpr *where, const QList<SqliteExpr *> &groupBy, SqliteExpr *having, const QList<SqliteWindowDefinition*> windows,
+ const QList<SqliteOrderBy*>& orderBy, SqliteLimit* limit)
{
if (distinct == 1)
distinctKw = true;
@@ -156,6 +167,7 @@ SqliteSelect::Core::Core(int distinct, const QList<ResultColumn *> &resCols, Sql
from = src;
this->where = where;
this->having = having;
+ this->windows = windows;
this->groupBy = groupBy;
resultColumns = resCols;
this->limit = limit;
@@ -173,6 +185,9 @@ SqliteSelect::Core::Core(int distinct, const QList<ResultColumn *> &resCols, Sql
if (limit)
limit->setParent(this);
+ for (SqliteWindowDefinition* win : windows)
+ win->setParent(this);
+
for (SqliteOrderBy* order : orderBy)
order->setParent(this);
@@ -246,7 +261,7 @@ TokenList SqliteSelect::Core::ResultColumn::getTableTokensInStatement()
return TokenList();
// Now, we know table was specified
- return getTokenListFromNamedKey("nm");
+ return getTokenListFromNamedKey("tnm");
}
QList<SqliteStatement::FullObject> SqliteSelect::Core::ResultColumn::getFullObjectsInStatement()
@@ -574,7 +589,7 @@ TokenList SqliteSelect::Core::ResultColumn::rebuildTokensFromContents()
if (star)
{
if (!table.isNull())
- builder.withOther(table, dialect).withOperator(".");
+ builder.withOther(table).withOperator(".");
builder.withOperator("*");
}
@@ -586,7 +601,7 @@ TokenList SqliteSelect::Core::ResultColumn::rebuildTokensFromContents()
if (asKw)
builder.withSpace().withKeyword("AS");
- builder.withSpace().withOther(alias, dialect);
+ builder.withSpace().withOther(alias);
}
}
@@ -599,35 +614,35 @@ TokenList SqliteSelect::Core::SingleSource::rebuildTokensFromContents()
if (!table.isNull())
{
if (!database.isNull())
- builder.withOther(database, dialect).withOperator(".");
+ builder.withOther(database).withOperator(".");
- builder.withOther(table, dialect);
+ builder.withOther(table);
if (!alias.isNull())
{
if (asKw)
builder.withSpace().withKeyword("AS");
- builder.withSpace().withOther(alias, dialect);
+ builder.withSpace().withOther(alias);
}
}
else if (!funcName.isNull())
{
if (!database.isNull())
- builder.withOther(database, dialect).withOperator(".");
+ builder.withOther(database).withOperator(".");
- builder.withOther(funcName, dialect).withParLeft().withStatementList(funcParams).withParRight();
+ builder.withOther(funcName).withParLeft().withStatementList(funcParams).withParRight();
if (!alias.isNull())
{
if (asKw)
builder.withSpace().withKeyword("AS");
- builder.withSpace().withOther(alias, dialect);
+ builder.withSpace().withOther(alias);
}
if (indexedByKw)
- builder.withSpace().withKeyword("INDEXED").withSpace().withKeyword("BY").withSpace().withOther(indexedBy, dialect);
+ builder.withSpace().withKeyword("INDEXED").withSpace().withKeyword("BY").withSpace().withOther(indexedBy);
else if (notIndexedKw)
builder.withSpace().withKeyword("NOT").withSpace().withKeyword("INDEXED");
}
@@ -639,7 +654,7 @@ TokenList SqliteSelect::Core::SingleSource::rebuildTokensFromContents()
if (asKw)
builder.withSpace().withKeyword("AS");
- builder.withSpace().withOther(alias, dialect);
+ builder.withSpace().withOther(alias);
}
}
else
@@ -652,46 +667,7 @@ TokenList SqliteSelect::Core::SingleSource::rebuildTokensFromContents()
TokenList SqliteSelect::Core::JoinOp::rebuildTokensFromContents()
{
- switch (dialect)
- {
- case Dialect::Sqlite3:
- return rebuildTokensForSqlite2();
- case Dialect::Sqlite2:
- return rebuildTokensForSqlite3();
- }
- return TokenList();
-}
-
-TokenList SqliteSelect::Core::JoinOp::rebuildTokensForSqlite2()
-{
- StatementTokenBuilder builder;
- if (comma)
- {
- builder.withOperator(",");
- }
- else
- {
- if (naturalKw)
- builder.withKeyword("NATURAL").withSpace();
-
- if (leftKw)
- builder.withKeyword("LEFT").withSpace();
- else if (rightKw)
- builder.withKeyword("RIGHT").withSpace();
- else if (fullKw)
- builder.withKeyword("FULL").withSpace();
-
- if (innerKw)
- builder.withKeyword("INNER").withSpace();
- else if (crossKw)
- builder.withKeyword("CROSS").withSpace();
- else if (outerKw)
- builder.withKeyword("OUTER").withSpace();
-
- builder.withKeyword("JOIN");
- }
-
- return builder.build();
+ return rebuildTokensForSqlite3();
}
TokenList SqliteSelect::Core::JoinOp::rebuildTokensForSqlite3()
@@ -730,7 +706,7 @@ TokenList SqliteSelect::Core::JoinConstraint::rebuildTokensFromContents()
if (expr)
builder.withKeyword("ON").withStatement(expr);
else
- builder.withKeyword("USING").withSpace().withParLeft().withOtherList(columnNames, dialect).withParRight();
+ builder.withKeyword("USING").withSpace().withParLeft().withOtherList(columnNames).withParRight();
return builder.build();
}
@@ -785,6 +761,9 @@ TokenList SqliteSelect::Core::rebuildTokensFromContents()
builder.withSpace().withKeyword("HAVING").withStatement(having);
}
+ if (windows.size() > 0)
+ builder.withSpace().withKeyword("WINDOW").withStatementList(windows);
+
if (orderBy.size() > 0)
builder.withSpace().withKeyword("ORDER").withSpace().withKeyword("BY").withStatementList(orderBy);
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteselect.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteselect.h
index b6f537d..58babfe 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteselect.h
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteselect.h
@@ -9,6 +9,7 @@
#include <QList>
class SqliteWith;
+class SqliteWindowDefinition;
/**
* @addtogroup sqlite_statement
@@ -44,8 +45,8 @@ class API_EXPORT SqliteSelect : public SqliteQuery
SqliteExpr* expr = nullptr;
bool star = false;
bool asKw = false;
- QString alias = QString::null;
- QString table = QString::null;
+ QString alias = QString();
+ QString table = QString();
protected:
QStringList getTablesInStatement();
@@ -70,15 +71,15 @@ class API_EXPORT SqliteSelect : public SqliteQuery
SqliteStatement* clone();
- QString database = QString::null;
- QString table = QString::null;
- QString alias = QString::null;
- QString funcName = QString::null;
+ QString database = QString();
+ QString table = QString();
+ QString alias = QString();
+ QString funcName = QString();
QList<SqliteExpr*> funcParams;
bool asKw = false;
bool indexedByKw = false;
bool notIndexedKw = false;
- QString indexedBy = QString::null;
+ QString indexedBy = QString();
SqliteSelect* select = nullptr;
JoinSource* joinSource = nullptr;
@@ -116,15 +117,14 @@ class API_EXPORT SqliteSelect : public SqliteQuery
bool crossKw = false;
bool rightKw = false;
bool fullKw = false;
- QString customKw1 = QString::null;
- QString customKw2 = QString::null;
- QString customKw3 = QString::null;
+ QString customKw1 = QString();
+ QString customKw2 = QString();
+ QString customKw3 = QString();
protected:
TokenList rebuildTokensFromContents();
private:
- TokenList rebuildTokensForSqlite2();
TokenList rebuildTokensForSqlite3();
};
@@ -185,8 +185,11 @@ class API_EXPORT SqliteSelect : public SqliteQuery
Core();
Core(const Core& other);
Core(int distinct, const QList<ResultColumn*>& resCols, JoinSource* src, SqliteExpr* where,
- const QList<SqliteExpr*>& groupBy, SqliteExpr* having, const QList<SqliteOrderBy*>& orderBy,
- SqliteLimit* limit);
+ const QList<SqliteExpr*>& groupBy, SqliteExpr* having,
+ const QList<SqliteOrderBy*>& orderBy, SqliteLimit* limit);
+ Core(int distinct, const QList<ResultColumn*>& resCols, JoinSource* src, SqliteExpr* where,
+ const QList<SqliteExpr*>& groupBy, SqliteExpr* having, const QList<SqliteWindowDefinition*> windows,
+ const QList<SqliteOrderBy*>& orderBy, SqliteLimit* limit);
SqliteStatement* clone();
@@ -199,6 +202,7 @@ class API_EXPORT SqliteSelect : public SqliteQuery
SqliteExpr* having = nullptr;
QList<SqliteExpr*> groupBy;
QList<SqliteOrderBy*> orderBy;
+ QList<SqliteWindowDefinition*> windows;
SqliteLimit* limit = nullptr;
bool valuesMode = false;
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitesortorder.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitesortorder.cpp
index 13f3951..eb0ca5c 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitesortorder.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitesortorder.cpp
@@ -19,7 +19,7 @@ QString sqliteSortOrder(SqliteSortOrder value)
case SqliteSortOrder::DESC:
return "DESC";
default:
- return QString::null;
+ return QString();
}
}
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitestatement.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitestatement.cpp
index 119461a..d349a86 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitestatement.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitestatement.cpp
@@ -9,7 +9,7 @@ SqliteStatement::SqliteStatement()
}
SqliteStatement::SqliteStatement(const SqliteStatement& other) :
- QObject(), tokens(other.tokens), tokensMap(other.tokensMap), dialect(other.dialect)
+ QObject(), tokens(other.tokens), tokensMap(other.tokensMap)
{
}
@@ -87,13 +87,6 @@ QList<SqliteStatement::FullObject> SqliteStatement::getContextFullObjects(bool c
return fullObjects;
}
-void SqliteStatement::setSqliteDialect(Dialect dialect)
-{
- this->dialect = dialect;
- for (SqliteStatement* stmt : childStatements())
- stmt->setSqliteDialect(dialect);
-}
-
SqliteStatementPtr SqliteStatement::detach()
{
if (!parent())
@@ -537,14 +530,6 @@ void SqliteStatement::rebuildTokens()
// and then compare new tokens map with previous one. This way we should be able to get all maps correctly.
}
-void SqliteStatement::setParent(QObject* parent)
-{
- QObject::setParent(parent);
- SqliteStatement* stmt = qobject_cast<SqliteStatement*>(parent);
- if (stmt)
- dialect = stmt->dialect;
-}
-
void SqliteStatement::attach(SqliteStatement*& memberForChild, SqliteStatement* childStatementToAttach)
{
memberForChild = childStatementToAttach;
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitestatement.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitestatement.h
index 779bea3..43a60ba 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitestatement.h
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitestatement.h
@@ -3,7 +3,6 @@
#include "common/utils.h"
#include "parser/token.h"
-#include "dialect.h"
#include <QList>
#include <QHash>
#include <QObject>
@@ -50,7 +49,7 @@ typedef QSharedPointer<SqliteStatement> SqliteStatementPtr;
*
* There is also SqliteStatement::tokensMap, which is a table mapping grammar rule name
* into tokens used to fulfill that rule. To learn possible keys for each SqliteStatement,
- * you have to look into sqlite2.y and sqlite3.y files and see definition of the statement,
+ * you have to look into sqlite3.y file and see definition of the statement,
* that you're examining SqliteStatement::tokensMap for.
*
* @note SqliteStatement::tokensMap is a low level API and it's not very predictible,
@@ -89,7 +88,7 @@ typedef QSharedPointer<SqliteStatement> SqliteStatementPtr;
* This is how it's usually done:
* @code
* // STEP 1
- * Parser parser(db->getDialect());
+ * Parser parser;
* if (!parser.parse("SELECT column FROM test WHERE value = 5") || parser.getQueries().size() == 0)
* {
* // handle parsing error, or no queries parsed (which is also some kind of error)
@@ -152,7 +151,7 @@ typedef QSharedPointer<SqliteStatement> SqliteStatementPtr;
*
* Example:
* @code
- * Parser parser(db->getDialect());
+ * Parser parser;
* if (!parser.parse("SELECT column FROM test WHERE value = 5") || parser.getQueries().size() == 0)
* {
* // handle parsing error, or no queries parsed (which is also some kind of error)
@@ -222,9 +221,7 @@ class API_EXPORT SqliteStatement : public QObject
TokenList getContextTableTokens(bool checkParent = true, bool checkChilds = true);
TokenList getContextDatabaseTokens(bool checkParent = true, bool checkChilds = true);
QList<FullObject> getContextFullObjects(bool checkParent = true, bool checkChilds = true);
- void setSqliteDialect(Dialect dialect);
void rebuildTokens();
- void setParent(QObject* parent);
void attach(SqliteStatement*& memberForChild, SqliteStatement* childStatementToAttach);
SqliteStatementPtr detach();
void processPostParsing();
@@ -284,8 +281,6 @@ class API_EXPORT SqliteStatement : public QObject
*/
QHash<QString,TokenList> tokensMap;
- Dialect dialect = Dialect::Sqlite3;
-
protected:
QStringList getContextColumns(SqliteStatement* caller, bool checkParent, bool checkChilds);
QStringList getContextTables(SqliteStatement* caller, bool checkParent, bool checkChilds);
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteupdate.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteupdate.cpp
index 2063e0e..89c8195 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteupdate.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteupdate.cpp
@@ -26,6 +26,7 @@ SqliteUpdate::SqliteUpdate(const SqliteUpdate& other) :
DEEP_COPY_FIELD(SqliteExpr, where);
DEEP_COPY_FIELD(SqliteWith, with);
+ DEEP_COPY_FIELD(SqliteSelect::Core::JoinSource, from);
}
SqliteUpdate::~SqliteUpdate()
@@ -33,7 +34,7 @@ SqliteUpdate::~SqliteUpdate()
}
SqliteUpdate::SqliteUpdate(SqliteConflictAlgo onConflict, const QString &name1, const QString &name2, bool notIndexedKw, const QString &indexedBy,
- const QList<ColumnAndValue>& values, SqliteExpr *where, SqliteWith* with)
+ const QList<ColumnAndValue>& values, SqliteSelect::Core::JoinSource* from, SqliteExpr *where, SqliteWith* with)
: SqliteUpdate()
{
this->onConflict = onConflict;
@@ -51,6 +52,10 @@ SqliteUpdate::SqliteUpdate(SqliteConflictAlgo onConflict, const QString &name1,
this->notIndexedKw = notIndexedKw;
keyValueMap = values;
+ this->from = from;
+ if (from)
+ from->setParent(this);
+
this->where = where;
if (where)
where->setParent(this);
@@ -188,12 +193,12 @@ TokenList SqliteUpdate::rebuildTokensFromContents()
builder.withKeyword("OR").withSpace().withKeyword(sqliteConflictAlgo(onConflict)).withSpace();
if (!database.isNull())
- builder.withOther(database, dialect).withOperator(".");
+ builder.withOther(database).withOperator(".");
- builder.withOther(table, dialect).withSpace();
+ builder.withOther(table).withSpace();
if (indexedByKw)
- builder.withKeyword("INDEXED").withSpace().withKeyword("BY").withSpace().withOther(indexedBy, dialect).withSpace();
+ builder.withKeyword("INDEXED").withSpace().withKeyword("BY").withSpace().withOther(indexedBy).withSpace();
else if (notIndexedKw)
builder.withKeyword("NOT").withSpace().withKeyword("INDEXED").withSpace();
@@ -206,14 +211,17 @@ TokenList SqliteUpdate::rebuildTokensFromContents()
builder.withOperator(",").withSpace();
if (keyVal.first.type() == QVariant::StringList)
- builder.withParLeft().withOtherList(keyVal.first.toStringList(), dialect).withParRight();
+ builder.withParLeft().withOtherList(keyVal.first.toStringList()).withParRight();
else
- builder.withOther(keyVal.first.toString(), dialect);
+ builder.withOther(keyVal.first.toString());
builder.withSpace().withOperator("=").withStatement(keyVal.second);
first = false;
}
+ if (from)
+ builder.withSpace().withKeyword("FROM").withStatement(from);
+
if (where)
builder.withSpace().withKeyword("WHERE").withStatement(where);
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteupdate.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteupdate.h
index 642473c..e843bcd 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteupdate.h
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteupdate.h
@@ -3,6 +3,7 @@
#include "sqlitequery.h"
#include "sqliteconflictalgo.h"
+#include "sqliteselect.h"
#include <QStringList>
#include <QMap>
@@ -20,18 +21,19 @@ class API_EXPORT SqliteUpdate : public SqliteQuery
~SqliteUpdate();
SqliteUpdate(SqliteConflictAlgo onConflict, const QString& name1, const QString& name2,
bool notIndexedKw, const QString& indexedBy, const QList<ColumnAndValue>& values,
- SqliteExpr* where, SqliteWith* with);
+ SqliteSelect::Core::JoinSource* from, SqliteExpr* where, SqliteWith* with);
SqliteStatement* clone();
SqliteExpr* getValueForColumnSet(const QString& column);
SqliteConflictAlgo onConflict = SqliteConflictAlgo::null;
- QString database = QString::null;
- QString table = QString::null;
+ QString database = QString();
+ QString table = QString();
bool indexedByKw = false;
bool notIndexedKw = false;
- QString indexedBy = QString::null;
+ QString indexedBy = QString();
QList<ColumnAndValue> keyValueMap;
+ SqliteSelect::Core::JoinSource* from = nullptr;
SqliteExpr* where = nullptr;
SqliteWith* with = nullptr;
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteupsert.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteupsert.cpp
index ced9c2d..441cd6d 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteupsert.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqliteupsert.cpp
@@ -94,9 +94,9 @@ TokenList SqliteUpsert::rebuildTokensFromContents()
builder.withOperator(",").withSpace();
if (keyVal.first.type() == QVariant::StringList)
- builder.withParLeft().withOtherList(keyVal.first.toStringList(), dialect).withParRight();
+ builder.withParLeft().withOtherList(keyVal.first.toStringList()).withParRight();
else
- builder.withOther(keyVal.first.toString(), dialect);
+ builder.withOther(keyVal.first.toString());
builder.withSpace().withOperator("=").withStatement(keyVal.second);
first = false;
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitevacuum.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitevacuum.cpp
index 9d595ed..e65530a 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitevacuum.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitevacuum.cpp
@@ -1,7 +1,8 @@
#include "sqlitevacuum.h"
#include "sqlitequerytype.h"
-
-#include <parser/statementtokenbuilder.h>
+#include "common/global.h"
+#include "parser/statementtokenbuilder.h"
+#include "sqliteexpr.h"
SqliteVacuum::SqliteVacuum()
{
@@ -11,13 +12,26 @@ SqliteVacuum::SqliteVacuum()
SqliteVacuum::SqliteVacuum(const SqliteVacuum& other) :
SqliteQuery(other), database(other.database)
{
+ DEEP_COPY_FIELD(SqliteExpr, expr);
+}
+
+SqliteVacuum::SqliteVacuum(SqliteExpr* expr)
+ : SqliteVacuum()
+{
+ this->expr = expr;
+ if (expr)
+ expr->setParent(this);
}
-SqliteVacuum::SqliteVacuum(const QString& name)
+SqliteVacuum::SqliteVacuum(const QString& name, SqliteExpr* expr)
: SqliteVacuum()
{
if (!name.isNull())
database = name;
+
+ this->expr = expr;
+ if (expr)
+ expr->setParent(this);
}
SqliteStatement*SqliteVacuum::clone()
@@ -55,6 +69,13 @@ TokenList SqliteVacuum::rebuildTokensFromContents()
{
StatementTokenBuilder builder;
builder.withTokens(SqliteQuery::rebuildTokensFromContents());
- builder.withKeyword("VACUUM").withOperator(";");
+ builder.withKeyword("VACUUM");
+ if (!database.isNull())
+ builder.withSpace().withOther(database);
+
+ if (expr)
+ builder.withSpace().withKeyword("INTO").withSpace().withStatement(expr);
+
+ builder.withOperator(";");
return builder.build();
}
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitevacuum.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitevacuum.h
index 871b8f4..db9af95 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitevacuum.h
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitevacuum.h
@@ -5,16 +5,20 @@
#include <QString>
+class SqliteExpr;
+
class API_EXPORT SqliteVacuum : public SqliteQuery
{
public:
SqliteVacuum();
SqliteVacuum(const SqliteVacuum& other);
- explicit SqliteVacuum(const QString &name);
+ SqliteVacuum(SqliteExpr* expr);
+ SqliteVacuum(const QString &name, SqliteExpr* expr);
SqliteStatement* clone();
QString database;
+ SqliteExpr* expr = nullptr;
protected:
QStringList getDatabasesInStatement();
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitewindowdefinition.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitewindowdefinition.cpp
new file mode 100644
index 0000000..adf135f
--- /dev/null
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitewindowdefinition.cpp
@@ -0,0 +1,308 @@
+#include "sqlitewindowdefinition.h"
+#include "sqliteexpr.h"
+#include "sqliteorderby.h"
+#include "parser/statementtokenbuilder.h"
+#include "common/global.h"
+#include <QDebug>
+
+SqliteWindowDefinition::SqliteWindowDefinition()
+{
+
+}
+
+SqliteWindowDefinition::SqliteWindowDefinition(const SqliteWindowDefinition& other) :
+ SqliteStatement(other), name(other.name)
+{
+ DEEP_COPY_FIELD(Window, window);
+}
+
+SqliteWindowDefinition::SqliteWindowDefinition(const QString& name, SqliteWindowDefinition::Window* window)
+{
+ this->name = name;
+ this->window = window;
+ if (window)
+ window->setParent(this);
+}
+
+SqliteStatement* SqliteWindowDefinition::clone()
+{
+ return new SqliteWindowDefinition(*this);
+}
+
+TokenList SqliteWindowDefinition::rebuildTokensFromContents()
+{
+ StatementTokenBuilder builder;
+
+ builder.withOther(name).withSpace().withKeyword("AS").withParLeft().withStatement(window).withParRight();
+
+ return builder.build();
+}
+
+SqliteWindowDefinition::Window::Window()
+{
+}
+
+SqliteWindowDefinition::Window::Window(const SqliteWindowDefinition::Window& other) :
+ SqliteStatement(other), name(other.name), mode(other.mode)
+{
+ DEEP_COPY_COLLECTION(SqliteExpr, exprList);
+ DEEP_COPY_COLLECTION(SqliteOrderBy, orderBy);
+ DEEP_COPY_FIELD(Frame, frame);
+}
+
+SqliteStatement* SqliteWindowDefinition::Window::clone()
+{
+ return new Window(*this);
+}
+
+void SqliteWindowDefinition::Window::initPartitionBy(const QString& name, const QList<SqliteExpr*>& exprList, const QList<SqliteOrderBy*>& orderBy, SqliteWindowDefinition::Window::Frame* frame)
+{
+ this->mode = Mode::PARTITION_BY;
+ this->name = name;
+ initExprList(exprList);
+ initOrderBy(orderBy);
+ initFrame(frame);
+}
+
+void SqliteWindowDefinition::Window::initOrderBy(const QString& name, const QList<SqliteOrderBy*>& orderBy, SqliteWindowDefinition::Window::Frame* frame)
+{
+ this->mode = Mode::ORDER_BY;
+ this->name = name;
+ initOrderBy(orderBy);
+ initFrame(frame);
+}
+
+void SqliteWindowDefinition::Window::init(const QString& name, SqliteWindowDefinition::Window::Frame* frame)
+{
+ this->mode = Mode::null;
+ this->name = name;
+ initFrame(frame);
+}
+
+TokenList SqliteWindowDefinition::Window::rebuildTokensFromContents()
+{
+ StatementTokenBuilder builder;
+
+ if (!name.isNull())
+ builder.withOther(name).withSpace();
+
+ switch (mode)
+ {
+ case SqliteWindowDefinition::Window::Mode::PARTITION_BY:
+ builder.withKeyword("PARTITION").withSpace().withKeyword("BY").withSpace().withStatementList(exprList).withSpace();
+ break;
+ case SqliteWindowDefinition::Window::Mode::ORDER_BY:
+ break;
+ case SqliteWindowDefinition::Window::Mode::null:
+ break;
+ }
+
+ if (orderBy.size() > 0)
+ builder.withKeyword("ORDER").withSpace().withKeyword("BY").withSpace().withStatementList(orderBy);
+
+ if (frame)
+ builder.withStatement(frame);
+
+ return builder.build();
+}
+
+void SqliteWindowDefinition::Window::initExprList(const QList<SqliteExpr*>& exprList)
+{
+ this->exprList = exprList;
+ for (SqliteExpr* expr : exprList)
+ expr->setParent(this);
+}
+
+void SqliteWindowDefinition::Window::initOrderBy(const QList<SqliteOrderBy*>& orderBy)
+{
+ this->orderBy = orderBy;
+ for (SqliteOrderBy* order : orderBy)
+ order->setParent(this);
+}
+
+void SqliteWindowDefinition::Window::initFrame(SqliteWindowDefinition::Window::Frame* frame)
+{
+ this->frame = frame;
+ if (frame)
+ frame->setParent(this);
+}
+
+SqliteWindowDefinition::Window::Frame::RangeOrRows SqliteWindowDefinition::Window::Frame::toRangeOrRows(const QString& value)
+{
+ QString upper = value.toUpper();
+ if (upper == "RANGE")
+ return RangeOrRows::RANGE;
+ else if (upper == "ROWS")
+ return RangeOrRows::ROWS;
+ else if (upper == "GROUPS")
+ return RangeOrRows::GROUPS;
+ else
+ return RangeOrRows::null;
+}
+
+QString SqliteWindowDefinition::Window::Frame::fromRangeOrRows(SqliteWindowDefinition::Window::Frame::RangeOrRows value)
+{
+ switch (value)
+ {
+ case SqliteWindowDefinition::Window::Frame::RangeOrRows::RANGE:
+ return "RANGE";
+ case SqliteWindowDefinition::Window::Frame::RangeOrRows::ROWS:
+ return "ROWS";
+ case SqliteWindowDefinition::Window::Frame::RangeOrRows::GROUPS:
+ return "GROUPS";
+ case SqliteWindowDefinition::Window::Frame::RangeOrRows::null:
+ break;
+ }
+ return QString();
+}
+
+SqliteWindowDefinition::Window::Frame::Exclude SqliteWindowDefinition::Window::Frame::toExclude(const QString& value)
+{
+ QString upper = value.toUpper();
+ if (upper == "NO OTHERS")
+ return Exclude::NO_OTHERS;
+ else if (upper == "CURRENT ROW")
+ return Exclude::CURRENT_ROW;
+ else if (upper == "GROUP")
+ return Exclude::GROUP;
+ else if (upper == "TIES")
+ return Exclude::TIES;
+ else
+ return Exclude::null;
+}
+
+QString SqliteWindowDefinition::Window::Frame::fromExclude(SqliteWindowDefinition::Window::Frame::Exclude value)
+{
+ switch (value)
+ {
+ case SqliteWindowDefinition::Window::Frame::Exclude::TIES:
+ return "TIES";
+ case SqliteWindowDefinition::Window::Frame::Exclude::NO_OTHERS:
+ return "NO OTHERS";
+ case SqliteWindowDefinition::Window::Frame::Exclude::CURRENT_ROW:
+ return "CURRENT ROW";
+ case SqliteWindowDefinition::Window::Frame::Exclude::GROUP:
+ return "GROUP";
+ case SqliteWindowDefinition::Window::Frame::Exclude::null:
+ break;
+ }
+ return QString();
+}
+
+SqliteWindowDefinition::Window::Frame::Frame()
+{
+}
+
+SqliteWindowDefinition::Window::Frame::Frame(const SqliteWindowDefinition::Window::Frame& other) :
+ SqliteStatement(other), rangeOrRows(other.rangeOrRows), exclude(other.exclude)
+{
+ DEEP_COPY_FIELD(Bound, startBound);
+ DEEP_COPY_FIELD(Bound, endBound);
+}
+
+SqliteWindowDefinition::Window::Frame::Frame(SqliteWindowDefinition::Window::Frame::RangeOrRows rangeOrRows,
+ SqliteWindowDefinition::Window::Frame::Bound* startBound,
+ SqliteWindowDefinition::Window::Frame::Bound* endBound,
+ SqliteWindowDefinition::Window::Frame::Exclude exclude)
+{
+ this->rangeOrRows = rangeOrRows;
+ this->startBound = startBound;
+ this->endBound = endBound;
+ this->exclude = exclude;
+
+ if (startBound)
+ startBound->setParent(this);
+
+ if (endBound)
+ endBound->setParent(this);
+}
+
+SqliteStatement* SqliteWindowDefinition::Window::Frame::clone()
+{
+ return new Frame(*this);
+}
+
+TokenList SqliteWindowDefinition::Window::Frame::rebuildTokensFromContents()
+{
+ StatementTokenBuilder builder;
+
+ if (rangeOrRows != RangeOrRows::null)
+ builder.withKeyword(fromRangeOrRows(rangeOrRows)).withSpace();
+
+ if (endBound)
+ builder.withKeyword("BETWEEN").withSpace().withStatement(startBound).withSpace()
+ .withKeyword("AND").withSpace().withStatement(endBound);
+ else
+ builder.withStatement(startBound);
+
+ if (exclude != Exclude::null)
+ {
+ builder.withSpace().withKeyword("EXCLUDE");
+ for (const QString& kw : fromExclude(exclude).split(" "))
+ builder.withSpace().withKeyword(kw);
+ }
+
+ return builder.build();
+}
+
+SqliteWindowDefinition::Window::Frame::Bound::Bound()
+{
+}
+
+SqliteWindowDefinition::Window::Frame::Bound::Bound(const SqliteWindowDefinition::Window::Frame::Bound& other) :
+ SqliteStatement(other), type(other.type)
+{
+ DEEP_COPY_FIELD(SqliteExpr, expr);
+}
+
+SqliteWindowDefinition::Window::Frame::Bound::Bound(SqliteExpr* expr, const QString& value)
+{
+ this->expr = expr;
+ if (expr)
+ expr->setParent(this);
+
+ QString upper = value.toUpper();
+ if (upper == "UNBOUNDED PRECEDING")
+ type = Type::UNBOUNDED_PRECEDING;
+ else if (expr && upper == "PRECEDING")
+ type = Type::EXPR_FOLLOWING;
+ else if (upper == "UNBOUNDED FOLLOWING")
+ type = Type::UNBOUNDED_FOLLOWING;
+ else if (expr && upper == "FOLLOWING")
+ type = Type::EXPR_FOLLOWING;
+ else if (upper == "CURRENT ROW")
+ type = Type::CURRENT_ROW;
+ else
+ qCritical() << "Unexpected Window Frame Bound:" << value;
+}
+
+SqliteStatement* SqliteWindowDefinition::Window::Frame::Bound::clone()
+{
+ return new Bound(*this);
+}
+
+TokenList SqliteWindowDefinition::Window::Frame::Bound::rebuildTokensFromContents()
+{
+ StatementTokenBuilder builder;
+
+ switch (type)
+ {
+ case SqliteWindowDefinition::Window::Frame::Bound::Type::UNBOUNDED_PRECEDING:
+ builder.withKeyword("UNBOUNDED").withSpace().withKeyword("PRECEDING");
+ break;
+ case SqliteWindowDefinition::Window::Frame::Bound::Type::UNBOUNDED_FOLLOWING:
+ builder.withKeyword("UNBOUNDED").withSpace().withKeyword("FOLLOWING");
+ break;
+ case SqliteWindowDefinition::Window::Frame::Bound::Type::EXPR_PRECEDING:
+ builder.withStatement(expr).withSpace().withKeyword("PRECEDING");
+ break;
+ case SqliteWindowDefinition::Window::Frame::Bound::Type::EXPR_FOLLOWING:
+ builder.withStatement(expr).withSpace().withKeyword("FOLLOWING");
+ break;
+ case SqliteWindowDefinition::Window::Frame::Bound::Type::CURRENT_ROW:
+ builder.withKeyword("CURRENT").withSpace().withKeyword("ROW");
+ break;
+ }
+
+ return builder.build();
+}
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitewindowdefinition.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitewindowdefinition.h
new file mode 100644
index 0000000..fb5cb8e
--- /dev/null
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitewindowdefinition.h
@@ -0,0 +1,129 @@
+#ifndef SQLITEWINDOWDEFINITION_H
+#define SQLITEWINDOWDEFINITION_H
+
+//#include "sqliteexpr.h"
+//#include "sqliteorderby.h"
+#include "sqlitestatement.h"
+
+class SqliteExpr;
+class SqliteOrderBy;
+
+/**
+ * @addtogroup sqlite_statement
+ * @brief The SqliteWindowDefinition class
+ */
+class API_EXPORT SqliteWindowDefinition : public SqliteStatement
+{
+ public:
+ class API_EXPORT Window : public SqliteStatement
+ {
+ public:
+ class API_EXPORT Frame : public SqliteStatement
+ {
+ public:
+ class API_EXPORT Bound : public SqliteStatement
+ {
+ public:
+ enum class Type
+ {
+ UNBOUNDED_PRECEDING,
+ UNBOUNDED_FOLLOWING,
+ EXPR_PRECEDING,
+ EXPR_FOLLOWING,
+ CURRENT_ROW
+ };
+
+ Bound();
+ Bound(const Bound& other);
+ Bound(SqliteExpr* expr, const QString& value);
+
+ SqliteStatement* clone();
+
+ Type type = Type::CURRENT_ROW;
+ SqliteExpr* expr = nullptr;
+
+ protected:
+ TokenList rebuildTokensFromContents();
+ };
+
+ enum class RangeOrRows
+ {
+ RANGE,
+ ROWS,
+ GROUPS,
+ null
+ };
+
+ enum class Exclude
+ {
+ NO_OTHERS,
+ CURRENT_ROW,
+ GROUP,
+ TIES,
+ null
+ };
+
+ static RangeOrRows toRangeOrRows(const QString& value);
+ static QString fromRangeOrRows(RangeOrRows value);
+ static Exclude toExclude(const QString& value);
+ static QString fromExclude(Exclude value);
+
+ Frame();
+ Frame(const Frame& other);
+ Frame(RangeOrRows rangeOrRows, Bound* startBound, Bound* endBound, Exclude exclude);
+
+ SqliteStatement* clone();
+
+ RangeOrRows rangeOrRows = RangeOrRows::null;
+ Exclude exclude = Exclude::null;
+ Bound* startBound = nullptr;
+ Bound* endBound = nullptr;
+
+ protected:
+ TokenList rebuildTokensFromContents();
+ };
+
+ enum class Mode
+ {
+ PARTITION_BY,
+ ORDER_BY,
+ null
+ };
+
+ Window();
+ Window(const Window& other);
+
+ SqliteStatement* clone();
+ void initPartitionBy(const QString& name, const QList<SqliteExpr*>& exprList, const QList<SqliteOrderBy*>& orderBy, Frame* frame);
+ void initOrderBy(const QString& name, const QList<SqliteOrderBy*>& orderBy, Frame* frame);
+ void init(const QString& name, Frame* frame);
+
+ QString name;
+ QList<SqliteExpr*> exprList;
+ QList<SqliteOrderBy*> orderBy;
+ Frame* frame = nullptr;
+ Mode mode = Mode::null;
+
+ protected:
+ TokenList rebuildTokensFromContents();
+
+ private:
+ void initExprList(const QList<SqliteExpr*>& exprList);
+ void initOrderBy(const QList<SqliteOrderBy*>& orderBy);
+ void initFrame(Frame* frame);
+ };
+
+ SqliteWindowDefinition();
+ SqliteWindowDefinition(const SqliteWindowDefinition& other);
+ SqliteWindowDefinition(const QString& name, Window* window);
+
+ SqliteStatement* clone();
+
+ QString name = QString();
+ Window* window = nullptr;
+
+ protected:
+ TokenList rebuildTokensFromContents();
+};
+
+#endif // SQLITEWINDOWDEFINITION_H
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitewith.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitewith.cpp
index 2b9c99f..901ac56 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitewith.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitewith.cpp
@@ -13,26 +13,6 @@ SqliteWith::SqliteWith(const SqliteWith& other) :
DEEP_COPY_COLLECTION(CommonTableExpression, cteList);
}
-SqliteWith* SqliteWith::append(const QString& tableName, const QList<SqliteIndexedColumn*>& indexedColumns, SqliteSelect* select)
-{
- SqliteWith* with = new SqliteWith();
- CommonTableExpression* cte = new CommonTableExpression(tableName, indexedColumns, select);
- cte->setParent(with);
- with->cteList << cte;
- return with;
-}
-
-SqliteWith* SqliteWith::append(SqliteWith* with, const QString& tableName, const QList<SqliteIndexedColumn*>& indexedColumns, SqliteSelect* select)
-{
- if (!with)
- with = new SqliteWith();
-
- CommonTableExpression* cte = new CommonTableExpression(tableName, indexedColumns, select);
- cte->setParent(with);
- with->cteList << cte;
- return with;
-}
-
SqliteStatement*SqliteWith::clone()
{
return new SqliteWith(*this);
@@ -76,7 +56,7 @@ SqliteStatement*SqliteWith::CommonTableExpression::clone()
TokenList SqliteWith::CommonTableExpression::rebuildTokensFromContents()
{
StatementTokenBuilder builder;
- builder.withOther(table, dialect);
+ builder.withOther(table);
if (indexedColumns.size() > 0)
builder.withSpace().withParLeft().withStatementList(indexedColumns).withParRight();
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitewith.h b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitewith.h
index fe64c9c..30f8181 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitewith.h
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/ast/sqlitewith.h
@@ -28,8 +28,6 @@ class SqliteWith : public SqliteStatement
SqliteWith();
SqliteWith(const SqliteWith& other);
- static SqliteWith* append(const QString& tableName, const QList<SqliteIndexedColumn*>& indexedColumns, SqliteSelect* select);
- static SqliteWith* append(SqliteWith* with, const QString& tableName, const QList<SqliteIndexedColumn*>& indexedColumns, SqliteSelect* select);
SqliteStatement* clone();
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/compile_lemon.bat b/SQLiteStudio3/coreSQLiteStudio/parser/compile_lemon.bat
new file mode 100644
index 0000000..683a997
--- /dev/null
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/compile_lemon.bat
@@ -0,0 +1,6 @@
+@echo off
+set LEMON=C:\utils\lemon.exe
+set GCC=C:\Qt\Tools\mingw810_64\bin\gcc.exe
+
+%GCC% -o %LEMON% lemon.c
+
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/keywords.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/keywords.cpp
index bc8112e..a5651db 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/keywords.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/keywords.cpp
@@ -1,24 +1,15 @@
#include "keywords.h"
#include "sqlite3_parse.h"
-#include "sqlite2_parse.h"
#include <QDebug>
#include <QList>
-QHash<QString,int> keywords2;
QHash<QString,int> keywords3;
+QSet<QString> softKeywords3;
QSet<QString> rowIdKeywords;
QStringList joinKeywords;
QStringList fkMatchKeywords;
QStringList conflictAlgoKeywords;
-
-int getKeywordId2(const QString& str)
-{
- QString upStr = str.toUpper();
- if (keywords2.contains(upStr))
- return keywords2[upStr];
- else
- return TK2_ID;
-}
+QStringList generatedColumnKeywords;
int getKeywordId3(const QString& str)
{
@@ -34,11 +25,6 @@ bool isRowIdKeyword(const QString& str)
return rowIdKeywords.contains(str.toUpper());
}
-const QHash<QString,int>& getKeywords2()
-{
- return keywords2;
-}
-
const QHash<QString,int>& getKeywords3()
{
return keywords3;
@@ -47,234 +33,151 @@ const QHash<QString,int>& getKeywords3()
void initKeywords()
{
// SQLite 3
- keywords3["REINDEX"] = TK3_REINDEX;
- keywords3["INDEXED"] = TK3_INDEXED;
- keywords3["INDEX"] = TK3_INDEX;
- keywords3["DESC"] = TK3_DESC;
- keywords3["ESCAPE"] = TK3_ESCAPE;
- keywords3["EACH"] = TK3_EACH;
- keywords3["CHECK"] = TK3_CHECK;
- keywords3["KEY"] = TK3_KEY;
- keywords3["BEFORE"] = TK3_BEFORE;
- keywords3["FOREIGN"] = TK3_FOREIGN;
- keywords3["FOR"] = TK3_FOR;
- keywords3["IGNORE"] = TK3_IGNORE;
- keywords3["REGEXP"] = TK3_LIKE_KW;
- keywords3["EXPLAIN"] = TK3_EXPLAIN;
- keywords3["INSTEAD"] = TK3_INSTEAD;
- keywords3["ADD"] = TK3_ADD;
- keywords3["DATABASE"] = TK3_DATABASE;
- keywords3["AS"] = TK3_AS;
- keywords3["SELECT"] = TK3_SELECT;
- keywords3["TABLE"] = TK3_TABLE;
- keywords3["LEFT"] = TK3_JOIN_KW;
- keywords3["THEN"] = TK3_THEN;
- keywords3["END"] = TK3_END;
- keywords3["DEFERRABLE"] = TK3_DEFERRABLE;
- keywords3["ELSE"] = TK3_ELSE;
- keywords3["EXCEPT"] = TK3_EXCEPT;
- keywords3["TRANSACTION"] = TK3_TRANSACTION;
+ keywords3["ABORT"] = TK3_ABORT;
keywords3["ACTION"] = TK3_ACTION;
- keywords3["ON"] = TK3_ON;
- keywords3["NATURAL"] = TK3_JOIN_KW;
+ keywords3["ADD"] = TK3_ADD;
+ keywords3["AFTER"] = TK3_AFTER;
+ keywords3["ALL"] = TK3_ALL;
keywords3["ALTER"] = TK3_ALTER;
- keywords3["RAISE"] = TK3_RAISE;
- keywords3["EXCLUSIVE"] = TK3_EXCLUSIVE;
- keywords3["EXISTS"] = TK3_EXISTS;
- keywords3["SAVEPOINT"] = TK3_SAVEPOINT;
- keywords3["INTERSECT"] = TK3_INTERSECT;
- keywords3["TRIGGER"] = TK3_TRIGGER;
- keywords3["REFERENCES"] = TK3_REFERENCES;
- keywords3["CONSTRAINT"] = TK3_CONSTRAINT;
- keywords3["INTO"] = TK3_INTO;
- keywords3["OFFSET"] = TK3_OFFSET;
- keywords3["OF"] = TK3_OF;
- keywords3["SET"] = TK3_SET;
- keywords3["TEMP"] = TK3_TEMP;
- keywords3["TEMPORARY"] = TK3_TEMP;
- keywords3["OR"] = TK3_OR;
- keywords3["UNIQUE"] = TK3_UNIQUE;
- keywords3["QUERY"] = TK3_QUERY;
+ keywords3["ALWAYS"] = TK3_ALWAYS;
+ keywords3["ANALYZE"] = TK3_ANALYZE;
+ keywords3["AND"] = TK3_AND;
+ keywords3["AS"] = TK3_AS;
+ keywords3["ASC"] = TK3_ASC;
keywords3["ATTACH"] = TK3_ATTACH;
- keywords3["HAVING"] = TK3_HAVING;
- keywords3["GROUP"] = TK3_GROUP;
- keywords3["UPDATE"] = TK3_UPDATE;
+ keywords3["AUTOINCREMENT"] = TK3_AUTOINCR;
+ keywords3["BEFORE"] = TK3_BEFORE;
keywords3["BEGIN"] = TK3_BEGIN;
- keywords3["INNER"] = TK3_JOIN_KW;
- keywords3["RELEASE"] = TK3_RELEASE;
keywords3["BETWEEN"] = TK3_BETWEEN;
- keywords3["NOTNULL"] = TK3_NOTNULL;
- keywords3["NOT"] = TK3_NOT;
- keywords3["NO"] = TK3_NO;
- keywords3["DO"] = TK3_DO;
- keywords3["NOTHING"] = TK3_NOTHING;
- keywords3["NULL"] = TK3_NULL;
- keywords3["LIKE"] = TK3_LIKE_KW;
+ keywords3["BY"] = TK3_BY;
keywords3["CASCADE"] = TK3_CASCADE;
- keywords3["ASC"] = TK3_ASC;
- keywords3["DELETE"] = TK3_DELETE;
keywords3["CASE"] = TK3_CASE;
- keywords3["COLLATE"] = TK3_COLLATE;
- keywords3["CREATE"] = TK3_CREATE;
- keywords3["CURRENT_DATE"] = TK3_CTIME_KW;
- keywords3["DETACH"] = TK3_DETACH;
- keywords3["IMMEDIATE"] = TK3_IMMEDIATE;
- keywords3["JOIN"] = TK3_JOIN;
- keywords3["INSERT"] = TK3_INSERT;
- keywords3["MATCH"] = TK3_MATCH;
- keywords3["PLAN"] = TK3_PLAN;
- keywords3["ANALYZE"] = TK3_ANALYZE;
- keywords3["PRAGMA"] = TK3_PRAGMA;
- keywords3["ABORT"] = TK3_ABORT;
- keywords3["VALUES"] = TK3_VALUES;
- keywords3["VIRTUAL"] = TK3_VIRTUAL;
- keywords3["LIMIT"] = TK3_LIMIT;
- keywords3["WHEN"] = TK3_WHEN;
- keywords3["WHERE"] = TK3_WHERE;
- keywords3["RENAME"] = TK3_RENAME;
- keywords3["AFTER"] = TK3_AFTER;
- keywords3["REPLACE"] = TK3_REPLACE;
- keywords3["AND"] = TK3_AND;
- keywords3["DEFAULT"] = TK3_DEFAULT;
- keywords3["AUTOINCREMENT"] = TK3_AUTOINCR;
- keywords3["TO"] = TK3_TO;
- keywords3["IN"] = TK3_IN;
keywords3["CAST"] = TK3_CAST;
+ keywords3["CHECK"] = TK3_CHECK;
+ keywords3["COLLATE"] = TK3_COLLATE;
keywords3["COLUMN"] = TK3_COLUMNKW;
keywords3["COMMIT"] = TK3_COMMIT;
keywords3["CONFLICT"] = TK3_CONFLICT;
+ keywords3["CONSTRAINT"] = TK3_CONSTRAINT;
+ keywords3["CREATE"] = TK3_CREATE;
keywords3["CROSS"] = TK3_JOIN_KW;
- keywords3["CURRENT_TIMESTAMP"] = TK3_CTIME_KW;
+ keywords3["CURRENT"] = TK3_CURRENT;
+ keywords3["CURRENT_DATE"] = TK3_CTIME_KW;
keywords3["CURRENT_TIME"] = TK3_CTIME_KW;
- keywords3["PRIMARY"] = TK3_PRIMARY;
+ keywords3["CURRENT_TIMESTAMP"] = TK3_CTIME_KW;
+ keywords3["DATABASE"] = TK3_DATABASE;
+ keywords3["DEFAULT"] = TK3_DEFAULT;
+ keywords3["DEFERRABLE"] = TK3_DEFERRABLE;
keywords3["DEFERRED"] = TK3_DEFERRED;
+ keywords3["DELETE"] = TK3_DELETE;
+ keywords3["DESC"] = TK3_DESC;
+ keywords3["DETACH"] = TK3_DETACH;
keywords3["DISTINCT"] = TK3_DISTINCT;
- keywords3["IS"] = TK3_IS;
+ keywords3["DO"] = TK3_DO;
keywords3["DROP"] = TK3_DROP;
+ keywords3["EACH"] = TK3_EACH;
+ keywords3["ELSE"] = TK3_ELSE;
+ keywords3["END"] = TK3_END;
+ keywords3["ESCAPE"] = TK3_ESCAPE;
+ keywords3["EXCEPT"] = TK3_EXCEPT;
+ keywords3["EXCLUDE"] = TK3_EXCLUDE;
+ keywords3["EXCLUSIVE"] = TK3_EXCLUSIVE;
+ keywords3["EXISTS"] = TK3_EXISTS;
+ keywords3["EXPLAIN"] = TK3_EXPLAIN;
keywords3["FAIL"] = TK3_FAIL;
+ keywords3["FILTER"] = TK3_FILTER;
+ keywords3["FIRST"] = TK3_FIRST;
+ keywords3["FOLLOWING"] = TK3_FOLLOWING;
+ keywords3["FOR"] = TK3_FOR;
+ keywords3["FOREIGN"] = TK3_FOREIGN;
keywords3["FROM"] = TK3_FROM;
keywords3["FULL"] = TK3_JOIN_KW;
+ keywords3["GENERATED"] = TK3_GENERATED;
keywords3["GLOB"] = TK3_LIKE_KW;
- keywords3["BY"] = TK3_BY;
+ keywords3["GROUP"] = TK3_GROUP;
+ keywords3["GROUPS"] = TK3_GROUPS;
+ keywords3["HAVING"] = TK3_HAVING;
keywords3["IF"] = TK3_IF;
+ keywords3["IGNORE"] = TK3_IGNORE;
+ keywords3["IMMEDIATE"] = TK3_IMMEDIATE;
+ keywords3["IN"] = TK3_IN;
+ keywords3["INDEX"] = TK3_INDEX;
+ keywords3["INDEXED"] = TK3_INDEXED;
+ keywords3["INITIALLY"] = TK3_INITIALLY;
+ keywords3["INNER"] = TK3_JOIN_KW;
+ keywords3["INSERT"] = TK3_INSERT;
+ keywords3["INSTEAD"] = TK3_INSTEAD;
+ keywords3["INTERSECT"] = TK3_INTERSECT;
+ keywords3["INTO"] = TK3_INTO;
+ keywords3["IS"] = TK3_IS;
keywords3["ISNULL"] = TK3_ISNULL;
+ keywords3["JOIN"] = TK3_JOIN;
+ keywords3["KEY"] = TK3_KEY;
+ keywords3["LAST"] = TK3_LAST;
+ keywords3["LEFT"] = TK3_JOIN_KW;
+ keywords3["LIKE"] = TK3_LIKE_KW;
+ keywords3["LIMIT"] = TK3_LIMIT;
+ keywords3["MATCH"] = TK3_MATCH;
+ keywords3["NATURAL"] = TK3_JOIN_KW;
+ keywords3["NO"] = TK3_NO;
+ keywords3["NOT"] = TK3_NOT;
+ keywords3["NOTHING"] = TK3_NOTHING;
+ keywords3["NOTNULL"] = TK3_NOTNULL;
+ keywords3["NULL"] = TK3_NULL;
+ keywords3["NULLS"] = TK3_NULLS;
+ keywords3["OF"] = TK3_OF;
+ keywords3["OFFSET"] = TK3_OFFSET;
+ keywords3["ON"] = TK3_ON;
+ keywords3["OR"] = TK3_OR;
keywords3["ORDER"] = TK3_ORDER;
- keywords3["RESTRICT"] = TK3_RESTRICT;
+ keywords3["OTHERS"] = TK3_OTHERS;
+ keywords3["OVER"] = TK3_OVER;
keywords3["OUTER"] = TK3_JOIN_KW;
+ keywords3["PARTITION"] = TK3_PARTITION;
+ keywords3["PLAN"] = TK3_PLAN;
+ keywords3["PRAGMA"] = TK3_PRAGMA;
+ keywords3["PRECEDING"] = TK3_PRECEDING;
+ keywords3["PRIMARY"] = TK3_PRIMARY;
+ keywords3["QUERY"] = TK3_QUERY;
+ keywords3["RAISE"] = TK3_RAISE;
+ keywords3["RANGE"] = TK3_RANGE;
+ keywords3["RECURSIVE"] = TK3_RECURSIVE;
+ keywords3["REFERENCES"] = TK3_REFERENCES;
+ keywords3["REGEXP"] = TK3_LIKE_KW;
+ keywords3["REINDEX"] = TK3_REINDEX;
+ keywords3["RELEASE"] = TK3_RELEASE;
+ keywords3["RENAME"] = TK3_RENAME;
+ keywords3["REPLACE"] = TK3_REPLACE;
+ keywords3["RESTRICT"] = TK3_RESTRICT;
keywords3["RIGHT"] = TK3_JOIN_KW;
keywords3["ROLLBACK"] = TK3_ROLLBACK;
keywords3["ROW"] = TK3_ROW;
+ keywords3["ROWS"] = TK3_ROWS;
+ keywords3["SAVEPOINT"] = TK3_SAVEPOINT;
+ keywords3["SELECT"] = TK3_SELECT;
+ keywords3["SET"] = TK3_SET;
+ keywords3["TABLE"] = TK3_TABLE;
+ keywords3["TEMP"] = TK3_TEMP;
+ keywords3["TEMPORARY"] = TK3_TEMP;
+ keywords3["THEN"] = TK3_THEN;
+ keywords3["TIES"] = TK3_TIES;
+ keywords3["TO"] = TK3_TO;
+ keywords3["TRANSACTION"] = TK3_TRANSACTION;
+ keywords3["TRIGGER"] = TK3_TRIGGER;
+ keywords3["UNBOUNDED"] = TK3_UNBOUNDED;
keywords3["UNION"] = TK3_UNION;
+ keywords3["UNIQUE"] = TK3_UNIQUE;
+ keywords3["UPDATE"] = TK3_UPDATE;
keywords3["USING"] = TK3_USING;
keywords3["VACUUM"] = TK3_VACUUM;
+ keywords3["VALUES"] = TK3_VALUES;
keywords3["VIEW"] = TK3_VIEW;
- keywords3["INITIALLY"] = TK3_INITIALLY;
- keywords3["WITHOUT"] = TK3_WITHOUT;
- keywords3["ALL"] = TK3_ALL;
+ keywords3["VIRTUAL"] = TK3_VIRTUAL;
+ keywords3["WHEN"] = TK3_WHEN;
+ keywords3["WHERE"] = TK3_WHERE;
+ keywords3["WINDOW"] = TK3_WINDOW;
keywords3["WITH"] = TK3_WITH;
- keywords3["RECURSIVE"] = TK3_RECURSIVE;
-
- // SQLite 2
- keywords2["ABORT"] = TK2_ABORT;
- keywords2["AFTER"] = TK2_AFTER;
- keywords2["ALL"] = TK2_ALL;
- keywords2["AND"] = TK2_AND;
- keywords2["AS"] = TK2_AS;
- keywords2["ASC"] = TK2_ASC;
- keywords2["ATTACH"] = TK2_ATTACH;
- keywords2["BEFORE"] = TK2_BEFORE;
- keywords2["BEGIN"] = TK2_BEGIN;
- keywords2["BETWEEN"] = TK2_BETWEEN;
- keywords2["BY"] = TK2_BY;
- keywords2["CASCADE"] = TK2_CASCADE;
- keywords2["CASE"] = TK2_CASE;
- keywords2["CHECK"] = TK2_CHECK;
- keywords2["CLUSTER"] = TK2_CLUSTER;
- keywords2["COLLATE"] = TK2_COLLATE;
- keywords2["COMMIT"] = TK2_COMMIT;
- keywords2["CONFLICT"] = TK2_CONFLICT;
- keywords2["CONSTRAINT"] = TK2_CONSTRAINT;
- keywords2["COPY"] = TK2_COPY;
- keywords2["CREATE"] = TK2_CREATE;
- keywords2["CROSS"] = TK2_JOIN_KW;
- keywords2["DATABASE"] = TK2_DATABASE;
- keywords2["DEFAULT"] = TK2_DEFAULT;
- keywords2["DEFERRED"] = TK2_DEFERRED;
- keywords2["DEFERRABLE"] = TK2_DEFERRABLE;
- keywords2["DELETE"] = TK2_DELETE;
- keywords2["DELIMITERS"] = TK2_DELIMITERS;
- keywords2["DESC"] = TK2_DESC;
- keywords2["DETACH"] = TK2_DETACH;
- keywords2["DISTINCT"] = TK2_DISTINCT;
- keywords2["DROP"] = TK2_DROP;
- keywords2["END"] = TK2_END;
- keywords2["EACH"] = TK2_EACH;
- keywords2["ELSE"] = TK2_ELSE;
- keywords2["EXCEPT"] = TK2_EXCEPT;
- keywords2["EXPLAIN"] = TK2_EXPLAIN;
- keywords2["FAIL"] = TK2_FAIL;
- keywords2["FOR"] = TK2_FOR;
- keywords2["FOREIGN"] = TK2_FOREIGN;
- keywords2["FROM"] = TK2_FROM;
- keywords2["FULL"] = TK2_JOIN_KW;
- keywords2["GLOB"] = TK2_GLOB;
- keywords2["GROUP"] = TK2_GROUP;
- keywords2["HAVING"] = TK2_HAVING;
- keywords2["IGNORE"] = TK2_IGNORE;
- keywords2["IMMEDIATE"] = TK2_IMMEDIATE;
- keywords2["IN"] = TK2_IN;
- keywords2["INDEX"] = TK2_INDEX;
- keywords2["INITIALLY"] = TK2_INITIALLY;
- keywords2["INNER"] = TK2_JOIN_KW;
- keywords2["INSERT"] = TK2_INSERT;
- keywords2["INSTEAD"] = TK2_INSTEAD;
- keywords2["INTERSECT"] = TK2_INTERSECT;
- keywords2["INTO"] = TK2_INTO;
- keywords2["IS"] = TK2_IS;
- keywords2["ISNULL"] = TK2_ISNULL;
- keywords2["JOIN"] = TK2_JOIN;
- keywords2["KEY"] = TK2_KEY;
- keywords2["LEFT"] = TK2_JOIN_KW;
- keywords2["LIKE"] = TK2_LIKE;
- keywords2["LIMIT"] = TK2_LIMIT;
- keywords2["MATCH"] = TK2_MATCH;
- keywords2["NATURAL"] = TK2_JOIN_KW;
- keywords2["NOT"] = TK2_NOT;
- keywords2["NOTNULL"] = TK2_NOTNULL;
- keywords2["NULL"] = TK2_NULL;
- keywords2["OF"] = TK2_OF;
- keywords2["OFFSET"] = TK2_OFFSET;
- keywords2["ON"] = TK2_ON;
- keywords2["OR"] = TK2_OR;
- keywords2["ORDER"] = TK2_ORDER;
- keywords2["OUTER"] = TK2_JOIN_KW;
- keywords2["PRAGMA"] = TK2_PRAGMA;
- keywords2["PRIMARY"] = TK2_PRIMARY;
- keywords2["RAISE"] = TK2_RAISE;
- keywords2["REFERENCES"] = TK2_REFERENCES;
- keywords2["REPLACE"] = TK2_REPLACE;
- keywords2["RESTRICT"] = TK2_RESTRICT;
- keywords2["RIGHT"] = TK2_JOIN_KW;
- keywords2["ROLLBACK"] = TK2_ROLLBACK;
- keywords2["ROW"] = TK2_ROW;
- keywords2["SELECT"] = TK2_SELECT;
- keywords2["SET"] = TK2_SET;
- keywords2["STATEMENT"] = TK2_STATEMENT;
- keywords2["TABLE"] = TK2_TABLE;
- keywords2["TEMP"] = TK2_TEMP;
- keywords2["TEMPORARY"] = TK2_TEMP;
- keywords2["THEN"] = TK2_THEN;
- keywords2["TRANSACTION"] = TK2_TRANSACTION;
- keywords2["TRIGGER"] = TK2_TRIGGER;
- keywords2["UNION"] = TK2_UNION;
- keywords2["UNIQUE"] = TK2_UNIQUE;
- keywords2["UPDATE"] = TK2_UPDATE;
- keywords2["USING"] = TK2_USING;
- keywords2["VACUUM"] = TK2_VACUUM;
- keywords2["VALUES"] = TK2_VALUES;
- keywords2["VIEW"] = TK2_VIEW;
- keywords2["WHEN"] = TK2_WHEN;
- keywords2["WHERE"] = TK2_WHERE;
+ keywords3["WITHOUT"] = TK3_WITHOUT;
rowIdKeywords << "_ROWID_"
<< "ROWID"
@@ -284,6 +187,16 @@ void initKeywords()
joinKeywords << "NATURAL" << "LEFT" << "RIGHT" << "OUTER" << "INNER" << "CROSS";
fkMatchKeywords << "SIMPLE" << "FULL" << "PARTIAL";
conflictAlgoKeywords << "ROLLBACK" << "ABORT" << "FAIL" << "IGNORE" << "REPLACE";
+ generatedColumnKeywords << "STORED" << "VIRTUAL";
+
+ softKeywords3 << "ABORT" << "ACTION" << "AFTER" << "ALWAYS" << "ANALYZE" << "ASC" << "ATTACH" << "BEFORE" << "BEGIN" << "BY" << "CASCADE"
+ << "CAST" << "COLUMNKW" << "CONFLICT" << "CURRENT" << "DATABASE" << "DEFERRED" << "DESC" << "DETACH" << "DO" << "EACH"
+ << "END" << "EXCLUDE" << "EXCLUSIVE" << "EXPLAIN" << "FAIL" << "FIRST" << "FOLLOWING" << "FOR" << "GENERATED" << "GROUPS"
+ << "IGNORE" << "IMMEDIATE" << "INDEXED" << "INITIALLY" << "INSTEAD" << "LAST" << "LIKE_KW" << "MATCH" << "NO" << "NULLS"
+ << "OTHERS" << "PLAN" << "QUERY" << "KEY" << "OF" << "OFFSET" << "PARTITION" << "PRAGMA" << "PRECEDING" << "RAISE" << "RANGE"
+ << "RECURSIVE" << "RELEASE" << "REPLACE" << "RESTRICT" << "ROW" << "ROWS" << "ROLLBACK" << "SAVEPOINT" << "TEMP" << "TIES"
+ << "TRIGGER" << "UNBOUNDED" << "VACUUM" << "VIEW" << "VIRTUAL" << "WITH" << "WITHOUT" << "REINDEX" << "RENAME" << "IF"
+ << "CURRENT_DATE" << "CURRENT_TIME" << "CURRENT_TIMESTAMP";
}
@@ -307,20 +220,22 @@ bool isFkMatchKeyword(const QString &str)
return fkMatchKeywords.contains(str);
}
-
-bool isKeyword(const QString& str, Dialect dialect)
+bool isKeyword(const QString& str)
{
- switch (dialect)
- {
- case Dialect::Sqlite3:
- return keywords3.contains(str.toUpper());
- case Dialect::Sqlite2:
- return keywords2.contains(str.toUpper());
- }
- return false;
+ return keywords3.contains(str.toUpper());
}
QStringList getConflictAlgorithms()
{
return conflictAlgoKeywords;
}
+
+QStringList getGeneratedColumnTypes()
+{
+ return generatedColumnKeywords;
+}
+
+bool isSoftKeyword(const QString& str)
+{
+ return softKeywords3.contains(str.toUpper());
+}
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/keywords.h b/SQLiteStudio3/coreSQLiteStudio/parser/keywords.h
index a6e1d3d..4bd8ae5 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/keywords.h
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/keywords.h
@@ -1,7 +1,6 @@
#ifndef KEYWORDS_H
#define KEYWORDS_H
-#include "dialect.h"
#include "coreSQLiteStudio_global.h"
#include <QString>
#include <QStringList>
@@ -10,34 +9,40 @@
/** @file */
/**
- * @brief Translates keyword into it's Lemon token ID for SQLite 2 dialect.
+ * @brief Translates keyword into it's Lemon token ID for SQLite 3 dialect.
* @param str The keyword.
- * @return Lemon generated token ID, or TK2_ID value when the \p str parameter was not recognized as a valid SQLite 2 keyword.
+ * @return Lemon generated token ID, or TK3_ID value when the \p str parameter was not recognized as a valid SQLite 3 keyword.
*
* This method is used internally by the Lexer.
* Comparision is done in case insensitive manner.
*/
-API_EXPORT int getKeywordId2(const QString& str);
+API_EXPORT int getKeywordId3(const QString& str);
/**
- * @brief Translates keyword into it's Lemon token ID for SQLite 3 dialect.
- * @param str The keyword.
- * @return Lemon generated token ID, or TK3_ID value when the \p str parameter was not recognized as a valid SQLite 3 keyword.
+ * @brief Tests whether given string represents a keyword in SQLite dialect.
+ * @param str String to test.
+ * @return true if the string represents a keyword, or false otherwise.
*
- * This method is used internally by the Lexer.
* Comparision is done in case insensitive manner.
*/
-API_EXPORT int getKeywordId3(const QString& str);
+API_EXPORT bool isKeyword(const QString& str);
/**
- * @brief Tests whether given string represents a keyword in given SQLite dialect.
+ * @brief Tests whether given string represents a "soft" keyword in SQLite dialect.
* @param str String to test.
- * @param dialect SQLite dialect.
- * @return true if the string represents a keyword, or false otherwise.
+ * @return true if the string represents a soft keyword, or false otherwise.
+ *
+ * "Soft" keywords are like any SQLite keywords, except these can be treated by SQLite as ID too,
+ * if it fits the syntax. It means that when SQLite parses a query, it first tries to parse these
+ * "soft" keywords are regular keywords and if it fails, it re-tries with treating them as ID.
+ *
+ * Quote from SQLite's parse.y:
+ * "The following directive causes tokens ABORT, AFTER, ASC, etc. to
+ * fallback to ID if they will not parse as their original value."
*
* Comparision is done in case insensitive manner.
*/
-API_EXPORT bool isKeyword(const QString& str, Dialect dialect);
+API_EXPORT bool isSoftKeyword(const QString& str);
/**
* @brief Tests whether given string representing any variation of ROWID.
@@ -50,12 +55,6 @@ API_EXPORT bool isKeyword(const QString& str, Dialect dialect);
API_EXPORT bool isRowIdKeyword(const QString& str);
/**
- * @brief Provides map of SQLite 2 keywords and their Lemon token IDs.
- * @return Keyword-to-Lemon-ID hash map, keywords are uppercase.
- */
-API_EXPORT const QHash<QString,int>& getKeywords2();
-
-/**
* @brief Provides map of SQLite 3 keywords and their Lemon token IDs.
* @return Keyword-to-Lemon-ID hash map, keywords are uppercase.
*/
@@ -120,4 +119,13 @@ API_EXPORT void initKeywords();
*/
API_EXPORT QStringList getConflictAlgorithms();
+/**
+ * @brief Provides list of accepted Generated Column storage types in SQLite.
+ *
+ * Generated column storage keywords are: <tt>STORED</tt>, <tt>VIRTUAL</tt>.
+ *
+ * Those keywords are used for example on GUI, when user has the storage type to pick from drop-down list.
+ */
+API_EXPORT QStringList getGeneratedColumnTypes();
+
#endif // KEYWORDS_H
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/lempar.c b/SQLiteStudio3/coreSQLiteStudio/parser/lempar.c
index 2d0e610..3b239dc 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/lempar.c
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/lempar.c
@@ -564,6 +564,7 @@ static int yy_find_reduce_action(
** The following routine is called if the stack overflows.
*/
static void yyStackOverflow(yyParser *yypParser, YYMINORTYPE *yypMinor){
+ UNUSED(yypMinor);
ParseARG_FETCH;
yypParser->yyidx--;
#ifndef NDEBUG
@@ -1022,4 +1023,4 @@ void Parse(
}
}while( yymajor!=YYNOCODE && yypParser->yyidx>=0 );
return;
-}
+} \ No newline at end of file
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/lexer.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/lexer.cpp
index f6a23a0..bf5185b 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/lexer.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/lexer.cpp
@@ -2,21 +2,18 @@
#include "keywords.h"
#include "log.h"
#include "lexer_low_lev.h"
-#include "sqlite2_parse.h"
#include "sqlite3_parse.h"
#include "common/utils_sql.h"
#include <QString>
#include <QMultiHash>
#include <QDebug>
-QHash<Token::Type,QSet<TokenPtr> > Lexer::everyTokenType2;
QHash<Token::Type,QSet<TokenPtr> > Lexer::everyTokenType3;
QHash<Token*,TokenPtr> Lexer::everyTokenTypePtrMap;
-TokenPtr Lexer::semicolonTokenSqlite2;
TokenPtr Lexer::semicolonTokenSqlite3;
-Lexer::Lexer(Dialect dialect)
- : dialect(dialect), sqlToTokenize(QString::null)
+Lexer::Lexer()
+ : sqlToTokenize(QString())
{
}
@@ -25,7 +22,7 @@ Lexer::~Lexer()
cleanUp();
}
-TokenList Lexer::tokenize(const QString &sql)
+TokenList Lexer::process(const QString &sql)
{
TokenList resultList;
int lgt;
@@ -40,7 +37,7 @@ TokenList Lexer::tokenize(const QString &sql)
else
token = TokenPtr::create();
- lgt = lexerGetToken(str, token, dialect == Dialect::Sqlite2 ? 2 : 3, tolerant);
+ lgt = lexerGetToken(str, token, 3, tolerant);
if (lgt == 0)
break;
@@ -73,7 +70,7 @@ TokenPtr Lexer::getToken()
else
token = TokenPtr::create();
- int lgt = lexerGetToken(sqlToTokenize, token, dialect == Dialect::Sqlite2 ? 2 : 3, tolerant);
+ int lgt = lexerGetToken(sqlToTokenize, token, 3, tolerant);
if (lgt == 0)
return TokenPtr();
@@ -110,9 +107,7 @@ QSet<TokenPtr> Lexer::getEveryTokenType(QSet<Token::Type> types)
{
// Process set of types
QSet<TokenPtr> results;
- QHashIterator<Token::Type,QSet<TokenPtr> > i(
- dialect == Dialect::Sqlite2 ? everyTokenType2 : everyTokenType3
- );
+ QHashIterator<Token::Type,QSet<TokenPtr> > i(everyTokenType3);
while (i.hasNext())
{
i.next();
@@ -130,149 +125,79 @@ bool Lexer::isEnd() const
return sqlToTokenize.isEmpty();
}
-TokenPtr Lexer::getSemicolonToken(Dialect dialect)
+TokenPtr Lexer::getSemicolonToken()
{
- return (dialect == Dialect::Sqlite3) ? semicolonTokenSqlite3 : semicolonTokenSqlite2;
+ return semicolonTokenSqlite3;
}
void Lexer::staticInit()
{
- createTokenType(Dialect::Sqlite3, TK3_SPACE, Token::SPACE, " ");
- createTokenType(Dialect::Sqlite3, TK3_COMMENT, Token::COMMENT, "--");
- createTokenType(Dialect::Sqlite3, TK3_MINUS, Token::OPERATOR, "-");
- createTokenType(Dialect::Sqlite3, TK3_SPACE, Token::SPACE, " ");
- createTokenType(Dialect::Sqlite3, TK3_LP, Token::PAR_LEFT, "(");
- createTokenType(Dialect::Sqlite3, TK3_RP, Token::PAR_RIGHT, ")");
+ createTokenType(TK3_SPACE, Token::SPACE, " ");
+ createTokenType(TK3_COMMENT, Token::COMMENT, "--");
+ createTokenType(TK3_MINUS, Token::OPERATOR, "-");
+ createTokenType(TK3_SPACE, Token::SPACE, " ");
+ createTokenType(TK3_LP, Token::PAR_LEFT, "(");
+ createTokenType(TK3_RP, Token::PAR_RIGHT, ")");
semicolonTokenSqlite3 =
- createTokenType(Dialect::Sqlite3, TK3_SEMI, Token::OPERATOR, ";");
- createTokenType(Dialect::Sqlite3, TK3_PLUS, Token::OPERATOR, "+");
- createTokenType(Dialect::Sqlite3, TK3_STAR, Token::OPERATOR, "*");
- createTokenType(Dialect::Sqlite3, TK3_SLASH, Token::OPERATOR, "/");
- createTokenType(Dialect::Sqlite3, TK3_COMMENT, Token::COMMENT, "/* */");
- createTokenType(Dialect::Sqlite3, TK3_EQ, Token::OPERATOR, "=");
- createTokenType(Dialect::Sqlite3, TK3_EQ, Token::OPERATOR, "==");
- createTokenType(Dialect::Sqlite3, TK3_LE, Token::OPERATOR, "<=");
- createTokenType(Dialect::Sqlite3, TK3_NE, Token::OPERATOR, "<>");
- createTokenType(Dialect::Sqlite3, TK3_NE, Token::OPERATOR, "!=");
- createTokenType(Dialect::Sqlite3, TK3_LSHIFT, Token::OPERATOR, "<<");
- createTokenType(Dialect::Sqlite3, TK3_LT, Token::OPERATOR, "<");
- createTokenType(Dialect::Sqlite3, TK3_GE, Token::OPERATOR, ">=");
- createTokenType(Dialect::Sqlite3, TK3_RSHIFT, Token::OPERATOR, ">>");
- createTokenType(Dialect::Sqlite3, TK3_GT, Token::OPERATOR, ">");
- createTokenType(Dialect::Sqlite3, TK3_BITOR, Token::OPERATOR, "|");
- createTokenType(Dialect::Sqlite3, TK3_CONCAT, Token::OPERATOR, "||");
- createTokenType(Dialect::Sqlite3, TK3_COMMA, Token::OPERATOR, ",");
- createTokenType(Dialect::Sqlite3, TK3_BITAND, Token::OPERATOR, "&");
- createTokenType(Dialect::Sqlite3, TK3_BITNOT, Token::OPERATOR, "~");
- createTokenType(Dialect::Sqlite3, TK3_STRING, Token::STRING, "' '");
- createTokenType(Dialect::Sqlite3, TK3_ID, Token::OTHER, "id");
- createTokenType(Dialect::Sqlite3, TK3_DOT, Token::OPERATOR, ".");
- createTokenType(Dialect::Sqlite3, TK3_INTEGER, Token::INTEGER, "1");
- createTokenType(Dialect::Sqlite3, TK3_FLOAT, Token::FLOAT, "1.0");
- createTokenType(Dialect::Sqlite3, TK3_VARIABLE, Token::BIND_PARAM, "?");
- createTokenType(Dialect::Sqlite3, TK3_BLOB, Token::BLOB, "X'53'");
+ createTokenType(TK3_SEMI, Token::OPERATOR, ";");
+ createTokenType(TK3_PLUS, Token::OPERATOR, "+");
+ createTokenType(TK3_STAR, Token::OPERATOR, "*");
+ createTokenType(TK3_SLASH, Token::OPERATOR, "/");
+ createTokenType(TK3_COMMENT, Token::COMMENT, "/* */");
+ createTokenType(TK3_EQ, Token::OPERATOR, "=");
+ createTokenType(TK3_EQ, Token::OPERATOR, "==");
+ createTokenType(TK3_LE, Token::OPERATOR, "<=");
+ createTokenType(TK3_NE, Token::OPERATOR, "<>");
+ createTokenType(TK3_NE, Token::OPERATOR, "!=");
+ createTokenType(TK3_LSHIFT, Token::OPERATOR, "<<");
+ createTokenType(TK3_LT, Token::OPERATOR, "<");
+ createTokenType(TK3_GE, Token::OPERATOR, ">=");
+ createTokenType(TK3_RSHIFT, Token::OPERATOR, ">>");
+ createTokenType(TK3_GT, Token::OPERATOR, ">");
+ createTokenType(TK3_BITOR, Token::OPERATOR, "|");
+ createTokenType(TK3_CONCAT, Token::OPERATOR, "||");
+ createTokenType(TK3_COMMA, Token::OPERATOR, ",");
+ createTokenType(TK3_BITAND, Token::OPERATOR, "&");
+ createTokenType(TK3_BITNOT, Token::OPERATOR, "~");
+ createTokenType(TK3_STRING, Token::STRING, "' '");
+ createTokenType(TK3_ID, Token::OTHER, "id");
+ createTokenType(TK3_DOT, Token::OPERATOR, ".");
+ createTokenType(TK3_INTEGER, Token::INTEGER, "1");
+ createTokenType(TK3_FLOAT, Token::FLOAT, "1.0");
+ createTokenType(TK3_VARIABLE, Token::BIND_PARAM, "?");
+ createTokenType(TK3_BLOB, Token::BLOB, "X'53'");
// Contextual ID tokens
- createTokenType(Dialect::Sqlite3, TK3_ID_DB, Token::CTX_DATABASE, "");
- createTokenType(Dialect::Sqlite3, TK3_ID_TAB, Token::CTX_TABLE, "");
- createTokenType(Dialect::Sqlite3, TK3_ID_TAB_NEW, Token::CTX_TABLE_NEW, "");
- createTokenType(Dialect::Sqlite3, TK3_ID_COL, Token::CTX_COLUMN, "");
- createTokenType(Dialect::Sqlite3, TK3_ID_COL_NEW, Token::CTX_COLUMN_NEW, "");
- createTokenType(Dialect::Sqlite3, TK3_ID_COL_TYPE, Token::CTX_COLUMN_TYPE, "");
- createTokenType(Dialect::Sqlite3, TK3_ID_COLLATE, Token::CTX_COLLATION, "");
- createTokenType(Dialect::Sqlite3, TK3_ID_FN, Token::CTX_FUNCTION, "");
- createTokenType(Dialect::Sqlite3, TK3_ID_ERR_MSG, Token::CTX_ERROR_MESSAGE, "");
- createTokenType(Dialect::Sqlite3, TK3_ID_IDX, Token::CTX_INDEX, "");
- createTokenType(Dialect::Sqlite3, TK3_ID_IDX_NEW, Token::CTX_INDEX_NEW, "");
- createTokenType(Dialect::Sqlite3, TK3_ID_VIEW, Token::CTX_VIEW, "");
- createTokenType(Dialect::Sqlite3, TK3_ID_VIEW_NEW, Token::CTX_VIEW_NEW, "");
- createTokenType(Dialect::Sqlite3, TK3_ID_JOIN_OPTS, Token::CTX_JOIN_OPTS, "");
- createTokenType(Dialect::Sqlite3, TK3_ID_CONSTR, Token::CTX_CONSTRAINT, "");
- createTokenType(Dialect::Sqlite3, TK3_ID_FK_MATCH, Token::CTX_FK_MATCH, "");
- createTokenType(Dialect::Sqlite3, TK3_ID_TRANS, Token::CTX_TRANSACTION, "");
- createTokenType(Dialect::Sqlite3, TK3_ID_ALIAS, Token::CTX_ALIAS, "");
- createTokenType(Dialect::Sqlite3, TK3_ID_PRAGMA, Token::CTX_PRAGMA, "");
- createTokenType(Dialect::Sqlite3, TK3_ID_TRIG, Token::CTX_TRIGGER, "");
- createTokenType(Dialect::Sqlite3, TK3_ID_TRIG_NEW, Token::CTX_TRIGGER_NEW, "");
- createTokenType(Dialect::Sqlite3, TK3_CTX_ROWID_KW, Token::CTX_ROWID_KW, "ROWID");
- createTokenType(Dialect::Sqlite3, TK3_ID, Token::CTX_OLD_KW, "OLD");
- createTokenType(Dialect::Sqlite3, TK3_ID, Token::CTX_NEW_KW, "NEW");
+ createTokenType(TK3_ID_DB, Token::CTX_DATABASE, "");
+ createTokenType(TK3_ID_TAB, Token::CTX_TABLE, "");
+ createTokenType(TK3_ID_TAB_NEW, Token::CTX_TABLE_NEW, "");
+ createTokenType(TK3_ID_COL, Token::CTX_COLUMN, "");
+ createTokenType(TK3_ID_COL_NEW, Token::CTX_COLUMN_NEW, "");
+ createTokenType(TK3_ID_COL_TYPE, Token::CTX_COLUMN_TYPE, "");
+ createTokenType(TK3_ID_COLLATE, Token::CTX_COLLATION, "");
+ createTokenType(TK3_ID_FN, Token::CTX_FUNCTION, "");
+ createTokenType(TK3_ID_ERR_MSG, Token::CTX_ERROR_MESSAGE, "");
+ createTokenType(TK3_ID_IDX, Token::CTX_INDEX, "");
+ createTokenType(TK3_ID_IDX_NEW, Token::CTX_INDEX_NEW, "");
+ createTokenType(TK3_ID_VIEW, Token::CTX_VIEW, "");
+ createTokenType(TK3_ID_VIEW_NEW, Token::CTX_VIEW_NEW, "");
+ createTokenType(TK3_ID_JOIN_OPTS, Token::CTX_JOIN_OPTS, "");
+ createTokenType(TK3_ID_CONSTR, Token::CTX_CONSTRAINT, "");
+ createTokenType(TK3_ID_FK_MATCH, Token::CTX_FK_MATCH, "");
+ createTokenType(TK3_ID_TRANS, Token::CTX_TRANSACTION, "");
+ createTokenType(TK3_ID_ALIAS, Token::CTX_ALIAS, "");
+ createTokenType(TK3_ID_PRAGMA, Token::CTX_PRAGMA, "");
+ createTokenType(TK3_ID_TRIG, Token::CTX_TRIGGER, "");
+ createTokenType(TK3_ID_TRIG_NEW, Token::CTX_TRIGGER_NEW, "");
+ createTokenType(TK3_CTX_ROWID_KW, Token::CTX_ROWID_KW, "ROWID");
+ createTokenType(TK3_ID, Token::CTX_OLD_KW, "OLD");
+ createTokenType(TK3_ID, Token::CTX_NEW_KW, "NEW");
QHashIterator<QString,int> i3(getKeywords3());
while (i3.hasNext())
{
i3.next();
- createTokenType(Dialect::Sqlite3, i3.value(), Token::KEYWORD, i3.key());
- }
-
- //
- // SQLite 2
- //
-
- createTokenType(Dialect::Sqlite2, TK2_SPACE, Token::SPACE, " ");
- createTokenType(Dialect::Sqlite2, TK2_COMMENT, Token::COMMENT, "--");
- createTokenType(Dialect::Sqlite2, TK2_MINUS, Token::OPERATOR, "-");
- createTokenType(Dialect::Sqlite2, TK2_SPACE, Token::SPACE, " ");
- createTokenType(Dialect::Sqlite2, TK2_LP, Token::PAR_LEFT, "(");
- createTokenType(Dialect::Sqlite2, TK2_RP, Token::PAR_RIGHT, ")");
- semicolonTokenSqlite2 =
- createTokenType(Dialect::Sqlite2, TK2_SEMI, Token::OPERATOR, ";");
- createTokenType(Dialect::Sqlite2, TK2_PLUS, Token::OPERATOR, "+");
- createTokenType(Dialect::Sqlite2, TK2_STAR, Token::OPERATOR, "*");
- createTokenType(Dialect::Sqlite2, TK2_SLASH, Token::OPERATOR, "/");
- createTokenType(Dialect::Sqlite2, TK2_COMMENT, Token::COMMENT, "/* */");
- createTokenType(Dialect::Sqlite2, TK2_EQ, Token::OPERATOR, "=");
- createTokenType(Dialect::Sqlite2, TK2_EQ, Token::OPERATOR, "==");
- createTokenType(Dialect::Sqlite2, TK2_LE, Token::OPERATOR, "<=");
- createTokenType(Dialect::Sqlite2, TK2_NE, Token::OPERATOR, "<>");
- createTokenType(Dialect::Sqlite2, TK2_NE, Token::OPERATOR, "!=");
- createTokenType(Dialect::Sqlite2, TK2_LSHIFT, Token::OPERATOR, "<<");
- createTokenType(Dialect::Sqlite2, TK2_LT, Token::OPERATOR, "<");
- createTokenType(Dialect::Sqlite2, TK2_GE, Token::OPERATOR, ">=");
- createTokenType(Dialect::Sqlite2, TK2_RSHIFT, Token::OPERATOR, ">>");
- createTokenType(Dialect::Sqlite2, TK2_GT, Token::OPERATOR, ">");
- createTokenType(Dialect::Sqlite2, TK2_BITOR, Token::OPERATOR, "|");
- createTokenType(Dialect::Sqlite2, TK2_CONCAT, Token::OPERATOR, "||");
- createTokenType(Dialect::Sqlite2, TK2_COMMA, Token::OPERATOR, ",");
- createTokenType(Dialect::Sqlite2, TK2_BITAND, Token::OPERATOR, "&");
- createTokenType(Dialect::Sqlite2, TK2_BITNOT, Token::OPERATOR, "~");
- createTokenType(Dialect::Sqlite2, TK2_STRING, Token::STRING, "' '");
- createTokenType(Dialect::Sqlite2, TK2_ID, Token::OTHER, "id");
- createTokenType(Dialect::Sqlite2, TK2_DOT, Token::OPERATOR, ".");
- createTokenType(Dialect::Sqlite2, TK2_INTEGER, Token::INTEGER, "1");
- createTokenType(Dialect::Sqlite2, TK2_FLOAT, Token::FLOAT, "1.0");
- createTokenType(Dialect::Sqlite2, TK2_VARIABLE, Token::BIND_PARAM, "?");
-
- // Contextual ID tokens
- createTokenType(Dialect::Sqlite2, TK2_ID_DB, Token::CTX_DATABASE, "");
- createTokenType(Dialect::Sqlite2, TK2_ID_TAB, Token::CTX_TABLE, "");
- createTokenType(Dialect::Sqlite2, TK2_ID_TAB_NEW, Token::CTX_TABLE_NEW, "");
- createTokenType(Dialect::Sqlite2, TK2_ID_COL, Token::CTX_COLUMN, "");
- createTokenType(Dialect::Sqlite2, TK2_ID_COL_NEW, Token::CTX_COLUMN_NEW, "");
- createTokenType(Dialect::Sqlite2, TK2_ID_COL_TYPE, Token::CTX_COLUMN_TYPE, "");
- createTokenType(Dialect::Sqlite2, TK2_ID_FN, Token::CTX_FUNCTION, "");
- createTokenType(Dialect::Sqlite2, TK2_ID_ERR_MSG, Token::CTX_ERROR_MESSAGE, "");
- createTokenType(Dialect::Sqlite2, TK2_ID_IDX, Token::CTX_INDEX, "");
- createTokenType(Dialect::Sqlite2, TK2_ID_IDX_NEW, Token::CTX_INDEX_NEW, "");
- createTokenType(Dialect::Sqlite2, TK2_ID_VIEW, Token::CTX_VIEW, "");
- createTokenType(Dialect::Sqlite2, TK2_ID_VIEW_NEW, Token::CTX_VIEW_NEW, "");
- createTokenType(Dialect::Sqlite2, TK2_ID_JOIN_OPTS, Token::CTX_JOIN_OPTS, "");
- createTokenType(Dialect::Sqlite2, TK2_ID_CONSTR, Token::CTX_CONSTRAINT, "");
- createTokenType(Dialect::Sqlite2, TK2_ID_FK_MATCH, Token::CTX_FK_MATCH, "");
- createTokenType(Dialect::Sqlite2, TK2_ID_TRANS, Token::CTX_TRANSACTION, "");
- createTokenType(Dialect::Sqlite2, TK2_ID_ALIAS, Token::CTX_ALIAS, "");
- createTokenType(Dialect::Sqlite2, TK2_ID_PRAGMA, Token::CTX_PRAGMA, "");
- createTokenType(Dialect::Sqlite2, TK2_ID_TRIG, Token::CTX_TRIGGER, "");
- createTokenType(Dialect::Sqlite2, TK2_ID_TRIG_NEW, Token::CTX_TRIGGER_NEW, "");
- createTokenType(Dialect::Sqlite2, TK2_ID, Token::CTX_ROWID_KW, "ROWID");
- createTokenType(Dialect::Sqlite2, TK2_ID, Token::CTX_OLD_KW, "OLD");
- createTokenType(Dialect::Sqlite2, TK2_ID, Token::CTX_NEW_KW, "NEW");
-
- QHashIterator<QString,int> i2(getKeywords2());
- while (i2.hasNext())
- {
- i2.next();
- createTokenType(Dialect::Sqlite2, i2.value(), Token::KEYWORD, i2.key());
+ createTokenType(i3.value(), Token::KEYWORD, i3.key());
}
}
@@ -308,7 +233,7 @@ QString Lexer::detokenize(const TokenPtr& token)
case Token::CTX_TRIGGER_NEW:
case Token::CTX_VIEW:
case Token::CTX_VIEW_NEW:
- return token->value.isEmpty() ? wrapObjName(token->value, Dialect::Sqlite3, NameWrapper::DOUBLE_QUOTE) : token->value;
+ return token->value.isEmpty() ? wrapObjName(token->value, NameWrapper::DOUBLE_QUOTE) : token->value;
case Token::CTX_ERROR_MESSAGE:
case Token::STRING:
return token->value.isEmpty() ? wrapString(token->value) : token->value;
@@ -318,10 +243,10 @@ QString Lexer::detokenize(const TokenPtr& token)
return token->value;
}
-TokenList Lexer::tokenize(const QString& sql, Dialect dialect)
+TokenList Lexer::tokenize(const QString& sql)
{
- Lexer lexer(dialect);
- return lexer.tokenize(sql);
+ Lexer lexer;
+ return lexer.process(sql);
}
TokenPtr Lexer::getEveryTokenTypePtr(Token *token)
@@ -333,13 +258,10 @@ TokenPtr Lexer::getEveryTokenTypePtr(Token *token)
return TokenPtr();
}
-TokenPtr Lexer::createTokenType(Dialect dialect, int lemonType, Token::Type type, const QString &value)
+TokenPtr Lexer::createTokenType(int lemonType, Token::Type type, const QString &value)
{
TokenPtr tokenPtr = TokenPtr::create(lemonType, type, value, -100, -100);
- if (dialect == Dialect::Sqlite2)
- everyTokenType2[type] << tokenPtr;
- else
- everyTokenType3[type] << tokenPtr;
+ everyTokenType3[type] << tokenPtr;
everyTokenTypePtrMap[tokenPtr.data()] = tokenPtr;
return tokenPtr;
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/lexer.h b/SQLiteStudio3/coreSQLiteStudio/parser/lexer.h
index 8473844..10db9ce 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/lexer.h
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/lexer.h
@@ -2,7 +2,6 @@
#define LEXER_H
#include "token.h"
-#include "dialect.h"
#include <QList>
#include <QString>
@@ -24,10 +23,9 @@ class API_EXPORT Lexer
{
public:
/**
- * @brief Creates lexer for given dialect.
- * @param dialect SQLite dialect.
+ * @brief Creates lexer.
*/
- Lexer(Dialect dialect);
+ Lexer();
/**
* @brief Releases resources.
@@ -39,7 +37,7 @@ class API_EXPORT Lexer
* @param sql SQL query to tokenize.
* @return List of tokens produced from tokenizing query.
*/
- TokenList tokenize(const QString& sql);
+ TokenList process(const QString& sql);
/**
* @brief Stores given SQL query internally for further processing by the lexer.
@@ -138,18 +136,17 @@ class API_EXPORT Lexer
static QString detokenize(const TokenPtr& token);
/**
- * @brief Tokenizes given SQL query with given dialect.
+ * @brief Tokenizes given SQL query.
* @param sql SQL query to tokenize.
- * @param dialect SQLite dialect to use when tokenizing.
* @return List of tokens from tokenizing.
*
* This method is a shortcut for:
* @code
- * Lexer lexer(dialect);
+ * Lexer lexer;
* lexer.tokenize(sql);
* @endcode
*/
- static TokenList tokenize(const QString& sql, Dialect dialect);
+ static TokenList tokenize(const QString& sql);
/**
* @brief Translates token pointer into common token shared pointer.
@@ -169,19 +166,16 @@ class API_EXPORT Lexer
static TokenPtr getEveryTokenTypePtr(Token* token);
/**
- * @brief Provides token representing semicolon in given SQLite dialect.
- * @param dialect Dialect to use.
+ * @brief Provides token representing semicolon in SQLite dialect.
* @return Token representing semicolon.
*
* This is used by Parser to complete the parsed query in case the input query did not end with semicolon.
- * Given the \p dialect it provides proper token for that dialect (they are different by Lemon token ID).
*/
- static TokenPtr getSemicolonToken(Dialect dialect);
+ static TokenPtr getSemicolonToken();
private:
/**
* @brief Creates token for every token type internal tables.
- * @param dialect SQLite dialect to create token for.
* @param lemonType Lemon token ID for this token type.
* @param type SQLiteStudio token type.
* @param value Sample value for the token.
@@ -191,7 +185,7 @@ class API_EXPORT Lexer
*
* @see getEveryTokenType()
*/
- static TokenPtr createTokenType(Dialect dialect, int lemonType, Token::Type type, const QString& value);
+ static TokenPtr createTokenType(int lemonType, Token::Type type, const QString& value);
/**
* @brief Current "tolerant mode" flag.
@@ -201,11 +195,6 @@ class API_EXPORT Lexer
bool tolerant = false;
/**
- * @brief Lexer's SQLite dialect.
- */
- Dialect dialect;
-
- /**
* @brief SQL query to be tokenized with getToken().
*
* It's defined with prepare().
@@ -223,13 +212,6 @@ class API_EXPORT Lexer
quint64 tokenPosition;
/**
- * @brief Internal table of every token type for SQLite 2.
- *
- * @see semicolonTokenSqlite3
- */
- static TokenPtr semicolonTokenSqlite2;
-
- /**
* @brief Internal table of every token type for SQLite 3.
*
* Internal token type table contains single token per token type, so it can be used to probe the Parser
@@ -238,13 +220,6 @@ class API_EXPORT Lexer
static TokenPtr semicolonTokenSqlite3;
/**
- * @brief Internal table of every token type for SQLite 2.
- *
- * @see everyTokenType3
- */
- static QHash<Token::Type,QSet<TokenPtr> > everyTokenType2;
-
- /**
* @brief Internal table of every token type for SQLite 3.
*
* Set of tokens representing all token types, including diversification by values for keywords and operators.
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/lexer_low_lev.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/lexer_low_lev.cpp
index 9a0d3d2..65f9222 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/lexer_low_lev.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/lexer_low_lev.cpp
@@ -2,7 +2,6 @@
#include "token.h"
#include "keywords.h"
#include "sqlite3_parse.h"
-#include "sqlite2_parse.h"
#include "common/utils.h"
#include "common/utils_sql.h"
@@ -21,7 +20,7 @@ bool isIdChar(const QChar& c)
int lexerGetToken(const QString& z, TokenPtr token, int sqliteVersion, bool tolerant)
{
- if (sqliteVersion < 2 || sqliteVersion > 3)
+ if (sqliteVersion < 3 || sqliteVersion > 3)
{
qCritical() << "lexerGetToken() called with invalid sqliteVersion:" << sqliteVersion;
return 0;
@@ -33,7 +32,6 @@ int lexerGetToken(const QString& z, TokenPtr token, int sqliteVersion, bool tole
return 0;
}
- bool v3 = sqliteVersion == 3;
int i;
QChar c;
QChar z0 = charAt(z, 0);
@@ -43,7 +41,7 @@ int lexerGetToken(const QString& z, TokenPtr token, int sqliteVersion, bool tole
if (z0.isSpace())
{
for(i=1; charAt(z, i).isSpace(); i++) {}
- token->lemonType = v3 ? TK3_SPACE : TK2_SPACE;
+ token->lemonType = TK3_SPACE;
token->type = Token::SPACE;
return i;
}
@@ -52,41 +50,41 @@ int lexerGetToken(const QString& z, TokenPtr token, int sqliteVersion, bool tole
if (charAt(z, 1) == '-')
{
for (i=2; !(c = charAt(z, i)).isNull() && c != '\n'; i++) {}
- token->lemonType = v3 ? TK3_COMMENT : TK2_COMMENT;
+ token->lemonType = TK3_COMMENT;
token->type = Token::COMMENT;
return i;
}
- token->lemonType = v3 ? TK3_MINUS : TK2_MINUS;
+ token->lemonType = TK3_MINUS;
token->type = Token::OPERATOR;
return 1;
}
if (z0 == '(')
{
- token->lemonType = v3 ? TK3_LP : TK2_LP;
+ token->lemonType = TK3_LP;
token->type = Token::PAR_LEFT;
return 1;
}
if (z0 == ')')
{
- token->lemonType = v3 ? TK3_RP : TK2_RP;
+ token->lemonType = TK3_RP;
token->type = Token::PAR_RIGHT;
return 1;
}
if (z0 == ';')
{
- token->lemonType = v3 ? TK3_SEMI : TK2_SEMI;
+ token->lemonType = TK3_SEMI;
token->type = Token::OPERATOR;
return 1;
}
if (z0 == '+')
{
- token->lemonType = v3 ? TK3_PLUS : TK2_PLUS;
+ token->lemonType = TK3_PLUS;
token->type = Token::OPERATOR;
return 1;
}
if (z0 == '*')
{
- token->lemonType = v3 ? TK3_STAR : TK2_STAR;
+ token->lemonType = TK3_STAR;
token->type = Token::OPERATOR;
return 1;
}
@@ -94,14 +92,14 @@ int lexerGetToken(const QString& z, TokenPtr token, int sqliteVersion, bool tole
{
if ( charAt(z, 1) != '*' )
{
- token->lemonType = v3 ? TK3_SLASH : TK2_SLASH;
+ token->lemonType = TK3_SLASH;
token->type = Token::OPERATOR;
return 1;
}
if ( charAt(z, 2).isNull() )
{
- token->lemonType = v3 ? TK3_COMMENT : TK2_COMMENT;
+ token->lemonType = TK3_COMMENT;
token->type = Token::COMMENT;
if (tolerant)
token.dynamicCast<TolerantToken>()->invalid = true;
@@ -119,19 +117,19 @@ int lexerGetToken(const QString& z, TokenPtr token, int sqliteVersion, bool tole
if ( c > 0 )
#endif
i++;
- token->lemonType = v3 ? TK3_COMMENT : TK2_COMMENT;
+ token->lemonType = TK3_COMMENT;
token->type = Token::COMMENT;
return i;
}
if (z0 == '%')
{
- token->lemonType = v3 ? TK3_REM : TK2_REM;
+ token->lemonType = TK3_REM;
token->type = Token::OPERATOR;
return 1;
}
if (z0 == '=')
{
- token->lemonType = v3 ? TK3_EQ : TK2_EQ;
+ token->lemonType = TK3_EQ;
token->type = Token::OPERATOR;
return 1 + (charAt(z, 1) == '=');
}
@@ -139,25 +137,25 @@ int lexerGetToken(const QString& z, TokenPtr token, int sqliteVersion, bool tole
{
if ( (c = charAt(z, 1)) == '=' )
{
- token->lemonType = v3 ? TK3_LE : TK2_LE;
+ token->lemonType = TK3_LE;
token->type = Token::OPERATOR;
return 2;
}
else if ( c == '>' )
{
- token->lemonType = v3 ? TK3_NE : TK2_NE;
+ token->lemonType = TK3_NE;
token->type = Token::OPERATOR;
return 2;
}
else if( c == '<' )
{
- token->lemonType = v3 ? TK3_LSHIFT : TK2_LSHIFT;
+ token->lemonType = TK3_LSHIFT;
token->type = Token::OPERATOR;
return 2;
}
else
{
- token->lemonType = v3 ? TK3_LT : TK2_LT;
+ token->lemonType = TK3_LT;
token->type = Token::OPERATOR;
return 1;
}
@@ -166,19 +164,19 @@ int lexerGetToken(const QString& z, TokenPtr token, int sqliteVersion, bool tole
{
if ( (c = charAt(z, 1)) == '=' )
{
- token->lemonType = v3 ? TK3_GE : TK2_GE;
+ token->lemonType = TK3_GE;
token->type = Token::OPERATOR;
return 2;
}
else if ( c == '>' )
{
- token->lemonType = v3 ? TK3_RSHIFT : TK2_RSHIFT;
+ token->lemonType = TK3_RSHIFT;
token->type = Token::OPERATOR;
return 2;
}
else
{
- token->lemonType = v3 ? TK3_GT : TK2_GT;
+ token->lemonType = TK3_GT;
token->type = Token::OPERATOR;
return 1;
}
@@ -187,13 +185,13 @@ int lexerGetToken(const QString& z, TokenPtr token, int sqliteVersion, bool tole
{
if ( charAt(z, 1) != '=' )
{
- token->lemonType = v3 ? TK3_ILLEGAL : TK2_ILLEGAL;
+ token->lemonType = TK3_ILLEGAL;
token->type = Token::INVALID;
return 2;
}
else
{
- token->lemonType = v3 ? TK3_NE : TK2_NE;
+ token->lemonType = TK3_NE;
token->type = Token::OPERATOR;
return 2;
}
@@ -202,32 +200,32 @@ int lexerGetToken(const QString& z, TokenPtr token, int sqliteVersion, bool tole
{
if( charAt(z, 1) != '|' )
{
- token->lemonType = v3 ? TK3_BITOR : TK2_BITOR;
+ token->lemonType = TK3_BITOR;
token->type = Token::OPERATOR;
return 1;
}
else
{
- token->lemonType = v3 ? TK3_CONCAT : TK2_CONCAT;
+ token->lemonType = TK3_CONCAT;
token->type = Token::OPERATOR;
return 2;
}
}
if (z0 == ',')
{
- token->lemonType = v3 ? TK3_COMMA : TK2_COMMA;
+ token->lemonType = TK3_COMMA;
token->type = Token::OPERATOR;
return 1;
}
if (z0 == '&')
{
- token->lemonType = v3? TK3_BITAND : TK2_BITAND;
+ token->lemonType = TK3_BITAND;
token->type = Token::OPERATOR;
return 1;
}
if (z0 == '~')
{
- token->lemonType = v3? TK3_BITNOT : TK2_BITAND;
+ token->lemonType = TK3_BITNOT;
token->type = Token::OPERATOR;
return 1;
}
@@ -248,13 +246,13 @@ int lexerGetToken(const QString& z, TokenPtr token, int sqliteVersion, bool tole
}
if ( c == '\'' )
{
- token->lemonType = v3? TK3_STRING : TK2_STRING;
+ token->lemonType = TK3_STRING;
token->type = Token::STRING;
return i+1;
}
else if ( !c.isNull() )
{
- token->lemonType = v3 ? TK3_ID : TK2_ID;
+ token->lemonType = TK3_ID;
token->type = Token::OTHER;
return i+1;
}
@@ -262,12 +260,12 @@ int lexerGetToken(const QString& z, TokenPtr token, int sqliteVersion, bool tole
{
if (z0 == '\'')
{
- token->lemonType = v3 ? TK3_STRING : TK2_STRING;
+ token->lemonType = TK3_STRING;
token->type = Token::STRING;
}
else
{
- token->lemonType = v3 ? TK3_ID : TK2_ID;
+ token->lemonType = TK3_ID;
token->type = Token::OTHER;
}
token.dynamicCast<TolerantToken>()->invalid = true;
@@ -275,7 +273,7 @@ int lexerGetToken(const QString& z, TokenPtr token, int sqliteVersion, bool tole
}
else
{
- token->lemonType = v3 ? TK3_ILLEGAL : TK2_ILLEGAL;
+ token->lemonType = TK3_ILLEGAL;
token->type = Token::INVALID;
return i;
}
@@ -284,7 +282,7 @@ int lexerGetToken(const QString& z, TokenPtr token, int sqliteVersion, bool tole
{
if( !charAt(z, 1).isDigit() )
{
- token->lemonType = v3 ? TK3_DOT : TK2_DOT;
+ token->lemonType = TK3_DOT;
token->type = Token::OPERATOR;
return 1;
}
@@ -295,9 +293,9 @@ int lexerGetToken(const QString& z, TokenPtr token, int sqliteVersion, bool tole
}
if (z0.isDigit() || z0 == '.')
{
- token->lemonType = v3 ? TK3_INTEGER : TK2_INTEGER;
+ token->lemonType = TK3_INTEGER;
token->type = Token::INTEGER;
- if (v3 && charAt(z, 0) == '0' && (charAt(z, 1) == 'x' || charAt(z, 1) == 'X') && isHex(charAt(z, 2)))
+ if (charAt(z, 0) == '0' && (charAt(z, 1) == 'x' || charAt(z, 1) == 'X') && isHex(charAt(z, 2)))
{
for (i=3; isHex(charAt(z, i)); i++) {}
return i;
@@ -309,7 +307,7 @@ int lexerGetToken(const QString& z, TokenPtr token, int sqliteVersion, bool tole
while ( charAt(z, i).isDigit() )
i++;
- token->lemonType = v3 ? TK3_FLOAT : TK2_FLOAT;
+ token->lemonType = TK3_FLOAT;
token->type = Token::FLOAT;
}
if ( (charAt(z, i) == 'e' || charAt(z, i) == 'E') &&
@@ -322,12 +320,12 @@ int lexerGetToken(const QString& z, TokenPtr token, int sqliteVersion, bool tole
while ( charAt(z, i).isDigit() )
i++;
- token->lemonType = v3 ? TK3_FLOAT : TK2_FLOAT;
+ token->lemonType = TK3_FLOAT;
token->type = Token::FLOAT;
}
while ( isIdChar(charAt(z, i)) )
{
- token->lemonType = v3 ? TK3_ILLEGAL : TK2_ILLEGAL;
+ token->lemonType = TK3_ILLEGAL;
token->type = Token::INVALID;
i++;
}
@@ -338,27 +336,27 @@ int lexerGetToken(const QString& z, TokenPtr token, int sqliteVersion, bool tole
for (i = 1, c = z0; c!=']' && !(c = charAt(z, i)).isNull(); i++) {}
if (c == ']')
{
- token->lemonType = v3 ? TK3_ID : TK2_ID;
+ token->lemonType = TK3_ID;
token->type = Token::OTHER;
}
else if (tolerant)
{
- token->lemonType = v3 ? TK3_ID : TK2_ID;
+ token->lemonType = TK3_ID;
token->type = Token::OTHER;
token.dynamicCast<TolerantToken>()->invalid = true;
}
else
{
- token->lemonType = v3 ? TK3_ILLEGAL : TK2_ILLEGAL;
+ token->lemonType = TK3_ILLEGAL;
token->type = Token::INVALID;
}
return i;
}
if (z0 == '?')
{
- token->lemonType = v3 ? TK3_VARIABLE : TK2_VARIABLE;
+ token->lemonType = TK3_VARIABLE;
token->type = Token::BIND_PARAM;
- for (i=1; charAt(z, i+2).isDigit(); i++) {}
+ for (i=1; charAt(z, i).isDigit(); i++) {}
return i;
}
if (z0 == '$' ||
@@ -366,7 +364,7 @@ int lexerGetToken(const QString& z, TokenPtr token, int sqliteVersion, bool tole
z0 == ':')
{
int n = 0;
- token->lemonType = v3 ? TK3_VARIABLE : TK2_VARIABLE;
+ token->lemonType = TK3_VARIABLE;
token->type = Token::BIND_PARAM;
for (i = 1; !(c = charAt(z, i)).isNull(); i++)
{
@@ -388,7 +386,7 @@ int lexerGetToken(const QString& z, TokenPtr token, int sqliteVersion, bool tole
}
else
{
- token->lemonType = v3 ? TK3_ILLEGAL : TK2_ILLEGAL;
+ token->lemonType = TK3_ILLEGAL;
token->type = Token::INVALID;
}
break;
@@ -404,15 +402,13 @@ int lexerGetToken(const QString& z, TokenPtr token, int sqliteVersion, bool tole
}
if( n == 0 )
{
- token->lemonType = v3 ? TK3_ILLEGAL : TK2_ILLEGAL;
+ token->lemonType = TK3_ILLEGAL;
token->type = Token::INVALID;
}
return i;
}
- if ((z0 == 'x' ||
- z0 == 'X') &&
- v3)
+ if (z0 == 'x' || z0 == 'X')
{
if ( charAt(z, 1) == '\'' )
{
@@ -457,12 +453,9 @@ int lexerGetToken(const QString& z, TokenPtr token, int sqliteVersion, bool tole
for (i = 1; isIdChar(charAt(z, i)); i++) {}
- if (v3)
token->lemonType = getKeywordId3(z.mid(0, i));
- else
- token->lemonType = getKeywordId2(z.mid(0, i));
- if (token->lemonType == TK3_ID || token->lemonType == TK2_ID)
+ if (token->lemonType == TK3_ID)
token->type = Token::OTHER;
else
token->type = Token::KEYWORD;
@@ -471,11 +464,7 @@ int lexerGetToken(const QString& z, TokenPtr token, int sqliteVersion, bool tole
}
}
- if (v3)
- token->lemonType = TK3_ILLEGAL;
- else
- token->lemonType = TK2_ILLEGAL;
-
+ token->lemonType = TK3_ILLEGAL;
token->type = Token::INVALID;
return 1;
}
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/lexer_low_lev.h b/SQLiteStudio3/coreSQLiteStudio/parser/lexer_low_lev.h
index 9027d04..d642177 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/lexer_low_lev.h
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/lexer_low_lev.h
@@ -11,16 +11,16 @@
* @brief Low level tokenizer function used by the Lexer.
* @param z Query to tokenize.
* @param[out] token Token container to fill with values. Can be also a TolerantToken.
- * @param sqliteVersion SQLite version, for which the tokenizer should work (2 or 3).
+ * @param sqliteVersion SQLite version, for which the tokenizer should work (currently only 3).
* Version affects the list of recognized keywords, a BLOB expression and an object name wrapper with the grave accent character (`).
* @param tolerant If true, then all multi-line and unfinished tokens (strings, comments)
* will be reported with invalid=true in TolerantToken, but the token itself will have type like it was finished.
* If this is true, then \p token must be of type TolerantToken, otherwise the the method will return 0 and log a critical error.
- * @return Lemon token ID (see sqlite2_parse.h and sqlite3_parse.h for possible token IDs).
+ * @return Lemon token ID (see sqlite3_parse.h for possible token IDs).
*
* You shouldn't normally need to use this method. Instead of that, use Lexer class, as it provides higher level API.
*
- * Most of the method code was taken from SQLite tokenizer code. It is modified to support both SQLite 2 and 3 grammas
+ * Most of the method code was taken from SQLite tokenizer code. It is modified to support both SQLite 3 gramma
* and other SQLiteStudio specific features.
*/
int lexerGetToken(const QString& z, TokenPtr token, int sqliteVersion, bool tolerant = false);
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/parser.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/parser.cpp
index 55669a5..b54c786 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/parser.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/parser.cpp
@@ -18,18 +18,8 @@ void sqlite3_parseRestoreParserState(void* saved, void* target);
void sqlite3_parseFreeSavedState(void* other);
void sqlite3_parseAddToken(void* other, Token* token);
-void* sqlite2_parseAlloc(void *(*mallocProc)(size_t));
-void sqlite2_parseFree(void *p, void (*freeProc)(void*));
-void sqlite2_parse(void *yyp, int yymajor, Token* yyminor, ParserContext* parserContext);
-void sqlite2_parseTrace(FILE *stream, char *zPrefix);
-void* sqlite2_parseCopyParserState(void* other);
-void sqlite2_parseRestoreParserState(void* saved, void* target);
-void sqlite2_parseFreeSavedState(void* other);
-void sqlite2_parseAddToken(void* other, Token* token);
-
-Parser::Parser(Dialect dialect)
+Parser::Parser()
{
- this->dialect = dialect;
init();
}
@@ -53,74 +43,44 @@ void Parser::cleanUp()
}
}
-void Parser::fillSqliteDialect()
-{
- for (SqliteQueryPtr query : context->parsedQueries)
- query->setSqliteDialect(dialect);
-}
-
void *Parser::parseAlloc(void *(*mallocProc)(size_t))
{
- if (dialect == Dialect::Sqlite2)
- return sqlite2_parseAlloc(mallocProc);
- else
- return sqlite3_parseAlloc(mallocProc);
+ return sqlite3_parseAlloc(mallocProc);
}
void Parser::parseFree(void *p, void (*freeProc)(void *))
{
- if (dialect == Dialect::Sqlite2)
- sqlite2_parseFree(p, freeProc);
- else
- sqlite3_parseFree(p, freeProc);
+ sqlite3_parseFree(p, freeProc);
}
void Parser::parse(void *yyp, int yymajor, TokenPtr yyminor, ParserContext *parserContext)
{
- if (dialect == Dialect::Sqlite2)
- sqlite2_parse(yyp, yymajor, yyminor.data(), parserContext);
- else
- sqlite3_parse(yyp, yymajor, yyminor.data(), parserContext);
+ sqlite3_parse(yyp, yymajor, yyminor.data(), parserContext);
}
void Parser::parseTrace(FILE *stream, char *zPrefix)
{
- if (dialect == Dialect::Sqlite2)
- sqlite2_parseTrace(stream, zPrefix);
- else
- sqlite3_parseTrace(stream, zPrefix);
+ sqlite3_parseTrace(stream, zPrefix);
}
void *Parser::parseCopyParserState(void *other)
{
- if (dialect == Dialect::Sqlite2)
- return sqlite2_parseCopyParserState(other);
- else
- return sqlite3_parseCopyParserState(other);
+ return sqlite3_parseCopyParserState(other);
}
void Parser::parseRestoreParserState(void *saved, void *target)
{
- if (dialect == Dialect::Sqlite2)
- sqlite2_parseRestoreParserState(saved, target);
- else
- sqlite3_parseRestoreParserState(saved, target);
+ sqlite3_parseRestoreParserState(saved, target);
}
void Parser::parseFreeSavedState(void *other)
{
- if (dialect == Dialect::Sqlite2)
- sqlite2_parseFreeSavedState(other);
- else
- sqlite3_parseFreeSavedState(other);
+ sqlite3_parseFreeSavedState(other);
}
void Parser::parseAddToken(void *other, TokenPtr token)
{
- if (dialect == Dialect::Sqlite2)
- sqlite2_parseAddToken(other, token.data());
- else
- sqlite3_parseAddToken(other, token.data());
+ sqlite3_parseAddToken(other, token.data());
}
bool Parser::parse(const QString &sql, bool ignoreMinorErrors)
@@ -134,21 +94,17 @@ bool Parser::parseInternal(const QString &sql, bool lookForExpectedToken)
void* pParser = parseAlloc( malloc );
if (debugLemon)
{
- char* label = nullptr;
- if (dialect == Dialect::Sqlite2)
- label = const_cast<char*>("[LEMON2]: ");
- else
- label = const_cast<char*>("[LEMON3]: ");
-
+ char* label = const_cast<char*>("[LEMON3]: ");
parseTrace(stderr, label);
}
+ else
+ parseTrace(nullptr, nullptr);
reset();
lexer->prepare(sql);
context->setupTokens = !lookForExpectedToken;
context->executeRules = !lookForExpectedToken;
context->doFallbacks = !lookForExpectedToken;
- context->dialect = dialect;
TokenPtr token = lexer->getToken();
if (!token.isNull())
@@ -186,17 +142,15 @@ bool Parser::parseInternal(const QString &sql, bool lookForExpectedToken)
{
if (!endsWithSemicolon)
{
- token = Lexer::getSemicolonToken(dialect);
+ token = Lexer::getSemicolonToken();
parse(pParser, token->lemonType, token, context);
}
qint64 endIdx = sql.length();
- TokenPtr endToken = TokenPtr::create(0, Token::INVALID, QString::null, endIdx, endIdx);
+ TokenPtr endToken = TokenPtr::create(0, Token::INVALID, QString(), endIdx, endIdx);
parse(pParser, 0, endToken, context);
}
- fillSqliteDialect();
-
// Free all non-termials having destructors
parseFree(pParser, free);
@@ -278,7 +232,7 @@ void Parser::expectedTokenLookup(void* pParser)
void Parser::init()
{
- lexer = new Lexer(dialect);
+ lexer = new Lexer();
context = new ParserContext();
}
@@ -307,16 +261,6 @@ void Parser::setLemonDebug(bool enabled)
debugLemon = enabled;
}
-void Parser::setDialect(Dialect dialect)
-{
- if (this->dialect == dialect)
- return;
-
- this->dialect = dialect;
- delete lexer;
- lexer = new Lexer(dialect);
-}
-
const QList<SqliteQueryPtr>& Parser::getQueries()
{
return context->getQueries();
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/parser.h b/SQLiteStudio3/coreSQLiteStudio/parser/parser.h
index 8fe25f2..04e9ccb 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/parser.h
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/parser.h
@@ -2,7 +2,7 @@
#define PARSER_H
#include "token.h"
-#include "../dialect.h"
+#undef NDEBUG
#include "ast/sqlitequery.h"
#include "ast/sqliteexpr.h"
@@ -18,7 +18,7 @@ class ParserError;
*
* Typical use case would be:
* @code
- * Parser parser(db->getDialect());
+ * Parser parser();
* if (parser.parse(queryString))
* {
* QList<SqliteQueryPtr> queries = parser.getQueries();
@@ -47,9 +47,7 @@ class ParserError;
* Finally, there is a parseExpr() to parse just a SQLite expression
* (http://sqlite.org/lang_expr.html).
*
- * Parser works basing on SQLite grammar defined in sqlite2.y and sqlite3.y files.
- * Since there are 2 completly separate grammar definitions, there are 2 dialects
- * that the parser works with.
+ * Parser works basing on SQLite grammar defined in sqlite3.y file.
*
* This is a high-level API to the Lemon Parser, the original SQLite parser.
*/
@@ -57,10 +55,9 @@ class API_EXPORT Parser
{
public:
/**
- * @brief Creates parser for given SQLite dialect.
- * @param dialect SQLite dialect to use. Can be changed later with setDialect().
+ * @brief Creates parser for SQLite dialect.
*/
- Parser(Dialect dialect);
+ Parser();
/**
* @brief Releases internal resources.
@@ -78,12 +75,6 @@ class API_EXPORT Parser
void setLemonDebug(bool enabled);
/**
- * @brief Changes dialect used by parser.
- * @param dialect Dialect to use.
- */
- void setDialect(Dialect dialect);
-
- /**
* @brief Parses given query string.
* @param sql SQL query string to parse. Can be multiple queries separated with semicolon.
* @param ignoreMinorErrors If true, then parser will ignore minor errors. Detailed descritpion below.
@@ -125,7 +116,7 @@ class API_EXPORT Parser
*
* Example:
* @code
- * Parser parser(db->getDialect());
+ * Parser parser;
* SqliteSelectPtr select = parser.parse<SelectPtr>(queryString);
* if (!select)
* {
@@ -257,14 +248,6 @@ class API_EXPORT Parser
void cleanUp();
/**
- * @brief Propagates dialect to all AST objects.
- *
- * This is called after successful parsing to set the adequate SQLite dialect
- * in all AST objects.
- */
- void fillSqliteDialect();
-
- /**
* @brief Creates Lemon parser.
* @return Pointer to Lemon parser.
*/
@@ -326,11 +309,6 @@ class API_EXPORT Parser
void parseAddToken(void* other, TokenPtr token);
/**
- * @brief Parser's dialect.
- */
- Dialect dialect;
-
- /**
* @brief Flag indicating if the Lemon low-level debug messages are enabled.
*/
bool debugLemon = false;
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/parser_helper_stubs.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/parser_helper_stubs.cpp
index 9299c52..8b14f07 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/parser_helper_stubs.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/parser_helper_stubs.cpp
@@ -44,3 +44,34 @@ ParserDeferSubClause::ParserDeferSubClause(SqliteDeferrable deferrable, SqliteIn
this->deferrable = deferrable;
}
+
+ParserTermOrLiteral::ParserTermOrLiteral(const QString& name)
+{
+ value = name;
+ nameMode = true;
+}
+
+ParserTermOrLiteral::ParserTermOrLiteral(const QVariant& literal)
+{
+ value = literal;
+}
+
+QString ParserTermOrLiteral::toName() const
+{
+ return value.toString();
+}
+
+QVariant ParserTermOrLiteral::toLiteral() const
+{
+ return value;
+}
+
+bool ParserTermOrLiteral::isName() const
+{
+ return !value.isNull() && value.type() == QVariant::String;
+}
+
+bool ParserTermOrLiteral::isLiteral() const
+{
+ return !nameMode;
+}
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/parser_helper_stubs.h b/SQLiteStudio3/coreSQLiteStudio/parser/parser_helper_stubs.h
index ae52989..5160b10 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/parser_helper_stubs.h
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/parser_helper_stubs.h
@@ -9,6 +9,8 @@
#include "ast/sqliteindexedcolumn.h"
#include "ast/sqliteforeignkey.h"
#include "ast/sqliteorderby.h"
+#include "ast/sqlitewindowdefinition.h"
+#include "ast/sqlitewith.h"
#include <QString>
#include <QList>
@@ -27,8 +29,8 @@
*/
struct ParserFullName
{
- QString name1 = QString::null;
- QString name2 = QString::null;
+ QString name1 = QString();
+ QString name2 = QString();
};
/**
@@ -59,7 +61,7 @@ struct ParserStubInsertOrReplace
*/
struct ParserStubTransDetails
{
- QString name = QString::null;
+ QString name = QString();
SqliteBeginTrans::Type type = SqliteBeginTrans::Type::null;
bool transactionKw = false;
bool toKw = false;
@@ -71,6 +73,7 @@ typedef QList<SqliteCreateTable::Constraint*> ParserCreateTableConstraintList;
typedef QList<SqliteCreateTable::Column::Constraint*> ParserCreateTableColumnConstraintList;
typedef QList<SqliteForeignKey::Condition*> ParserFkConditionList;
typedef QList<SqliteExpr*> ParserExprList;
+typedef QList<SqliteWith::CommonTableExpression*> ParserCteList;
typedef QList<SqliteSelect::Core::ResultColumn*> ParserResultColumnList;
typedef QList<SqliteSelect::Core::JoinSourceOther*> ParserOtherSourceList;
typedef QList<SqliteOrderBy*> ParserOrderByList;
@@ -79,6 +82,7 @@ typedef QPair<QVariant,SqliteExpr*> ParserSetValue;
typedef QList<ParserSetValue> ParserSetValueList;
typedef QList<SqliteIndexedColumn*> ParserIndexedColumnList;
typedef QList<ParserExprList> ParserExprNestedList;
+typedef QList<SqliteWindowDefinition*> ParserWindowDefList;
/**
* @brief Stores parameters for defferable foreign keys.
@@ -98,7 +102,7 @@ struct ParserStubAlias
{
ParserStubAlias(const QString& name, bool asKw);
- QString name = QString::null;
+ QString name = QString();
bool asKw = false;
};
@@ -111,7 +115,23 @@ struct ParserIndexedBy
explicit ParserIndexedBy(bool indexedBy);
bool notIndexedKw = false;
- QString indexedBy = QString::null;
+ QString indexedBy = QString();
+};
+
+class ParserTermOrLiteral
+{
+ public:
+ explicit ParserTermOrLiteral(const QString& name);
+ explicit ParserTermOrLiteral(const QVariant& literal);
+
+ QString toName() const;
+ QVariant toLiteral() const;
+ bool isName() const;
+ bool isLiteral() const;
+
+ private:
+ QVariant value;
+ bool nameMode = false;
};
#endif // PARSER_HELPER_STUBS_H
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/parsercontext.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/parsercontext.cpp
index d9832bc..a9eae82 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/parsercontext.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/parsercontext.cpp
@@ -109,7 +109,7 @@ void ParserContext::flushErrors()
else
error(QObject::tr("Incomplete query."));
- nextTokenError = QString::null;
+ nextTokenError = QString();
raiseErrorBeforeNextToken = false;
}
}
@@ -144,7 +144,7 @@ void ParserContext::addManagedToken(TokenPtr token)
if (raiseErrorBeforeNextToken)
{
error(token, nextTokenError);
- nextTokenError = QString::null;
+ nextTokenError = QString();
raiseErrorBeforeNextToken = false;
}
}
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/parsercontext.h b/SQLiteStudio3/coreSQLiteStudio/parser/parsercontext.h
index 64ce3a3..154fe3f 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/parsercontext.h
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/parsercontext.h
@@ -3,7 +3,6 @@
#include "ast/sqlitequery.h"
#include "parser.h"
-#include "../dialect.h"
#include <QHash>
#include <QList>
@@ -233,14 +232,6 @@ class ParserContext
*/
bool ignoreMinorErrors = false;
- /**
- * @brief Dialect used for the parsing.
- *
- * This is used by the Lemon parser in various situations, like for example when it strips the object name
- * from it's wrapping characters ([], "", ``) - that depends on the dialect.
- */
- Dialect dialect;
-
private:
/**
* @brief Clears all internal containers and deletes error objects.
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/parsererror.h b/SQLiteStudio3/coreSQLiteStudio/parser/parsererror.h
index 673f030..bd4462d 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/parsererror.h
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/parsererror.h
@@ -64,7 +64,7 @@ class API_EXPORT ParserError
/**
* @brief Error message.
*/
- QString message = QString::null;
+ QString message = QString();
/**
* @brief Error start position.
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/run_lemon.bat b/SQLiteStudio3/coreSQLiteStudio/parser/run_lemon.bat
index 961e21e..3b74bbb 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/run_lemon.bat
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/run_lemon.bat
@@ -1,8 +1,7 @@
+@echo off
set LEMON=C:\utils\lemon.exe
rem %LEMON% -l -q -s sqlite3_parse.y
+rem %LEMON% -l -p sqlite3_parse.y
%LEMON% -l -q sqlite3_parse.y
move sqlite3_parse.c sqlite3_parse.cpp
-
-%LEMON% -l -q sqlite2_parse.y
-move sqlite2_parse.c sqlite2_parse.cpp
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/run_lemon.sh b/SQLiteStudio3/coreSQLiteStudio/parser/run_lemon.sh
index 3df47e1..d42f0c1 100755
--- a/SQLiteStudio3/coreSQLiteStudio/parser/run_lemon.sh
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/run_lemon.sh
@@ -3,6 +3,3 @@
#lemon -l -q -s sqlite3_parse.y
lemon -l -q sqlite3_parse.y
mv sqlite3_parse.c sqlite3_parse.cpp
-
-lemon -l -q sqlite2_parse.y
-mv sqlite2_parse.c sqlite2_parse.cpp
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/sqlite2_parse.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/sqlite2_parse.cpp
deleted file mode 100644
index ea60ecc..0000000
--- a/SQLiteStudio3/coreSQLiteStudio/parser/sqlite2_parse.cpp
+++ /dev/null
@@ -1,4662 +0,0 @@
-/* Driver template for the LEMON parser generator.
-** The author disclaims copyright to this source code.
-**
-** This version of "lempar.c" is modified, slightly, for use by SQLite.
-** The only modifications are the addition of a couple of NEVER()
-** macros to disable tests that are needed in the case of a general
-** LALR(1) grammar but which are always false in the
-** specific grammar used by SQLite.
-*/
-/* First off, code is included that follows the "include" declaration
-** in the input grammar file. */
-#include <stdio.h>
-
-#include "token.h"
-#include "parsercontext.h"
-#include "parser/ast/sqlitealtertable.h"
-#include "parser/ast/sqliteanalyze.h"
-#include "parser/ast/sqliteattach.h"
-#include "parser/ast/sqlitebegintrans.h"
-#include "parser/ast/sqlitecommittrans.h"
-#include "parser/ast/sqlitecopy.h"
-#include "parser/ast/sqlitecreateindex.h"
-#include "parser/ast/sqlitecreatetable.h"
-#include "parser/ast/sqlitecreatetrigger.h"
-#include "parser/ast/sqlitecreateview.h"
-#include "parser/ast/sqlitecreatevirtualtable.h"
-#include "parser/ast/sqlitedelete.h"
-#include "parser/ast/sqlitedetach.h"
-#include "parser/ast/sqlitedropindex.h"
-#include "parser/ast/sqlitedroptable.h"
-#include "parser/ast/sqlitedroptrigger.h"
-#include "parser/ast/sqlitedropview.h"
-#include "parser/ast/sqliteemptyquery.h"
-#include "parser/ast/sqliteinsert.h"
-#include "parser/ast/sqlitepragma.h"
-#include "parser/ast/sqlitereindex.h"
-#include "parser/ast/sqliterelease.h"
-#include "parser/ast/sqliterollback.h"
-#include "parser/ast/sqlitesavepoint.h"
-#include "parser/ast/sqliteselect.h"
-#include "parser/ast/sqliteupdate.h"
-#include "parser/ast/sqlitevacuum.h"
-#include "parser/ast/sqliteexpr.h"
-#include "parser/ast/sqlitecolumntype.h"
-#include "parser/ast/sqliteconflictalgo.h"
-#include "parser/ast/sqlitesortorder.h"
-#include "parser/ast/sqliteindexedcolumn.h"
-#include "parser/ast/sqliteforeignkey.h"
-#include "parser_helper_stubs.h"
-#include "common/utils_sql.h"
-#include <QObject>
-#include <QDebug>
-
-#define assert(X) Q_ASSERT(X)
-#define UNUSED_PARAMETER(X) (void)(X)
-#define DONT_INHERIT_TOKENS(X) noTokenInheritanceFields << X
-/* Next is all token values, in a form suitable for use by makeheaders.
-** This section will be null unless lemon is run with the -m switch.
-*/
-/*
-** These constants (all generated automatically by the parser generator)
-** specify the various kinds of tokens (terminals) that the parser
-** understands.
-**
-** Each symbol here is a terminal symbol in the grammar.
-*/
-/* Make sure the INTERFACE macro is defined.
-*/
-#ifndef INTERFACE
-# define INTERFACE 1
-#endif
-/* The next thing included is series of defines which control
-** various aspects of the generated parser.
-** YYCODETYPE is the data type used for storing terminal
-** and nonterminal numbers. "unsigned char" is
-** used if there are fewer than 250 terminals
-** and nonterminals. "int" is used otherwise.
-** YYNOCODE is a number of type YYCODETYPE which corresponds
-** to no legal terminal or nonterminal number. This
-** number is used to fill in empty slots of the hash
-** table.
-** YYFALLBACK If defined, this indicates that one or more tokens
-** have fall-back values which should be used if the
-** original value of the token will not parse.
-** YYACTIONTYPE is the data type used for storing terminal
-** and nonterminal numbers. "unsigned char" is
-** used if there are fewer than 250 rules and
-** states combined. "int" is used otherwise.
-** sqlite2_parseTOKENTYPE is the data type used for minor tokens given
-** directly to the parser from the tokenizer.
-** YYMINORTYPE is the data type used for all minor tokens.
-** This is typically a union of many types, one of
-** which is sqlite2_parseTOKENTYPE. The entry in the union
-** for base tokens is called "yy0".
-** YYSTACKDEPTH is the maximum depth of the parser's stack. If
-** zero the stack is dynamically sized using realloc()
-** sqlite2_parseARG_SDECL A static variable declaration for the %extra_argument
-** sqlite2_parseARG_PDECL A parameter declaration for the %extra_argument
-** sqlite2_parseARG_STORE Code to store %extra_argument into yypParser
-** sqlite2_parseARG_FETCH Code to extract %extra_argument from yypParser
-** YYNSTATE the combined number of states.
-** YYNRULE the number of rules in the grammar
-** YYERRORSYMBOL is the code number of the error symbol. If not
-** defined, then do no error processing.
-*/
-#define YYCODETYPE unsigned char
-#define YYNOCODE 241
-#define YYACTIONTYPE unsigned short int
-#define sqlite2_parseTOKENTYPE Token*
-typedef union {
- int yyinit;
- sqlite2_parseTOKENTYPE yy0;
- ParserCreateTableConstraintList* yy13;
- SqliteSelect::Core::JoinSource* yy31;
- ParserStubAlias* yy40;
- SqliteExpr::LikeOp* yy41;
- ParserCreateTableColumnList* yy42;
- SqliteColumnType* yy57;
- ParserIndexedColumnList* yy63;
- QVariant* yy69;
- SqliteCreateTrigger::Scope* yy83;
- ParserStubExplain* yy91;
- QStringList* yy95;
- ParserFullName* yy120;
- SqliteSelect::Core::SingleSource* yy121;
- ParserOtherSourceList* yy131;
- SqliteCreateTable::Column* yy147;
- SqliteSelect::Core* yy150;
- SqliteCreateTrigger::Event* yy151;
- SqliteSelect* yy153;
- SqliteForeignKey::Condition* yy187;
- SqliteExpr* yy192;
- ParserSetValueList* yy201;
- SqliteQuery* yy203;
- ParserResultColumnList* yy213;
- SqliteSelect::Core::JoinOp* yy221;
- int* yy226;
- ParserExprList* yy231;
- ParserOrderByList* yy243;
- ParserFkConditionList* yy264;
- ParserQueryList* yy270;
- bool* yy291;
- SqliteCreateTable::Column::Constraint* yy304;
- SqliteInitially* yy312;
- QString* yy319;
- SqliteLimit* yy324;
- ParserDeferSubClause* yy329;
- ParserStubInsertOrReplace* yy344;
- ParserCreateTableColumnConstraintList* yy371;
- SqliteCreateTrigger::Time* yy372;
- SqliteSelect::CompoundOperator* yy382;
- SqliteSortOrder* yy389;
- ParserStubTransDetails* yy404;
- SqliteCreateTable::Constraint* yy406;
- SqliteConflictAlgo* yy418;
- SqliteForeignKey::Condition::Reaction* yy424;
- SqliteIndexedColumn* yy428;
- SqliteSelect::Core::JoinConstraint* yy455;
-} YYMINORTYPE;
-#ifndef YYSTACKDEPTH
-#define YYSTACKDEPTH 100
-#endif
-#define sqlite2_parseARG_SDECL ParserContext* parserContext;
-#define sqlite2_parseARG_PDECL ,ParserContext* parserContext
-#define sqlite2_parseARG_FETCH ParserContext* parserContext = yypParser->parserContext
-#define sqlite2_parseARG_STORE yypParser->parserContext = parserContext
-#define YYNSTATE 584
-#define YYNRULE 352
-#define YYFALLBACK 1
-#define YY_NO_ACTION (YYNSTATE+YYNRULE+2)
-#define YY_ACCEPT_ACTION (YYNSTATE+YYNRULE+1)
-#define YY_ERROR_ACTION (YYNSTATE+YYNRULE)
-
-#define GET_CONTEXT yyParser* yypParser = pParser; sqlite2_parseARG_FETCH
-
-/* The yyzerominor constant is used to initialize instances of
-** YYMINORTYPE objects to zero. */
-static const YYMINORTYPE yyzerominor = { 0 };
-
-/* Define the yytestcase() macro to be a no-op if is not already defined
-** otherwise.
-**
-** Applications can choose to define yytestcase() in the %include section
-** to a macro that can assist in verifying code coverage. For production
-** code the yytestcase() macro should be turned off. But it is useful
-** for testing.
-*/
-#ifndef yytestcase
-# define yytestcase(X)
-#endif
-
-
-/* Next are the tables used to determine what action to take based on the
-** current state and lookahead token. These tables are used to implement
-** functions that take a state number and lookahead value and return an
-** action integer.
-**
-** Suppose the action integer is N. Then the action is determined as
-** follows
-**
-** 0 <= N < YYNSTATE Shift N. That is, push the lookahead
-** token onto the stack and goto state N.
-**
-** YYNSTATE <= N < YYNSTATE+YYNRULE Reduce by rule N-YYNSTATE.
-**
-** N == YYNSTATE+YYNRULE A syntax error has occurred.
-**
-** N == YYNSTATE+YYNRULE+1 The parser accepts its input.
-**
-** N == YYNSTATE+YYNRULE+2 No such action. Denotes unused
-** slots in the yy_action[] table.
-**
-** The action table is constructed as a single large table named yy_action[].
-** Given state S and lookahead X, the action is computed as
-**
-** yy_action[ yy_shift_ofst[S] + X ]
-**
-** If the index value yy_shift_ofst[S]+X is out of range or if the value
-** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S]
-** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table
-** and that yy_default[S] should be used instead.
-**
-** The formula above is for computing the action when the lookahead is
-** a terminal symbol. If the lookahead is a non-terminal (as occurs after
-** a reduce action) then the yy_reduce_ofst[] array is used in place of
-** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of
-** YY_SHIFT_USE_DFLT.
-**
-** The following are the tables generated in this section:
-**
-** yy_action[] A single table containing all actions.
-** yy_lookahead[] A table containing the lookahead for each entry in
-** yy_action. Used to detect hash collisions.
-** yy_shift_ofst[] For each state, the offset into yy_action for
-** shifting terminals.
-** yy_reduce_ofst[] For each state, the offset into yy_action for
-** shifting non-terminals after a reduce.
-** yy_default[] Default action for each state.
-*/
-#define YY_ACTTAB_COUNT (1737)
-static const YYACTIONTYPE yy_action[] = {
- /* 0 */ 338, 191, 186, 242, 476, 511, 576, 193, 332, 16,
- /* 10 */ 511, 384, 189, 322, 239, 519, 518, 570, 337, 450,
- /* 20 */ 15, 851, 125, 58, 575, 179, 851, 574, 63, 143,
- /* 30 */ 401, 581, 328, 26, 84, 569, 114, 322, 573, 519,
- /* 40 */ 518, 851, 851, 35, 851, 851, 851, 851, 851, 851,
- /* 50 */ 851, 851, 851, 851, 851, 851, 851, 851, 851, 32,
- /* 60 */ 33, 851, 851, 851, 851, 320, 379, 34, 240, 238,
- /* 70 */ 121, 556, 291, 251, 57, 7, 217, 577, 265, 264,
- /* 80 */ 523, 179, 555, 336, 335, 338, 569, 549, 548, 550,
- /* 90 */ 271, 569, 10, 724, 199, 297, 203, 489, 459, 332,
- /* 100 */ 568, 567, 451, 253, 158, 523, 449, 444, 443, 337,
- /* 110 */ 187, 870, 266, 187, 580, 517, 168, 328, 505, 343,
- /* 120 */ 143, 235, 490, 108, 101, 489, 523, 164, 35, 531,
- /* 130 */ 187, 13, 523, 252, 234, 547, 236, 119, 340, 232,
- /* 140 */ 339, 120, 216, 155, 32, 33, 481, 547, 322, 215,
- /* 150 */ 519, 518, 34, 714, 456, 477, 320, 367, 547, 478,
- /* 160 */ 7, 714, 400, 321, 251, 523, 714, 563, 336, 335,
- /* 170 */ 500, 553, 549, 548, 550, 188, 465, 500, 401, 466,
- /* 180 */ 366, 365, 552, 364, 293, 435, 39, 39, 39, 38,
- /* 190 */ 523, 562, 60, 255, 714, 569, 714, 714, 852, 570,
- /* 200 */ 271, 714, 502, 852, 500, 714, 570, 714, 714, 714,
- /* 210 */ 714, 523, 569, 178, 531, 422, 13, 523, 44, 45,
- /* 220 */ 330, 42, 42, 530, 530, 223, 852, 852, 43, 43,
- /* 230 */ 43, 43, 41, 41, 41, 41, 40, 40, 39, 39,
- /* 240 */ 39, 38, 199, 297, 203, 55, 236, 92, 340, 232,
- /* 250 */ 339, 120, 216, 500, 106, 570, 268, 19, 187, 215,
- /* 260 */ 500, 105, 553, 41, 41, 41, 41, 40, 40, 39,
- /* 270 */ 39, 39, 38, 552, 40, 40, 39, 39, 39, 38,
- /* 280 */ 852, 3, 568, 567, 187, 852, 512, 500, 219, 568,
- /* 290 */ 567, 17, 496, 156, 322, 345, 519, 518, 569, 292,
- /* 300 */ 44, 45, 330, 42, 42, 530, 530, 223, 852, 852,
- /* 310 */ 43, 43, 43, 43, 41, 41, 41, 41, 40, 40,
- /* 320 */ 39, 39, 39, 38, 547, 533, 852, 100, 308, 306,
- /* 330 */ 305, 852, 448, 447, 418, 418, 316, 245, 568, 567,
- /* 340 */ 304, 937, 122, 344, 1, 582, 44, 45, 330, 42,
- /* 350 */ 42, 530, 530, 223, 852, 852, 43, 43, 43, 43,
- /* 360 */ 41, 41, 41, 41, 40, 40, 39, 39, 39, 38,
- /* 370 */ 338, 442, 44, 45, 330, 42, 42, 530, 530, 223,
- /* 380 */ 524, 569, 43, 43, 43, 43, 41, 41, 41, 41,
- /* 390 */ 40, 40, 39, 39, 39, 38, 5, 9, 524, 781,
- /* 400 */ 220, 324, 328, 167, 44, 45, 330, 42, 42, 530,
- /* 410 */ 530, 223, 781, 35, 43, 43, 43, 43, 41, 41,
- /* 420 */ 41, 41, 40, 40, 39, 39, 39, 38, 8, 32,
- /* 430 */ 33, 274, 387, 435, 547, 388, 237, 34, 774, 421,
- /* 440 */ 60, 14, 219, 569, 250, 7, 774, 437, 441, 169,
- /* 450 */ 523, 524, 569, 336, 335, 285, 781, 549, 548, 550,
- /* 460 */ 43, 43, 43, 43, 41, 41, 41, 41, 40, 40,
- /* 470 */ 39, 39, 39, 38, 332, 523, 332, 425, 470, 774,
- /* 480 */ 560, 774, 774, 850, 337, 426, 337, 455, 850, 613,
- /* 490 */ 774, 181, 774, 774, 774, 143, 523, 143, 30, 531,
- /* 500 */ 614, 13, 523, 850, 850, 850, 850, 850, 850, 850,
- /* 510 */ 850, 850, 850, 850, 850, 850, 850, 850, 850, 850,
- /* 520 */ 850, 850, 850, 850, 850, 850, 850, 852, 500, 460,
- /* 530 */ 357, 320, 852, 318, 75, 570, 401, 570, 311, 251,
- /* 540 */ 569, 251, 446, 445, 570, 358, 359, 44, 45, 330,
- /* 550 */ 42, 42, 530, 530, 223, 852, 852, 43, 43, 43,
- /* 560 */ 43, 41, 41, 41, 41, 40, 40, 39, 39, 39,
- /* 570 */ 38, 338, 44, 45, 330, 42, 42, 530, 530, 223,
- /* 580 */ 615, 570, 43, 43, 43, 43, 41, 41, 41, 41,
- /* 590 */ 40, 40, 39, 39, 39, 38, 185, 184, 497, 782,
- /* 600 */ 199, 297, 203, 328, 360, 538, 96, 488, 97, 570,
- /* 610 */ 103, 500, 782, 436, 35, 570, 187, 225, 568, 567,
- /* 620 */ 568, 567, 332, 354, 540, 539, 294, 568, 567, 570,
- /* 630 */ 32, 33, 337, 356, 482, 355, 569, 85, 34, 759,
- /* 640 */ 532, 111, 70, 78, 487, 483, 7, 759, 90, 494,
- /* 650 */ 508, 523, 493, 160, 336, 335, 782, 528, 549, 548,
- /* 660 */ 550, 532, 440, 434, 568, 567, 118, 54, 332, 919,
- /* 670 */ 214, 100, 308, 306, 305, 75, 523, 333, 337, 571,
- /* 680 */ 759, 529, 759, 759, 304, 48, 177, 522, 31, 143,
- /* 690 */ 29, 759, 568, 567, 759, 759, 159, 523, 568, 567,
- /* 700 */ 531, 464, 13, 523, 44, 45, 330, 42, 42, 530,
- /* 710 */ 530, 223, 568, 567, 43, 43, 43, 43, 41, 41,
- /* 720 */ 41, 41, 40, 40, 39, 39, 39, 38, 463, 570,
- /* 730 */ 498, 919, 570, 323, 514, 570, 222, 44, 45, 330,
- /* 740 */ 42, 42, 530, 530, 223, 393, 392, 43, 43, 43,
- /* 750 */ 43, 41, 41, 41, 41, 40, 40, 39, 39, 39,
- /* 760 */ 38, 44, 45, 330, 42, 42, 530, 530, 223, 540,
- /* 770 */ 539, 43, 43, 43, 43, 41, 41, 41, 41, 40,
- /* 780 */ 40, 39, 39, 39, 38, 583, 1, 44, 45, 330,
- /* 790 */ 42, 42, 530, 530, 223, 267, 475, 43, 43, 43,
- /* 800 */ 43, 41, 41, 41, 41, 40, 40, 39, 39, 39,
- /* 810 */ 38, 256, 568, 567, 420, 568, 567, 163, 568, 567,
- /* 820 */ 110, 570, 218, 44, 45, 330, 42, 42, 530, 530,
- /* 830 */ 223, 27, 468, 43, 43, 43, 43, 41, 41, 41,
- /* 840 */ 41, 40, 40, 39, 39, 39, 38, 486, 547, 44,
- /* 850 */ 45, 330, 42, 42, 530, 530, 223, 859, 212, 43,
- /* 860 */ 43, 43, 43, 41, 41, 41, 41, 40, 40, 39,
- /* 870 */ 39, 39, 38, 44, 47, 330, 42, 42, 530, 530,
- /* 880 */ 223, 535, 284, 43, 43, 43, 43, 41, 41, 41,
- /* 890 */ 41, 40, 40, 39, 39, 39, 38, 45, 330, 42,
- /* 900 */ 42, 530, 530, 223, 568, 567, 43, 43, 43, 43,
- /* 910 */ 41, 41, 41, 41, 40, 40, 39, 39, 39, 38,
- /* 920 */ 330, 42, 42, 530, 530, 223, 338, 160, 43, 43,
- /* 930 */ 43, 43, 41, 41, 41, 41, 40, 40, 39, 39,
- /* 940 */ 39, 38, 164, 570, 527, 338, 332, 269, 544, 543,
- /* 950 */ 526, 162, 561, 79, 452, 64, 337, 88, 328, 455,
- /* 960 */ 570, 209, 385, 272, 205, 357, 204, 139, 525, 35,
- /* 970 */ 520, 569, 395, 547, 569, 569, 23, 328, 213, 254,
- /* 980 */ 358, 275, 547, 75, 182, 32, 33, 310, 35, 569,
- /* 990 */ 361, 66, 164, 34, 160, 396, 398, 317, 397, 293,
- /* 1000 */ 570, 7, 862, 516, 32, 33, 523, 570, 538, 336,
- /* 1010 */ 335, 522, 34, 549, 548, 550, 25, 4, 289, 338,
- /* 1020 */ 7, 471, 395, 547, 12, 523, 568, 567, 336, 335,
- /* 1030 */ 302, 523, 549, 548, 550, 75, 570, 404, 338, 276,
- /* 1040 */ 538, 104, 108, 568, 567, 396, 398, 76, 397, 293,
- /* 1050 */ 523, 328, 523, 570, 65, 531, 500, 13, 523, 101,
- /* 1060 */ 185, 184, 35, 570, 172, 171, 170, 197, 290, 503,
- /* 1070 */ 328, 523, 75, 570, 531, 301, 13, 523, 32, 33,
- /* 1080 */ 380, 35, 10, 568, 567, 479, 34, 490, 540, 539,
- /* 1090 */ 568, 567, 570, 325, 7, 211, 666, 32, 33, 523,
- /* 1100 */ 179, 423, 336, 335, 570, 34, 549, 548, 550, 80,
- /* 1110 */ 569, 570, 490, 7, 480, 489, 391, 570, 523, 568,
- /* 1120 */ 567, 336, 335, 338, 523, 549, 548, 550, 255, 497,
- /* 1130 */ 570, 262, 584, 106, 215, 484, 568, 567, 380, 500,
- /* 1140 */ 312, 391, 202, 523, 296, 523, 568, 567, 531, 198,
- /* 1150 */ 13, 523, 569, 413, 345, 328, 568, 567, 532, 569,
- /* 1160 */ 474, 570, 307, 570, 523, 495, 35, 531, 53, 13,
- /* 1170 */ 523, 496, 860, 456, 473, 568, 567, 570, 413, 532,
- /* 1180 */ 570, 485, 32, 33, 407, 439, 10, 568, 567, 500,
- /* 1190 */ 34, 489, 730, 570, 568, 567, 431, 403, 7, 52,
- /* 1200 */ 568, 567, 570, 523, 582, 234, 336, 335, 338, 407,
- /* 1210 */ 549, 548, 550, 568, 567, 18, 490, 570, 303, 489,
- /* 1220 */ 497, 570, 403, 389, 390, 287, 570, 502, 523, 730,
- /* 1230 */ 730, 570, 201, 570, 200, 424, 187, 569, 332, 51,
- /* 1240 */ 328, 376, 569, 371, 568, 567, 568, 567, 337, 523,
- /* 1250 */ 99, 35, 531, 124, 13, 523, 492, 368, 497, 148,
- /* 1260 */ 568, 567, 570, 568, 567, 82, 376, 32, 33, 350,
- /* 1270 */ 2, 570, 568, 567, 570, 34, 568, 567, 570, 73,
- /* 1280 */ 179, 259, 570, 7, 862, 568, 567, 417, 523, 338,
- /* 1290 */ 569, 336, 335, 22, 491, 549, 548, 550, 416, 69,
- /* 1300 */ 568, 567, 371, 522, 568, 567, 570, 415, 405, 568,
- /* 1310 */ 567, 261, 21, 523, 568, 567, 568, 567, 196, 368,
- /* 1320 */ 378, 328, 411, 67, 542, 544, 543, 6, 569, 350,
- /* 1330 */ 258, 406, 35, 502, 523, 399, 377, 531, 394, 13,
- /* 1340 */ 523, 71, 338, 569, 108, 568, 567, 409, 32, 33,
- /* 1350 */ 536, 544, 543, 456, 568, 567, 34, 568, 567, 81,
- /* 1360 */ 386, 568, 567, 50, 7, 568, 567, 570, 281, 523,
- /* 1370 */ 374, 383, 336, 335, 328, 115, 549, 548, 550, 263,
- /* 1380 */ 544, 543, 309, 544, 543, 538, 219, 286, 179, 568,
- /* 1390 */ 567, 381, 278, 179, 523, 195, 569, 372, 569, 277,
- /* 1400 */ 363, 32, 33, 569, 501, 569, 351, 49, 457, 34,
- /* 1410 */ 373, 538, 353, 102, 352, 523, 370, 7, 531, 260,
- /* 1420 */ 13, 523, 523, 569, 257, 336, 335, 174, 332, 549,
- /* 1430 */ 548, 550, 408, 160, 507, 245, 579, 157, 337, 570,
- /* 1440 */ 538, 241, 332, 538, 332, 515, 332, 523, 332, 77,
- /* 1450 */ 568, 567, 337, 342, 337, 569, 337, 112, 337, 180,
- /* 1460 */ 332, 456, 332, 147, 11, 145, 456, 151, 523, 150,
- /* 1470 */ 337, 531, 337, 13, 523, 194, 332, 369, 332, 332,
- /* 1480 */ 74, 152, 332, 161, 566, 569, 337, 565, 337, 337,
- /* 1490 */ 564, 332, 337, 522, 559, 557, 332, 224, 558, 249,
- /* 1500 */ 144, 337, 341, 149, 270, 332, 337, 522, 332, 522,
- /* 1510 */ 332, 522, 146, 522, 332, 337, 554, 248, 337, 551,
- /* 1520 */ 337, 434, 568, 567, 337, 522, 247, 522, 332, 246,
- /* 1530 */ 332, 141, 187, 546, 229, 133, 332, 17, 337, 319,
- /* 1540 */ 337, 522, 332, 522, 522, 332, 337, 522, 228, 132,
- /* 1550 */ 332, 140, 337, 334, 192, 337, 522, 131, 227, 332,
- /* 1560 */ 337, 522, 279, 142, 569, 24, 130, 332, 332, 337,
- /* 1570 */ 522, 129, 569, 522, 362, 522, 332, 337, 337, 522,
- /* 1580 */ 127, 332, 332, 226, 569, 46, 337, 59, 135, 134,
- /* 1590 */ 220, 337, 337, 522, 545, 522, 346, 136, 38, 332,
- /* 1600 */ 36, 522, 138, 137, 314, 521, 569, 522, 572, 337,
- /* 1610 */ 522, 534, 326, 504, 337, 522, 183, 499, 569, 315,
- /* 1620 */ 128, 569, 569, 569, 522, 61, 469, 569, 432, 569,
- /* 1630 */ 210, 28, 522, 522, 300, 166, 569, 513, 569, 295,
- /* 1640 */ 569, 522, 375, 331, 569, 569, 522, 522, 221, 569,
- /* 1650 */ 208, 109, 569, 569, 510, 570, 176, 83, 569, 107,
- /* 1660 */ 569, 472, 244, 56, 522, 454, 569, 430, 453, 522,
- /* 1670 */ 429, 428, 427, 243, 419, 98, 207, 95, 206, 288,
- /* 1680 */ 298, 20, 94, 153, 93, 91, 414, 68, 123, 72,
- /* 1690 */ 283, 402, 382, 117, 89, 87, 86, 116, 175, 280,
- /* 1700 */ 347, 349, 173, 233, 113, 126, 230, 509, 541, 470,
- /* 1710 */ 506, 537, 458, 282, 154, 410, 273, 190, 348, 438,
- /* 1720 */ 467, 462, 329, 461, 578, 231, 62, 938, 37, 412,
- /* 1730 */ 165, 433, 938, 938, 938, 327, 299,
-};
-static const YYCODETYPE yy_lookahead[] = {
- /* 0 */ 4, 8, 195, 10, 80, 25, 5, 14, 156, 202,
- /* 10 */ 30, 41, 19, 113, 21, 115, 116, 4, 166, 4,
- /* 20 */ 79, 25, 81, 34, 23, 156, 30, 26, 35, 177,
- /* 30 */ 37, 72, 36, 53, 54, 166, 43, 113, 37, 115,
- /* 40 */ 116, 45, 46, 47, 48, 49, 50, 51, 52, 53,
- /* 50 */ 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
- /* 60 */ 64, 65, 66, 67, 68, 213, 96, 71, 75, 76,
- /* 70 */ 77, 16, 220, 221, 85, 79, 156, 76, 63, 64,
- /* 80 */ 84, 156, 27, 87, 88, 4, 166, 91, 92, 93,
- /* 90 */ 47, 166, 79, 80, 101, 102, 103, 84, 229, 156,
- /* 100 */ 87, 88, 87, 110, 161, 109, 91, 92, 93, 166,
- /* 110 */ 117, 141, 187, 117, 148, 80, 161, 36, 80, 153,
- /* 120 */ 177, 93, 109, 85, 31, 112, 130, 161, 47, 133,
- /* 130 */ 117, 135, 136, 90, 106, 192, 93, 94, 95, 96,
- /* 140 */ 97, 98, 99, 13, 63, 64, 65, 192, 113, 106,
- /* 150 */ 115, 116, 71, 72, 229, 114, 213, 191, 192, 118,
- /* 160 */ 79, 80, 21, 220, 221, 84, 85, 80, 87, 88,
- /* 170 */ 4, 7, 91, 92, 93, 32, 90, 4, 37, 93,
- /* 180 */ 214, 215, 18, 217, 218, 156, 65, 66, 67, 68,
- /* 190 */ 109, 162, 163, 100, 113, 166, 115, 116, 25, 4,
- /* 200 */ 47, 120, 156, 30, 4, 124, 4, 126, 127, 128,
- /* 210 */ 129, 130, 166, 184, 133, 186, 135, 136, 45, 46,
- /* 220 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
- /* 230 */ 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
- /* 240 */ 67, 68, 101, 102, 103, 79, 93, 85, 95, 96,
- /* 250 */ 97, 98, 99, 87, 81, 4, 210, 79, 117, 106,
- /* 260 */ 87, 80, 7, 59, 60, 61, 62, 63, 64, 65,
- /* 270 */ 66, 67, 68, 18, 63, 64, 65, 66, 67, 68,
- /* 280 */ 25, 79, 87, 88, 117, 30, 84, 87, 156, 87,
- /* 290 */ 88, 129, 119, 161, 113, 22, 115, 116, 166, 132,
- /* 300 */ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
- /* 310 */ 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
- /* 320 */ 65, 66, 67, 68, 192, 130, 25, 94, 95, 96,
- /* 330 */ 97, 30, 91, 92, 83, 84, 204, 205, 87, 88,
- /* 340 */ 107, 149, 150, 151, 152, 72, 45, 46, 47, 48,
- /* 350 */ 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
- /* 360 */ 59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
- /* 370 */ 4, 156, 45, 46, 47, 48, 49, 50, 51, 52,
- /* 380 */ 5, 166, 55, 56, 57, 58, 59, 60, 61, 62,
- /* 390 */ 63, 64, 65, 66, 67, 68, 79, 48, 23, 72,
- /* 400 */ 99, 26, 36, 161, 45, 46, 47, 48, 49, 50,
- /* 410 */ 51, 52, 85, 47, 55, 56, 57, 58, 59, 60,
- /* 420 */ 61, 62, 63, 64, 65, 66, 67, 68, 79, 63,
- /* 430 */ 64, 82, 6, 156, 192, 9, 159, 71, 72, 162,
- /* 440 */ 163, 125, 156, 166, 164, 79, 80, 167, 168, 169,
- /* 450 */ 84, 76, 166, 87, 88, 29, 129, 91, 92, 93,
- /* 460 */ 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
- /* 470 */ 65, 66, 67, 68, 156, 109, 156, 180, 181, 113,
- /* 480 */ 173, 115, 116, 25, 166, 188, 166, 180, 30, 82,
- /* 490 */ 124, 205, 126, 127, 128, 177, 130, 177, 139, 133,
- /* 500 */ 82, 135, 136, 45, 46, 47, 48, 49, 50, 51,
- /* 510 */ 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
- /* 520 */ 62, 63, 64, 65, 66, 67, 68, 25, 4, 80,
- /* 530 */ 156, 213, 30, 213, 85, 4, 37, 4, 220, 221,
- /* 540 */ 166, 221, 91, 92, 4, 171, 172, 45, 46, 47,
- /* 550 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
- /* 560 */ 58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
- /* 570 */ 68, 4, 45, 46, 47, 48, 49, 50, 51, 52,
- /* 580 */ 82, 4, 55, 56, 57, 58, 59, 60, 61, 62,
- /* 590 */ 63, 64, 65, 66, 67, 68, 63, 64, 167, 72,
- /* 600 */ 101, 102, 103, 36, 230, 231, 42, 85, 44, 4,
- /* 610 */ 88, 87, 85, 89, 47, 4, 117, 85, 87, 88,
- /* 620 */ 87, 88, 156, 90, 91, 92, 156, 87, 88, 4,
- /* 630 */ 63, 64, 166, 100, 203, 102, 166, 82, 71, 72,
- /* 640 */ 109, 82, 78, 177, 122, 123, 79, 80, 82, 109,
- /* 650 */ 85, 84, 112, 222, 87, 88, 129, 21, 91, 92,
- /* 660 */ 93, 130, 80, 86, 87, 88, 100, 85, 156, 10,
- /* 670 */ 80, 94, 95, 96, 97, 85, 109, 211, 166, 74,
- /* 680 */ 113, 93, 115, 116, 107, 120, 216, 221, 138, 177,
- /* 690 */ 140, 124, 87, 88, 127, 128, 79, 130, 87, 88,
- /* 700 */ 133, 11, 135, 136, 45, 46, 47, 48, 49, 50,
- /* 710 */ 51, 52, 87, 88, 55, 56, 57, 58, 59, 60,
- /* 720 */ 61, 62, 63, 64, 65, 66, 67, 68, 38, 4,
- /* 730 */ 119, 72, 4, 221, 109, 4, 224, 45, 46, 47,
- /* 740 */ 48, 49, 50, 51, 52, 39, 40, 55, 56, 57,
- /* 750 */ 58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
- /* 760 */ 68, 45, 46, 47, 48, 49, 50, 51, 52, 91,
- /* 770 */ 92, 55, 56, 57, 58, 59, 60, 61, 62, 63,
- /* 780 */ 64, 65, 66, 67, 68, 151, 152, 45, 46, 47,
- /* 790 */ 48, 49, 50, 51, 52, 105, 80, 55, 56, 57,
- /* 800 */ 58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
- /* 810 */ 68, 157, 87, 88, 83, 87, 88, 161, 87, 88,
- /* 820 */ 85, 4, 80, 45, 46, 47, 48, 49, 50, 51,
- /* 830 */ 52, 139, 104, 55, 56, 57, 58, 59, 60, 61,
- /* 840 */ 62, 63, 64, 65, 66, 67, 68, 122, 192, 45,
- /* 850 */ 46, 47, 48, 49, 50, 51, 52, 138, 80, 55,
- /* 860 */ 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
- /* 870 */ 66, 67, 68, 45, 46, 47, 48, 49, 50, 51,
- /* 880 */ 52, 176, 228, 55, 56, 57, 58, 59, 60, 61,
- /* 890 */ 62, 63, 64, 65, 66, 67, 68, 46, 47, 48,
- /* 900 */ 49, 50, 51, 52, 87, 88, 55, 56, 57, 58,
- /* 910 */ 59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
- /* 920 */ 47, 48, 49, 50, 51, 52, 4, 222, 55, 56,
- /* 930 */ 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
- /* 940 */ 67, 68, 161, 4, 80, 4, 156, 170, 171, 172,
- /* 950 */ 80, 161, 173, 174, 175, 42, 166, 44, 36, 180,
- /* 960 */ 4, 156, 145, 158, 156, 156, 158, 177, 80, 47,
- /* 970 */ 114, 166, 191, 192, 166, 166, 100, 36, 80, 156,
- /* 980 */ 171, 172, 192, 85, 212, 63, 64, 65, 47, 166,
- /* 990 */ 167, 78, 161, 71, 222, 214, 215, 121, 217, 218,
- /* 1000 */ 4, 79, 80, 80, 63, 64, 84, 4, 231, 87,
- /* 1010 */ 88, 221, 71, 91, 92, 93, 85, 236, 237, 4,
- /* 1020 */ 79, 80, 191, 192, 125, 84, 87, 88, 87, 88,
- /* 1030 */ 80, 109, 91, 92, 93, 85, 4, 80, 4, 230,
- /* 1040 */ 231, 80, 85, 87, 88, 214, 215, 79, 217, 218,
- /* 1050 */ 109, 36, 130, 4, 141, 133, 4, 135, 136, 31,
- /* 1060 */ 63, 64, 47, 4, 101, 102, 103, 80, 237, 130,
- /* 1070 */ 36, 130, 85, 4, 133, 47, 135, 136, 63, 64,
- /* 1080 */ 84, 47, 79, 87, 88, 65, 71, 84, 91, 92,
- /* 1090 */ 87, 88, 4, 137, 79, 80, 80, 63, 64, 84,
- /* 1100 */ 156, 85, 87, 88, 4, 71, 91, 92, 93, 82,
- /* 1110 */ 166, 4, 109, 79, 65, 112, 84, 4, 84, 87,
- /* 1120 */ 88, 87, 88, 4, 109, 91, 92, 93, 100, 167,
- /* 1130 */ 4, 187, 0, 81, 106, 122, 87, 88, 142, 87,
- /* 1140 */ 82, 109, 156, 109, 158, 130, 87, 88, 133, 156,
- /* 1150 */ 135, 136, 166, 84, 22, 36, 87, 88, 109, 166,
- /* 1160 */ 80, 4, 32, 4, 130, 203, 47, 133, 79, 135,
- /* 1170 */ 136, 119, 138, 229, 80, 87, 88, 4, 109, 130,
- /* 1180 */ 4, 122, 63, 64, 84, 80, 79, 87, 88, 4,
- /* 1190 */ 71, 84, 85, 4, 87, 88, 108, 84, 79, 79,
- /* 1200 */ 87, 88, 4, 84, 72, 106, 87, 88, 4, 109,
- /* 1210 */ 91, 92, 93, 87, 88, 79, 109, 4, 32, 112,
- /* 1220 */ 167, 4, 109, 101, 102, 103, 4, 156, 109, 122,
- /* 1230 */ 123, 4, 156, 4, 158, 109, 117, 166, 156, 79,
- /* 1240 */ 36, 84, 166, 84, 87, 88, 87, 88, 166, 130,
- /* 1250 */ 98, 47, 133, 81, 135, 136, 203, 84, 167, 177,
- /* 1260 */ 87, 88, 4, 87, 88, 100, 109, 63, 64, 84,
- /* 1270 */ 10, 4, 87, 88, 4, 71, 87, 88, 4, 105,
- /* 1280 */ 156, 210, 4, 79, 80, 87, 88, 111, 84, 4,
- /* 1290 */ 166, 87, 88, 48, 203, 91, 92, 93, 109, 120,
- /* 1300 */ 87, 88, 143, 221, 87, 88, 4, 109, 80, 87,
- /* 1310 */ 88, 187, 48, 109, 87, 88, 87, 88, 156, 146,
- /* 1320 */ 158, 36, 109, 131, 170, 171, 172, 79, 166, 144,
- /* 1330 */ 20, 109, 47, 156, 130, 72, 109, 133, 72, 135,
- /* 1340 */ 136, 33, 4, 166, 85, 87, 88, 130, 63, 64,
- /* 1350 */ 170, 171, 172, 229, 87, 88, 71, 87, 88, 141,
- /* 1360 */ 33, 87, 88, 79, 79, 87, 88, 4, 100, 84,
- /* 1370 */ 112, 142, 87, 88, 36, 120, 91, 92, 93, 170,
- /* 1380 */ 171, 172, 170, 171, 172, 231, 156, 210, 156, 87,
- /* 1390 */ 88, 109, 121, 156, 109, 156, 166, 158, 166, 17,
- /* 1400 */ 87, 63, 64, 166, 130, 166, 144, 165, 130, 71,
- /* 1410 */ 143, 231, 80, 156, 80, 130, 146, 79, 133, 187,
- /* 1420 */ 135, 136, 84, 166, 187, 87, 88, 81, 156, 91,
- /* 1430 */ 92, 93, 130, 222, 204, 205, 155, 206, 166, 4,
- /* 1440 */ 231, 154, 156, 231, 156, 156, 156, 109, 156, 177,
- /* 1450 */ 87, 88, 166, 100, 166, 166, 166, 73, 166, 179,
- /* 1460 */ 156, 229, 156, 177, 85, 177, 229, 177, 130, 177,
- /* 1470 */ 166, 133, 166, 135, 136, 156, 156, 158, 156, 156,
- /* 1480 */ 179, 177, 156, 177, 154, 166, 166, 154, 166, 166,
- /* 1490 */ 154, 156, 166, 221, 155, 183, 156, 177, 155, 177,
- /* 1500 */ 177, 166, 160, 177, 28, 156, 166, 221, 156, 221,
- /* 1510 */ 156, 221, 177, 221, 156, 166, 155, 177, 166, 155,
- /* 1520 */ 166, 86, 87, 88, 166, 221, 177, 221, 156, 177,
- /* 1530 */ 156, 177, 117, 192, 197, 177, 156, 129, 166, 126,
- /* 1540 */ 166, 221, 156, 221, 221, 156, 166, 221, 198, 177,
- /* 1550 */ 156, 177, 166, 124, 156, 166, 221, 177, 199, 156,
- /* 1560 */ 166, 221, 156, 177, 166, 127, 177, 156, 156, 166,
- /* 1570 */ 221, 177, 166, 221, 156, 221, 156, 166, 166, 221,
- /* 1580 */ 177, 156, 156, 200, 166, 212, 166, 128, 177, 177,
- /* 1590 */ 99, 166, 166, 221, 201, 221, 156, 177, 68, 156,
- /* 1600 */ 222, 221, 177, 177, 156, 47, 166, 221, 156, 166,
- /* 1610 */ 221, 156, 156, 156, 166, 221, 225, 156, 166, 156,
- /* 1620 */ 177, 166, 166, 166, 221, 177, 156, 166, 156, 166,
- /* 1630 */ 156, 138, 221, 221, 156, 156, 166, 209, 166, 156,
- /* 1640 */ 166, 221, 156, 156, 166, 166, 221, 221, 156, 166,
- /* 1650 */ 156, 82, 166, 166, 166, 4, 156, 82, 166, 209,
- /* 1660 */ 166, 155, 178, 79, 221, 166, 166, 155, 183, 221,
- /* 1670 */ 155, 155, 155, 178, 209, 82, 209, 82, 234, 24,
- /* 1680 */ 235, 138, 82, 45, 82, 82, 197, 190, 219, 79,
- /* 1690 */ 209, 190, 155, 82, 82, 82, 82, 190, 238, 209,
- /* 1700 */ 15, 239, 121, 176, 238, 194, 196, 176, 231, 181,
- /* 1710 */ 208, 231, 176, 209, 185, 197, 167, 167, 167, 167,
- /* 1720 */ 182, 182, 226, 182, 189, 193, 207, 240, 223, 189,
- /* 1730 */ 232, 186, 240, 240, 240, 227, 233,
-};
-#define YY_SHIFT_USE_DFLT (-101)
-#define YY_SHIFT_COUNT (343)
-#define YY_SHIFT_MIN (-100)
-#define YY_SHIFT_MAX (1685)
-static const short yy_shift_ofst[] = {
- /* 0 */ 273, -7, 499, -4, 141, 922, 1204, 1119, 533, 533,
- /* 10 */ 13, 577, 567, 1034, 1285, 1435, 81, 366, 1015, 941,
- /* 20 */ 1285, 1285, 1285, 1285, 1285, 1285, 1285, 1285, 1285, 1285,
- /* 30 */ 1285, 1285, 1285, 1285, 1285, 1285, 1285, 1285, 1285, 1285,
- /* 40 */ 1285, 1285, 1285, 1285, 1285, 1285, 1285, 1338, 1107, 43,
- /* 50 */ 1278, 1278, 1278, 1278, 997, 997, 1278, 997, 997, 997,
- /* 60 */ 524, 173, 1003, 1185, 1173, 1159, 1157, 1113, 1100, 1069,
- /* 70 */ 251, 1274, 1274, 1302, 1028, 1278, 1274, 255, 301, 153,
- /* 80 */ 1049, 996, 1032, 540, 202, 531, 1270, 1267, 1258, 1227,
- /* 90 */ 1229, 1222, 1217, 1213, 1198, 1189, 817, 1176, 731, 1126,
- /* 100 */ 1088, 728, 1059, 725, 1052, 1052, 611, 1052, 939, 625,
- /* 110 */ 956, 195, 605, 1363, 1363, 1363, 1363, 1363, 1363, 1363,
- /* 120 */ 1363, -30, 1132, 167, 1415, 1415, -101, 502, 502, 502,
- /* 130 */ 502, 502, 502, 502, 527, 327, 659, 778, 742, 716,
- /* 140 */ 692, 359, 828, 804, 804, 851, 873, 873, 405, 405,
- /* 150 */ 405, 204, 211, 1, 233, 1, 181, 522, 35, 375,
- /* 160 */ -20, 121, -76, -100, -100, 1122, 426, -100, -100, 166,
- /* 170 */ 690, 690, 690, 200, 200, 200, 566, 162, 1016, 164,
- /* 180 */ 93, 876, 164, 550, 678, 678, 565, 41, 164, 1685,
- /* 190 */ 1581, 1685, 1611, 1638, 1614, 1613, 1612, 1353, 1611, 1638,
- /* 200 */ 1610, 1603, 1602, 1638, 1408, 1600, 1543, 1655, 1595, 1593,
- /* 210 */ 1584, 1353, 1353, 1353, 1353, 1476, 1651, 1584, 1353, 1575,
- /* 220 */ 1651, 1569, 1493, 1558, 1530, 1491, 1459, 1429, 1438, 1413,
- /* 230 */ 1408, 1415, 1353, 1353, 1476, 1353, 1353, 1379, 1384, 1384,
- /* 240 */ 1384, 1353, 1384, -101, -101, -101, -101, -101, -101, -101,
- /* 250 */ -101, 458, 15, 913, 349, 963, 564, 987, 706, 957,
- /* 260 */ 950, 898, 590, 582, 451, 241, 449, 86, 38, -11,
- /* 270 */ 55, 28, -59, 1346, 1262, 1334, 1332, 1313, 1382, 1271,
- /* 280 */ 1255, 1282, 1268, 1284, 1218, 1327, 1259, 1308, 1310, 1266,
- /* 290 */ 1263, 1228, 1248, 1192, 1264, 1245, 1174, 1179, 1260, 1165,
- /* 300 */ 1172, 1099, 1152, 1160, 1186, 1136, 1120, 1089, 1130, 1105,
- /* 310 */ 1094, 1080, 1020, 1058, 1027, 1013, 961, 968, 931, 899,
- /* 320 */ 931, 923, 856, 719, 888, 870, 864, 735, 617, 636,
- /* 330 */ 588, 559, 555, 532, 316, 498, 418, 407, 317, 178,
- /* 340 */ 143, 87, 130, -41,
-};
-#define YY_REDUCE_USE_DFLT (-194)
-#define YY_REDUCE_COUNT (250)
-#define YY_REDUCE_MIN (-193)
-#define YY_REDUCE_MAX (1552)
-static const short yy_reduce_ofst[] = {
- /* 0 */ 192, -34, 781, -57, 831, 318, -148, 790, 809, 374,
- /* 10 */ 132, 29, 320, 512, 466, 277, 1448, 1443, 1426, 1425,
- /* 20 */ 1420, 1412, 1411, 1403, 1394, 1389, 1386, 1380, 1374, 1372,
- /* 30 */ 1358, 1354, 1352, 1349, 1340, 1335, 1326, 1323, 1322, 1320,
- /* 40 */ 1306, 1304, 1292, 1290, 1288, 1286, 1272, 1082, 1230, 779,
- /* 50 */ 1237, 1232, 1124, 944, 1212, 1209, -75, 1180, 1154, 777,
- /* 60 */ 280, 431, 286, 823, 1319, 1239, 1162, 1076, 986, 808,
- /* 70 */ 805, 1177, 1071, 470, 297, -131, 46, 705, 772, 307,
- /* 80 */ 1487, 1500, 1494, 1289, 1492, 1487, 1289, 1289, 1486, 1289,
- /* 90 */ 1289, 1289, 1483, 1289, 1289, 1289, 1479, 1478, 1289, 1474,
- /* 100 */ 1472, 1470, 1463, 1257, 1091, 1053, 1461, 962, 1457, 1289,
- /* 110 */ 1456, 1455, 1452, 1440, 1418, 1406, 1398, 1289, 993, 215,
- /* 120 */ -80, 654, 634, 656, 242, -45, -193, 1211, 1211, 1211,
- /* 130 */ 1211, 1211, 1211, 1211, 1211, 1211, 1211, 1211, 1211, 1211,
- /* 140 */ 1211, 1211, 1211, 1211, 1211, 1211, 1211, 1211, 1211, 1211,
- /* 150 */ 1211, 1211, 1211, 1540, 1545, 1535, 1532, 1519, 1532, 1508,
- /* 160 */ 1505, 1211, 1532, 1532, 1532, 1503, 1498, 1532, 1532, 1552,
- /* 170 */ 1541, 1539, 1538, 1551, 1550, 1549, 1504, 1518, 1529, 1536,
- /* 180 */ 1528, 1502, 1531, 1496, 1480, 1477, 1510, 1511, 1527, 1466,
- /* 190 */ 1462, 1460, 1490, 1507, 1465, 1465, 1465, 1537, 1481, 1501,
- /* 200 */ 1469, 1465, 1465, 1497, 1489, 1465, 1445, 1444, 1467, 1465,
- /* 210 */ 1495, 1517, 1516, 1515, 1512, 1485, 1499, 1484, 1506, 1450,
- /* 220 */ 1488, 1428, 1391, 1378, 1211, 1373, 1393, 1383, 1359, 1350,
- /* 230 */ 1337, 1341, 1364, 1361, 1312, 1343, 1339, 1342, 1336, 1333,
- /* 240 */ 1330, 1281, 1287, 1301, 1280, 1231, 1211, 1211, 1211, 1211,
- /* 250 */ 1242,
-};
-static const YYACTIONTYPE yy_default[] = {
- /* 0 */ 589, 936, 936, 862, 903, 851, 851, 851, 936, 936,
- /* 10 */ 730, 936, 851, 851, 851, 936, 851, 851, 851, 851,
- /* 20 */ 851, 851, 851, 851, 851, 851, 851, 851, 851, 851,
- /* 30 */ 851, 851, 851, 851, 851, 851, 851, 851, 851, 851,
- /* 40 */ 851, 851, 851, 851, 851, 851, 851, 841, 724, 608,
- /* 50 */ 936, 936, 936, 936, 936, 936, 936, 936, 936, 936,
- /* 60 */ 616, 720, 730, 936, 936, 936, 936, 790, 777, 768,
- /* 70 */ 936, 800, 800, 783, 679, 936, 800, 756, 752, 936,
- /* 80 */ 839, 936, 936, 731, 936, 839, 936, 936, 936, 936,
- /* 90 */ 936, 791, 784, 778, 769, 936, 936, 936, 936, 936,
- /* 100 */ 936, 936, 936, 936, 720, 720, 936, 720, 936, 936,
- /* 110 */ 936, 840, 594, 936, 882, 936, 936, 936, 936, 936,
- /* 120 */ 936, 605, 589, 936, 936, 936, 710, 736, 773, 761,
- /* 130 */ 863, 856, 857, 855, 852, 852, 852, 852, 852, 852,
- /* 140 */ 852, 852, 852, 852, 823, 816, 827, 815, 831, 826,
- /* 150 */ 818, 817, 819, 936, 936, 936, 936, 723, 936, 936,
- /* 160 */ 936, 820, 936, 789, 698, 936, 910, 693, 601, 618,
- /* 170 */ 936, 936, 936, 936, 936, 936, 936, 772, 670, 756,
- /* 180 */ 645, 738, 756, 858, 936, 936, 721, 708, 756, 934,
- /* 190 */ 931, 934, 739, 683, 739, 739, 739, 681, 739, 683,
- /* 200 */ 796, 739, 739, 683, 772, 739, 918, 915, 739, 739,
- /* 210 */ 871, 681, 681, 681, 681, 662, 936, 871, 681, 739,
- /* 220 */ 936, 739, 936, 852, 821, 752, 762, 748, 760, 757,
- /* 230 */ 772, 936, 681, 681, 662, 681, 681, 665, 593, 593,
- /* 240 */ 593, 681, 593, 649, 649, 726, 830, 829, 828, 822,
- /* 250 */ 629, 864, 936, 936, 936, 936, 936, 936, 936, 936,
- /* 260 */ 936, 936, 936, 936, 936, 936, 936, 936, 936, 763,
- /* 270 */ 936, 936, 936, 936, 936, 936, 936, 936, 936, 881,
- /* 280 */ 936, 936, 936, 936, 936, 936, 914, 913, 936, 936,
- /* 290 */ 936, 936, 936, 936, 936, 936, 936, 936, 902, 936,
- /* 300 */ 936, 936, 936, 936, 936, 936, 936, 936, 936, 936,
- /* 310 */ 936, 936, 936, 936, 936, 936, 936, 936, 758, 936,
- /* 320 */ 861, 843, 701, 850, 936, 936, 936, 936, 936, 842,
- /* 330 */ 853, 810, 936, 749, 936, 809, 806, 808, 611, 936,
- /* 340 */ 936, 936, 936, 936, 586, 590, 935, 933, 932, 930,
- /* 350 */ 890, 889, 888, 886, 895, 894, 893, 892, 891, 887,
- /* 360 */ 885, 884, 883, 880, 787, 775, 766, 697, 929, 927,
- /* 370 */ 928, 879, 877, 878, 696, 695, 692, 691, 690, 869,
- /* 380 */ 868, 866, 865, 867, 604, 906, 909, 908, 907, 912,
- /* 390 */ 911, 904, 917, 916, 921, 925, 924, 923, 922, 920,
- /* 400 */ 901, 795, 794, 792, 797, 788, 793, 780, 786, 785,
- /* 410 */ 776, 779, 684, 771, 767, 770, 905, 694, 603, 741,
- /* 420 */ 602, 607, 668, 669, 677, 680, 675, 678, 674, 673,
- /* 430 */ 672, 676, 671, 667, 610, 609, 623, 621, 622, 620,
- /* 440 */ 619, 617, 639, 638, 635, 637, 634, 636, 633, 632,
- /* 450 */ 631, 630, 628, 661, 647, 646, 874, 876, 875, 873,
- /* 460 */ 872, 654, 653, 659, 658, 657, 656, 652, 655, 651,
- /* 470 */ 650, 648, 644, 814, 813, 807, 835, 707, 706, 715,
- /* 480 */ 713, 712, 711, 747, 746, 745, 744, 743, 742, 735,
- /* 490 */ 733, 729, 728, 734, 732, 727, 719, 717, 718, 716,
- /* 500 */ 612, 802, 799, 801, 798, 737, 725, 722, 709, 751,
- /* 510 */ 753, 854, 844, 834, 845, 740, 832, 833, 704, 703,
- /* 520 */ 702, 853, 850, 846, 926, 838, 849, 837, 836, 825,
- /* 530 */ 824, 812, 847, 848, 811, 750, 765, 898, 897, 900,
- /* 540 */ 899, 896, 764, 625, 624, 705, 700, 699, 805, 804,
- /* 550 */ 803, 643, 755, 754, 642, 664, 663, 660, 641, 640,
- /* 560 */ 627, 626, 606, 600, 599, 598, 597, 615, 614, 613,
- /* 570 */ 611, 596, 595, 689, 688, 687, 686, 685, 682, 592,
- /* 580 */ 591, 588, 587, 585,
-};
-
-/* The next table maps tokens into fallback tokens. If a construct
-** like the following:
-**
-** %fallback ID X Y Z.
-**
-** appears in the grammar, then ID becomes a fallback token for X, Y,
-** and Z. Whenever one of the tokens X, Y, or Z is input to the parser
-** but it does not parse, the type of the token is changed to ID and
-** the parse is retried before an error is thrown.
-*/
-#ifdef YYFALLBACK
-static const YYCODETYPE yyFallback[] = {
- 0, /* $ => nothing */
- 0, /* ILLEGAL => nothing */
- 0, /* COMMENT => nothing */
- 0, /* SPACE => nothing */
- 0, /* ID => nothing */
- 4, /* ABORT => ID */
- 4, /* AFTER => ID */
- 4, /* ASC => ID */
- 4, /* ATTACH => ID */
- 4, /* BEFORE => ID */
- 4, /* BEGIN => ID */
- 4, /* CASCADE => ID */
- 4, /* CLUSTER => ID */
- 4, /* CONFLICT => ID */
- 4, /* COPY => ID */
- 4, /* DATABASE => ID */
- 4, /* DEFERRED => ID */
- 4, /* DELIMITERS => ID */
- 4, /* DESC => ID */
- 4, /* DETACH => ID */
- 4, /* EACH => ID */
- 4, /* END => ID */
- 4, /* EXPLAIN => ID */
- 4, /* FAIL => ID */
- 4, /* FOR => ID */
- 4, /* GLOB => ID */
- 4, /* IGNORE => ID */
- 4, /* IMMEDIATE => ID */
- 4, /* INITIALLY => ID */
- 4, /* INSTEAD => ID */
- 4, /* LIKE => ID */
- 4, /* MATCH => ID */
- 4, /* KEY => ID */
- 4, /* OF => ID */
- 4, /* OFFSET => ID */
- 4, /* PRAGMA => ID */
- 4, /* RAISE => ID */
- 4, /* REPLACE => ID */
- 4, /* RESTRICT => ID */
- 4, /* ROW => ID */
- 4, /* STATEMENT => ID */
- 4, /* TEMP => ID */
- 4, /* TRIGGER => ID */
- 4, /* VACUUM => ID */
- 4, /* VIEW => ID */
-};
-#endif /* YYFALLBACK */
-
-/* The following structure represents a single element of the
-** parser's stack. Information stored includes:
-**
-** + The state number for the parser at this level of the stack.
-**
-** + The value of the token stored at this level of the stack.
-** (In other words, the "major" token.)
-**
-** + The semantic value stored at this level of the stack. This is
-** the information used by the action routines in the grammar.
-** It is sometimes called the "minor" token.
-*/
-struct yyStackEntry {
- YYACTIONTYPE stateno; /* The state-number */
- YYCODETYPE major; /* The major token value. This is the code
- ** number for the token at this stack level */
- YYMINORTYPE minor; /* The user-supplied minor token value. This
- ** is the value of the token */
- QList<Token*>* tokens = nullptr;
-};
-typedef struct yyStackEntry yyStackEntry;
-
-/* The state of the parser is completely contained in an instance of
-** the following structure */
-struct yyParser {
- int yyidx; /* Index of top element in stack */
-#ifdef YYTRACKMAXSTACKDEPTH
- int yyidxMax; /* Maximum value of yyidx */
-#endif
- int yyerrcnt; /* Shifts left before out of the error */
- sqlite2_parseARG_SDECL /* A place to hold %extra_argument */
-#if YYSTACKDEPTH<=0
- int yystksz; /* Current side of the stack */
- yyStackEntry *yystack; /* The parser's stack */
-#else
- yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */
-#endif
-};
-typedef struct yyParser yyParser;
-
-#ifndef NDEBUG
-#include <stdio.h>
-static FILE *yyTraceFILE = 0;
-static char *yyTracePrompt = 0;
-#endif /* NDEBUG */
-
-void *sqlite2_parseCopyParserState(void* other)
-{
- yyParser *pParser;
- yyParser *otherParser = (yyParser*)other;
-
- // Copy parser
- pParser = (yyParser*)malloc((size_t)sizeof(yyParser));
- memcpy(pParser, other, (size_t)sizeof(yyParser));
-
-#if YYSTACKDEPTH<=0
- // Copy stack
- int stackSize = sizeof(yyStackEntry) * pParser->yystksz;
- pParser->yystack = malloc((size_t)stackSize);
- memcpy(pParser->yystack, ((yyParser*)other)->yystack, (size_t)stackSize);
-#endif
-
- for (int i = 0; i <= pParser->yyidx; i++)
- {
- pParser->yystack[i].tokens = new QList<Token*>();
- *(pParser->yystack[i].tokens) = *(otherParser->yystack[i].tokens);
- }
-
- return pParser;
-}
-
-void sqlite2_parseAddToken(void* other, Token* token)
-{
- yyParser *otherParser = (yyParser*)other;
- if (otherParser->yyidx < 0)
- return; // Nothing on stack yet. Might happen when parsing just whitespaces, nothing else.
-
- otherParser->yystack[otherParser->yyidx].tokens->append(token);
-}
-
-void sqlite2_parseRestoreParserState(void* saved, void* target)
-{
- yyParser *pParser = (yyParser*)target;
- yyParser *savedParser = (yyParser*)saved;
-
- for (int i = 0; i <= pParser->yyidx; i++)
- delete pParser->yystack[i].tokens;
-
- memcpy(pParser, saved, (size_t)sizeof(yyParser));
-
- for (int i = 0; i <= savedParser->yyidx; i++)
- {
- pParser->yystack[i].tokens = new QList<Token*>();
- *(pParser->yystack[i].tokens) = *(savedParser->yystack[i].tokens);
- }
-
-#if YYSTACKDEPTH<=0
- // Copy stack
- int stackSize = sizeof(yyStackEntry) * pParser->yystksz;
- pParser->yystack = relloc(pParser->yystack, (size_t)stackSize);
- memcpy(pParser->yystack, ((yyParser*)saved)->yystack, (size_t)stackSize);
-#endif
-}
-
-void sqlite2_parseFreeSavedState(void* other)
-{
- yyParser *pParser = (yyParser*)other;
- for (int i = 0; i <= pParser->yyidx; i++)
- delete pParser->yystack[i].tokens;
-
-#if YYSTACKDEPTH<=0
- free(pParser->yystack);
-#endif
- free(other);
-}
-
-#ifndef NDEBUG
-/*
-** Turn parser tracing on by giving a stream to which to write the trace
-** and a prompt to preface each trace message. Tracing is turned off
-** by making either argument NULL
-**
-** Inputs:
-** <ul>
-** <li> A FILE* to which trace output should be written.
-** If NULL, then tracing is turned off.
-** <li> A prefix string written at the beginning of every
-** line of trace output. If NULL, then tracing is
-** turned off.
-** </ul>
-**
-** Outputs:
-** None.
-*/
-void sqlite2_parseTrace(FILE *TraceFILE, char *zTracePrompt){
- yyTraceFILE = TraceFILE;
- yyTracePrompt = zTracePrompt;
- if( yyTraceFILE==0 ) yyTracePrompt = 0;
- else if( yyTracePrompt==0 ) yyTraceFILE = 0;
-}
-#endif /* NDEBUG */
-
-#ifndef NDEBUG
-/* For tracing shifts, the names of all terminals and nonterminals
-** are required. The following table supplies these names */
-static const char *const yyTokenName[] = {
- "$", "ILLEGAL", "COMMENT", "SPACE",
- "ID", "ABORT", "AFTER", "ASC",
- "ATTACH", "BEFORE", "BEGIN", "CASCADE",
- "CLUSTER", "CONFLICT", "COPY", "DATABASE",
- "DEFERRED", "DELIMITERS", "DESC", "DETACH",
- "EACH", "END", "EXPLAIN", "FAIL",
- "FOR", "GLOB", "IGNORE", "IMMEDIATE",
- "INITIALLY", "INSTEAD", "LIKE", "MATCH",
- "KEY", "OF", "OFFSET", "PRAGMA",
- "RAISE", "REPLACE", "RESTRICT", "ROW",
- "STATEMENT", "TEMP", "TRIGGER", "VACUUM",
- "VIEW", "OR", "AND", "NOT",
- "EQ", "NE", "ISNULL", "NOTNULL",
- "IS", "BETWEEN", "IN", "GT",
- "GE", "LT", "LE", "BITAND",
- "BITOR", "LSHIFT", "RSHIFT", "PLUS",
- "MINUS", "STAR", "SLASH", "REM",
- "CONCAT", "UMINUS", "UPLUS", "BITNOT",
- "SEMI", "TRANSACTION", "ID_TRANS", "COMMIT",
- "ROLLBACK", "CREATE", "TABLE", "LP",
- "RP", "AS", "DOT", "ID_TAB_NEW",
- "ID_DB", "COMMA", "ID_COL_NEW", "STRING",
- "JOIN_KW", "ID_COL_TYPE", "DEFAULT", "INTEGER",
- "FLOAT", "NULL", "CONSTRAINT", "PRIMARY",
- "UNIQUE", "CHECK", "REFERENCES", "COLLATE",
- "ON", "INSERT", "DELETE", "UPDATE",
- "ID_FK_MATCH", "SET", "DEFERRABLE", "FOREIGN",
- "ID_CONSTR", "ID_TAB", "DROP", "ID_VIEW_NEW",
- "ID_VIEW", "UNION", "ALL", "EXCEPT",
- "INTERSECT", "SELECT", "DISTINCT", "ID_ALIAS",
- "FROM", "USING", "JOIN", "ID_JOIN_OPTS",
- "ORDER", "BY", "GROUP", "HAVING",
- "LIMIT", "WHERE", "ID_COL", "INTO",
- "VALUES", "VARIABLE", "LIKE_KW", "CASE",
- "ID_FN", "ID_ERR_MSG", "WHEN", "THEN",
- "ELSE", "INDEX", "ID_IDX_NEW", "ID_IDX",
- "ID_PRAGMA", "ID_TRIG_NEW", "ID_TRIG", "error",
- "cmd", "input", "cmdlist", "ecmd",
- "explain", "cmdx", "trans_opt", "onconf",
- "nm", "temp", "fullname", "columnlist",
- "conslist_opt", "select", "column", "columnid",
- "type", "carglist", "id", "ids",
- "typetoken", "typename", "signed", "plus_num",
- "minus_num", "ccons", "ccons_nm", "carg",
- "sortorder", "expr", "idxlist_opt", "refargs",
- "defer_subclause", "refarg", "refact", "init_deferred_pred_opt",
- "conslist", "tconscomma", "tcons", "idxlist",
- "defer_subclause_opt", "resolvetype", "orconf", "select_stmt",
- "oneselect", "multiselect_op", "distinct", "selcollist",
- "from", "where_opt", "groupby_opt", "having_opt",
- "orderby_opt", "limit_opt", "sclp", "as",
- "joinsrc", "singlesrc", "seltablist", "joinop",
- "joinconstr_opt", "dbnm", "idlist", "sortlist",
- "collate", "nexprlist", "delete_stmt", "update_stmt",
- "setlist", "insert_stmt", "insert_cmd", "idlist_opt",
- "exprlist", "exprx", "not_opt", "likeop",
- "case_operand", "case_exprlist", "case_else", "raisetype",
- "uniqueflag", "idxlist_single", "nmnum", "number",
- "trigger_time", "trigger_event", "foreach_clause", "when_clause",
- "trigger_cmd_list", "trigger_cmd", "database_kw_opt", "key_opt",
-};
-#endif /* NDEBUG */
-
-#ifndef NDEBUG
-/* For tracing reduce actions, the names of all rules are required.
-*/
-static const char *const yyRuleName[] = {
- /* 0 */ "input ::= cmdlist",
- /* 1 */ "cmdlist ::= cmdlist ecmd",
- /* 2 */ "cmdlist ::= ecmd",
- /* 3 */ "ecmd ::= SEMI",
- /* 4 */ "ecmd ::= explain cmdx SEMI",
- /* 5 */ "explain ::=",
- /* 6 */ "explain ::= EXPLAIN",
- /* 7 */ "cmdx ::= cmd",
- /* 8 */ "cmd ::= BEGIN trans_opt onconf",
- /* 9 */ "trans_opt ::=",
- /* 10 */ "trans_opt ::= TRANSACTION",
- /* 11 */ "trans_opt ::= TRANSACTION nm",
- /* 12 */ "trans_opt ::= TRANSACTION ID_TRANS",
- /* 13 */ "cmd ::= COMMIT trans_opt",
- /* 14 */ "cmd ::= END trans_opt",
- /* 15 */ "cmd ::= ROLLBACK trans_opt",
- /* 16 */ "cmd ::= CREATE temp TABLE fullname LP columnlist conslist_opt RP",
- /* 17 */ "cmd ::= CREATE temp TABLE fullname AS select",
- /* 18 */ "cmd ::= CREATE temp TABLE nm DOT ID_TAB_NEW",
- /* 19 */ "cmd ::= CREATE temp TABLE ID_DB|ID_TAB_NEW",
- /* 20 */ "temp ::= TEMP",
- /* 21 */ "temp ::=",
- /* 22 */ "columnlist ::= columnlist COMMA column",
- /* 23 */ "columnlist ::= column",
- /* 24 */ "column ::= columnid type carglist",
- /* 25 */ "columnid ::= nm",
- /* 26 */ "columnid ::= ID_COL_NEW",
- /* 27 */ "id ::= ID",
- /* 28 */ "ids ::= ID|STRING",
- /* 29 */ "nm ::= id",
- /* 30 */ "nm ::= STRING",
- /* 31 */ "nm ::= JOIN_KW",
- /* 32 */ "type ::=",
- /* 33 */ "type ::= typetoken",
- /* 34 */ "typetoken ::= typename",
- /* 35 */ "typetoken ::= typename LP signed RP",
- /* 36 */ "typetoken ::= typename LP signed COMMA signed RP",
- /* 37 */ "typename ::= ids",
- /* 38 */ "typename ::= typename ids",
- /* 39 */ "typename ::= ID_COL_TYPE",
- /* 40 */ "signed ::= plus_num",
- /* 41 */ "signed ::= minus_num",
- /* 42 */ "carglist ::= carglist ccons",
- /* 43 */ "carglist ::= carglist ccons_nm ccons",
- /* 44 */ "carglist ::= carglist carg",
- /* 45 */ "carglist ::=",
- /* 46 */ "carg ::= DEFAULT STRING",
- /* 47 */ "carg ::= DEFAULT ID",
- /* 48 */ "carg ::= DEFAULT INTEGER",
- /* 49 */ "carg ::= DEFAULT PLUS INTEGER",
- /* 50 */ "carg ::= DEFAULT MINUS INTEGER",
- /* 51 */ "carg ::= DEFAULT FLOAT",
- /* 52 */ "carg ::= DEFAULT PLUS FLOAT",
- /* 53 */ "carg ::= DEFAULT MINUS FLOAT",
- /* 54 */ "carg ::= DEFAULT NULL",
- /* 55 */ "ccons_nm ::= CONSTRAINT nm",
- /* 56 */ "ccons ::= NULL onconf",
- /* 57 */ "ccons ::= NOT NULL onconf",
- /* 58 */ "ccons ::= PRIMARY KEY sortorder onconf",
- /* 59 */ "ccons ::= UNIQUE onconf",
- /* 60 */ "ccons ::= CHECK LP expr RP onconf",
- /* 61 */ "ccons ::= REFERENCES nm idxlist_opt refargs",
- /* 62 */ "ccons ::= defer_subclause",
- /* 63 */ "ccons ::= COLLATE id",
- /* 64 */ "ccons ::= CHECK LP RP",
- /* 65 */ "refargs ::=",
- /* 66 */ "refargs ::= refargs refarg",
- /* 67 */ "refarg ::= MATCH nm",
- /* 68 */ "refarg ::= ON INSERT refact",
- /* 69 */ "refarg ::= ON DELETE refact",
- /* 70 */ "refarg ::= ON UPDATE refact",
- /* 71 */ "refarg ::= MATCH ID_FK_MATCH",
- /* 72 */ "refact ::= SET NULL",
- /* 73 */ "refact ::= SET DEFAULT",
- /* 74 */ "refact ::= CASCADE",
- /* 75 */ "refact ::= RESTRICT",
- /* 76 */ "defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt",
- /* 77 */ "defer_subclause ::= DEFERRABLE init_deferred_pred_opt",
- /* 78 */ "init_deferred_pred_opt ::=",
- /* 79 */ "init_deferred_pred_opt ::= INITIALLY DEFERRED",
- /* 80 */ "init_deferred_pred_opt ::= INITIALLY IMMEDIATE",
- /* 81 */ "conslist_opt ::=",
- /* 82 */ "conslist_opt ::= COMMA conslist",
- /* 83 */ "conslist ::= conslist tconscomma tcons",
- /* 84 */ "conslist ::= tcons",
- /* 85 */ "tconscomma ::= COMMA",
- /* 86 */ "tconscomma ::=",
- /* 87 */ "tcons ::= CONSTRAINT nm",
- /* 88 */ "tcons ::= PRIMARY KEY LP idxlist RP onconf",
- /* 89 */ "tcons ::= UNIQUE LP idxlist RP onconf",
- /* 90 */ "tcons ::= CHECK LP expr RP onconf",
- /* 91 */ "tcons ::= FOREIGN KEY LP idxlist RP REFERENCES nm idxlist_opt refargs defer_subclause_opt",
- /* 92 */ "tcons ::= CONSTRAINT ID_CONSTR",
- /* 93 */ "tcons ::= FOREIGN KEY LP idxlist RP REFERENCES ID_TAB",
- /* 94 */ "tcons ::= CHECK LP RP onconf",
- /* 95 */ "defer_subclause_opt ::=",
- /* 96 */ "defer_subclause_opt ::= defer_subclause",
- /* 97 */ "onconf ::=",
- /* 98 */ "onconf ::= ON CONFLICT resolvetype",
- /* 99 */ "orconf ::=",
- /* 100 */ "orconf ::= OR resolvetype",
- /* 101 */ "resolvetype ::= ROLLBACK",
- /* 102 */ "resolvetype ::= ABORT",
- /* 103 */ "resolvetype ::= FAIL",
- /* 104 */ "resolvetype ::= IGNORE",
- /* 105 */ "resolvetype ::= REPLACE",
- /* 106 */ "cmd ::= DROP TABLE fullname",
- /* 107 */ "cmd ::= DROP TABLE nm DOT ID_TAB",
- /* 108 */ "cmd ::= DROP TABLE ID_DB|ID_TAB",
- /* 109 */ "cmd ::= CREATE temp VIEW nm AS select",
- /* 110 */ "cmd ::= CREATE temp VIEW ID_VIEW_NEW",
- /* 111 */ "cmd ::= DROP VIEW nm",
- /* 112 */ "cmd ::= DROP VIEW ID_VIEW",
- /* 113 */ "cmd ::= select_stmt",
- /* 114 */ "select_stmt ::= select",
- /* 115 */ "select ::= oneselect",
- /* 116 */ "select ::= select multiselect_op oneselect",
- /* 117 */ "multiselect_op ::= UNION",
- /* 118 */ "multiselect_op ::= UNION ALL",
- /* 119 */ "multiselect_op ::= EXCEPT",
- /* 120 */ "multiselect_op ::= INTERSECT",
- /* 121 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt",
- /* 122 */ "distinct ::= DISTINCT",
- /* 123 */ "distinct ::= ALL",
- /* 124 */ "distinct ::=",
- /* 125 */ "sclp ::= selcollist COMMA",
- /* 126 */ "sclp ::=",
- /* 127 */ "selcollist ::= sclp expr as",
- /* 128 */ "selcollist ::= sclp STAR",
- /* 129 */ "selcollist ::= sclp nm DOT STAR",
- /* 130 */ "selcollist ::= sclp",
- /* 131 */ "selcollist ::= sclp ID_TAB DOT STAR",
- /* 132 */ "as ::= AS nm",
- /* 133 */ "as ::= ids",
- /* 134 */ "as ::= AS ID_ALIAS",
- /* 135 */ "as ::= ID_ALIAS",
- /* 136 */ "as ::=",
- /* 137 */ "from ::=",
- /* 138 */ "from ::= FROM joinsrc",
- /* 139 */ "joinsrc ::= singlesrc seltablist",
- /* 140 */ "joinsrc ::=",
- /* 141 */ "seltablist ::= seltablist joinop singlesrc joinconstr_opt",
- /* 142 */ "seltablist ::=",
- /* 143 */ "singlesrc ::= nm dbnm as",
- /* 144 */ "singlesrc ::= LP select RP as",
- /* 145 */ "singlesrc ::= LP joinsrc RP as",
- /* 146 */ "singlesrc ::=",
- /* 147 */ "singlesrc ::= nm DOT",
- /* 148 */ "singlesrc ::= nm DOT ID_TAB",
- /* 149 */ "singlesrc ::= ID_DB|ID_TAB",
- /* 150 */ "singlesrc ::= nm DOT ID_VIEW",
- /* 151 */ "singlesrc ::= ID_DB|ID_VIEW",
- /* 152 */ "joinconstr_opt ::= ON expr",
- /* 153 */ "joinconstr_opt ::= USING LP idlist RP",
- /* 154 */ "joinconstr_opt ::=",
- /* 155 */ "dbnm ::=",
- /* 156 */ "dbnm ::= DOT nm",
- /* 157 */ "fullname ::= nm dbnm",
- /* 158 */ "joinop ::= COMMA",
- /* 159 */ "joinop ::= JOIN",
- /* 160 */ "joinop ::= JOIN_KW JOIN",
- /* 161 */ "joinop ::= JOIN_KW nm JOIN",
- /* 162 */ "joinop ::= JOIN_KW nm nm JOIN",
- /* 163 */ "joinop ::= ID_JOIN_OPTS",
- /* 164 */ "orderby_opt ::=",
- /* 165 */ "orderby_opt ::= ORDER BY sortlist",
- /* 166 */ "sortlist ::= sortlist COMMA collate expr sortorder",
- /* 167 */ "sortlist ::= expr collate sortorder",
- /* 168 */ "collate ::=",
- /* 169 */ "collate ::= COLLATE id",
- /* 170 */ "sortorder ::= ASC",
- /* 171 */ "sortorder ::= DESC",
- /* 172 */ "sortorder ::=",
- /* 173 */ "groupby_opt ::=",
- /* 174 */ "groupby_opt ::= GROUP BY nexprlist",
- /* 175 */ "groupby_opt ::= GROUP BY",
- /* 176 */ "having_opt ::=",
- /* 177 */ "having_opt ::= HAVING expr",
- /* 178 */ "limit_opt ::=",
- /* 179 */ "limit_opt ::= LIMIT signed",
- /* 180 */ "limit_opt ::= LIMIT signed OFFSET signed",
- /* 181 */ "limit_opt ::= LIMIT signed COMMA signed",
- /* 182 */ "cmd ::= delete_stmt",
- /* 183 */ "delete_stmt ::= DELETE FROM fullname where_opt",
- /* 184 */ "delete_stmt ::= DELETE FROM",
- /* 185 */ "delete_stmt ::= DELETE FROM nm DOT",
- /* 186 */ "delete_stmt ::= DELETE FROM nm DOT ID_TAB",
- /* 187 */ "delete_stmt ::= DELETE FROM ID_DB|ID_TAB",
- /* 188 */ "where_opt ::=",
- /* 189 */ "where_opt ::= WHERE expr",
- /* 190 */ "where_opt ::= WHERE",
- /* 191 */ "cmd ::= update_stmt",
- /* 192 */ "update_stmt ::= UPDATE orconf fullname SET setlist where_opt",
- /* 193 */ "update_stmt ::= UPDATE orconf",
- /* 194 */ "update_stmt ::= UPDATE orconf nm DOT",
- /* 195 */ "update_stmt ::= UPDATE orconf nm DOT ID_TAB",
- /* 196 */ "update_stmt ::= UPDATE orconf ID_DB|ID_TAB",
- /* 197 */ "setlist ::= setlist COMMA nm EQ expr",
- /* 198 */ "setlist ::= nm EQ expr",
- /* 199 */ "setlist ::=",
- /* 200 */ "setlist ::= setlist COMMA",
- /* 201 */ "setlist ::= setlist COMMA ID_COL",
- /* 202 */ "setlist ::= ID_COL",
- /* 203 */ "cmd ::= insert_stmt",
- /* 204 */ "insert_stmt ::= insert_cmd INTO fullname idlist_opt VALUES LP exprlist RP",
- /* 205 */ "insert_stmt ::= insert_cmd INTO fullname idlist_opt select",
- /* 206 */ "insert_stmt ::= insert_cmd INTO",
- /* 207 */ "insert_stmt ::= insert_cmd INTO nm DOT",
- /* 208 */ "insert_stmt ::= insert_cmd INTO ID_DB|ID_TAB",
- /* 209 */ "insert_stmt ::= insert_cmd INTO nm DOT ID_TAB",
- /* 210 */ "insert_cmd ::= INSERT orconf",
- /* 211 */ "insert_cmd ::= REPLACE",
- /* 212 */ "idlist_opt ::=",
- /* 213 */ "idlist_opt ::= LP idlist RP",
- /* 214 */ "idlist ::= idlist COMMA nm",
- /* 215 */ "idlist ::= nm",
- /* 216 */ "idlist ::=",
- /* 217 */ "idlist ::= idlist COMMA ID_COL",
- /* 218 */ "idlist ::= ID_COL",
- /* 219 */ "exprx ::= NULL",
- /* 220 */ "exprx ::= INTEGER",
- /* 221 */ "exprx ::= FLOAT",
- /* 222 */ "exprx ::= STRING",
- /* 223 */ "exprx ::= LP expr RP",
- /* 224 */ "exprx ::= id",
- /* 225 */ "exprx ::= JOIN_KW",
- /* 226 */ "exprx ::= nm DOT nm",
- /* 227 */ "exprx ::= nm DOT nm DOT nm",
- /* 228 */ "exprx ::= VARIABLE",
- /* 229 */ "exprx ::= ID LP exprlist RP",
- /* 230 */ "exprx ::= ID LP STAR RP",
- /* 231 */ "exprx ::= expr AND expr",
- /* 232 */ "exprx ::= expr OR expr",
- /* 233 */ "exprx ::= expr LT|GT|GE|LE expr",
- /* 234 */ "exprx ::= expr EQ|NE expr",
- /* 235 */ "exprx ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr",
- /* 236 */ "exprx ::= expr PLUS|MINUS expr",
- /* 237 */ "exprx ::= expr STAR|SLASH|REM expr",
- /* 238 */ "exprx ::= expr CONCAT expr",
- /* 239 */ "exprx ::= expr not_opt likeop expr",
- /* 240 */ "exprx ::= expr ISNULL|NOTNULL",
- /* 241 */ "exprx ::= expr NOT NULL",
- /* 242 */ "exprx ::= expr IS not_opt expr",
- /* 243 */ "exprx ::= NOT expr",
- /* 244 */ "exprx ::= BITNOT expr",
- /* 245 */ "exprx ::= MINUS expr",
- /* 246 */ "exprx ::= PLUS expr",
- /* 247 */ "exprx ::= expr not_opt BETWEEN expr AND expr",
- /* 248 */ "exprx ::= expr not_opt IN LP exprlist RP",
- /* 249 */ "exprx ::= expr not_opt IN LP select RP",
- /* 250 */ "exprx ::= expr not_opt IN nm dbnm",
- /* 251 */ "exprx ::= LP select RP",
- /* 252 */ "exprx ::= CASE case_operand case_exprlist case_else END",
- /* 253 */ "exprx ::= RAISE LP raisetype COMMA nm RP",
- /* 254 */ "exprx ::= RAISE LP IGNORE RP",
- /* 255 */ "exprx ::= nm DOT",
- /* 256 */ "exprx ::= nm DOT nm DOT",
- /* 257 */ "exprx ::= expr not_opt BETWEEN expr AND",
- /* 258 */ "exprx ::= CASE case_operand case_exprlist case_else",
- /* 259 */ "exprx ::= expr not_opt IN LP exprlist",
- /* 260 */ "exprx ::= expr not_opt IN ID_DB",
- /* 261 */ "exprx ::= expr not_opt IN nm DOT ID_TAB",
- /* 262 */ "exprx ::= ID_DB|ID_TAB|ID_COL|ID_FN",
- /* 263 */ "exprx ::= nm DOT ID_TAB|ID_COL",
- /* 264 */ "exprx ::= nm DOT nm DOT ID_COL",
- /* 265 */ "exprx ::= RAISE LP raisetype COMMA ID_ERR_MSG RP",
- /* 266 */ "expr ::= exprx",
- /* 267 */ "expr ::=",
- /* 268 */ "not_opt ::=",
- /* 269 */ "not_opt ::= NOT",
- /* 270 */ "likeop ::= LIKE|GLOB",
- /* 271 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
- /* 272 */ "case_exprlist ::= WHEN expr THEN expr",
- /* 273 */ "case_else ::= ELSE expr",
- /* 274 */ "case_else ::=",
- /* 275 */ "case_operand ::= exprx",
- /* 276 */ "case_operand ::=",
- /* 277 */ "exprlist ::= nexprlist",
- /* 278 */ "exprlist ::=",
- /* 279 */ "nexprlist ::= nexprlist COMMA expr",
- /* 280 */ "nexprlist ::= exprx",
- /* 281 */ "cmd ::= CREATE uniqueflag INDEX nm ON nm dbnm LP idxlist RP onconf",
- /* 282 */ "cmd ::= CREATE uniqueflag INDEX nm dbnm ON ID_TAB",
- /* 283 */ "cmd ::= CREATE uniqueflag INDEX nm DOT ID_IDX_NEW",
- /* 284 */ "cmd ::= CREATE uniqueflag INDEX ID_DB|ID_IDX_NEW",
- /* 285 */ "uniqueflag ::= UNIQUE",
- /* 286 */ "uniqueflag ::=",
- /* 287 */ "idxlist_opt ::=",
- /* 288 */ "idxlist_opt ::= LP idxlist RP",
- /* 289 */ "idxlist ::= idxlist COMMA idxlist_single",
- /* 290 */ "idxlist ::= idxlist_single",
- /* 291 */ "idxlist_single ::= nm sortorder",
- /* 292 */ "idxlist_single ::= ID_COL",
- /* 293 */ "cmd ::= DROP INDEX fullname",
- /* 294 */ "cmd ::= DROP INDEX nm DOT ID_IDX",
- /* 295 */ "cmd ::= DROP INDEX ID_DB|ID_IDX",
- /* 296 */ "cmd ::= COPY orconf nm dbnm FROM nm USING DELIMITERS STRING",
- /* 297 */ "cmd ::= COPY orconf nm dbnm FROM nm",
- /* 298 */ "cmd ::= VACUUM",
- /* 299 */ "cmd ::= VACUUM nm",
- /* 300 */ "cmd ::= PRAGMA ids",
- /* 301 */ "cmd ::= PRAGMA nm EQ nmnum",
- /* 302 */ "cmd ::= PRAGMA nm LP nmnum RP",
- /* 303 */ "cmd ::= PRAGMA nm EQ minus_num",
- /* 304 */ "cmd ::= PRAGMA nm LP minus_num RP",
- /* 305 */ "cmd ::= PRAGMA nm DOT ID_PRAGMA",
- /* 306 */ "cmd ::= PRAGMA ID_DB|ID_PRAGMA",
- /* 307 */ "nmnum ::= plus_num",
- /* 308 */ "nmnum ::= nm",
- /* 309 */ "nmnum ::= ON",
- /* 310 */ "nmnum ::= DELETE",
- /* 311 */ "nmnum ::= DEFAULT",
- /* 312 */ "plus_num ::= PLUS number",
- /* 313 */ "plus_num ::= number",
- /* 314 */ "minus_num ::= MINUS number",
- /* 315 */ "number ::= INTEGER",
- /* 316 */ "number ::= FLOAT",
- /* 317 */ "cmd ::= CREATE temp TRIGGER nm trigger_time trigger_event ON nm dbnm foreach_clause when_clause BEGIN trigger_cmd_list END",
- /* 318 */ "cmd ::= CREATE temp TRIGGER nm trigger_time trigger_event ON nm dbnm foreach_clause when_clause",
- /* 319 */ "cmd ::= CREATE temp TRIGGER nm trigger_time trigger_event ON nm dbnm foreach_clause when_clause BEGIN trigger_cmd_list",
- /* 320 */ "cmd ::= CREATE temp TRIGGER nm trigger_time trigger_event ON ID_TAB|ID_DB",
- /* 321 */ "cmd ::= CREATE temp TRIGGER nm trigger_time trigger_event ON nm DOT ID_TAB",
- /* 322 */ "cmd ::= CREATE temp TRIGGER ID_TRIG_NEW",
- /* 323 */ "trigger_time ::= BEFORE",
- /* 324 */ "trigger_time ::= AFTER",
- /* 325 */ "trigger_time ::= INSTEAD OF",
- /* 326 */ "trigger_time ::=",
- /* 327 */ "trigger_event ::= DELETE",
- /* 328 */ "trigger_event ::= INSERT",
- /* 329 */ "trigger_event ::= UPDATE",
- /* 330 */ "trigger_event ::= UPDATE OF idlist",
- /* 331 */ "foreach_clause ::=",
- /* 332 */ "foreach_clause ::= FOR EACH ROW",
- /* 333 */ "foreach_clause ::= FOR EACH STATEMENT",
- /* 334 */ "when_clause ::=",
- /* 335 */ "when_clause ::= WHEN expr",
- /* 336 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
- /* 337 */ "trigger_cmd_list ::= trigger_cmd SEMI",
- /* 338 */ "trigger_cmd ::= update_stmt",
- /* 339 */ "trigger_cmd ::= insert_stmt",
- /* 340 */ "trigger_cmd ::= delete_stmt",
- /* 341 */ "trigger_cmd ::= select_stmt",
- /* 342 */ "raisetype ::= ROLLBACK|ABORT|FAIL",
- /* 343 */ "cmd ::= DROP TRIGGER fullname",
- /* 344 */ "cmd ::= DROP TRIGGER nm DOT ID_TRIG",
- /* 345 */ "cmd ::= DROP TRIGGER ID_DB|ID_TRIG",
- /* 346 */ "cmd ::= ATTACH database_kw_opt ids AS ids key_opt",
- /* 347 */ "key_opt ::=",
- /* 348 */ "key_opt ::= USING ids",
- /* 349 */ "database_kw_opt ::= DATABASE",
- /* 350 */ "database_kw_opt ::=",
- /* 351 */ "cmd ::= DETACH database_kw_opt nm",
-};
-#endif /* NDEBUG */
-
-
-#if YYSTACKDEPTH<=0
-/*
-** Try to increase the size of the parser stack.
-*/
-static void yyGrowStack(yyParser *p){
- int newSize;
- yyStackEntry *pNew;
-
- newSize = p->yystksz*2 + 100;
- pNew = realloc(p->yystack, newSize*sizeof(pNew[0]));
- if( pNew ){
- p->yystack = pNew;
- p->yystksz = newSize;
-#ifndef NDEBUG
- if( yyTraceFILE ){
- fprintf(yyTraceFILE,"%sStack grows to %d entries!\n",
- yyTracePrompt, p->yystksz);
- }
-#endif
- }
-}
-#endif
-
-/*
-** This function allocates a new parser.
-** The only argument is a pointer to a function which works like
-** malloc.
-**
-** Inputs:
-** A pointer to the function used to allocate memory.
-**
-** Outputs:
-** A pointer to a parser. This pointer is used in subsequent calls
-** to sqlite2_parse and sqlite2_parseFree.
-*/
-void *sqlite2_parseAlloc(void *(*mallocProc)(size_t)){
- yyParser *pParser;
- pParser = (yyParser*)(*mallocProc)( (size_t)sizeof(yyParser) );
- if( pParser ){
- pParser->yyidx = -1;
-#ifdef YYTRACKMAXSTACKDEPTH
- pParser->yyidxMax = 0;
-#endif
-#if YYSTACKDEPTH<=0
- pParser->yystack = NULL;
- pParser->yystksz = 0;
- yyGrowStack(pParser);
-#endif
- }
- return pParser;
-}
-
-/* The following function deletes the value associated with a
-** symbol. The symbol can be either a terminal or nonterminal.
-** "yymajor" is the symbol code, and "yypminor" is a pointer to
-** the value.
-*/
-static void yy_destructor(
- yyParser *yypParser, /* The parser */
- YYCODETYPE yymajor, /* Type code for object to destroy */
- YYMINORTYPE *yypminor /* The object to be destroyed */
-){
- sqlite2_parseARG_FETCH;
- if (parserContext->executeRules)
- {
- switch( yymajor ){
- /* Here is inserted the actions which take place when a
- ** terminal or non-terminal is destroyed. This can happen
- ** when the symbol is popped from the stack during a
- ** reduce or during error processing or when a parser is
- ** being destroyed before it is finished parsing.
- **
- ** Note: during a reduce, the only symbols destroyed are those
- ** which appear on the RHS of the rule, but which are not used
- ** inside the C code.
- */
- case 148: /* cmd */
- case 151: /* ecmd */
- case 153: /* cmdx */
- case 191: /* select_stmt */
- case 214: /* delete_stmt */
- case 215: /* update_stmt */
- case 217: /* insert_stmt */
- case 237: /* trigger_cmd */
-{
-delete (yypminor->yy203);
-}
- break;
- case 152: /* explain */
-{
-delete (yypminor->yy91);
-}
- break;
- case 154: /* trans_opt */
-{
-delete (yypminor->yy404);
-}
- break;
- case 155: /* onconf */
- case 189: /* resolvetype */
- case 190: /* orconf */
-{
-delete (yypminor->yy418);
-}
- break;
- case 156: /* nm */
- case 163: /* columnid */
- case 166: /* id */
- case 167: /* ids */
- case 169: /* typename */
- case 209: /* dbnm */
-{
-delete (yypminor->yy319);
-}
- break;
- case 157: /* temp */
- case 194: /* distinct */
-{
-delete (yypminor->yy226);
-}
- break;
- case 158: /* fullname */
-{
-delete (yypminor->yy120);
-}
- break;
- case 159: /* columnlist */
-{
-delete (yypminor->yy42);
-}
- break;
- case 160: /* conslist_opt */
- case 184: /* conslist */
-{
-delete (yypminor->yy13);
-}
- break;
- case 161: /* select */
-{
-delete (yypminor->yy153);
-}
- break;
- case 162: /* column */
-{
-delete (yypminor->yy147);
-}
- break;
- case 164: /* type */
- case 168: /* typetoken */
-{
-delete (yypminor->yy57);
-}
- break;
- case 165: /* carglist */
-{
-delete (yypminor->yy371);
-}
- break;
- case 170: /* signed */
- case 171: /* plus_num */
- case 172: /* minus_num */
- case 230: /* nmnum */
- case 231: /* number */
-{
-delete (yypminor->yy69);
-}
- break;
- case 173: /* ccons */
- case 174: /* ccons_nm */
- case 175: /* carg */
-{
-delete (yypminor->yy304);
-}
- break;
- case 176: /* sortorder */
-{
-delete (yypminor->yy389);
-}
- break;
- case 177: /* expr */
- case 197: /* where_opt */
- case 199: /* having_opt */
- case 221: /* exprx */
- case 224: /* case_operand */
- case 226: /* case_else */
-{
-delete (yypminor->yy192);
-}
- break;
- case 178: /* idxlist_opt */
- case 187: /* idxlist */
-{
-delete (yypminor->yy63);
-}
- break;
- case 179: /* refargs */
-{
-delete (yypminor->yy264);
-}
- break;
- case 180: /* defer_subclause */
- case 188: /* defer_subclause_opt */
-{
-delete (yypminor->yy329);
-}
- break;
- case 181: /* refarg */
-{
-delete (yypminor->yy187);
-}
- break;
- case 182: /* refact */
-{
-delete (yypminor->yy424);
-}
- break;
- case 183: /* init_deferred_pred_opt */
-{
-delete (yypminor->yy312);
-}
- break;
- case 185: /* tconscomma */
- case 222: /* not_opt */
- case 228: /* uniqueflag */
- case 238: /* database_kw_opt */
-{
-delete (yypminor->yy291);
-}
- break;
- case 186: /* tcons */
-{
-delete (yypminor->yy406);
-}
- break;
- case 192: /* oneselect */
-{
-delete (yypminor->yy150);
-}
- break;
- case 193: /* multiselect_op */
-{
-delete (yypminor->yy382);
-}
- break;
- case 195: /* selcollist */
- case 202: /* sclp */
-{
-delete (yypminor->yy213);
-}
- break;
- case 196: /* from */
- case 204: /* joinsrc */
-{
-delete (yypminor->yy31);
-}
- break;
- case 198: /* groupby_opt */
- case 213: /* nexprlist */
- case 220: /* exprlist */
- case 225: /* case_exprlist */
-{
-delete (yypminor->yy231);
-}
- break;
- case 200: /* orderby_opt */
- case 211: /* sortlist */
-{
-delete (yypminor->yy243);
-}
- break;
- case 201: /* limit_opt */
-{
-delete (yypminor->yy324);
-}
- break;
- case 203: /* as */
-{
-delete (yypminor->yy40);
-}
- break;
- case 205: /* singlesrc */
-{
-delete (yypminor->yy121);
-}
- break;
- case 206: /* seltablist */
-{
-delete (yypminor->yy131);
-}
- break;
- case 207: /* joinop */
-{
-delete (yypminor->yy221);
-}
- break;
- case 208: /* joinconstr_opt */
-{
-delete (yypminor->yy455);
-}
- break;
- case 210: /* idlist */
- case 219: /* idlist_opt */
-{
-delete (yypminor->yy95);
-}
- break;
- case 212: /* collate */
-{
-if ((yypminor->yy319)) delete (yypminor->yy319);
-}
- break;
- case 216: /* setlist */
-{
-delete (yypminor->yy201);
-}
- break;
- case 218: /* insert_cmd */
-{
-delete (yypminor->yy344);
-}
- break;
- case 223: /* likeop */
-{
-delete (yypminor->yy41);
-}
- break;
- case 229: /* idxlist_single */
-{
-delete (yypminor->yy428);
-}
- break;
- case 232: /* trigger_time */
-{
-delete (yypminor->yy372);
-}
- break;
- case 233: /* trigger_event */
-{
-delete (yypminor->yy151);
-}
- break;
- case 234: /* foreach_clause */
-{
-delete (yypminor->yy83);
-}
- break;
- case 235: /* when_clause */
- case 239: /* key_opt */
-{
-if ((yypminor->yy192)) delete (yypminor->yy192);
-}
- break;
- case 236: /* trigger_cmd_list */
-{
-delete (yypminor->yy270);
-}
- break;
- default: break; /* If no destructor action specified: do nothing */
- }
- }
-}
-
-/*
-** Pop the parser's stack once.
-**
-** If there is a destructor routine associated with the token which
-** is popped from the stack, then call it.
-**
-** Return the major token number for the symbol popped.
-*/
-static int yy_pop_parser_stack(yyParser *pParser){
- YYCODETYPE yymajor;
- yyStackEntry *yytos = &pParser->yystack[pParser->yyidx];
-
- /* There is no mechanism by which the parser stack can be popped below
- ** empty in SQLite. */
- if( pParser->yyidx<0 ) return 0;
-#ifndef NDEBUG
- if( yyTraceFILE && pParser->yyidx>=0 ){
- fprintf(yyTraceFILE,"%sPopping %s\n",
- yyTracePrompt,
- yyTokenName[yytos->major]);
- }
-#endif
- yymajor = yytos->major;
- yy_destructor(pParser, yymajor, &yytos->minor);
- delete yytos->tokens;
- yytos->tokens = nullptr;
- pParser->yyidx--;
- return yymajor;
-}
-
-/*
-** Deallocate and destroy a parser. Destructors are all called for
-** all stack elements before shutting the parser down.
-**
-** Inputs:
-** <ul>
-** <li> A pointer to the parser. This should be a pointer
-** obtained from sqlite2_parseAlloc.
-** <li> A pointer to a function used to reclaim memory obtained
-** from malloc.
-** </ul>
-*/
-void sqlite2_parseFree(
- void *p, /* The parser to be deleted */
- void (*freeProc)(void*) /* Function used to reclaim memory */
-){
- yyParser *pParser = (yyParser*)p;
- /* In SQLite, we never try to destroy a parser that was not successfully
- ** created in the first place. */
- if( pParser==0 ) return;
- while( pParser->yyidx>=0 ) yy_pop_parser_stack(pParser);
-#if YYSTACKDEPTH<=0
- free(pParser->yystack);
-#endif
- (*freeProc)((void*)pParser);
-}
-
-/*
-** Return the peak depth of the stack for a parser.
-*/
-#ifdef YYTRACKMAXSTACKDEPTH
-int sqlite2_parseStackPeak(void *p){
- yyParser *pParser = (yyParser*)p;
- return pParser->yyidxMax;
-}
-#endif
-
-/*
-** Find the appropriate action for a parser given the terminal
-** look-ahead token iLookAhead.
-**
-** If the look-ahead token is YYNOCODE, then check to see if the action is
-** independent of the look-ahead. If it is, return the action, otherwise
-** return YY_NO_ACTION.
-*/
-static int yy_find_shift_action(
- yyParser *pParser, /* The parser */
- YYCODETYPE iLookAhead /* The look-ahead token */
-){
- int i;
- int stateno = pParser->yystack[pParser->yyidx].stateno;
- GET_CONTEXT;
-
- if( stateno>YY_SHIFT_COUNT
- || (i = yy_shift_ofst[stateno])==YY_SHIFT_USE_DFLT ){
- return yy_default[stateno];
- }
- assert( iLookAhead!=YYNOCODE );
- i += iLookAhead;
- if( i<0 || i>=YY_ACTTAB_COUNT || yy_lookahead[i]!=iLookAhead ){
- if( iLookAhead>0 ){
-#ifdef YYFALLBACK
- YYCODETYPE iFallback; /* Fallback token */
- if( iLookAhead<sizeof(yyFallback)/sizeof(yyFallback[0])
- && (iFallback = yyFallback[iLookAhead])!=0
- && parserContext->doFallbacks ){
-#ifndef NDEBUG
- if( yyTraceFILE ){
- fprintf(yyTraceFILE, "%sFALLBACK %s => %s\n",
- yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]);
- }
-#endif
- return yy_find_shift_action(pParser, iFallback);
- }
-#endif
-#ifdef YYWILDCARD
- {
- int j = i - iLookAhead + YYWILDCARD;
- if(
-#if YY_SHIFT_MIN+YYWILDCARD<0
- j>=0 &&
-#endif
-#if YY_SHIFT_MAX+YYWILDCARD>=YY_ACTTAB_COUNT
- j<YY_ACTTAB_COUNT &&
-#endif
- yy_lookahead[j]==YYWILDCARD
- ){
-#ifndef NDEBUG
- if( yyTraceFILE ){
- fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n",
- yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[YYWILDCARD]);
- }
-#endif /* NDEBUG */
- return yy_action[j];
- }
- }
-#endif /* YYWILDCARD */
- }
- return yy_default[stateno];
- }else{
- return yy_action[i];
- }
-}
-
-/*
-** Find the appropriate action for a parser given the non-terminal
-** look-ahead token iLookAhead.
-**
-** If the look-ahead token is YYNOCODE, then check to see if the action is
-** independent of the look-ahead. If it is, return the action, otherwise
-** return YY_NO_ACTION.
-*/
-static int yy_find_reduce_action(
- int stateno, /* Current state number */
- YYCODETYPE iLookAhead /* The look-ahead token */
-){
- int i;
-#ifdef YYERRORSYMBOL
- if( stateno>YY_REDUCE_COUNT ){
- return yy_default[stateno];
- }
-#else
- assert( stateno<=YY_REDUCE_COUNT );
-#endif
- i = yy_reduce_ofst[stateno];
- assert( i!=YY_REDUCE_USE_DFLT );
- assert( iLookAhead!=YYNOCODE );
- i += iLookAhead;
-#ifdef YYERRORSYMBOL
- if( i<0 || i>=YY_ACTTAB_COUNT || yy_lookahead[i]!=iLookAhead ){
- return yy_default[stateno];
- }
-#else
- assert( i>=0 && i<YY_ACTTAB_COUNT );
- assert( yy_lookahead[i]==iLookAhead );
-#endif
- return yy_action[i];
-}
-
-/*
-** The following routine is called if the stack overflows.
-*/
-static void yyStackOverflow(yyParser *yypParser, YYMINORTYPE *yypMinor){
- sqlite2_parseARG_FETCH;
- yypParser->yyidx--;
-#ifndef NDEBUG
- if( yyTraceFILE ){
- fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt);
- }
-#endif
- while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
- /* Here code is inserted which will execute if the parser
- ** stack every overflows */
-
- UNUSED_PARAMETER(yypMinor);
- parserContext->error(QObject::tr("Parser stack overflow"));
- sqlite2_parseARG_STORE; /* Suppress warning about unused %extra_argument var */
-}
-
-/*
-** Perform a shift action.
-*/
-static void yy_shift(
- yyParser *yypParser, /* The parser to be shifted */
- int yyNewState, /* The new state to shift in */
- int yyMajor, /* The major token to shift in */
- YYMINORTYPE *yypMinor /* Pointer to the minor token to shift in */
-){
- yyStackEntry *yytos;
- yypParser->yyidx++;
-#ifdef YYTRACKMAXSTACKDEPTH
- if( yypParser->yyidx>yypParser->yyidxMax ){
- yypParser->yyidxMax = yypParser->yyidx;
- }
-#endif
-#if YYSTACKDEPTH>0
- if( yypParser->yyidx>=YYSTACKDEPTH ){
- yyStackOverflow(yypParser, yypMinor);
- return;
- }
-#else
- if( yypParser->yyidx>=yypParser->yystksz ){
- yyGrowStack(yypParser);
- if( yypParser->yyidx>=yypParser->yystksz ){
- yyStackOverflow(yypParser, yypMinor);
- return;
- }
- }
-#endif
- yytos = &yypParser->yystack[yypParser->yyidx];
- yytos->stateno = (YYACTIONTYPE)yyNewState;
- yytos->major = (YYCODETYPE)yyMajor;
- yytos->minor = *yypMinor;
- yytos->tokens = new QList<Token*>();
-#ifndef NDEBUG
- if( yyTraceFILE && yypParser->yyidx>0 ){
- int i;
- fprintf(yyTraceFILE,"%sShift %d\n",yyTracePrompt,yyNewState);
- fprintf(yyTraceFILE,"%sStack:",yyTracePrompt);
- for(i=1; i<=yypParser->yyidx; i++)
- fprintf(yyTraceFILE," %s",yyTokenName[yypParser->yystack[i].major]);
- fprintf(yyTraceFILE,"\n");
- }
-#endif
-}
-
-/* The following table contains information about every rule that
-** is used during the reduce.
-*/
-static const struct {
- YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */
- unsigned char nrhs; /* Number of right-hand side symbols in the rule */
-} yyRuleInfo[] = {
- { 149, 1 },
- { 150, 2 },
- { 150, 1 },
- { 151, 1 },
- { 151, 3 },
- { 152, 0 },
- { 152, 1 },
- { 153, 1 },
- { 148, 3 },
- { 154, 0 },
- { 154, 1 },
- { 154, 2 },
- { 154, 2 },
- { 148, 2 },
- { 148, 2 },
- { 148, 2 },
- { 148, 8 },
- { 148, 6 },
- { 148, 6 },
- { 148, 4 },
- { 157, 1 },
- { 157, 0 },
- { 159, 3 },
- { 159, 1 },
- { 162, 3 },
- { 163, 1 },
- { 163, 1 },
- { 166, 1 },
- { 167, 1 },
- { 156, 1 },
- { 156, 1 },
- { 156, 1 },
- { 164, 0 },
- { 164, 1 },
- { 168, 1 },
- { 168, 4 },
- { 168, 6 },
- { 169, 1 },
- { 169, 2 },
- { 169, 1 },
- { 170, 1 },
- { 170, 1 },
- { 165, 2 },
- { 165, 3 },
- { 165, 2 },
- { 165, 0 },
- { 175, 2 },
- { 175, 2 },
- { 175, 2 },
- { 175, 3 },
- { 175, 3 },
- { 175, 2 },
- { 175, 3 },
- { 175, 3 },
- { 175, 2 },
- { 174, 2 },
- { 173, 2 },
- { 173, 3 },
- { 173, 4 },
- { 173, 2 },
- { 173, 5 },
- { 173, 4 },
- { 173, 1 },
- { 173, 2 },
- { 173, 3 },
- { 179, 0 },
- { 179, 2 },
- { 181, 2 },
- { 181, 3 },
- { 181, 3 },
- { 181, 3 },
- { 181, 2 },
- { 182, 2 },
- { 182, 2 },
- { 182, 1 },
- { 182, 1 },
- { 180, 3 },
- { 180, 2 },
- { 183, 0 },
- { 183, 2 },
- { 183, 2 },
- { 160, 0 },
- { 160, 2 },
- { 184, 3 },
- { 184, 1 },
- { 185, 1 },
- { 185, 0 },
- { 186, 2 },
- { 186, 6 },
- { 186, 5 },
- { 186, 5 },
- { 186, 10 },
- { 186, 2 },
- { 186, 7 },
- { 186, 4 },
- { 188, 0 },
- { 188, 1 },
- { 155, 0 },
- { 155, 3 },
- { 190, 0 },
- { 190, 2 },
- { 189, 1 },
- { 189, 1 },
- { 189, 1 },
- { 189, 1 },
- { 189, 1 },
- { 148, 3 },
- { 148, 5 },
- { 148, 3 },
- { 148, 6 },
- { 148, 4 },
- { 148, 3 },
- { 148, 3 },
- { 148, 1 },
- { 191, 1 },
- { 161, 1 },
- { 161, 3 },
- { 193, 1 },
- { 193, 2 },
- { 193, 1 },
- { 193, 1 },
- { 192, 9 },
- { 194, 1 },
- { 194, 1 },
- { 194, 0 },
- { 202, 2 },
- { 202, 0 },
- { 195, 3 },
- { 195, 2 },
- { 195, 4 },
- { 195, 1 },
- { 195, 4 },
- { 203, 2 },
- { 203, 1 },
- { 203, 2 },
- { 203, 1 },
- { 203, 0 },
- { 196, 0 },
- { 196, 2 },
- { 204, 2 },
- { 204, 0 },
- { 206, 4 },
- { 206, 0 },
- { 205, 3 },
- { 205, 4 },
- { 205, 4 },
- { 205, 0 },
- { 205, 2 },
- { 205, 3 },
- { 205, 1 },
- { 205, 3 },
- { 205, 1 },
- { 208, 2 },
- { 208, 4 },
- { 208, 0 },
- { 209, 0 },
- { 209, 2 },
- { 158, 2 },
- { 207, 1 },
- { 207, 1 },
- { 207, 2 },
- { 207, 3 },
- { 207, 4 },
- { 207, 1 },
- { 200, 0 },
- { 200, 3 },
- { 211, 5 },
- { 211, 3 },
- { 212, 0 },
- { 212, 2 },
- { 176, 1 },
- { 176, 1 },
- { 176, 0 },
- { 198, 0 },
- { 198, 3 },
- { 198, 2 },
- { 199, 0 },
- { 199, 2 },
- { 201, 0 },
- { 201, 2 },
- { 201, 4 },
- { 201, 4 },
- { 148, 1 },
- { 214, 4 },
- { 214, 2 },
- { 214, 4 },
- { 214, 5 },
- { 214, 3 },
- { 197, 0 },
- { 197, 2 },
- { 197, 1 },
- { 148, 1 },
- { 215, 6 },
- { 215, 2 },
- { 215, 4 },
- { 215, 5 },
- { 215, 3 },
- { 216, 5 },
- { 216, 3 },
- { 216, 0 },
- { 216, 2 },
- { 216, 3 },
- { 216, 1 },
- { 148, 1 },
- { 217, 8 },
- { 217, 5 },
- { 217, 2 },
- { 217, 4 },
- { 217, 3 },
- { 217, 5 },
- { 218, 2 },
- { 218, 1 },
- { 219, 0 },
- { 219, 3 },
- { 210, 3 },
- { 210, 1 },
- { 210, 0 },
- { 210, 3 },
- { 210, 1 },
- { 221, 1 },
- { 221, 1 },
- { 221, 1 },
- { 221, 1 },
- { 221, 3 },
- { 221, 1 },
- { 221, 1 },
- { 221, 3 },
- { 221, 5 },
- { 221, 1 },
- { 221, 4 },
- { 221, 4 },
- { 221, 3 },
- { 221, 3 },
- { 221, 3 },
- { 221, 3 },
- { 221, 3 },
- { 221, 3 },
- { 221, 3 },
- { 221, 3 },
- { 221, 4 },
- { 221, 2 },
- { 221, 3 },
- { 221, 4 },
- { 221, 2 },
- { 221, 2 },
- { 221, 2 },
- { 221, 2 },
- { 221, 6 },
- { 221, 6 },
- { 221, 6 },
- { 221, 5 },
- { 221, 3 },
- { 221, 5 },
- { 221, 6 },
- { 221, 4 },
- { 221, 2 },
- { 221, 4 },
- { 221, 5 },
- { 221, 4 },
- { 221, 5 },
- { 221, 4 },
- { 221, 6 },
- { 221, 1 },
- { 221, 3 },
- { 221, 5 },
- { 221, 6 },
- { 177, 1 },
- { 177, 0 },
- { 222, 0 },
- { 222, 1 },
- { 223, 1 },
- { 225, 5 },
- { 225, 4 },
- { 226, 2 },
- { 226, 0 },
- { 224, 1 },
- { 224, 0 },
- { 220, 1 },
- { 220, 0 },
- { 213, 3 },
- { 213, 1 },
- { 148, 11 },
- { 148, 7 },
- { 148, 6 },
- { 148, 4 },
- { 228, 1 },
- { 228, 0 },
- { 178, 0 },
- { 178, 3 },
- { 187, 3 },
- { 187, 1 },
- { 229, 2 },
- { 229, 1 },
- { 148, 3 },
- { 148, 5 },
- { 148, 3 },
- { 148, 9 },
- { 148, 6 },
- { 148, 1 },
- { 148, 2 },
- { 148, 2 },
- { 148, 4 },
- { 148, 5 },
- { 148, 4 },
- { 148, 5 },
- { 148, 4 },
- { 148, 2 },
- { 230, 1 },
- { 230, 1 },
- { 230, 1 },
- { 230, 1 },
- { 230, 1 },
- { 171, 2 },
- { 171, 1 },
- { 172, 2 },
- { 231, 1 },
- { 231, 1 },
- { 148, 14 },
- { 148, 11 },
- { 148, 13 },
- { 148, 8 },
- { 148, 10 },
- { 148, 4 },
- { 232, 1 },
- { 232, 1 },
- { 232, 2 },
- { 232, 0 },
- { 233, 1 },
- { 233, 1 },
- { 233, 1 },
- { 233, 3 },
- { 234, 0 },
- { 234, 3 },
- { 234, 3 },
- { 235, 0 },
- { 235, 2 },
- { 236, 3 },
- { 236, 2 },
- { 237, 1 },
- { 237, 1 },
- { 237, 1 },
- { 237, 1 },
- { 227, 1 },
- { 148, 3 },
- { 148, 5 },
- { 148, 3 },
- { 148, 6 },
- { 239, 0 },
- { 239, 2 },
- { 238, 1 },
- { 238, 0 },
- { 148, 3 },
-};
-
-static void yy_accept(yyParser*); /* Forward Declaration */
-
-/*
-** Perform a reduce action and the shift that must immediately
-** follow the reduce.
-*/
-static void yy_reduce(
- yyParser *yypParser, /* The parser */
- int yyruleno /* Number of the rule by which to reduce */
-){
- int yygoto; /* The next state */
- int yyact; /* The next action */
- YYMINORTYPE yygotominor; /* The LHS of the rule reduced */
- yyStackEntry *yymsp; /* The top of the parser's stack */
- int yysize; /* Amount to pop the stack */
- sqlite2_parseARG_FETCH;
- SqliteStatement* objectForTokens = 0;
- QStringList noTokenInheritanceFields;
- yymsp = &yypParser->yystack[yypParser->yyidx];
-#ifndef NDEBUG
- if( yyTraceFILE && yyruleno>=0
- && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){
- fprintf(yyTraceFILE, "%sReduce [%s].\n", yyTracePrompt,
- yyRuleName[yyruleno]);
- }
-#endif /* NDEBUG */
-
- /* Silence complaints from purify about yygotominor being uninitialized
- ** in some cases when it is copied into the stack after the following
- ** switch. yygotominor is uninitialized when a rule reduces that does
- ** not set the value of its left-hand side nonterminal. Leaving the
- ** value of the nonterminal uninitialized is utterly harmless as long
- ** as the value is never used. So really the only thing this code
- ** accomplishes is to quieten purify.
- **
- ** 2007-01-16: The wireshark project (www.wireshark.org) reports that
- ** without this code, their parser segfaults. I'm not sure what there
- ** parser is doing to make this happen. This is the second bug report
- ** from wireshark this week. Clearly they are stressing Lemon in ways
- ** that it has not been previously stressed... (SQLite ticket #2172)
- */
- /*memset(&yygotominor, 0, sizeof(yygotominor));*/
- yygotominor = yyzerominor;
-
-
- if (parserContext->executeRules)
- {
- switch( yyruleno ){
- /* Beginning here are the reduction cases. A typical example
- ** follows:
- ** case 0:
- ** #line <lineno> <grammarfile>
- ** { ... } // User supplied code
- ** #line <lineno> <thisfile>
- ** break;
- */
- case 1: /* cmdlist ::= cmdlist ecmd */
-{parserContext->addQuery(yymsp[0].minor.yy203); DONT_INHERIT_TOKENS("cmdlist");}
- break;
- case 2: /* cmdlist ::= ecmd */
-{parserContext->addQuery(yymsp[0].minor.yy203);}
- break;
- case 3: /* ecmd ::= SEMI */
-{yygotominor.yy203 = new SqliteEmptyQuery();}
- break;
- case 4: /* ecmd ::= explain cmdx SEMI */
-{
- yygotominor.yy203 = yymsp[-1].minor.yy203;
- yygotominor.yy203->explain = yymsp[-2].minor.yy91->explain;
- yygotominor.yy203->queryPlan = yymsp[-2].minor.yy91->queryPlan;
- delete yymsp[-2].minor.yy91;
- objectForTokens = yygotominor.yy203;
- }
- break;
- case 5: /* explain ::= */
-{yygotominor.yy91 = new ParserStubExplain(false, false);}
- break;
- case 6: /* explain ::= EXPLAIN */
-{yygotominor.yy91 = new ParserStubExplain(true, false);}
- break;
- case 7: /* cmdx ::= cmd */
- case 338: /* trigger_cmd ::= update_stmt */ yytestcase(yyruleno==338);
- case 339: /* trigger_cmd ::= insert_stmt */ yytestcase(yyruleno==339);
- case 340: /* trigger_cmd ::= delete_stmt */ yytestcase(yyruleno==340);
- case 341: /* trigger_cmd ::= select_stmt */ yytestcase(yyruleno==341);
-{yygotominor.yy203 = yymsp[0].minor.yy203;}
- break;
- case 8: /* cmd ::= BEGIN trans_opt onconf */
-{
- yygotominor.yy203 = new SqliteBeginTrans(
- yymsp[-1].minor.yy404->transactionKw,
- yymsp[-1].minor.yy404->name,
- *(yymsp[0].minor.yy418)
- );
- delete yymsp[-1].minor.yy404;
- delete yymsp[0].minor.yy418;
- objectForTokens = yygotominor.yy203;
- }
- break;
- case 9: /* trans_opt ::= */
-{yygotominor.yy404 = new ParserStubTransDetails();}
- break;
- case 10: /* trans_opt ::= TRANSACTION */
-{
- yygotominor.yy404 = new ParserStubTransDetails();
- yygotominor.yy404->transactionKw = true;
- }
- break;
- case 11: /* trans_opt ::= TRANSACTION nm */
- case 12: /* trans_opt ::= TRANSACTION ID_TRANS */ yytestcase(yyruleno==12);
-{
- yygotominor.yy404 = new ParserStubTransDetails();
- yygotominor.yy404->transactionKw = true;
- yygotominor.yy404->name = *(yymsp[0].minor.yy319);
- delete yymsp[0].minor.yy319;
- }
- break;
- case 13: /* cmd ::= COMMIT trans_opt */
-{
- yygotominor.yy203 = new SqliteCommitTrans(
- yymsp[0].minor.yy404->transactionKw,
- yymsp[0].minor.yy404->name,
- false
- );
- delete yymsp[0].minor.yy404;
- objectForTokens = yygotominor.yy203;
- }
- break;
- case 14: /* cmd ::= END trans_opt */
-{
- yygotominor.yy203 = new SqliteCommitTrans(
- yymsp[0].minor.yy404->transactionKw,
- yymsp[0].minor.yy404->name,
- true
- );
- delete yymsp[0].minor.yy404;
- objectForTokens = yygotominor.yy203;
- }
- break;
- case 15: /* cmd ::= ROLLBACK trans_opt */
-{
- yygotominor.yy203 = new SqliteRollback(
- yymsp[0].minor.yy404->transactionKw,
- yymsp[0].minor.yy404->name
- );
- delete yymsp[0].minor.yy404;
- objectForTokens = yygotominor.yy203;
- }
- break;
- case 16: /* cmd ::= CREATE temp TABLE fullname LP columnlist conslist_opt RP */
-{
- yygotominor.yy203 = new SqliteCreateTable(
- false,
- *(yymsp[-6].minor.yy226),
- yymsp[-4].minor.yy120->name1,
- yymsp[-4].minor.yy120->name2,
- *(yymsp[-2].minor.yy42),
- *(yymsp[-1].minor.yy13)
- );
- delete yymsp[-6].minor.yy226;
- delete yymsp[-2].minor.yy42;
- delete yymsp[-1].minor.yy13;
- delete yymsp[-4].minor.yy120;
- objectForTokens = yygotominor.yy203;
- }
- break;
- case 17: /* cmd ::= CREATE temp TABLE fullname AS select */
-{
- yygotominor.yy203 = new SqliteCreateTable(
- false,
- *(yymsp[-4].minor.yy226),
- yymsp[-2].minor.yy120->name1,
- yymsp[-2].minor.yy120->name2,
- yymsp[0].minor.yy153
- );
- delete yymsp[-4].minor.yy226;
- delete yymsp[-2].minor.yy120;
- objectForTokens = yygotominor.yy203;
- }
- break;
- case 18: /* cmd ::= CREATE temp TABLE nm DOT ID_TAB_NEW */
-{ yy_destructor(yypParser,157,&yymsp[-4].minor);
- yy_destructor(yypParser,156,&yymsp[-2].minor);
-}
- break;
- case 19: /* cmd ::= CREATE temp TABLE ID_DB|ID_TAB_NEW */
- case 110: /* cmd ::= CREATE temp VIEW ID_VIEW_NEW */ yytestcase(yyruleno==110);
- case 322: /* cmd ::= CREATE temp TRIGGER ID_TRIG_NEW */ yytestcase(yyruleno==322);
-{ yy_destructor(yypParser,157,&yymsp[-2].minor);
-}
- break;
- case 20: /* temp ::= TEMP */
-{yygotominor.yy226 = new int( (yymsp[0].minor.yy0->value.length() > 4) ? 2 : 1 );}
- break;
- case 21: /* temp ::= */
- case 124: /* distinct ::= */ yytestcase(yyruleno==124);
-{yygotominor.yy226 = new int(0);}
- break;
- case 22: /* columnlist ::= columnlist COMMA column */
-{
- yymsp[-2].minor.yy42->append(yymsp[0].minor.yy147);
- yygotominor.yy42 = yymsp[-2].minor.yy42;
- DONT_INHERIT_TOKENS("columnlist");
- }
- break;
- case 23: /* columnlist ::= column */
-{
- yygotominor.yy42 = new ParserCreateTableColumnList();
- yygotominor.yy42->append(yymsp[0].minor.yy147);
- }
- break;
- case 24: /* column ::= columnid type carglist */
-{
- yygotominor.yy147 = new SqliteCreateTable::Column(*(yymsp[-2].minor.yy319), yymsp[-1].minor.yy57, *(yymsp[0].minor.yy371));
- delete yymsp[-2].minor.yy319;
- delete yymsp[0].minor.yy371;
- objectForTokens = yygotominor.yy147;
- }
- break;
- case 25: /* columnid ::= nm */
- case 26: /* columnid ::= ID_COL_NEW */ yytestcase(yyruleno==26);
- case 29: /* nm ::= id */ yytestcase(yyruleno==29);
- case 37: /* typename ::= ids */ yytestcase(yyruleno==37);
- case 156: /* dbnm ::= DOT nm */ yytestcase(yyruleno==156);
- case 169: /* collate ::= COLLATE id */ yytestcase(yyruleno==169);
-{yygotominor.yy319 = yymsp[0].minor.yy319;}
- break;
- case 27: /* id ::= ID */
-{
- yygotominor.yy319 = new QString(
- stripObjName(
- yymsp[0].minor.yy0->value,
- parserContext->dialect
- )
- );
- }
- break;
- case 28: /* ids ::= ID|STRING */
- case 31: /* nm ::= JOIN_KW */ yytestcase(yyruleno==31);
-{yygotominor.yy319 = new QString(yymsp[0].minor.yy0->value);}
- break;
- case 30: /* nm ::= STRING */
-{yygotominor.yy319 = new QString(stripString(yymsp[0].minor.yy0->value));}
- break;
- case 32: /* type ::= */
-{yygotominor.yy57 = nullptr;}
- break;
- case 33: /* type ::= typetoken */
-{yygotominor.yy57 = yymsp[0].minor.yy57;}
- break;
- case 34: /* typetoken ::= typename */
-{
- yygotominor.yy57 = new SqliteColumnType(*(yymsp[0].minor.yy319));
- delete yymsp[0].minor.yy319;
- objectForTokens = yygotominor.yy57;
- }
- break;
- case 35: /* typetoken ::= typename LP signed RP */
-{
- yygotominor.yy57 = new SqliteColumnType(*(yymsp[-3].minor.yy319), *(yymsp[-1].minor.yy69));
- delete yymsp[-3].minor.yy319;
- delete yymsp[-1].minor.yy69;
- objectForTokens = yygotominor.yy57;
- }
- break;
- case 36: /* typetoken ::= typename LP signed COMMA signed RP */
-{
- yygotominor.yy57 = new SqliteColumnType(*(yymsp[-5].minor.yy319), *(yymsp[-3].minor.yy69), *(yymsp[-1].minor.yy69));
- delete yymsp[-5].minor.yy319;
- delete yymsp[-3].minor.yy69;
- delete yymsp[-1].minor.yy69;
- objectForTokens = yygotominor.yy57;
- }
- break;
- case 38: /* typename ::= typename ids */
- case 39: /* typename ::= ID_COL_TYPE */ yytestcase(yyruleno==39);
-{
- yymsp[-1].minor.yy319->append(" " + *(yymsp[0].minor.yy319));
- delete yymsp[0].minor.yy319;
- yygotominor.yy319 = yymsp[-1].minor.yy319;
- }
- break;
- case 40: /* signed ::= plus_num */
- case 41: /* signed ::= minus_num */ yytestcase(yyruleno==41);
- case 307: /* nmnum ::= plus_num */ yytestcase(yyruleno==307);
- case 312: /* plus_num ::= PLUS number */ yytestcase(yyruleno==312);
- case 313: /* plus_num ::= number */ yytestcase(yyruleno==313);
-{yygotominor.yy69 = yymsp[0].minor.yy69;}
- break;
- case 42: /* carglist ::= carglist ccons */
- case 44: /* carglist ::= carglist carg */ yytestcase(yyruleno==44);
-{
- yymsp[-1].minor.yy371->append(yymsp[0].minor.yy304);
- yygotominor.yy371 = yymsp[-1].minor.yy371;
- DONT_INHERIT_TOKENS("carglist");
- }
- break;
- case 43: /* carglist ::= carglist ccons_nm ccons */
-{
- yymsp[-2].minor.yy371->append(yymsp[-1].minor.yy304);
- yymsp[-2].minor.yy371->append(yymsp[0].minor.yy304);
- yygotominor.yy371 = yymsp[-2].minor.yy371;
- DONT_INHERIT_TOKENS("carglist");
- }
- break;
- case 45: /* carglist ::= */
-{yygotominor.yy371 = new ParserCreateTableColumnConstraintList();}
- break;
- case 46: /* carg ::= DEFAULT STRING */
-{
- yygotominor.yy304 = new SqliteCreateTable::Column::Constraint();
- yygotominor.yy304->initDefId(stripObjName(
- yymsp[0].minor.yy0->value,
- parserContext->dialect
- ));
- objectForTokens = yygotominor.yy304;
- }
- break;
- case 47: /* carg ::= DEFAULT ID */
-{
- yygotominor.yy304 = new SqliteCreateTable::Column::Constraint();
- yygotominor.yy304->initDefId(stripObjName(
- yymsp[0].minor.yy0->value,
- parserContext->dialect
- ));
- objectForTokens = yygotominor.yy304;
-
- }
- break;
- case 48: /* carg ::= DEFAULT INTEGER */
- case 49: /* carg ::= DEFAULT PLUS INTEGER */ yytestcase(yyruleno==49);
-{
- yygotominor.yy304 = new SqliteCreateTable::Column::Constraint();
- QVariant val = QVariant(yymsp[0].minor.yy0->value).toLongLong();
- yygotominor.yy304->initDefTerm(val, false);
- objectForTokens = yygotominor.yy304;
- }
- break;
- case 50: /* carg ::= DEFAULT MINUS INTEGER */
-{
- yygotominor.yy304 = new SqliteCreateTable::Column::Constraint();
- QVariant val = QVariant(yymsp[0].minor.yy0->value).toLongLong();
- yygotominor.yy304->initDefTerm(val, true);
- objectForTokens = yygotominor.yy304;
- }
- break;
- case 51: /* carg ::= DEFAULT FLOAT */
- case 52: /* carg ::= DEFAULT PLUS FLOAT */ yytestcase(yyruleno==52);
-{
- yygotominor.yy304 = new SqliteCreateTable::Column::Constraint();
- QVariant val = QVariant(yymsp[0].minor.yy0->value).toDouble();
- yygotominor.yy304->initDefTerm(val, false);
- objectForTokens = yygotominor.yy304;
- }
- break;
- case 53: /* carg ::= DEFAULT MINUS FLOAT */
-{
- yygotominor.yy304 = new SqliteCreateTable::Column::Constraint();
- QVariant val = QVariant(yymsp[0].minor.yy0->value).toDouble();
- yygotominor.yy304->initDefTerm(val, true);
- objectForTokens = yygotominor.yy304;
- }
- break;
- case 54: /* carg ::= DEFAULT NULL */
-{
- yygotominor.yy304 = new SqliteCreateTable::Column::Constraint();
- yygotominor.yy304->initDefTerm(QVariant(), false);
- objectForTokens = yygotominor.yy304;
- }
- break;
- case 55: /* ccons_nm ::= CONSTRAINT nm */
-{
- yygotominor.yy304 = new SqliteCreateTable::Column::Constraint();
- yygotominor.yy304->initDefNameOnly(*(yymsp[0].minor.yy319));
- delete yymsp[0].minor.yy319;
- objectForTokens = yygotominor.yy304;
- }
- break;
- case 56: /* ccons ::= NULL onconf */
-{
- yygotominor.yy304 = new SqliteCreateTable::Column::Constraint();
- yygotominor.yy304->initNull(*(yymsp[0].minor.yy418));
- delete yymsp[0].minor.yy418;
- objectForTokens = yygotominor.yy304;
- }
- break;
- case 57: /* ccons ::= NOT NULL onconf */
-{
- yygotominor.yy304 = new SqliteCreateTable::Column::Constraint();
- yygotominor.yy304->initNotNull(*(yymsp[0].minor.yy418));
- delete yymsp[0].minor.yy418;
- objectForTokens = yygotominor.yy304;
- }
- break;
- case 58: /* ccons ::= PRIMARY KEY sortorder onconf */
-{
- yygotominor.yy304 = new SqliteCreateTable::Column::Constraint();
- yygotominor.yy304->initPk(*(yymsp[-1].minor.yy389), *(yymsp[0].minor.yy418), false);
- delete yymsp[-1].minor.yy389;
- delete yymsp[0].minor.yy418;
- objectForTokens = yygotominor.yy304;
- }
- break;
- case 59: /* ccons ::= UNIQUE onconf */
-{
- yygotominor.yy304 = new SqliteCreateTable::Column::Constraint();
- yygotominor.yy304->initUnique(*(yymsp[0].minor.yy418));
- delete yymsp[0].minor.yy418;
- objectForTokens = yygotominor.yy304;
- }
- break;
- case 60: /* ccons ::= CHECK LP expr RP onconf */
-{
- yygotominor.yy304 = new SqliteCreateTable::Column::Constraint();
- yygotominor.yy304->initCheck(yymsp[-2].minor.yy192, *(yymsp[0].minor.yy418));
- delete yymsp[0].minor.yy418;
- objectForTokens = yygotominor.yy304;
- }
- break;
- case 61: /* ccons ::= REFERENCES nm idxlist_opt refargs */
-{
- yygotominor.yy304 = new SqliteCreateTable::Column::Constraint();
- yygotominor.yy304->initFk(*(yymsp[-2].minor.yy319), *(yymsp[-1].minor.yy63), *(yymsp[0].minor.yy264));
- delete yymsp[-2].minor.yy319;
- delete yymsp[0].minor.yy264;
- delete yymsp[-1].minor.yy63;
- objectForTokens = yygotominor.yy304;
- }
- break;
- case 62: /* ccons ::= defer_subclause */
-{
- yygotominor.yy304 = new SqliteCreateTable::Column::Constraint();
- yygotominor.yy304->initDefer(yymsp[0].minor.yy329->initially, yymsp[0].minor.yy329->deferrable);
- delete yymsp[0].minor.yy329;
- objectForTokens = yygotominor.yy304;
- }
- break;
- case 63: /* ccons ::= COLLATE id */
-{
- yygotominor.yy304 = new SqliteCreateTable::Column::Constraint();
- yygotominor.yy304->initColl(*(yymsp[0].minor.yy319));
- delete yymsp[0].minor.yy319;
- objectForTokens = yygotominor.yy304;
- }
- break;
- case 64: /* ccons ::= CHECK LP RP */
-{
- yygotominor.yy304 = new SqliteCreateTable::Column::Constraint();
- yygotominor.yy304->initCheck();
- objectForTokens = yygotominor.yy304;
- parserContext->minorErrorAfterLastToken("Syntax error");
- }
- break;
- case 65: /* refargs ::= */
-{yygotominor.yy264 = new ParserFkConditionList();}
- break;
- case 66: /* refargs ::= refargs refarg */
-{
- yymsp[-1].minor.yy264->append(yymsp[0].minor.yy187);
- yygotominor.yy264 = yymsp[-1].minor.yy264;
- DONT_INHERIT_TOKENS("refargs");
- }
- break;
- case 67: /* refarg ::= MATCH nm */
-{
- yygotominor.yy187 = new SqliteForeignKey::Condition(*(yymsp[0].minor.yy319));
- delete yymsp[0].minor.yy319;
- }
- break;
- case 68: /* refarg ::= ON INSERT refact */
-{yygotominor.yy187 = new SqliteForeignKey::Condition(SqliteForeignKey::Condition::INSERT, *(yymsp[0].minor.yy424)); delete yymsp[0].minor.yy424;}
- break;
- case 69: /* refarg ::= ON DELETE refact */
-{yygotominor.yy187 = new SqliteForeignKey::Condition(SqliteForeignKey::Condition::DELETE, *(yymsp[0].minor.yy424)); delete yymsp[0].minor.yy424;}
- break;
- case 70: /* refarg ::= ON UPDATE refact */
- case 71: /* refarg ::= MATCH ID_FK_MATCH */ yytestcase(yyruleno==71);
-{yygotominor.yy187 = new SqliteForeignKey::Condition(SqliteForeignKey::Condition::UPDATE, *(yymsp[0].minor.yy424)); delete yymsp[0].minor.yy424;}
- break;
- case 72: /* refact ::= SET NULL */
-{yygotominor.yy424 = new SqliteForeignKey::Condition::Reaction(SqliteForeignKey::Condition::SET_NULL);}
- break;
- case 73: /* refact ::= SET DEFAULT */
-{yygotominor.yy424 = new SqliteForeignKey::Condition::Reaction(SqliteForeignKey::Condition::SET_DEFAULT);}
- break;
- case 74: /* refact ::= CASCADE */
-{yygotominor.yy424 = new SqliteForeignKey::Condition::Reaction(SqliteForeignKey::Condition::CASCADE);}
- break;
- case 75: /* refact ::= RESTRICT */
-{yygotominor.yy424 = new SqliteForeignKey::Condition::Reaction(SqliteForeignKey::Condition::RESTRICT);}
- break;
- case 76: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
-{
- yygotominor.yy329 = new ParserDeferSubClause(SqliteDeferrable::NOT_DEFERRABLE, *(yymsp[0].minor.yy312));
- delete yymsp[0].minor.yy312;
- }
- break;
- case 77: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
-{
- yygotominor.yy329 = new ParserDeferSubClause(SqliteDeferrable::DEFERRABLE, *(yymsp[0].minor.yy312));
- delete yymsp[0].minor.yy312;
- }
- break;
- case 78: /* init_deferred_pred_opt ::= */
-{yygotominor.yy312 = new SqliteInitially(SqliteInitially::null);}
- break;
- case 79: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */
-{yygotominor.yy312 = new SqliteInitially(SqliteInitially::DEFERRED);}
- break;
- case 80: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
-{yygotominor.yy312 = new SqliteInitially(SqliteInitially::IMMEDIATE);}
- break;
- case 81: /* conslist_opt ::= */
-{yygotominor.yy13 = new ParserCreateTableConstraintList();}
- break;
- case 82: /* conslist_opt ::= COMMA conslist */
-{yygotominor.yy13 = yymsp[0].minor.yy13;}
- break;
- case 83: /* conslist ::= conslist tconscomma tcons */
-{
- yymsp[0].minor.yy406->afterComma = *(yymsp[-1].minor.yy291);
- yymsp[-2].minor.yy13->append(yymsp[0].minor.yy406);
- yygotominor.yy13 = yymsp[-2].minor.yy13;
- delete yymsp[-1].minor.yy291;
- DONT_INHERIT_TOKENS("conslist");
- }
- break;
- case 84: /* conslist ::= tcons */
-{
- yygotominor.yy13 = new ParserCreateTableConstraintList();
- yygotominor.yy13->append(yymsp[0].minor.yy406);
- }
- break;
- case 85: /* tconscomma ::= COMMA */
- case 269: /* not_opt ::= NOT */ yytestcase(yyruleno==269);
- case 285: /* uniqueflag ::= UNIQUE */ yytestcase(yyruleno==285);
- case 349: /* database_kw_opt ::= DATABASE */ yytestcase(yyruleno==349);
-{yygotominor.yy291 = new bool(true);}
- break;
- case 86: /* tconscomma ::= */
- case 268: /* not_opt ::= */ yytestcase(yyruleno==268);
- case 286: /* uniqueflag ::= */ yytestcase(yyruleno==286);
- case 350: /* database_kw_opt ::= */ yytestcase(yyruleno==350);
-{yygotominor.yy291 = new bool(false);}
- break;
- case 87: /* tcons ::= CONSTRAINT nm */
-{
- yygotominor.yy406 = new SqliteCreateTable::Constraint();
- yygotominor.yy406->initNameOnly(*(yymsp[0].minor.yy319));
- delete yymsp[0].minor.yy319;
- objectForTokens = yygotominor.yy406;
- }
- break;
- case 88: /* tcons ::= PRIMARY KEY LP idxlist RP onconf */
-{
- yygotominor.yy406 = new SqliteCreateTable::Constraint();
- yygotominor.yy406->initPk(*(yymsp[-2].minor.yy63), false, *(yymsp[0].minor.yy418));
- delete yymsp[0].minor.yy418;
- delete yymsp[-2].minor.yy63;
- objectForTokens = yygotominor.yy406;
- }
- break;
- case 89: /* tcons ::= UNIQUE LP idxlist RP onconf */
-{
- yygotominor.yy406 = new SqliteCreateTable::Constraint();
- yygotominor.yy406->initUnique(*(yymsp[-2].minor.yy63), *(yymsp[0].minor.yy418));
- delete yymsp[0].minor.yy418;
- delete yymsp[-2].minor.yy63;
- objectForTokens = yygotominor.yy406;
- }
- break;
- case 90: /* tcons ::= CHECK LP expr RP onconf */
-{
- yygotominor.yy406 = new SqliteCreateTable::Constraint();
- yygotominor.yy406->initCheck(yymsp[-2].minor.yy192, *(yymsp[0].minor.yy418));
- objectForTokens = yygotominor.yy406;
- }
- break;
- case 91: /* tcons ::= FOREIGN KEY LP idxlist RP REFERENCES nm idxlist_opt refargs defer_subclause_opt */
- case 92: /* tcons ::= CONSTRAINT ID_CONSTR */ yytestcase(yyruleno==92);
- case 93: /* tcons ::= FOREIGN KEY LP idxlist RP REFERENCES ID_TAB */ yytestcase(yyruleno==93);
-{
- yygotominor.yy406 = new SqliteCreateTable::Constraint();
- yygotominor.yy406->initFk(
- *(yymsp[-6].minor.yy63),
- *(yymsp[-3].minor.yy319),
- *(yymsp[-2].minor.yy63),
- *(yymsp[-1].minor.yy264),
- yymsp[0].minor.yy329->initially,
- yymsp[0].minor.yy329->deferrable
- );
- delete yymsp[-3].minor.yy319;
- delete yymsp[-1].minor.yy264;
- delete yymsp[0].minor.yy329;
- delete yymsp[-2].minor.yy63;
- delete yymsp[-6].minor.yy63;
- objectForTokens = yygotominor.yy406;
- }
- break;
- case 94: /* tcons ::= CHECK LP RP onconf */
-{
- yygotominor.yy406 = new SqliteCreateTable::Constraint();
- yygotominor.yy406->initCheck();
- objectForTokens = yygotominor.yy406;
- parserContext->minorErrorAfterLastToken("Syntax error");
- yy_destructor(yypParser,155,&yymsp[0].minor);
-}
- break;
- case 95: /* defer_subclause_opt ::= */
-{yygotominor.yy329 = new ParserDeferSubClause(SqliteDeferrable::null, SqliteInitially::null);}
- break;
- case 96: /* defer_subclause_opt ::= defer_subclause */
-{yygotominor.yy329 = yymsp[0].minor.yy329;}
- break;
- case 97: /* onconf ::= */
- case 99: /* orconf ::= */ yytestcase(yyruleno==99);
-{yygotominor.yy418 = new SqliteConflictAlgo(SqliteConflictAlgo::null);}
- break;
- case 98: /* onconf ::= ON CONFLICT resolvetype */
- case 100: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==100);
-{yygotominor.yy418 = yymsp[0].minor.yy418;}
- break;
- case 101: /* resolvetype ::= ROLLBACK */
- case 102: /* resolvetype ::= ABORT */ yytestcase(yyruleno==102);
- case 103: /* resolvetype ::= FAIL */ yytestcase(yyruleno==103);
- case 104: /* resolvetype ::= IGNORE */ yytestcase(yyruleno==104);
- case 105: /* resolvetype ::= REPLACE */ yytestcase(yyruleno==105);
-{yygotominor.yy418 = new SqliteConflictAlgo(sqliteConflictAlgo(yymsp[0].minor.yy0->value));}
- break;
- case 106: /* cmd ::= DROP TABLE fullname */
-{
- yygotominor.yy203 = new SqliteDropTable(false, yymsp[0].minor.yy120->name1, yymsp[0].minor.yy120->name2);
- delete yymsp[0].minor.yy120;
- objectForTokens = yygotominor.yy203;
- }
- break;
- case 107: /* cmd ::= DROP TABLE nm DOT ID_TAB */
- case 108: /* cmd ::= DROP TABLE ID_DB|ID_TAB */ yytestcase(yyruleno==108);
- case 148: /* singlesrc ::= nm DOT ID_TAB */ yytestcase(yyruleno==148);
- case 149: /* singlesrc ::= ID_DB|ID_TAB */ yytestcase(yyruleno==149);
- case 150: /* singlesrc ::= nm DOT ID_VIEW */ yytestcase(yyruleno==150);
- case 151: /* singlesrc ::= ID_DB|ID_VIEW */ yytestcase(yyruleno==151);
- case 186: /* delete_stmt ::= DELETE FROM nm DOT ID_TAB */ yytestcase(yyruleno==186);
- case 187: /* delete_stmt ::= DELETE FROM ID_DB|ID_TAB */ yytestcase(yyruleno==187);
- case 195: /* update_stmt ::= UPDATE orconf nm DOT ID_TAB */ yytestcase(yyruleno==195);
- case 196: /* update_stmt ::= UPDATE orconf ID_DB|ID_TAB */ yytestcase(yyruleno==196);
- case 263: /* exprx ::= nm DOT ID_TAB|ID_COL */ yytestcase(yyruleno==263);
- case 283: /* cmd ::= CREATE uniqueflag INDEX nm DOT ID_IDX_NEW */ yytestcase(yyruleno==283);
- case 284: /* cmd ::= CREATE uniqueflag INDEX ID_DB|ID_IDX_NEW */ yytestcase(yyruleno==284);
- case 294: /* cmd ::= DROP INDEX nm DOT ID_IDX */ yytestcase(yyruleno==294);
- case 295: /* cmd ::= DROP INDEX ID_DB|ID_IDX */ yytestcase(yyruleno==295);
- case 305: /* cmd ::= PRAGMA nm DOT ID_PRAGMA */ yytestcase(yyruleno==305);
- case 306: /* cmd ::= PRAGMA ID_DB|ID_PRAGMA */ yytestcase(yyruleno==306);
- case 344: /* cmd ::= DROP TRIGGER nm DOT ID_TRIG */ yytestcase(yyruleno==344);
- case 345: /* cmd ::= DROP TRIGGER ID_DB|ID_TRIG */ yytestcase(yyruleno==345);
-{ yy_destructor(yypParser,156,&yymsp[-2].minor);
-}
- break;
- case 109: /* cmd ::= CREATE temp VIEW nm AS select */
-{
- yygotominor.yy203 = new SqliteCreateView(*(yymsp[-4].minor.yy226), false, *(yymsp[-2].minor.yy319), QString::null, yymsp[0].minor.yy153);
- delete yymsp[-4].minor.yy226;
- delete yymsp[-2].minor.yy319;
- objectForTokens = yygotominor.yy203;
- }
- break;
- case 111: /* cmd ::= DROP VIEW nm */
- case 112: /* cmd ::= DROP VIEW ID_VIEW */ yytestcase(yyruleno==112);
-{
- yygotominor.yy203 = new SqliteDropView(false, *(yymsp[0].minor.yy319), QString::null);
- delete yymsp[0].minor.yy319;
- objectForTokens = yygotominor.yy203;
- }
- break;
- case 113: /* cmd ::= select_stmt */
- case 182: /* cmd ::= delete_stmt */ yytestcase(yyruleno==182);
- case 191: /* cmd ::= update_stmt */ yytestcase(yyruleno==191);
- case 203: /* cmd ::= insert_stmt */ yytestcase(yyruleno==203);
-{
- yygotominor.yy203 = yymsp[0].minor.yy203;
- objectForTokens = yygotominor.yy203;
- }
- break;
- case 114: /* select_stmt ::= select */
-{
- yygotominor.yy203 = yymsp[0].minor.yy153;
- // since it's used in trigger:
- objectForTokens = yygotominor.yy203;
- }
- break;
- case 115: /* select ::= oneselect */
-{
- yygotominor.yy153 = SqliteSelect::append(yymsp[0].minor.yy150);
- objectForTokens = yygotominor.yy153;
- }
- break;
- case 116: /* select ::= select multiselect_op oneselect */
-{
- yygotominor.yy153 = SqliteSelect::append(yymsp[-2].minor.yy153, *(yymsp[-1].minor.yy382), yymsp[0].minor.yy150);
- delete yymsp[-1].minor.yy382;
- objectForTokens = yygotominor.yy153;
- }
- break;
- case 117: /* multiselect_op ::= UNION */
-{yygotominor.yy382 = new SqliteSelect::CompoundOperator(SqliteSelect::CompoundOperator::UNION);}
- break;
- case 118: /* multiselect_op ::= UNION ALL */
-{yygotominor.yy382 = new SqliteSelect::CompoundOperator(SqliteSelect::CompoundOperator::UNION_ALL);}
- break;
- case 119: /* multiselect_op ::= EXCEPT */
-{yygotominor.yy382 = new SqliteSelect::CompoundOperator(SqliteSelect::CompoundOperator::EXCEPT);}
- break;
- case 120: /* multiselect_op ::= INTERSECT */
-{yygotominor.yy382 = new SqliteSelect::CompoundOperator(SqliteSelect::CompoundOperator::INTERSECT);}
- break;
- case 121: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
-{
- yygotominor.yy150 = new SqliteSelect::Core(
- *(yymsp[-7].minor.yy226),
- *(yymsp[-6].minor.yy213),
- yymsp[-5].minor.yy31,
- yymsp[-4].minor.yy192,
- *(yymsp[-3].minor.yy231),
- yymsp[-2].minor.yy192,
- *(yymsp[-1].minor.yy243),
- yymsp[0].minor.yy324
- );
- delete yymsp[-6].minor.yy213;
- delete yymsp[-7].minor.yy226;
- delete yymsp[-3].minor.yy231;
- delete yymsp[-1].minor.yy243;
- objectForTokens = yygotominor.yy150;
- }
- break;
- case 122: /* distinct ::= DISTINCT */
-{yygotominor.yy226 = new int(1);}
- break;
- case 123: /* distinct ::= ALL */
-{yygotominor.yy226 = new int(2);}
- break;
- case 125: /* sclp ::= selcollist COMMA */
-{yygotominor.yy213 = yymsp[-1].minor.yy213;}
- break;
- case 126: /* sclp ::= */
-{yygotominor.yy213 = new ParserResultColumnList();}
- break;
- case 127: /* selcollist ::= sclp expr as */
-{
- SqliteSelect::Core::ResultColumn* obj =
- new SqliteSelect::Core::ResultColumn(
- yymsp[-1].minor.yy192,
- yymsp[0].minor.yy40 ? yymsp[0].minor.yy40->asKw : false,
- yymsp[0].minor.yy40 ? yymsp[0].minor.yy40->name : QString::null
- );
-
- yymsp[-2].minor.yy213->append(obj);
- yygotominor.yy213 = yymsp[-2].minor.yy213;
- delete yymsp[0].minor.yy40;
- objectForTokens = obj;
- DONT_INHERIT_TOKENS("sclp");
- }
- break;
- case 128: /* selcollist ::= sclp STAR */
-{
- SqliteSelect::Core::ResultColumn* obj =
- new SqliteSelect::Core::ResultColumn(true);
-
- yymsp[-1].minor.yy213->append(obj);
- yygotominor.yy213 = yymsp[-1].minor.yy213;
- objectForTokens = obj;
- DONT_INHERIT_TOKENS("sclp");
- }
- break;
- case 129: /* selcollist ::= sclp nm DOT STAR */
-{
- SqliteSelect::Core::ResultColumn* obj =
- new SqliteSelect::Core::ResultColumn(
- true,
- *(yymsp[-2].minor.yy319)
- );
- yymsp[-3].minor.yy213->append(obj);
- yygotominor.yy213 = yymsp[-3].minor.yy213;
- delete yymsp[-2].minor.yy319;
- objectForTokens = obj;
- DONT_INHERIT_TOKENS("sclp");
- }
- break;
- case 130: /* selcollist ::= sclp */
- case 131: /* selcollist ::= sclp ID_TAB DOT STAR */ yytestcase(yyruleno==131);
-{
- parserContext->minorErrorBeforeNextToken("Syntax error");
- yygotominor.yy213 = yymsp[0].minor.yy213;
- }
- break;
- case 132: /* as ::= AS nm */
-{
- yygotominor.yy40 = new ParserStubAlias(*(yymsp[0].minor.yy319), true);
- delete yymsp[0].minor.yy319;
- }
- break;
- case 133: /* as ::= ids */
- case 134: /* as ::= AS ID_ALIAS */ yytestcase(yyruleno==134);
- case 135: /* as ::= ID_ALIAS */ yytestcase(yyruleno==135);
-{
- yygotominor.yy40 = new ParserStubAlias(*(yymsp[0].minor.yy319), false);
- delete yymsp[0].minor.yy319;
- }
- break;
- case 136: /* as ::= */
-{yygotominor.yy40 = nullptr;}
- break;
- case 137: /* from ::= */
-{yygotominor.yy31 = nullptr;}
- break;
- case 138: /* from ::= FROM joinsrc */
-{yygotominor.yy31 = yymsp[0].minor.yy31;}
- break;
- case 139: /* joinsrc ::= singlesrc seltablist */
-{
- yygotominor.yy31 = new SqliteSelect::Core::JoinSource(
- yymsp[-1].minor.yy121,
- *(yymsp[0].minor.yy131)
- );
- delete yymsp[0].minor.yy131;
- objectForTokens = yygotominor.yy31;
- }
- break;
- case 140: /* joinsrc ::= */
-{
- parserContext->minorErrorBeforeNextToken("Syntax error");
- yygotominor.yy31 = new SqliteSelect::Core::JoinSource();
- objectForTokens = yygotominor.yy31;
- }
- break;
- case 141: /* seltablist ::= seltablist joinop singlesrc joinconstr_opt */
-{
- SqliteSelect::Core::JoinSourceOther* src =
- new SqliteSelect::Core::JoinSourceOther(yymsp[-2].minor.yy221, yymsp[-1].minor.yy121, yymsp[0].minor.yy455);
-
- yymsp[-3].minor.yy131->append(src);
- yygotominor.yy131 = yymsp[-3].minor.yy131;
- objectForTokens = src;
- DONT_INHERIT_TOKENS("seltablist");
- }
- break;
- case 142: /* seltablist ::= */
-{
- yygotominor.yy131 = new ParserOtherSourceList();
- }
- break;
- case 143: /* singlesrc ::= nm dbnm as */
-{
- yygotominor.yy121 = new SqliteSelect::Core::SingleSource(
- *(yymsp[-2].minor.yy319),
- *(yymsp[-1].minor.yy319),
- yymsp[0].minor.yy40 ? yymsp[0].minor.yy40->asKw : false,
- yymsp[0].minor.yy40 ? yymsp[0].minor.yy40->name : QString::null,
- false,
- QString::null
- );
- delete yymsp[-2].minor.yy319;
- delete yymsp[-1].minor.yy319;
- delete yymsp[0].minor.yy40;
- objectForTokens = yygotominor.yy121;
- }
- break;
- case 144: /* singlesrc ::= LP select RP as */
-{
- yygotominor.yy121 = new SqliteSelect::Core::SingleSource(
- yymsp[-2].minor.yy153,
- yymsp[0].minor.yy40 ? yymsp[0].minor.yy40->asKw : false,
- yymsp[0].minor.yy40 ? yymsp[0].minor.yy40->name : QString::null
- );
- delete yymsp[0].minor.yy40;
- objectForTokens = yygotominor.yy121;
- }
- break;
- case 145: /* singlesrc ::= LP joinsrc RP as */
-{
- yygotominor.yy121 = new SqliteSelect::Core::SingleSource(
- yymsp[-2].minor.yy31,
- yymsp[0].minor.yy40 ? yymsp[0].minor.yy40->asKw : false,
- yymsp[0].minor.yy40 ? yymsp[0].minor.yy40->name : QString::null
- );
- delete yymsp[0].minor.yy40;
- objectForTokens = yygotominor.yy121;
- }
- break;
- case 146: /* singlesrc ::= */
-{
- parserContext->minorErrorBeforeNextToken("Syntax error");
- yygotominor.yy121 = new SqliteSelect::Core::SingleSource();
- objectForTokens = yygotominor.yy121;
- }
- break;
- case 147: /* singlesrc ::= nm DOT */
-{
- parserContext->minorErrorBeforeNextToken("Syntax error");
- yygotominor.yy121 = new SqliteSelect::Core::SingleSource();
- yygotominor.yy121->database = *(yymsp[-1].minor.yy319);
- delete yymsp[-1].minor.yy319;
- objectForTokens = yygotominor.yy121;
- }
- break;
- case 152: /* joinconstr_opt ::= ON expr */
-{
- yygotominor.yy455 = new SqliteSelect::Core::JoinConstraint(yymsp[0].minor.yy192);
- objectForTokens = yygotominor.yy455;
- }
- break;
- case 153: /* joinconstr_opt ::= USING LP idlist RP */
-{
- yygotominor.yy455 = new SqliteSelect::Core::JoinConstraint(*(yymsp[-1].minor.yy95));
- delete yymsp[-1].minor.yy95;
- objectForTokens = yygotominor.yy455;
- }
- break;
- case 154: /* joinconstr_opt ::= */
-{yygotominor.yy455 = nullptr;}
- break;
- case 155: /* dbnm ::= */
-{yygotominor.yy319 = new QString();}
- break;
- case 157: /* fullname ::= nm dbnm */
-{
- yygotominor.yy120 = new ParserFullName();
- yygotominor.yy120->name1 = *(yymsp[-1].minor.yy319);
- yygotominor.yy120->name2 = *(yymsp[0].minor.yy319);
- delete yymsp[-1].minor.yy319;
- delete yymsp[0].minor.yy319;
- }
- break;
- case 158: /* joinop ::= COMMA */
-{
- yygotominor.yy221 = new SqliteSelect::Core::JoinOp(true);
- objectForTokens = yygotominor.yy221;
- }
- break;
- case 159: /* joinop ::= JOIN */
-{
- yygotominor.yy221 = new SqliteSelect::Core::JoinOp(false);
- objectForTokens = yygotominor.yy221;
- }
- break;
- case 160: /* joinop ::= JOIN_KW JOIN */
-{
- yygotominor.yy221 = new SqliteSelect::Core::JoinOp(yymsp[-1].minor.yy0->value);
- objectForTokens = yygotominor.yy221;
- }
- break;
- case 161: /* joinop ::= JOIN_KW nm JOIN */
-{
- yygotominor.yy221 = new SqliteSelect::Core::JoinOp(yymsp[-2].minor.yy0->value, *(yymsp[-1].minor.yy319));
- delete yymsp[-1].minor.yy319;
- objectForTokens = yygotominor.yy221;
- }
- break;
- case 162: /* joinop ::= JOIN_KW nm nm JOIN */
- case 163: /* joinop ::= ID_JOIN_OPTS */ yytestcase(yyruleno==163);
-{
- yygotominor.yy221 = new SqliteSelect::Core::JoinOp(yymsp[-3].minor.yy0->value, *(yymsp[-2].minor.yy319), *(yymsp[-1].minor.yy319));
- delete yymsp[-2].minor.yy319;
- delete yymsp[-2].minor.yy319;
- objectForTokens = yygotominor.yy221;
- }
- break;
- case 164: /* orderby_opt ::= */
-{yygotominor.yy243 = new ParserOrderByList();}
- break;
- case 165: /* orderby_opt ::= ORDER BY sortlist */
-{yygotominor.yy243 = yymsp[0].minor.yy243;}
- break;
- case 166: /* sortlist ::= sortlist COMMA collate expr sortorder */
-{
- SqliteOrderBy* obj;
- if (yymsp[-2].minor.yy319)
- {
- SqliteExpr* coll = new SqliteExpr();
- coll->initCollate(yymsp[-1].minor.yy192, *(yymsp[-2].minor.yy319));
- delete yymsp[-2].minor.yy319;
- obj = new SqliteOrderBy(coll, *(yymsp[0].minor.yy389));
- }
- else
- {
- obj = new SqliteOrderBy(yymsp[-1].minor.yy192, *(yymsp[0].minor.yy389));
- }
- yymsp[-4].minor.yy243->append(obj);
- yygotominor.yy243 = yymsp[-4].minor.yy243;
- delete yymsp[0].minor.yy389;
- objectForTokens = obj;
- DONT_INHERIT_TOKENS("sortlist");
- }
- break;
- case 167: /* sortlist ::= expr collate sortorder */
-{
- SqliteOrderBy* obj;
- if (yymsp[-1].minor.yy319)
- {
- SqliteExpr* coll = new SqliteExpr();
- coll->initCollate(yymsp[-2].minor.yy192, *(yymsp[-1].minor.yy319));
- delete yymsp[-1].minor.yy319;
- obj = new SqliteOrderBy(coll, *(yymsp[0].minor.yy389));
- }
- else
- {
- obj = new SqliteOrderBy(yymsp[-2].minor.yy192, *(yymsp[0].minor.yy389));
- }
- yygotominor.yy243 = new ParserOrderByList();
- yygotominor.yy243->append(obj);
- delete yymsp[0].minor.yy389;
- objectForTokens = obj;
- }
- break;
- case 168: /* collate ::= */
-{yygotominor.yy319 = nullptr;}
- break;
- case 170: /* sortorder ::= ASC */
-{yygotominor.yy389 = new SqliteSortOrder(SqliteSortOrder::ASC);}
- break;
- case 171: /* sortorder ::= DESC */
-{yygotominor.yy389 = new SqliteSortOrder(SqliteSortOrder::DESC);}
- break;
- case 172: /* sortorder ::= */
-{yygotominor.yy389 = new SqliteSortOrder(SqliteSortOrder::null);}
- break;
- case 173: /* groupby_opt ::= */
- case 278: /* exprlist ::= */ yytestcase(yyruleno==278);
-{yygotominor.yy231 = new ParserExprList();}
- break;
- case 174: /* groupby_opt ::= GROUP BY nexprlist */
- case 277: /* exprlist ::= nexprlist */ yytestcase(yyruleno==277);
-{yygotominor.yy231 = yymsp[0].minor.yy231;}
- break;
- case 175: /* groupby_opt ::= GROUP BY */
-{
- parserContext->minorErrorBeforeNextToken("Syntax error");
- yygotominor.yy231 = new ParserExprList();
- }
- break;
- case 176: /* having_opt ::= */
- case 188: /* where_opt ::= */ yytestcase(yyruleno==188);
- case 274: /* case_else ::= */ yytestcase(yyruleno==274);
- case 276: /* case_operand ::= */ yytestcase(yyruleno==276);
- case 334: /* when_clause ::= */ yytestcase(yyruleno==334);
- case 347: /* key_opt ::= */ yytestcase(yyruleno==347);
-{yygotominor.yy192 = nullptr;}
- break;
- case 177: /* having_opt ::= HAVING expr */
- case 189: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==189);
- case 266: /* expr ::= exprx */ yytestcase(yyruleno==266);
- case 273: /* case_else ::= ELSE expr */ yytestcase(yyruleno==273);
- case 275: /* case_operand ::= exprx */ yytestcase(yyruleno==275);
- case 335: /* when_clause ::= WHEN expr */ yytestcase(yyruleno==335);
-{yygotominor.yy192 = yymsp[0].minor.yy192;}
- break;
- case 178: /* limit_opt ::= */
-{yygotominor.yy324 = nullptr;}
- break;
- case 179: /* limit_opt ::= LIMIT signed */
-{
- yygotominor.yy324 = new SqliteLimit(*(yymsp[0].minor.yy69));
- delete yymsp[0].minor.yy69;
- objectForTokens = yygotominor.yy324;
- }
- break;
- case 180: /* limit_opt ::= LIMIT signed OFFSET signed */
-{
- SqliteExpr* expr1 = new SqliteExpr();
- expr1->initLiteral(*(yymsp[-2].minor.yy69));
- expr1->setParent(yygotominor.yy324);
-
- SqliteExpr* expr2 = new SqliteExpr();
- expr1->initLiteral(*(yymsp[0].minor.yy69));
- expr1->setParent(yygotominor.yy324);
-
- yygotominor.yy324 = new SqliteLimit(expr1, expr2, true);
-
- TokenPtr limitToken = TokenPtr::create(Token::INTEGER, yymsp[-2].minor.yy69->toString());
- parserContext->addManagedToken(limitToken);
- expr1->tokens << limitToken;
- expr1->tokensMap["term"] << limitToken;
-
- TokenPtr offsetToken = TokenPtr::create(Token::INTEGER, yymsp[0].minor.yy69->toString());
- parserContext->addManagedToken(offsetToken);
- expr2->tokens << offsetToken;
- expr2->tokensMap["term"] << offsetToken;
-
- delete yymsp[-2].minor.yy69;
- delete yymsp[0].minor.yy69;
- objectForTokens = yygotominor.yy324;
- }
- break;
- case 181: /* limit_opt ::= LIMIT signed COMMA signed */
-{
- SqliteExpr* expr1 = new SqliteExpr();
- expr1->initLiteral(*(yymsp[-2].minor.yy69));
- expr1->setParent(yygotominor.yy324);
-
- SqliteExpr* expr2 = new SqliteExpr();
- expr1->initLiteral(*(yymsp[0].minor.yy69));
- expr1->setParent(yygotominor.yy324);
-
- yygotominor.yy324 = new SqliteLimit(expr1, expr2, false);
-
- TokenPtr limitToken = TokenPtr::create(Token::INTEGER, yymsp[-2].minor.yy69->toString());
- parserContext->addManagedToken(limitToken);
- expr1->tokens << limitToken;
- expr1->tokensMap["term"] << limitToken;
-
- TokenPtr offsetToken = TokenPtr::create(Token::INTEGER, yymsp[0].minor.yy69->toString());
- parserContext->addManagedToken(offsetToken);
- expr2->tokens << offsetToken;
- expr2->tokensMap["term"] << offsetToken;
-
- delete yymsp[-2].minor.yy69;
- delete yymsp[0].minor.yy69;
- objectForTokens = yygotominor.yy324;
- }
- break;
- case 183: /* delete_stmt ::= DELETE FROM fullname where_opt */
-{
- yygotominor.yy203 = new SqliteDelete(
- yymsp[-1].minor.yy120->name1,
- yymsp[-1].minor.yy120->name2,
- false,
- yymsp[0].minor.yy192,
- nullptr
- );
- delete yymsp[-1].minor.yy120;
- // since it's used in trigger:
- objectForTokens = yygotominor.yy203;
- }
- break;
- case 184: /* delete_stmt ::= DELETE FROM */
-{
- parserContext->minorErrorBeforeNextToken("Syntax error");
- SqliteDelete* q = new SqliteDelete();
- yygotominor.yy203 = q;
- objectForTokens = yygotominor.yy203;
- }
- break;
- case 185: /* delete_stmt ::= DELETE FROM nm DOT */
-{
- parserContext->minorErrorBeforeNextToken("Syntax error");
- SqliteDelete* q = new SqliteDelete();
- q->database = *(yymsp[-1].minor.yy319);
- yygotominor.yy203 = q;
- objectForTokens = yygotominor.yy203;
- delete yymsp[-1].minor.yy319;
- }
- break;
- case 190: /* where_opt ::= WHERE */
-{
- parserContext->minorErrorBeforeNextToken("Syntax error");
- yygotominor.yy192 = new SqliteExpr();
- }
- break;
- case 192: /* update_stmt ::= UPDATE orconf fullname SET setlist where_opt */
-{
- yygotominor.yy203 = new SqliteUpdate(
- *(yymsp[-4].minor.yy418),
- yymsp[-3].minor.yy120->name1,
- yymsp[-3].minor.yy120->name2,
- false,
- QString::null,
- *(yymsp[-1].minor.yy201),
- yymsp[0].minor.yy192,
- nullptr
- );
- delete yymsp[-4].minor.yy418;
- delete yymsp[-3].minor.yy120;
- delete yymsp[-1].minor.yy201;
- // since it's used in trigger:
- objectForTokens = yygotominor.yy203;
- }
- break;
- case 193: /* update_stmt ::= UPDATE orconf */
-{
- parserContext->minorErrorBeforeNextToken("Syntax error");
- yygotominor.yy203 = new SqliteUpdate();
- objectForTokens = yygotominor.yy203;
- delete yymsp[0].minor.yy418;
- }
- break;
- case 194: /* update_stmt ::= UPDATE orconf nm DOT */
-{
- parserContext->minorErrorBeforeNextToken("Syntax error");
- SqliteUpdate* q = new SqliteUpdate();
- q->database = *(yymsp[-1].minor.yy319);
- yygotominor.yy203 = q;
- objectForTokens = yygotominor.yy203;
- delete yymsp[-2].minor.yy418;
- delete yymsp[-1].minor.yy319;
- }
- break;
- case 197: /* setlist ::= setlist COMMA nm EQ expr */
-{
- yymsp[-4].minor.yy201->append(ParserSetValue(*(yymsp[-2].minor.yy319), yymsp[0].minor.yy192));
- yygotominor.yy201 = yymsp[-4].minor.yy201;
- delete yymsp[-2].minor.yy319;
- DONT_INHERIT_TOKENS("setlist");
- }
- break;
- case 198: /* setlist ::= nm EQ expr */
-{
- yygotominor.yy201 = new ParserSetValueList();
- yygotominor.yy201->append(ParserSetValue(*(yymsp[-2].minor.yy319), yymsp[0].minor.yy192));
- delete yymsp[-2].minor.yy319;
- }
- break;
- case 199: /* setlist ::= */
-{
- parserContext->minorErrorBeforeNextToken("Syntax error");
- yygotominor.yy201 = new ParserSetValueList();
- }
- break;
- case 200: /* setlist ::= setlist COMMA */
-{
- parserContext->minorErrorBeforeNextToken("Syntax error");
- yygotominor.yy201 = yymsp[-1].minor.yy201;
- }
- break;
- case 201: /* setlist ::= setlist COMMA ID_COL */
- case 202: /* setlist ::= ID_COL */ yytestcase(yyruleno==202);
-{ yy_destructor(yypParser,216,&yymsp[-2].minor);
-}
- break;
- case 204: /* insert_stmt ::= insert_cmd INTO fullname idlist_opt VALUES LP exprlist RP */
-{
- yygotominor.yy203 = new SqliteInsert(
- yymsp[-7].minor.yy344->replace,
- yymsp[-7].minor.yy344->orConflict,
- yymsp[-5].minor.yy120->name1,
- yymsp[-5].minor.yy120->name2,
- *(yymsp[-4].minor.yy95),
- *(yymsp[-1].minor.yy231),
- nullptr
- );
- delete yymsp[-5].minor.yy120;
- delete yymsp[-7].minor.yy344;
- delete yymsp[-1].minor.yy231;
- delete yymsp[-4].minor.yy95;
- // since it's used in trigger:
- objectForTokens = yygotominor.yy203;
- }
- break;
- case 205: /* insert_stmt ::= insert_cmd INTO fullname idlist_opt select */
-{
- yygotominor.yy203 = new SqliteInsert(
- yymsp[-4].minor.yy344->replace,
- yymsp[-4].minor.yy344->orConflict,
- yymsp[-2].minor.yy120->name1,
- yymsp[-2].minor.yy120->name2,
- *(yymsp[-1].minor.yy95),
- yymsp[0].minor.yy153,
- nullptr
- );
- delete yymsp[-2].minor.yy120;
- delete yymsp[-4].minor.yy344;
- delete yymsp[-1].minor.yy95;
- // since it's used in trigger:
- objectForTokens = yygotominor.yy203;
- }
- break;
- case 206: /* insert_stmt ::= insert_cmd INTO */
-{
- parserContext->minorErrorBeforeNextToken("Syntax error");
- SqliteInsert* q = new SqliteInsert();
- q->replaceKw = yymsp[-1].minor.yy344->replace;
- q->onConflict = yymsp[-1].minor.yy344->orConflict;
- yygotominor.yy203 = q;
- objectForTokens = yygotominor.yy203;
- delete yymsp[-1].minor.yy344;
- }
- break;
- case 207: /* insert_stmt ::= insert_cmd INTO nm DOT */
-{
- parserContext->minorErrorBeforeNextToken("Syntax error");
- SqliteInsert* q = new SqliteInsert();
- q->replaceKw = yymsp[-3].minor.yy344->replace;
- q->onConflict = yymsp[-3].minor.yy344->orConflict;
- q->database = *(yymsp[-1].minor.yy319);
- yygotominor.yy203 = q;
- objectForTokens = yygotominor.yy203;
- delete yymsp[-3].minor.yy344;
- delete yymsp[-1].minor.yy319;
- }
- break;
- case 208: /* insert_stmt ::= insert_cmd INTO ID_DB|ID_TAB */
-{ yy_destructor(yypParser,218,&yymsp[-2].minor);
-}
- break;
- case 209: /* insert_stmt ::= insert_cmd INTO nm DOT ID_TAB */
-{ yy_destructor(yypParser,218,&yymsp[-4].minor);
- yy_destructor(yypParser,156,&yymsp[-2].minor);
-}
- break;
- case 210: /* insert_cmd ::= INSERT orconf */
-{
- yygotominor.yy344 = new ParserStubInsertOrReplace(false, *(yymsp[0].minor.yy418));
- delete yymsp[0].minor.yy418;
- }
- break;
- case 211: /* insert_cmd ::= REPLACE */
-{yygotominor.yy344 = new ParserStubInsertOrReplace(true);}
- break;
- case 212: /* idlist_opt ::= */
-{yygotominor.yy95 = new QStringList();}
- break;
- case 213: /* idlist_opt ::= LP idlist RP */
-{yygotominor.yy95 = yymsp[-1].minor.yy95;}
- break;
- case 214: /* idlist ::= idlist COMMA nm */
-{
- yymsp[-2].minor.yy95->append(*(yymsp[0].minor.yy319));
- yygotominor.yy95 = yymsp[-2].minor.yy95;
- delete yymsp[0].minor.yy319;
- DONT_INHERIT_TOKENS("idlist");
- }
- break;
- case 215: /* idlist ::= nm */
-{
- yygotominor.yy95 = new QStringList();
- yygotominor.yy95->append(*(yymsp[0].minor.yy319));
- delete yymsp[0].minor.yy319;
- }
- break;
- case 216: /* idlist ::= */
-{
- parserContext->minorErrorBeforeNextToken("Syntax error");
- yygotominor.yy95 = new QStringList();
- }
- break;
- case 217: /* idlist ::= idlist COMMA ID_COL */
- case 218: /* idlist ::= ID_COL */ yytestcase(yyruleno==218);
-{ yy_destructor(yypParser,210,&yymsp[-2].minor);
-}
- break;
- case 219: /* exprx ::= NULL */
-{
- yygotominor.yy192 = new SqliteExpr();
- yygotominor.yy192->initNull();
- objectForTokens = yygotominor.yy192;
- }
- break;
- case 220: /* exprx ::= INTEGER */
-{
- yygotominor.yy192 = new SqliteExpr();
- QVariant val = QVariant(yymsp[0].minor.yy0->value).toLongLong();
- yygotominor.yy192->initLiteral(val);
- objectForTokens = yygotominor.yy192;
- }
- break;
- case 221: /* exprx ::= FLOAT */
-{
- yygotominor.yy192 = new SqliteExpr();
- QVariant val = QVariant(yymsp[0].minor.yy0->value).toDouble();
- yygotominor.yy192->initLiteral(val);
- objectForTokens = yygotominor.yy192;
- }
- break;
- case 222: /* exprx ::= STRING */
-{
- yygotominor.yy192 = new SqliteExpr();
- yygotominor.yy192->initLiteral(QVariant(yymsp[0].minor.yy0->value));
- objectForTokens = yygotominor.yy192;
- }
- break;
- case 223: /* exprx ::= LP expr RP */
-{
- yygotominor.yy192 = new SqliteExpr();
- yygotominor.yy192->initSubExpr(yymsp[-1].minor.yy192);
- objectForTokens = yygotominor.yy192;
- }
- break;
- case 224: /* exprx ::= id */
-{
- yygotominor.yy192 = new SqliteExpr();
- yygotominor.yy192->initId(*(yymsp[0].minor.yy319));
- delete yymsp[0].minor.yy319;
- objectForTokens = yygotominor.yy192;
- }
- break;
- case 225: /* exprx ::= JOIN_KW */
-{
- yygotominor.yy192 = new SqliteExpr();
- yygotominor.yy192->initId(yymsp[0].minor.yy0->value);
- objectForTokens = yygotominor.yy192;
- }
- break;
- case 226: /* exprx ::= nm DOT nm */
-{
- yygotominor.yy192 = new SqliteExpr();
- yygotominor.yy192->initId(*(yymsp[-2].minor.yy319), *(yymsp[0].minor.yy319));
- delete yymsp[-2].minor.yy319;
- delete yymsp[0].minor.yy319;
- objectForTokens = yygotominor.yy192;
- }
- break;
- case 227: /* exprx ::= nm DOT nm DOT nm */
-{
- yygotominor.yy192 = new SqliteExpr();
- yygotominor.yy192->initId(*(yymsp[-4].minor.yy319), *(yymsp[-2].minor.yy319), *(yymsp[0].minor.yy319));
- delete yymsp[-4].minor.yy319;
- delete yymsp[-2].minor.yy319;
- delete yymsp[0].minor.yy319;
- objectForTokens = yygotominor.yy192;
- }
- break;
- case 228: /* exprx ::= VARIABLE */
-{
- yygotominor.yy192 = new SqliteExpr();
- yygotominor.yy192->initBindParam(yymsp[0].minor.yy0->value);
- objectForTokens = yygotominor.yy192;
- }
- break;
- case 229: /* exprx ::= ID LP exprlist RP */
-{
- yygotominor.yy192 = new SqliteExpr();
- yygotominor.yy192->initFunction(yymsp[-3].minor.yy0->value, false, *(yymsp[-1].minor.yy231));
- delete yymsp[-1].minor.yy231;
- objectForTokens = yygotominor.yy192;
- }
- break;
- case 230: /* exprx ::= ID LP STAR RP */
-{
- yygotominor.yy192 = new SqliteExpr();
- yygotominor.yy192->initFunction(yymsp[-3].minor.yy0->value, true);
- objectForTokens = yygotominor.yy192;
- }
- break;
- case 231: /* exprx ::= expr AND expr */
- case 232: /* exprx ::= expr OR expr */ yytestcase(yyruleno==232);
- case 233: /* exprx ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==233);
- case 234: /* exprx ::= expr EQ|NE expr */ yytestcase(yyruleno==234);
- case 235: /* exprx ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==235);
- case 236: /* exprx ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==236);
- case 237: /* exprx ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==237);
- case 238: /* exprx ::= expr CONCAT expr */ yytestcase(yyruleno==238);
-{
- yygotominor.yy192 = new SqliteExpr();
- yygotominor.yy192->initBinOp(yymsp[-2].minor.yy192, yymsp[-1].minor.yy0->value, yymsp[0].minor.yy192);
- objectForTokens = yygotominor.yy192;
- }
- break;
- case 239: /* exprx ::= expr not_opt likeop expr */
-{
- yygotominor.yy192 = new SqliteExpr();
- yygotominor.yy192->initLike(yymsp[-3].minor.yy192, *(yymsp[-2].minor.yy291), *(yymsp[-1].minor.yy41), yymsp[0].minor.yy192);
- delete yymsp[-2].minor.yy291;
- delete yymsp[-1].minor.yy41;
- objectForTokens = yygotominor.yy192;
- }
- break;
- case 240: /* exprx ::= expr ISNULL|NOTNULL */
-{
- yygotominor.yy192 = new SqliteExpr();
- yygotominor.yy192->initNull(yymsp[-1].minor.yy192, yymsp[0].minor.yy0->value);
- objectForTokens = yygotominor.yy192;
- }
- break;
- case 241: /* exprx ::= expr NOT NULL */
-{
- yygotominor.yy192 = new SqliteExpr();
- yygotominor.yy192->initNull(yymsp[-2].minor.yy192, "NOT NULL");
- objectForTokens = yygotominor.yy192;
- }
- break;
- case 242: /* exprx ::= expr IS not_opt expr */
-{
- yygotominor.yy192 = new SqliteExpr();
- yygotominor.yy192->initIs(yymsp[-3].minor.yy192, *(yymsp[-1].minor.yy291), yymsp[0].minor.yy192);
- delete yymsp[-1].minor.yy291;
- objectForTokens = yygotominor.yy192;
- }
- break;
- case 243: /* exprx ::= NOT expr */
-{
- yygotominor.yy192 = new SqliteExpr();
- yygotominor.yy192->initUnaryOp(yymsp[0].minor.yy192, yymsp[-1].minor.yy0->value);
- }
- break;
- case 244: /* exprx ::= BITNOT expr */
- case 245: /* exprx ::= MINUS expr */ yytestcase(yyruleno==245);
- case 246: /* exprx ::= PLUS expr */ yytestcase(yyruleno==246);
-{
- yygotominor.yy192 = new SqliteExpr();
- yygotominor.yy192->initUnaryOp(yymsp[0].minor.yy192, yymsp[-1].minor.yy0->value);
- objectForTokens = yygotominor.yy192;
- }
- break;
- case 247: /* exprx ::= expr not_opt BETWEEN expr AND expr */
-{
- yygotominor.yy192 = new SqliteExpr();
- yygotominor.yy192->initBetween(yymsp[-5].minor.yy192, *(yymsp[-4].minor.yy291), yymsp[-2].minor.yy192, yymsp[0].minor.yy192);
- delete yymsp[-4].minor.yy291;
- objectForTokens = yygotominor.yy192;
- }
- break;
- case 248: /* exprx ::= expr not_opt IN LP exprlist RP */
-{
- yygotominor.yy192 = new SqliteExpr();
- yygotominor.yy192->initIn(yymsp[-5].minor.yy192, *(yymsp[-4].minor.yy291), *(yymsp[-1].minor.yy231));
- delete yymsp[-4].minor.yy291;
- delete yymsp[-1].minor.yy231;
- objectForTokens = yygotominor.yy192;
- }
- break;
- case 249: /* exprx ::= expr not_opt IN LP select RP */
-{
- yygotominor.yy192 = new SqliteExpr();
- yygotominor.yy192->initIn(yymsp[-5].minor.yy192, *(yymsp[-4].minor.yy291), yymsp[-1].minor.yy153);
- delete yymsp[-4].minor.yy291;
- objectForTokens = yygotominor.yy192;
- }
- break;
- case 250: /* exprx ::= expr not_opt IN nm dbnm */
-{
- yygotominor.yy192 = new SqliteExpr();
- yygotominor.yy192->initIn(yymsp[-4].minor.yy192, *(yymsp[-3].minor.yy291), *(yymsp[-1].minor.yy319), *(yymsp[0].minor.yy319));
- delete yymsp[-3].minor.yy291;
- delete yymsp[-1].minor.yy319;
- objectForTokens = yygotominor.yy192;
- }
- break;
- case 251: /* exprx ::= LP select RP */
-{
- yygotominor.yy192 = new SqliteExpr();
- yygotominor.yy192->initSubSelect(yymsp[-1].minor.yy153);
- objectForTokens = yygotominor.yy192;
- }
- break;
- case 252: /* exprx ::= CASE case_operand case_exprlist case_else END */
-{
- yygotominor.yy192 = new SqliteExpr();
- yygotominor.yy192->initCase(yymsp[-3].minor.yy192, *(yymsp[-2].minor.yy231), yymsp[-1].minor.yy192);
- delete yymsp[-2].minor.yy231;
- objectForTokens = yygotominor.yy192;
- }
- break;
- case 253: /* exprx ::= RAISE LP raisetype COMMA nm RP */
-{
- yygotominor.yy192 = new SqliteExpr();
- yygotominor.yy192->initRaise(yymsp[-3].minor.yy0->value, *(yymsp[-1].minor.yy319));
- delete yymsp[-1].minor.yy319;
- objectForTokens = yygotominor.yy192;
- }
- break;
- case 254: /* exprx ::= RAISE LP IGNORE RP */
-{
- yygotominor.yy192 = new SqliteExpr();
- yygotominor.yy192->initRaise(yymsp[-1].minor.yy0->value);
- objectForTokens = yygotominor.yy192;
- }
- break;
- case 255: /* exprx ::= nm DOT */
-{
- yygotominor.yy192 = new SqliteExpr();
- yygotominor.yy192->initId(*(yymsp[-1].minor.yy319), QString::null, QString::null);
- delete yymsp[-1].minor.yy319;
- objectForTokens = yygotominor.yy192;
- parserContext->minorErrorBeforeNextToken("Syntax error");
- }
- break;
- case 256: /* exprx ::= nm DOT nm DOT */
-{
- yygotominor.yy192 = new SqliteExpr();
- yygotominor.yy192->initId(*(yymsp[-3].minor.yy319), *(yymsp[-1].minor.yy319), QString::null);
- delete yymsp[-3].minor.yy319;
- delete yymsp[-1].minor.yy319;
- objectForTokens = yygotominor.yy192;
- parserContext->minorErrorBeforeNextToken("Syntax error");
- }
- break;
- case 257: /* exprx ::= expr not_opt BETWEEN expr AND */
-{
- yygotominor.yy192 = new SqliteExpr();
- delete yymsp[-3].minor.yy291;
- delete yymsp[-4].minor.yy192;
- delete yymsp[-1].minor.yy192;
- objectForTokens = yygotominor.yy192;
- parserContext->minorErrorBeforeNextToken("Syntax error");
- }
- break;
- case 258: /* exprx ::= CASE case_operand case_exprlist case_else */
-{
- yygotominor.yy192 = new SqliteExpr();
- delete yymsp[-1].minor.yy231;
- delete yymsp[-2].minor.yy192;
- delete yymsp[0].minor.yy192;
- objectForTokens = yygotominor.yy192;
- parserContext->minorErrorBeforeNextToken("Syntax error");
- }
- break;
- case 259: /* exprx ::= expr not_opt IN LP exprlist */
-{
- yygotominor.yy192 = new SqliteExpr();
- delete yymsp[-3].minor.yy291;
- delete yymsp[0].minor.yy231;
- delete yymsp[-4].minor.yy192;
- objectForTokens = yygotominor.yy192;
- parserContext->minorErrorBeforeNextToken("Syntax error");
- }
- break;
- case 260: /* exprx ::= expr not_opt IN ID_DB */
-{ yy_destructor(yypParser,177,&yymsp[-3].minor);
-}
- break;
- case 261: /* exprx ::= expr not_opt IN nm DOT ID_TAB */
- case 262: /* exprx ::= ID_DB|ID_TAB|ID_COL|ID_FN */ yytestcase(yyruleno==262);
-{ yy_destructor(yypParser,177,&yymsp[-5].minor);
- yy_destructor(yypParser,156,&yymsp[-2].minor);
-}
- break;
- case 264: /* exprx ::= nm DOT nm DOT ID_COL */
- case 265: /* exprx ::= RAISE LP raisetype COMMA ID_ERR_MSG RP */ yytestcase(yyruleno==265);
-{ yy_destructor(yypParser,156,&yymsp[-4].minor);
- yy_destructor(yypParser,156,&yymsp[-2].minor);
-}
- break;
- case 267: /* expr ::= */
-{
- yygotominor.yy192 = new SqliteExpr();
- objectForTokens = yygotominor.yy192;
- parserContext->minorErrorAfterLastToken("Syntax error");
- }
- break;
- case 270: /* likeop ::= LIKE|GLOB */
-{yygotominor.yy41 = new SqliteExpr::LikeOp(SqliteExpr::likeOp(yymsp[0].minor.yy0->value));}
- break;
- case 271: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
-{
- yymsp[-4].minor.yy231->append(yymsp[-2].minor.yy192);
- yymsp[-4].minor.yy231->append(yymsp[0].minor.yy192);
- yygotominor.yy231 = yymsp[-4].minor.yy231;
- }
- break;
- case 272: /* case_exprlist ::= WHEN expr THEN expr */
-{
- yygotominor.yy231 = new ParserExprList();
- yygotominor.yy231->append(yymsp[-2].minor.yy192);
- yygotominor.yy231->append(yymsp[0].minor.yy192);
- }
- break;
- case 279: /* nexprlist ::= nexprlist COMMA expr */
-{
- yymsp[-2].minor.yy231->append(yymsp[0].minor.yy192);
- yygotominor.yy231 = yymsp[-2].minor.yy231;
- DONT_INHERIT_TOKENS("nexprlist");
- }
- break;
- case 280: /* nexprlist ::= exprx */
-{
- yygotominor.yy231 = new ParserExprList();
- yygotominor.yy231->append(yymsp[0].minor.yy192);
- }
- break;
- case 281: /* cmd ::= CREATE uniqueflag INDEX nm ON nm dbnm LP idxlist RP onconf */
-{
- yygotominor.yy203 = new SqliteCreateIndex(
- *(yymsp[-9].minor.yy291),
- false,
- *(yymsp[-7].minor.yy319),
- *(yymsp[-5].minor.yy319),
- *(yymsp[-4].minor.yy319),
- *(yymsp[-2].minor.yy63),
- *(yymsp[0].minor.yy418)
- );
- delete yymsp[-9].minor.yy291;
- delete yymsp[-7].minor.yy319;
- delete yymsp[-5].minor.yy319;
- delete yymsp[-4].minor.yy319;
- delete yymsp[-2].minor.yy63;
- delete yymsp[0].minor.yy418;
- objectForTokens = yygotominor.yy203;
- }
- break;
- case 282: /* cmd ::= CREATE uniqueflag INDEX nm dbnm ON ID_TAB */
-{ yy_destructor(yypParser,156,&yymsp[-3].minor);
-}
- break;
- case 287: /* idxlist_opt ::= */
-{yygotominor.yy63 = new ParserIndexedColumnList();}
- break;
- case 288: /* idxlist_opt ::= LP idxlist RP */
-{yygotominor.yy63 = yymsp[-1].minor.yy63;}
- break;
- case 289: /* idxlist ::= idxlist COMMA idxlist_single */
-{
- yymsp[-2].minor.yy63->append(yymsp[0].minor.yy428);
- yygotominor.yy63 = yymsp[-2].minor.yy63;
- DONT_INHERIT_TOKENS("idxlist");
- }
- break;
- case 290: /* idxlist ::= idxlist_single */
-{
- yygotominor.yy63 = new ParserIndexedColumnList();
- yygotominor.yy63->append(yymsp[0].minor.yy428);
- }
- break;
- case 291: /* idxlist_single ::= nm sortorder */
- case 292: /* idxlist_single ::= ID_COL */ yytestcase(yyruleno==292);
-{
- SqliteIndexedColumn* obj =
- new SqliteIndexedColumn(
- *(yymsp[-1].minor.yy319),
- QString::null,
- *(yymsp[0].minor.yy389)
- );
- yygotominor.yy428 = obj;
- delete yymsp[0].minor.yy389;
- delete yymsp[-1].minor.yy319;
- objectForTokens = yygotominor.yy428;
- }
- break;
- case 293: /* cmd ::= DROP INDEX fullname */
-{
- yygotominor.yy203 = new SqliteDropIndex(false, yymsp[0].minor.yy120->name1, yymsp[0].minor.yy120->name2);
- delete yymsp[0].minor.yy120;
- objectForTokens = yygotominor.yy203;
- }
- break;
- case 296: /* cmd ::= COPY orconf nm dbnm FROM nm USING DELIMITERS STRING */
-{
- yygotominor.yy203 = new SqliteCopy(
- *(yymsp[-7].minor.yy418),
- *(yymsp[-6].minor.yy319),
- *(yymsp[-5].minor.yy319),
- *(yymsp[-3].minor.yy319),
- yymsp[0].minor.yy0->value
- );
- delete yymsp[-7].minor.yy418;
- delete yymsp[-6].minor.yy319;
- delete yymsp[-5].minor.yy319;
- delete yymsp[-3].minor.yy319;
- objectForTokens = yygotominor.yy203;
- }
- break;
- case 297: /* cmd ::= COPY orconf nm dbnm FROM nm */
-{
- yygotominor.yy203 = new SqliteCopy(
- *(yymsp[-4].minor.yy418),
- *(yymsp[-3].minor.yy319),
- *(yymsp[-2].minor.yy319),
- *(yymsp[0].minor.yy319)
- );
- delete yymsp[-4].minor.yy418;
- delete yymsp[-3].minor.yy319;
- delete yymsp[-2].minor.yy319;
- delete yymsp[0].minor.yy319;
- objectForTokens = yygotominor.yy203;
- }
- break;
- case 298: /* cmd ::= VACUUM */
-{
- yygotominor.yy203 = new SqliteVacuum();
- objectForTokens = yygotominor.yy203;
- }
- break;
- case 299: /* cmd ::= VACUUM nm */
-{
- yygotominor.yy203 = new SqliteVacuum(*(yymsp[0].minor.yy319));
- delete yymsp[0].minor.yy319;
- objectForTokens = yygotominor.yy203;
- }
- break;
- case 300: /* cmd ::= PRAGMA ids */
-{
- yygotominor.yy203 = new SqlitePragma(*(yymsp[0].minor.yy319), QString::null);
- delete yymsp[0].minor.yy319;
- objectForTokens = yygotominor.yy203;
- }
- break;
- case 301: /* cmd ::= PRAGMA nm EQ nmnum */
- case 303: /* cmd ::= PRAGMA nm EQ minus_num */ yytestcase(yyruleno==303);
-{
- yygotominor.yy203 = new SqlitePragma(*(yymsp[-2].minor.yy319), QString::null, *(yymsp[0].minor.yy69), true);
- delete yymsp[-2].minor.yy319;
- delete yymsp[0].minor.yy69;
- objectForTokens = yygotominor.yy203;
- }
- break;
- case 302: /* cmd ::= PRAGMA nm LP nmnum RP */
- case 304: /* cmd ::= PRAGMA nm LP minus_num RP */ yytestcase(yyruleno==304);
-{
- yygotominor.yy203 = new SqlitePragma(*(yymsp[-3].minor.yy319), QString::null, *(yymsp[-1].minor.yy69), false);
- delete yymsp[-3].minor.yy319;
- delete yymsp[-1].minor.yy69;
- objectForTokens = yygotominor.yy203;
- }
- break;
- case 308: /* nmnum ::= nm */
-{
- yygotominor.yy69 = new QVariant(*(yymsp[0].minor.yy319));
- delete yymsp[0].minor.yy319;
- }
- break;
- case 309: /* nmnum ::= ON */
- case 310: /* nmnum ::= DELETE */ yytestcase(yyruleno==310);
- case 311: /* nmnum ::= DEFAULT */ yytestcase(yyruleno==311);
-{yygotominor.yy69 = new QVariant(yymsp[0].minor.yy0->value);}
- break;
- case 314: /* minus_num ::= MINUS number */
-{
- if (yymsp[0].minor.yy69->type() == QVariant::Double)
- *(yymsp[0].minor.yy69) = -(yymsp[0].minor.yy69->toDouble());
- else if (yymsp[0].minor.yy69->type() == QVariant::LongLong)
- *(yymsp[0].minor.yy69) = -(yymsp[0].minor.yy69->toLongLong());
- else
- Q_ASSERT_X(true, "producing minus number", "QVariant is neither of Double or LongLong.");
-
- yygotominor.yy69 = yymsp[0].minor.yy69;
- }
- break;
- case 315: /* number ::= INTEGER */
-{yygotominor.yy69 = new QVariant(QVariant(yymsp[0].minor.yy0->value).toLongLong());}
- break;
- case 316: /* number ::= FLOAT */
-{yygotominor.yy69 = new QVariant(QVariant(yymsp[0].minor.yy0->value).toDouble());}
- break;
- case 317: /* cmd ::= CREATE temp TRIGGER nm trigger_time trigger_event ON nm dbnm foreach_clause when_clause BEGIN trigger_cmd_list END */
-{
- yygotominor.yy203 = new SqliteCreateTrigger(
- *(yymsp[-12].minor.yy226),
- false,
- *(yymsp[-10].minor.yy319),
- *(yymsp[-6].minor.yy319),
- *(yymsp[-5].minor.yy319),
- *(yymsp[-9].minor.yy372),
- yymsp[-8].minor.yy151,
- *(yymsp[-4].minor.yy83),
- yymsp[-3].minor.yy192,
- *(yymsp[-1].minor.yy270),
- 2
- );
- delete yymsp[-12].minor.yy226;
- delete yymsp[-9].minor.yy372;
- delete yymsp[-4].minor.yy83;
- delete yymsp[-6].minor.yy319;
- delete yymsp[-10].minor.yy319;
- delete yymsp[-5].minor.yy319;
- delete yymsp[-1].minor.yy270;
- objectForTokens = yygotominor.yy203;
- }
- break;
- case 318: /* cmd ::= CREATE temp TRIGGER nm trigger_time trigger_event ON nm dbnm foreach_clause when_clause */
-{
- QList<SqliteQuery *> CL;
-
- yygotominor.yy203 = new SqliteCreateTrigger(
- *(yymsp[-9].minor.yy226),
- false,
- *(yymsp[-7].minor.yy319),
- *(yymsp[-3].minor.yy319),
- *(yymsp[-2].minor.yy319),
- *(yymsp[-6].minor.yy372),
- yymsp[-5].minor.yy151,
- *(yymsp[-1].minor.yy83),
- yymsp[0].minor.yy192,
- CL,
- 2
- );
- delete yymsp[-9].minor.yy226;
- delete yymsp[-6].minor.yy372;
- delete yymsp[-1].minor.yy83;
- delete yymsp[-3].minor.yy319;
- delete yymsp[-7].minor.yy319;
- delete yymsp[-2].minor.yy319;
- objectForTokens = yygotominor.yy203;
- parserContext->minorErrorAfterLastToken("Syntax error");
- }
- break;
- case 319: /* cmd ::= CREATE temp TRIGGER nm trigger_time trigger_event ON nm dbnm foreach_clause when_clause BEGIN trigger_cmd_list */
-{
- yygotominor.yy203 = new SqliteCreateTrigger(
- *(yymsp[-11].minor.yy226),
- false,
- *(yymsp[-9].minor.yy319),
- *(yymsp[-5].minor.yy319),
- *(yymsp[-4].minor.yy319),
- *(yymsp[-8].minor.yy372),
- yymsp[-7].minor.yy151,
- *(yymsp[-3].minor.yy83),
- yymsp[-2].minor.yy192,
- *(yymsp[0].minor.yy270),
- 2
- );
- delete yymsp[-11].minor.yy226;
- delete yymsp[-8].minor.yy372;
- delete yymsp[-3].minor.yy83;
- delete yymsp[-5].minor.yy319;
- delete yymsp[-9].minor.yy319;
- delete yymsp[-4].minor.yy319;
- delete yymsp[0].minor.yy270;
- objectForTokens = yygotominor.yy203;
- parserContext->minorErrorAfterLastToken("Syntax error");
- }
- break;
- case 320: /* cmd ::= CREATE temp TRIGGER nm trigger_time trigger_event ON ID_TAB|ID_DB */
-{ yy_destructor(yypParser,157,&yymsp[-6].minor);
- yy_destructor(yypParser,156,&yymsp[-4].minor);
- yy_destructor(yypParser,232,&yymsp[-3].minor);
- yy_destructor(yypParser,233,&yymsp[-2].minor);
-}
- break;
- case 321: /* cmd ::= CREATE temp TRIGGER nm trigger_time trigger_event ON nm DOT ID_TAB */
-{ yy_destructor(yypParser,157,&yymsp[-8].minor);
- yy_destructor(yypParser,156,&yymsp[-6].minor);
- yy_destructor(yypParser,232,&yymsp[-5].minor);
- yy_destructor(yypParser,233,&yymsp[-4].minor);
- yy_destructor(yypParser,156,&yymsp[-2].minor);
-}
- break;
- case 323: /* trigger_time ::= BEFORE */
-{yygotominor.yy372 = new SqliteCreateTrigger::Time(SqliteCreateTrigger::Time::BEFORE);}
- break;
- case 324: /* trigger_time ::= AFTER */
-{yygotominor.yy372 = new SqliteCreateTrigger::Time(SqliteCreateTrigger::Time::AFTER);}
- break;
- case 325: /* trigger_time ::= INSTEAD OF */
-{yygotominor.yy372 = new SqliteCreateTrigger::Time(SqliteCreateTrigger::Time::INSTEAD_OF);}
- break;
- case 326: /* trigger_time ::= */
-{yygotominor.yy372 = new SqliteCreateTrigger::Time(SqliteCreateTrigger::Time::null);}
- break;
- case 327: /* trigger_event ::= DELETE */
-{
- yygotominor.yy151 = new SqliteCreateTrigger::Event(SqliteCreateTrigger::Event::DELETE);
- objectForTokens = yygotominor.yy151;
- }
- break;
- case 328: /* trigger_event ::= INSERT */
-{
- yygotominor.yy151 = new SqliteCreateTrigger::Event(SqliteCreateTrigger::Event::INSERT);
- objectForTokens = yygotominor.yy151;
- }
- break;
- case 329: /* trigger_event ::= UPDATE */
-{
- yygotominor.yy151 = new SqliteCreateTrigger::Event(SqliteCreateTrigger::Event::UPDATE);
- objectForTokens = yygotominor.yy151;
- }
- break;
- case 330: /* trigger_event ::= UPDATE OF idlist */
-{
- yygotominor.yy151 = new SqliteCreateTrigger::Event(*(yymsp[0].minor.yy95));
- delete yymsp[0].minor.yy95;
- objectForTokens = yygotominor.yy151;
- }
- break;
- case 331: /* foreach_clause ::= */
-{yygotominor.yy83 = new SqliteCreateTrigger::Scope(SqliteCreateTrigger::Scope::null);}
- break;
- case 332: /* foreach_clause ::= FOR EACH ROW */
-{yygotominor.yy83 = new SqliteCreateTrigger::Scope(SqliteCreateTrigger::Scope::FOR_EACH_ROW);}
- break;
- case 333: /* foreach_clause ::= FOR EACH STATEMENT */
-{yygotominor.yy83 = new SqliteCreateTrigger::Scope(SqliteCreateTrigger::Scope::FOR_EACH_STATEMENT);}
- break;
- case 336: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
-{
- yymsp[-2].minor.yy270->append(yymsp[-1].minor.yy203);
- yygotominor.yy270 = yymsp[-2].minor.yy270;
- DONT_INHERIT_TOKENS("trigger_cmd_list");
- }
- break;
- case 337: /* trigger_cmd_list ::= trigger_cmd SEMI */
-{
- yygotominor.yy270 = new ParserQueryList();
- yygotominor.yy270->append(yymsp[-1].minor.yy203);
- }
- break;
- case 342: /* raisetype ::= ROLLBACK|ABORT|FAIL */
-{yygotominor.yy0 = yymsp[0].minor.yy0;}
- break;
- case 343: /* cmd ::= DROP TRIGGER fullname */
-{
- yygotominor.yy203 = new SqliteDropTrigger(false, yymsp[0].minor.yy120->name1, yymsp[0].minor.yy120->name2);
- delete yymsp[0].minor.yy120;
- objectForTokens = yygotominor.yy203;
- }
- break;
- case 346: /* cmd ::= ATTACH database_kw_opt ids AS ids key_opt */
-{
- SqliteExpr* e1 = new SqliteExpr();
- SqliteExpr* e2 = new SqliteExpr();
- e1->initLiteral(*(yymsp[-3].minor.yy319));
- e2->initLiteral(*(yymsp[-1].minor.yy319));
- yygotominor.yy203 = new SqliteAttach(*(yymsp[-4].minor.yy291), e1, e2, yymsp[0].minor.yy192);
- delete yymsp[-4].minor.yy291;
- delete yymsp[-3].minor.yy319;
- delete yymsp[-1].minor.yy319;
- objectForTokens = yygotominor.yy203;
- }
- break;
- case 348: /* key_opt ::= USING ids */
-{
- SqliteExpr* e = new SqliteExpr();
- e->initLiteral(*(yymsp[0].minor.yy319));
- delete yymsp[0].minor.yy319;
- yygotominor.yy192 = e;
- }
- break;
- case 351: /* cmd ::= DETACH database_kw_opt nm */
-{
- SqliteExpr* e = new SqliteExpr();
- e->initLiteral(*(yymsp[0].minor.yy319));
- delete yymsp[0].minor.yy319;
- yygotominor.yy203 = new SqliteDetach(*(yymsp[-1].minor.yy291), e);
- delete yymsp[-1].minor.yy291;
- objectForTokens = yygotominor.yy203;
- }
- break;
- default:
- /* (0) input ::= cmdlist */ yytestcase(yyruleno==0);
- break;
- };
- }
- assert( yyruleno>=0 && yyruleno<(int)(sizeof(yyRuleInfo)/sizeof(yyRuleInfo[0])) );
- yygoto = yyRuleInfo[yyruleno].lhs;
- yysize = yyRuleInfo[yyruleno].nrhs;
-
- // Store tokens for the rule in parser context
- QList<Token*> allTokens;
- QList<Token*> allTokensWithAllInherited;
- QString keyForTokensMap;
- int tokensMapKeyCnt;
- if (parserContext->setupTokens)
- {
- if (objectForTokens)
- {
- // In case this is a list with recurrent references we need
- // to clear tokens before adding the new and extended list.
- objectForTokens->tokens.clear();
- }
-
- QList<Token*> tokens;
- for (int i = yypParser->yyidx - yysize + 1; i <= yypParser->yyidx; i++)
- {
- tokens.clear();
- const char* fieldName = yyTokenName[yypParser->yystack[i].major];
-
- // Adding token being subject of this reduction. It's usually not includes in the inherited tokens,
- // although if inheriting from simple statements, like "FAIL" or "ROLLBACK", this tends to be redundant with the inherited tokens.
- // That's why we're checking if it's not contained in the inherited tokens and add it only then.
- if (parserContext->isManagedToken(yypParser->yystack[i].minor.yy0) && !yypParser->yystack[i].tokens->contains(yypParser->yystack[i].minor.yy0))
- tokens += yypParser->yystack[i].minor.yy0;
-
- tokens += *(yypParser->yystack[i].tokens);
-
- if (!noTokenInheritanceFields.contains(fieldName))
- {
- if (objectForTokens)
- {
- keyForTokensMap = fieldName;
- tokensMapKeyCnt = 2;
- while (objectForTokens->tokensMap.contains(keyForTokensMap))
- keyForTokensMap = fieldName + QString::number(tokensMapKeyCnt++);
-
- objectForTokens->tokensMap[keyForTokensMap] = parserContext->getTokenPtrList(tokens);
- }
-
- allTokens += tokens;
- }
- else
- {
- // If field is mentioned only once, then only one occurance of it will be ignored.
- // Second one should be inherited. See "anylist" definition for explanation why.
- noTokenInheritanceFields.removeOne(fieldName);
- }
- allTokensWithAllInherited += tokens;
- }
- if (objectForTokens)
- {
- objectForTokens->tokens += parserContext->getTokenPtrList(allTokens);
- }
- }
-
- // Clear token lists
- for (int i = yypParser->yyidx - yysize + 1; i <= yypParser->yyidx; i++)
- {
- delete yypParser->yystack[i].tokens;
- yypParser->yystack[i].tokens = nullptr;
- }
-
- yypParser->yyidx -= yysize;
- yyact = yy_find_reduce_action(yymsp[-yysize].stateno,(YYCODETYPE)yygoto);
- if( yyact < YYNSTATE ){
-#ifdef NDEBUG
- /* If we are not debugging and the reduce action popped at least
- ** one element off the stack, then we can push the new element back
- ** onto the stack here, and skip the stack overflow test in yy_shift().
- ** That gives a significant speed improvement. */
- if( yysize ){
- yypParser->yyidx++;
- yymsp -= yysize-1;
- yymsp->stateno = (YYACTIONTYPE)yyact;
- yymsp->major = (YYCODETYPE)yygoto;
- yymsp->minor = yygotominor;
- if (parserContext->setupTokens)
- *(yypParser->yystack[yypParser->yyidx].tokens) = allTokens;
- }else
-#endif
- {
- yy_shift(yypParser,yyact,yygoto,&yygotominor);
- if (parserContext->setupTokens)
- {
- QList<Token*>* tokensPtr = yypParser->yystack[yypParser->yyidx].tokens;
- *tokensPtr = allTokensWithAllInherited + *tokensPtr;
- }
- }
- }else{
- assert( yyact == YYNSTATE + YYNRULE + 1 );
- yy_accept(yypParser);
- }
-}
-
-/*
-** The following code executes when the parse fails
-*/
-#ifndef YYNOERRORRECOVERY
-static void yy_parse_failed(
- yyParser *yypParser /* The parser */
-){
- sqlite2_parseARG_FETCH;
-#ifndef NDEBUG
- if( yyTraceFILE ){
- fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt);
- }
-#endif
- while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
- /* Here code is inserted which will be executed whenever the
- ** parser fails */
- sqlite2_parseARG_STORE; /* Suppress warning about unused %extra_argument variable */
-}
-#endif /* YYNOERRORRECOVERY */
-
-/*
-** The following code executes when a syntax error first occurs.
-*/
-static void yy_syntax_error(
- yyParser *yypParser, /* The parser */
- int yymajor, /* The major type of the error token */
- YYMINORTYPE yyminor /* The minor type of the error token */
-){
- sqlite2_parseARG_FETCH;
-#define TOKEN (yyminor.yy0)
-
- UNUSED_PARAMETER(yymajor);
- parserContext->error(TOKEN, QObject::tr("Syntax error"));
- sqlite2_parseARG_STORE; /* Suppress warning about unused %extra_argument variable */
-}
-
-/*
-** The following is executed when the parser accepts
-*/
-static void yy_accept(
- yyParser *yypParser /* The parser */
-){
- sqlite2_parseARG_FETCH;
-#ifndef NDEBUG
- if( yyTraceFILE ){
- fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt);
- }
-#endif
- while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
- /* Here code is inserted which will be executed whenever the
- ** parser accepts */
- sqlite2_parseARG_STORE; /* Suppress warning about unused %extra_argument variable */
-}
-
-/* The main parser program.
-** The first argument is a pointer to a structure obtained from
-** "sqlite2_parseAlloc" which describes the current state of the parser.
-** The second argument is the major token number. The third is
-** the minor token. The fourth optional argument is whatever the
-** user wants (and specified in the grammar) and is available for
-** use by the action routines.
-**
-** Inputs:
-** <ul>
-** <li> A pointer to the parser (an opaque structure.)
-** <li> The major token number.
-** <li> The minor token number.
-** <li> An option argument of a grammar-specified type.
-** </ul>
-**
-** Outputs:
-** None.
-*/
-void sqlite2_parse(
- void *yyp, /* The parser */
- int yymajor, /* The major token code number */
- sqlite2_parseTOKENTYPE yyminor /* The value for the token */
- sqlite2_parseARG_PDECL /* Optional %extra_argument parameter */
-){
- YYMINORTYPE yyminorunion;
- int yyact; /* The parser action. */
-#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY)
- int yyendofinput; /* True if we are at the end of input */
-#endif
-#ifdef YYERRORSYMBOL
- int yyerrorhit = 0; /* True if yymajor has invoked an error */
-#endif
- yyParser *yypParser; /* The parser */
-
- /* (re)initialize the parser, if necessary */
- yypParser = (yyParser*)yyp;
- if( yypParser->yyidx<0 ){
-#if YYSTACKDEPTH<=0
- if( yypParser->yystksz <=0 ){
- /*memset(&yyminorunion, 0, sizeof(yyminorunion));*/
- yyminorunion = yyzerominor;
- yyStackOverflow(yypParser, &yyminorunion);
- return;
- }
-#endif
- yypParser->yyidx = 0;
- yypParser->yyerrcnt = -1;
- yypParser->yystack[0].stateno = 0;
- yypParser->yystack[0].major = 0;
- yypParser->yystack[0].tokens = new QList<Token*>();
- }
- yyminorunion.yy0 = yyminor;
-#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY)
- yyendofinput = (yymajor==0);
-#endif
- sqlite2_parseARG_STORE;
-
-#ifndef NDEBUG
- if( yyTraceFILE ){
- fprintf(yyTraceFILE,"%sInput %s [%s] (lemon type: %s)\n",
- yyTracePrompt,
- yyminor->value.toLatin1().data(),
- yyminor->typeString().toLatin1().data(),
- yyTokenName[yymajor]); }
-#endif
-
- do{
- yyact = yy_find_shift_action(yypParser,(YYCODETYPE)yymajor);
- if( yyact<YYNSTATE ){
- yy_shift(yypParser,yyact,yymajor,&yyminorunion);
- yypParser->yyerrcnt--;
- yymajor = YYNOCODE;
- }else if( yyact < YYNSTATE + YYNRULE ){
- yy_reduce(yypParser,yyact-YYNSTATE);
- }else{
- assert( yyact == YY_ERROR_ACTION );
-#ifdef YYERRORSYMBOL
- int yymx;
-#endif
-#ifndef NDEBUG
- if( yyTraceFILE ){
- fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt);
- }
-#endif
-#ifdef YYERRORSYMBOL
- /* A syntax error has occurred.
- ** The response to an error depends upon whether or not the
- ** grammar defines an error token "ERROR".
- **
- ** This is what we do if the grammar does define ERROR:
- **
- ** * Call the %syntax_error function.
- **
- ** * Begin popping the stack until we enter a state where
- ** it is legal to shift the error symbol, then shift
- ** the error symbol.
- **
- ** * Set the error count to three.
- **
- ** * Begin accepting and shifting new tokens. No new error
- ** processing will occur until three tokens have been
- ** shifted successfully.
- **
- */
- if( yypParser->yyerrcnt<0 ){
- yy_syntax_error(yypParser,yymajor,yyminorunion);
- }
- yymx = yypParser->yystack[yypParser->yyidx].major;
- if( yymx==YYERRORSYMBOL || yyerrorhit ){
-#ifndef NDEBUG
- if( yyTraceFILE ){
- fprintf(yyTraceFILE,"%sDiscard input token %s\n",
- yyTracePrompt,yyTokenName[yymajor]);
- }
-#endif
- yy_destructor(yypParser, (YYCODETYPE)yymajor,&yyminorunion);
- yymajor = YYNOCODE;
- }else{
- while(
- yypParser->yyidx >= 0 &&
- yymx != YYERRORSYMBOL &&
- (yyact = yy_find_reduce_action(
- yypParser->yystack[yypParser->yyidx].stateno,
- YYERRORSYMBOL)) >= YYNSTATE
- ){
- yy_pop_parser_stack(yypParser);
- }
- if( yypParser->yyidx < 0 || yymajor==0 ){
- yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
- yy_parse_failed(yypParser);
- yymajor = YYNOCODE;
- }else if( yymx!=YYERRORSYMBOL ){
- YYMINORTYPE u2;
- u2.YYERRSYMDT = 0;
- yy_shift(yypParser,yyact,YYERRORSYMBOL,&u2);
- }
- }
- yypParser->yyerrcnt = 1; // not 3 valid tokens, but 1
- yyerrorhit = 1;
-#elif defined(YYNOERRORRECOVERY)
- /* If the YYNOERRORRECOVERY macro is defined, then do not attempt to
- ** do any kind of error recovery. Instead, simply invoke the syntax
- ** error routine and continue going as if nothing had happened.
- **
- ** Applications can set this macro (for example inside %include) if
- ** they intend to abandon the parse upon the first syntax error seen.
- */
- yy_syntax_error(yypParser,yymajor,yyminorunion);
- yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
- yymajor = YYNOCODE;
-
-#else /* YYERRORSYMBOL is not defined */
- /* This is what we do if the grammar does not define ERROR:
- **
- ** * Report an error message, and throw away the input token.
- **
- ** * If the input token is $, then fail the parse.
- **
- ** As before, subsequent error messages are suppressed until
- ** three input tokens have been successfully shifted.
- */
- if( yypParser->yyerrcnt<=0 ){
- yy_syntax_error(yypParser,yymajor,yyminorunion);
- }
- yypParser->yyerrcnt = 1; // not 3 valid tokens, but 1
- yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
- if( yyendofinput ){
- yy_parse_failed(yypParser);
- }
- yymajor = YYNOCODE;
-#endif
- }
- }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 );
- return;
-}
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/sqlite2_parse.h b/SQLiteStudio3/coreSQLiteStudio/parser/sqlite2_parse.h
deleted file mode 100644
index 058d397..0000000
--- a/SQLiteStudio3/coreSQLiteStudio/parser/sqlite2_parse.h
+++ /dev/null
@@ -1,146 +0,0 @@
-#define TK2_ILLEGAL 1
-#define TK2_COMMENT 2
-#define TK2_SPACE 3
-#define TK2_ID 4
-#define TK2_ABORT 5
-#define TK2_AFTER 6
-#define TK2_ASC 7
-#define TK2_ATTACH 8
-#define TK2_BEFORE 9
-#define TK2_BEGIN 10
-#define TK2_CASCADE 11
-#define TK2_CLUSTER 12
-#define TK2_CONFLICT 13
-#define TK2_COPY 14
-#define TK2_DATABASE 15
-#define TK2_DEFERRED 16
-#define TK2_DELIMITERS 17
-#define TK2_DESC 18
-#define TK2_DETACH 19
-#define TK2_EACH 20
-#define TK2_END 21
-#define TK2_EXPLAIN 22
-#define TK2_FAIL 23
-#define TK2_FOR 24
-#define TK2_GLOB 25
-#define TK2_IGNORE 26
-#define TK2_IMMEDIATE 27
-#define TK2_INITIALLY 28
-#define TK2_INSTEAD 29
-#define TK2_LIKE 30
-#define TK2_MATCH 31
-#define TK2_KEY 32
-#define TK2_OF 33
-#define TK2_OFFSET 34
-#define TK2_PRAGMA 35
-#define TK2_RAISE 36
-#define TK2_REPLACE 37
-#define TK2_RESTRICT 38
-#define TK2_ROW 39
-#define TK2_STATEMENT 40
-#define TK2_TEMP 41
-#define TK2_TRIGGER 42
-#define TK2_VACUUM 43
-#define TK2_VIEW 44
-#define TK2_OR 45
-#define TK2_AND 46
-#define TK2_NOT 47
-#define TK2_EQ 48
-#define TK2_NE 49
-#define TK2_ISNULL 50
-#define TK2_NOTNULL 51
-#define TK2_IS 52
-#define TK2_BETWEEN 53
-#define TK2_IN 54
-#define TK2_GT 55
-#define TK2_GE 56
-#define TK2_LT 57
-#define TK2_LE 58
-#define TK2_BITAND 59
-#define TK2_BITOR 60
-#define TK2_LSHIFT 61
-#define TK2_RSHIFT 62
-#define TK2_PLUS 63
-#define TK2_MINUS 64
-#define TK2_STAR 65
-#define TK2_SLASH 66
-#define TK2_REM 67
-#define TK2_CONCAT 68
-#define TK2_UMINUS 69
-#define TK2_UPLUS 70
-#define TK2_BITNOT 71
-#define TK2_SEMI 72
-#define TK2_TRANSACTION 73
-#define TK2_ID_TRANS 74
-#define TK2_COMMIT 75
-#define TK2_ROLLBACK 76
-#define TK2_CREATE 77
-#define TK2_TABLE 78
-#define TK2_LP 79
-#define TK2_RP 80
-#define TK2_AS 81
-#define TK2_DOT 82
-#define TK2_ID_TAB_NEW 83
-#define TK2_ID_DB 84
-#define TK2_COMMA 85
-#define TK2_ID_COL_NEW 86
-#define TK2_STRING 87
-#define TK2_JOIN_KW 88
-#define TK2_ID_COL_TYPE 89
-#define TK2_DEFAULT 90
-#define TK2_INTEGER 91
-#define TK2_FLOAT 92
-#define TK2_NULL 93
-#define TK2_CONSTRAINT 94
-#define TK2_PRIMARY 95
-#define TK2_UNIQUE 96
-#define TK2_CHECK 97
-#define TK2_REFERENCES 98
-#define TK2_COLLATE 99
-#define TK2_ON 100
-#define TK2_INSERT 101
-#define TK2_DELETE 102
-#define TK2_UPDATE 103
-#define TK2_ID_FK_MATCH 104
-#define TK2_SET 105
-#define TK2_DEFERRABLE 106
-#define TK2_FOREIGN 107
-#define TK2_ID_CONSTR 108
-#define TK2_ID_TAB 109
-#define TK2_DROP 110
-#define TK2_ID_VIEW_NEW 111
-#define TK2_ID_VIEW 112
-#define TK2_UNION 113
-#define TK2_ALL 114
-#define TK2_EXCEPT 115
-#define TK2_INTERSECT 116
-#define TK2_SELECT 117
-#define TK2_DISTINCT 118
-#define TK2_ID_ALIAS 119
-#define TK2_FROM 120
-#define TK2_USING 121
-#define TK2_JOIN 122
-#define TK2_ID_JOIN_OPTS 123
-#define TK2_ORDER 124
-#define TK2_BY 125
-#define TK2_GROUP 126
-#define TK2_HAVING 127
-#define TK2_LIMIT 128
-#define TK2_WHERE 129
-#define TK2_ID_COL 130
-#define TK2_INTO 131
-#define TK2_VALUES 132
-#define TK2_VARIABLE 133
-#define TK2_LIKE_KW 134
-#define TK2_CASE 135
-#define TK2_ID_FN 136
-#define TK2_ID_ERR_MSG 137
-#define TK2_WHEN 138
-#define TK2_THEN 139
-#define TK2_ELSE 140
-#define TK2_INDEX 141
-#define TK2_ID_IDX_NEW 142
-#define TK2_ID_IDX 143
-#define TK2_ID_PRAGMA 144
-#define TK2_ID_TRIG_NEW 145
-#define TK2_ID_TRIG 146
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/sqlite2_parse.y b/SQLiteStudio3/coreSQLiteStudio/parser/sqlite2_parse.y
deleted file mode 100644
index 621d92e..0000000
--- a/SQLiteStudio3/coreSQLiteStudio/parser/sqlite2_parse.y
+++ /dev/null
@@ -1,2077 +0,0 @@
-%token_prefix TK2_
-%token_type {Token*}
-%default_type {Token*}
-%extra_argument {ParserContext* parserContext}
-%name sqlite2_parse
-
-%syntax_error {
- UNUSED_PARAMETER(yymajor);
- parserContext->error(TOKEN, QObject::tr("Syntax error"));
-}
-
-%stack_overflow {
- UNUSED_PARAMETER(yypMinor);
- parserContext->error(QObject::tr("Parser stack overflow"));
-}
-
-%include {
-#include "token.h"
-#include "parsercontext.h"
-#include "parser/ast/sqlitealtertable.h"
-#include "parser/ast/sqliteanalyze.h"
-#include "parser/ast/sqliteattach.h"
-#include "parser/ast/sqlitebegintrans.h"
-#include "parser/ast/sqlitecommittrans.h"
-#include "parser/ast/sqlitecopy.h"
-#include "parser/ast/sqlitecreateindex.h"
-#include "parser/ast/sqlitecreatetable.h"
-#include "parser/ast/sqlitecreatetrigger.h"
-#include "parser/ast/sqlitecreateview.h"
-#include "parser/ast/sqlitecreatevirtualtable.h"
-#include "parser/ast/sqlitedelete.h"
-#include "parser/ast/sqlitedetach.h"
-#include "parser/ast/sqlitedropindex.h"
-#include "parser/ast/sqlitedroptable.h"
-#include "parser/ast/sqlitedroptrigger.h"
-#include "parser/ast/sqlitedropview.h"
-#include "parser/ast/sqliteemptyquery.h"
-#include "parser/ast/sqliteinsert.h"
-#include "parser/ast/sqlitepragma.h"
-#include "parser/ast/sqlitereindex.h"
-#include "parser/ast/sqliterelease.h"
-#include "parser/ast/sqliterollback.h"
-#include "parser/ast/sqlitesavepoint.h"
-#include "parser/ast/sqliteselect.h"
-#include "parser/ast/sqliteupdate.h"
-#include "parser/ast/sqlitevacuum.h"
-#include "parser/ast/sqliteexpr.h"
-#include "parser/ast/sqlitecolumntype.h"
-#include "parser/ast/sqliteconflictalgo.h"
-#include "parser/ast/sqlitesortorder.h"
-#include "parser/ast/sqliteindexedcolumn.h"
-#include "parser/ast/sqliteforeignkey.h"
-#include "parser_helper_stubs.h"
-#include "common/utils_sql.h"
-#include <QObject>
-#include <QDebug>
-
-#define assert(X) Q_ASSERT(X)
-#define UNUSED_PARAMETER(X) (void)(X)
-#define DONT_INHERIT_TOKENS(X) noTokenInheritanceFields << X
-}
-
-// These are extra tokens used by the lexer but never seen by the
-// parser. We put them in a rule so that the parser generator will
-// add them to the parse.h output file.
-
-%nonassoc ILLEGAL COMMENT SPACE.
-
-// The following directive causes tokens ABORT, AFTER, ASC, etc. to
-// fallback to ID if they will not parse as their original value.
-// This obviates the need for the "id" nonterminal.
-
-%fallback ID
- ABORT AFTER ASC ATTACH BEFORE BEGIN CASCADE CLUSTER CONFLICT
- COPY DATABASE DEFERRED DELIMITERS DESC DETACH EACH END EXPLAIN FAIL FOR
- GLOB IGNORE IMMEDIATE INITIALLY INSTEAD LIKE MATCH KEY
- OF OFFSET PRAGMA RAISE REPLACE RESTRICT ROW STATEMENT
- TEMP TRIGGER VACUUM VIEW.
-
-// Define operator precedence early so that this is the first occurance
-// of the operator tokens in the grammer. Keeping the operators together
-// causes them to be assigned integer values that are close together,
-// which keeps parser tables smaller.
-
-%left OR.
-%left AND.
-%right NOT.
-%left EQ NE ISNULL NOTNULL IS LIKE GLOB BETWEEN IN.
-%left GT GE LT LE.
-%left BITAND BITOR LSHIFT RSHIFT.
-%left PLUS MINUS.
-%left STAR SLASH REM.
-%left CONCAT.
-%right UMINUS UPLUS BITNOT.
-
-// Input is a single SQL command
-%type cmd {SqliteQuery*}
-%destructor cmd {delete $$;}
-
-input ::= cmdlist.
-
-cmdlist ::= cmdlist ecmd(C). {parserContext->addQuery(C); DONT_INHERIT_TOKENS("cmdlist");}
-cmdlist ::= ecmd(C). {parserContext->addQuery(C);}
-
-%type ecmd {SqliteQuery*}
-%destructor ecmd {delete $$;}
-ecmd(X) ::= SEMI. {X = new SqliteEmptyQuery();}
-ecmd(X) ::= explain(E) cmdx(C) SEMI. {
- X = C;
- X->explain = E->explain;
- X->queryPlan = E->queryPlan;
- delete E;
- objectForTokens = X;
- }
-
-%type explain {ParserStubExplain*}
-%destructor explain {delete $$;}
-explain(X) ::= . {X = new ParserStubExplain(false, false);}
-explain(X) ::= EXPLAIN. {X = new ParserStubExplain(true, false);}
-
-%type cmdx {SqliteQuery*}
-%destructor cmdx {delete $$;}
-cmdx(X) ::= cmd(C). {X = C;}
-
-///////////////////// Begin and end transactions. ////////////////////////////
-
-cmd(X) ::= BEGIN trans_opt(TO) onconf(C). {
- X = new SqliteBeginTrans(
- TO->transactionKw,
- TO->name,
- *(C)
- );
- delete TO;
- delete C;
- objectForTokens = X;
- }
-
-%type trans_opt {ParserStubTransDetails*}
-%destructor trans_opt {delete $$;}
-trans_opt(X) ::= . {X = new ParserStubTransDetails();}
-trans_opt(X) ::= TRANSACTION. {
- X = new ParserStubTransDetails();
- X->transactionKw = true;
- }
-trans_opt(X) ::= TRANSACTION nm(N). {
- X = new ParserStubTransDetails();
- X->transactionKw = true;
- X->name = *(N);
- delete N;
- }
-trans_opt ::= TRANSACTION ID_TRANS. {}
-
-cmd(X) ::= COMMIT trans_opt(T). {
- X = new SqliteCommitTrans(
- T->transactionKw,
- T->name,
- false
- );
- delete T;
- objectForTokens = X;
- }
-cmd(X) ::= END trans_opt(T). {
- X = new SqliteCommitTrans(
- T->transactionKw,
- T->name,
- true
- );
- delete T;
- objectForTokens = X;
- }
-cmd(X) ::= ROLLBACK trans_opt(T). {
- X = new SqliteRollback(
- T->transactionKw,
- T->name
- );
- delete T;
- objectForTokens = X;
- }
-
-///////////////////// The CREATE TABLE statement ////////////////////////////
-
-cmd(X) ::= CREATE temp(T) TABLE
- fullname(N)
- LP columnlist(CL)
- conslist_opt(CS) RP. {
- X = new SqliteCreateTable(
- false,
- *(T),
- N->name1,
- N->name2,
- *(CL),
- *(CS)
- );
- delete T;
- delete CL;
- delete CS;
- delete N;
- objectForTokens = X;
- }
-cmd(X) ::= CREATE temp(T) TABLE
- fullname(N)
- AS select(S). {
- X = new SqliteCreateTable(
- false,
- *(T),
- N->name1,
- N->name2,
- S
- );
- delete T;
- delete N;
- objectForTokens = X;
- }
-cmd ::= CREATE temp TABLE
- nm DOT ID_TAB_NEW. {}
-cmd ::= CREATE temp TABLE
- ID_DB|ID_TAB_NEW. {}
-
-%type temp {int*}
-%destructor temp {delete $$;}
-temp(X) ::= TEMP(T). {X = new int( (T->value.length() > 4) ? 2 : 1 );}
-temp(X) ::= . {X = new int(0);}
-
-%type columnlist {ParserCreateTableColumnList*}
-%destructor columnlist {delete $$;}
-columnlist(X) ::= columnlist(L)
- COMMA column(C). {
- L->append(C);
- X = L;
- DONT_INHERIT_TOKENS("columnlist");
- }
-columnlist(X) ::= column(C). {
- X = new ParserCreateTableColumnList();
- X->append(C);
- }
-
-%type column {SqliteCreateTable::Column*}
-%destructor column {delete $$;}
-column(X) ::= columnid(C) type(T)
- carglist(L). {
- X = new SqliteCreateTable::Column(*(C), T, *(L));
- delete C;
- delete L;
- objectForTokens = X;
- }
-
-%type columnid {QString*}
-%destructor columnid {delete $$;}
-columnid(X) ::= nm(N). {X = N;}
-columnid ::= ID_COL_NEW. {}
-
-// An IDENTIFIER can be a generic identifier, or one of several
-// keywords. Any non-standard keyword can also be an identifier.
-
-%type id {QString*}
-%destructor id {delete $$;}
-id(X) ::= ID(T). {
- X = new QString(
- stripObjName(
- T->value,
- parserContext->dialect
- )
- );
- }
-
-// And "ids" is an identifer-or-string.
-
-%type ids {QString*}
-%destructor ids {delete $$;}
-ids(X) ::= ID|STRING(T). {X = new QString(T->value);}
-
-// The name of a column or table can be any of the following:
-
-%type nm {QString*}
-%destructor nm {delete $$;}
-nm(X) ::= id(N). {X = N;}
-nm(X) ::= STRING(N). {X = new QString(stripString(N->value));}
-nm(X) ::= JOIN_KW(N). {X = new QString(N->value);}
-
-%type type {SqliteColumnType*}
-%destructor type {delete $$;}
-type(X) ::= . {X = nullptr;}
-type(X) ::= typetoken(T). {X = T;}
-
-%type typetoken {SqliteColumnType*}
-%destructor typetoken {delete $$;}
-typetoken(X) ::= typename(N). {
- X = new SqliteColumnType(*(N));
- delete N;
- objectForTokens = X;
- }
-typetoken(X) ::= typename(N)
- LP signed(P) RP. {
- X = new SqliteColumnType(*(N), *(P));
- delete N;
- delete P;
- objectForTokens = X;
- }
-typetoken(X) ::= typename(N) LP signed(P)
- COMMA signed(S) RP. {
- X = new SqliteColumnType(*(N), *(P), *(S));
- delete N;
- delete P;
- delete S;
- objectForTokens = X;
- }
-
-%type typename {QString*}
-%destructor typename {delete $$;}
-typename(X) ::= ids(I). {X = I;}
-typename(X) ::= typename(T) ids(I). {
- T->append(" " + *(I));
- delete I;
- X = T;
- }
-typename ::= ID_COL_TYPE. {}
-
-%type signed {QVariant*}
-%destructor signed {delete $$;}
-signed(X) ::= plus_num(N). {X = N;}
-signed(X) ::= minus_num(N). {X = N;}
-
-%type carglist {ParserCreateTableColumnConstraintList*}
-%destructor carglist {delete $$;}
-carglist(X) ::= carglist(L) ccons(C). {
- L->append(C);
- X = L;
- DONT_INHERIT_TOKENS("carglist");
- }
-carglist(X) ::= carglist(L) ccons_nm(N)
- ccons(C). {
- L->append(N);
- L->append(C);
- X = L;
- DONT_INHERIT_TOKENS("carglist");
- }
-carglist(X) ::= carglist(L) carg(C). {
- L->append(C);
- X = L;
- DONT_INHERIT_TOKENS("carglist");
- }
-carglist(X) ::= . {X = new ParserCreateTableColumnConstraintList();}
-
-%type carg {SqliteCreateTable::Column::Constraint*}
-%destructor carg {delete $$;}
-carg(X) ::= DEFAULT STRING(S). {
- X = new SqliteCreateTable::Column::Constraint();
- X->initDefId(stripObjName(
- S->value,
- parserContext->dialect
- ));
- objectForTokens = X;
- }
-carg(X) ::= DEFAULT ID(I). {
- X = new SqliteCreateTable::Column::Constraint();
- X->initDefId(stripObjName(
- I->value,
- parserContext->dialect
- ));
- objectForTokens = X;
-
- }
-carg(X) ::= DEFAULT INTEGER(I). {
- X = new SqliteCreateTable::Column::Constraint();
- QVariant val = QVariant(I->value).toLongLong();
- X->initDefTerm(val, false);
- objectForTokens = X;
- }
-carg(X) ::= DEFAULT PLUS INTEGER(I). {
- X = new SqliteCreateTable::Column::Constraint();
- QVariant val = QVariant(I->value).toLongLong();
- X->initDefTerm(val, false);
- objectForTokens = X;
- }
-carg(X) ::= DEFAULT MINUS INTEGER(I). {
- X = new SqliteCreateTable::Column::Constraint();
- QVariant val = QVariant(I->value).toLongLong();
- X->initDefTerm(val, true);
- objectForTokens = X;
- }
-carg(X) ::= DEFAULT FLOAT(F). {
- X = new SqliteCreateTable::Column::Constraint();
- QVariant val = QVariant(F->value).toDouble();
- X->initDefTerm(val, false);
- objectForTokens = X;
- }
-carg(X) ::= DEFAULT PLUS FLOAT(F). {
- X = new SqliteCreateTable::Column::Constraint();
- QVariant val = QVariant(F->value).toDouble();
- X->initDefTerm(val, false);
- objectForTokens = X;
- }
-carg(X) ::= DEFAULT MINUS FLOAT(F). {
- X = new SqliteCreateTable::Column::Constraint();
- QVariant val = QVariant(F->value).toDouble();
- X->initDefTerm(val, true);
- objectForTokens = X;
- }
-carg(X) ::= DEFAULT NULL. {
- X = new SqliteCreateTable::Column::Constraint();
- X->initDefTerm(QVariant(), false);
- objectForTokens = X;
- }
-
-// In addition to the type name, we also care about the primary key and
-// UNIQUE constraints.
-
-%type ccons_nm {SqliteCreateTable::Column::Constraint*}
-%destructor ccons_nm {delete $$;}
-ccons_nm(X) ::= CONSTRAINT nm(N). {
- X = new SqliteCreateTable::Column::Constraint();
- X->initDefNameOnly(*(N));
- delete N;
- objectForTokens = X;
- }
-
-%type ccons {SqliteCreateTable::Column::Constraint*}
-%destructor ccons {delete $$;}
-ccons(X) ::= NULL onconf(C). {
- X = new SqliteCreateTable::Column::Constraint();
- X->initNull(*(C));
- delete C;
- objectForTokens = X;
- }
-ccons(X) ::= NOT NULL onconf(C). {
- X = new SqliteCreateTable::Column::Constraint();
- X->initNotNull(*(C));
- delete C;
- objectForTokens = X;
- }
-ccons(X) ::= PRIMARY KEY sortorder(O)
- onconf(C). {
- X = new SqliteCreateTable::Column::Constraint();
- X->initPk(*(O), *(C), false);
- delete O;
- delete C;
- objectForTokens = X;
- }
-ccons(X) ::= UNIQUE onconf(C). {
- X = new SqliteCreateTable::Column::Constraint();
- X->initUnique(*(C));
- delete C;
- objectForTokens = X;
- }
-ccons(X) ::= CHECK LP expr(E) RP onconf(C). {
- X = new SqliteCreateTable::Column::Constraint();
- X->initCheck(E, *(C));
- delete C;
- objectForTokens = X;
- }
-ccons(X) ::= REFERENCES nm(N)
- idxlist_opt(I) refargs(A). {
- X = new SqliteCreateTable::Column::Constraint();
- X->initFk(*(N), *(I), *(A));
- delete N;
- delete A;
- delete I;
- objectForTokens = X;
- }
-ccons(X) ::= defer_subclause(D). {
- X = new SqliteCreateTable::Column::Constraint();
- X->initDefer(D->initially, D->deferrable);
- delete D;
- objectForTokens = X;
- }
-ccons(X) ::= COLLATE id(I). {
- X = new SqliteCreateTable::Column::Constraint();
- X->initColl(*(I));
- delete I;
- objectForTokens = X;
- }
-ccons(X) ::= CHECK LP RP. {
- X = new SqliteCreateTable::Column::Constraint();
- X->initCheck();
- objectForTokens = X;
- parserContext->minorErrorAfterLastToken("Syntax error");
- }
-
-// The next group of rules parses the arguments to a REFERENCES clause
-// that determine if the referential integrity checking is deferred or
-// or immediate and which determine what action to take if a ref-integ
-// check fails.
-
-%type refargs {ParserFkConditionList*}
-%destructor refargs {delete $$;}
-refargs(X) ::= . {X = new ParserFkConditionList();}
-refargs(X) ::= refargs(L) refarg(A). {
- L->append(A);
- X = L;
- DONT_INHERIT_TOKENS("refargs");
- }
-
-%type refarg {SqliteForeignKey::Condition*}
-%destructor refarg {delete $$;}
-refarg(X) ::= MATCH nm(N). {
- X = new SqliteForeignKey::Condition(*(N));
- delete N;
- }
-refarg(X) ::= ON INSERT refact(R). {X = new SqliteForeignKey::Condition(SqliteForeignKey::Condition::INSERT, *(R)); delete R;}
-refarg(X) ::= ON DELETE refact(R). {X = new SqliteForeignKey::Condition(SqliteForeignKey::Condition::DELETE, *(R)); delete R;}
-refarg(X) ::= ON UPDATE refact(R). {X = new SqliteForeignKey::Condition(SqliteForeignKey::Condition::UPDATE, *(R)); delete R;}
-refarg ::= MATCH ID_FK_MATCH. {}
-
-%type refact {SqliteForeignKey::Condition::Reaction*}
-%destructor refact {delete $$;}
-refact(X) ::= SET NULL. {X = new SqliteForeignKey::Condition::Reaction(SqliteForeignKey::Condition::SET_NULL);}
-refact(X) ::= SET DEFAULT. {X = new SqliteForeignKey::Condition::Reaction(SqliteForeignKey::Condition::SET_DEFAULT);}
-refact(X) ::= CASCADE. {X = new SqliteForeignKey::Condition::Reaction(SqliteForeignKey::Condition::CASCADE);}
-refact(X) ::= RESTRICT. {X = new SqliteForeignKey::Condition::Reaction(SqliteForeignKey::Condition::RESTRICT);}
-
-%type defer_subclause {ParserDeferSubClause*}
-%destructor defer_subclause {delete $$;}
-defer_subclause(X) ::= NOT DEFERRABLE
- init_deferred_pred_opt(I). {
- X = new ParserDeferSubClause(SqliteDeferrable::NOT_DEFERRABLE, *(I));
- delete I;
- }
-defer_subclause(X) ::= DEFERRABLE
- init_deferred_pred_opt(I). {
- X = new ParserDeferSubClause(SqliteDeferrable::DEFERRABLE, *(I));
- delete I;
- }
-
-%type init_deferred_pred_opt {SqliteInitially*}
-%destructor init_deferred_pred_opt {delete $$;}
-init_deferred_pred_opt(X) ::= . {X = new SqliteInitially(SqliteInitially::null);}
-init_deferred_pred_opt(X) ::= INITIALLY
- DEFERRED. {X = new SqliteInitially(SqliteInitially::DEFERRED);}
-init_deferred_pred_opt(X) ::= INITIALLY
- IMMEDIATE. {X = new SqliteInitially(SqliteInitially::IMMEDIATE);}
-
-
-%type conslist_opt {ParserCreateTableConstraintList*}
-%destructor conslist_opt {delete $$;}
-conslist_opt(X) ::= . {X = new ParserCreateTableConstraintList();}
-conslist_opt(X) ::= COMMA conslist(L). {X = L;}
-
-%type conslist {ParserCreateTableConstraintList*}
-%destructor conslist {delete $$;}
-conslist(X) ::= conslist(L) tconscomma(CM)
- tcons(C). {
- C->afterComma = *(CM);
- L->append(C);
- X = L;
- delete CM;
- DONT_INHERIT_TOKENS("conslist");
- }
-conslist(X) ::= tcons(C). {
- X = new ParserCreateTableConstraintList();
- X->append(C);
- }
-
-%type tconscomma {bool*}
-%destructor tconscomma {delete $$;}
-tconscomma(X) ::= COMMA. {X = new bool(true);}
-tconscomma(X) ::= . {X = new bool(false);}
-
-%type tcons {SqliteCreateTable::Constraint*}
-%destructor tcons {delete $$;}
-tcons(X) ::= CONSTRAINT nm(N). {
- X = new SqliteCreateTable::Constraint();
- X->initNameOnly(*(N));
- delete N;
- objectForTokens = X;
- }
-tcons(X) ::= PRIMARY KEY LP idxlist(L)
- RP onconf(C). {
- X = new SqliteCreateTable::Constraint();
- X->initPk(*(L), false, *(C));
- delete C;
- delete L;
- objectForTokens = X;
- }
-tcons(X) ::= UNIQUE LP idxlist(L) RP
- onconf(C). {
- X = new SqliteCreateTable::Constraint();
- X->initUnique(*(L), *(C));
- delete C;
- delete L;
- objectForTokens = X;
- }
-tcons(X) ::= CHECK LP expr(E) RP onconf(C). {
- X = new SqliteCreateTable::Constraint();
- X->initCheck(E, *(C));
- objectForTokens = X;
- }
-tcons(X) ::= FOREIGN KEY LP idxlist(L) RP
- REFERENCES nm(N) idxlist_opt(IL)
- refargs(R) defer_subclause_opt(D). {
- X = new SqliteCreateTable::Constraint();
- X->initFk(
- *(L),
- *(N),
- *(IL),
- *(R),
- D->initially,
- D->deferrable
- );
- delete N;
- delete R;
- delete D;
- delete IL;
- delete L;
- objectForTokens = X;
- }
-
-tcons ::= CONSTRAINT ID_CONSTR. {}
-tcons ::= FOREIGN KEY LP idxlist RP
- REFERENCES ID_TAB. {}
-tcons(X) ::= CHECK LP RP onconf. {
- X = new SqliteCreateTable::Constraint();
- X->initCheck();
- objectForTokens = X;
- parserContext->minorErrorAfterLastToken("Syntax error");
- }
-
-%type defer_subclause_opt {ParserDeferSubClause*}
-%destructor defer_subclause_opt {delete $$;}
-defer_subclause_opt(X) ::= . {X = new ParserDeferSubClause(SqliteDeferrable::null, SqliteInitially::null);}
-defer_subclause_opt(X) ::=
- defer_subclause(D). {X = D;}
-
-// The following is a non-standard extension that allows us to declare the
-// default behavior when there is a constraint conflict.
-%type onconf {SqliteConflictAlgo*}
-%destructor onconf {delete $$;}
-onconf(X) ::= . {X = new SqliteConflictAlgo(SqliteConflictAlgo::null);}
-onconf(X) ::= ON CONFLICT resolvetype(R). {X = R;}
-
-%type orconf {SqliteConflictAlgo*}
-%destructor orconf {delete $$;}
-orconf(X) ::= . {X = new SqliteConflictAlgo(SqliteConflictAlgo::null);}
-orconf(X) ::= OR resolvetype(R). {X = R;}
-
-%type resolvetype {SqliteConflictAlgo*}
-%destructor resolvetype {delete $$;}
-resolvetype(X) ::= ROLLBACK(V). {X = new SqliteConflictAlgo(sqliteConflictAlgo(V->value));}
-resolvetype(X) ::= ABORT(V). {X = new SqliteConflictAlgo(sqliteConflictAlgo(V->value));}
-resolvetype(X) ::= FAIL(V). {X = new SqliteConflictAlgo(sqliteConflictAlgo(V->value));}
-resolvetype(X) ::= IGNORE(V). {X = new SqliteConflictAlgo(sqliteConflictAlgo(V->value));}
-resolvetype(X) ::= REPLACE(V). {X = new SqliteConflictAlgo(sqliteConflictAlgo(V->value));}
-
-////////////////////////// The DROP TABLE /////////////////////////////////////
-
-cmd(X) ::= DROP TABLE fullname(N). {
- X = new SqliteDropTable(false, N->name1, N->name2);
- delete N;
- objectForTokens = X;
- }
-
-cmd ::= DROP TABLE nm DOT
- ID_TAB. {}
-cmd ::= DROP TABLE ID_DB|ID_TAB. {}
-
-///////////////////// The CREATE VIEW statement /////////////////////////////
-
-cmd(X) ::= CREATE temp(T) VIEW
- nm(N)
- AS select(S). {
- X = new SqliteCreateView(*(T), false, *(N), QString::null, S);
- delete T;
- delete N;
- objectForTokens = X;
- }
-
-cmd ::= CREATE temp VIEW ID_VIEW_NEW. {}
-
-cmd(X) ::= DROP VIEW nm(N). {
- X = new SqliteDropView(false, *(N), QString::null);
- delete N;
- objectForTokens = X;
- }
-
-cmd ::= DROP VIEW ID_VIEW. {}
-
-//////////////////////// The SELECT statement /////////////////////////////////
-
-cmd(X) ::= select_stmt(S). {
- X = S;
- objectForTokens = X;
- }
-
-%type select_stmt {SqliteQuery*}
-%destructor select_stmt {delete $$;}
-select_stmt(X) ::= select(S). {
- X = S;
- // since it's used in trigger:
- objectForTokens = X;
- }
-
-%type select {SqliteSelect*}
-%destructor select {delete $$;}
-select(X) ::= oneselect(S). {
- X = SqliteSelect::append(S);
- objectForTokens = X;
- }
-select(X) ::= select(S1) multiselect_op(O)
- oneselect(S2). {
- X = SqliteSelect::append(S1, *(O), S2);
- delete O;
- objectForTokens = X;
- }
-
-%type multiselect_op {SqliteSelect::CompoundOperator*}
-%destructor multiselect_op {delete $$;}
-multiselect_op(X) ::= UNION. {X = new SqliteSelect::CompoundOperator(SqliteSelect::CompoundOperator::UNION);}
-multiselect_op(X) ::= UNION ALL. {X = new SqliteSelect::CompoundOperator(SqliteSelect::CompoundOperator::UNION_ALL);}
-multiselect_op(X) ::= EXCEPT. {X = new SqliteSelect::CompoundOperator(SqliteSelect::CompoundOperator::EXCEPT);}
-multiselect_op(X) ::= INTERSECT. {X = new SqliteSelect::CompoundOperator(SqliteSelect::CompoundOperator::INTERSECT);}
-
-%type oneselect {SqliteSelect::Core*}
-%destructor oneselect {delete $$;}
-oneselect(X) ::= SELECT distinct(D)
- selcollist(L) from(F)
- where_opt(W) groupby_opt(G)
- having_opt(H)
- orderby_opt(O)
- limit_opt(LI). {
- X = new SqliteSelect::Core(
- *(D),
- *(L),
- F,
- W,
- *(G),
- H,
- *(O),
- LI
- );
- delete L;
- delete D;
- delete G;
- delete O;
- objectForTokens = X;
- }
-
-%type distinct {int*}
-%destructor distinct {delete $$;}
-distinct(X) ::= DISTINCT. {X = new int(1);}
-distinct(X) ::= ALL. {X = new int(2);}
-distinct(X) ::= . {X = new int(0);}
-
-// selcollist is a list of expressions that are to become the return
-// values of the SELECT statement. The "*" in statements like
-// "SELECT * FROM ..." is encoded as a special expression with an
-// opcode of TK_ALL.
-
-%type sclp {ParserResultColumnList*}
-%destructor sclp {delete $$;}
-sclp(X) ::= selcollist(L) COMMA. {X = L;}
-sclp(X) ::= . {X = new ParserResultColumnList();}
-
-%type selcollist {ParserResultColumnList*}
-%destructor selcollist {delete $$;}
-selcollist(X) ::= sclp(L) expr(E) as(N). {
- SqliteSelect::Core::ResultColumn* obj =
- new SqliteSelect::Core::ResultColumn(
- E,
- N ? N->asKw : false,
- N ? N->name : QString::null
- );
-
- L->append(obj);
- X = L;
- delete N;
- objectForTokens = obj;
- DONT_INHERIT_TOKENS("sclp");
- }
-selcollist(X) ::= sclp(L) STAR. {
- SqliteSelect::Core::ResultColumn* obj =
- new SqliteSelect::Core::ResultColumn(true);
-
- L->append(obj);
- X = L;
- objectForTokens = obj;
- DONT_INHERIT_TOKENS("sclp");
- }
-selcollist(X) ::= sclp(L) nm(N) DOT STAR. {
- SqliteSelect::Core::ResultColumn* obj =
- new SqliteSelect::Core::ResultColumn(
- true,
- *(N)
- );
- L->append(obj);
- X = L;
- delete N;
- objectForTokens = obj;
- DONT_INHERIT_TOKENS("sclp");
- }
-selcollist(X) ::= sclp(L). {
- parserContext->minorErrorBeforeNextToken("Syntax error");
- X = L;
- }
-selcollist ::= sclp ID_TAB DOT STAR. {}
-
-// An option "AS <id>" phrase that can follow one of the expressions that
-// define the result set, or one of the tables in the FROM clause.
-
-%type as {ParserStubAlias*}
-%destructor as {delete $$;}
-as(X) ::= AS nm(N). {
- X = new ParserStubAlias(*(N), true);
- delete N;
- }
-as(X) ::= ids(N). {
- X = new ParserStubAlias(*(N), false);
- delete N;
- }
-as ::= AS ID_ALIAS. {}
-as ::= ID_ALIAS. {}
-as(X) ::= . {X = nullptr;}
-
-// A complete FROM clause.
-%type from {SqliteSelect::Core::JoinSource*}
-%destructor from {delete $$;}
-from(X) ::= . {X = nullptr;}
-from(X) ::= FROM joinsrc(L). {X = L;}
-
-%type joinsrc {SqliteSelect::Core::JoinSource*}
-%destructor joinsrc {delete $$;}
-joinsrc(X) ::= singlesrc(S) seltablist(L). {
- X = new SqliteSelect::Core::JoinSource(
- S,
- *(L)
- );
- delete L;
- objectForTokens = X;
- }
-joinsrc(X) ::= . {
- parserContext->minorErrorBeforeNextToken("Syntax error");
- X = new SqliteSelect::Core::JoinSource();
- objectForTokens = X;
- }
-
-%type seltablist {ParserOtherSourceList*}
-%destructor seltablist {delete $$;}
-seltablist(X) ::= seltablist(L) joinop(O)
- singlesrc(S)
- joinconstr_opt(C). {
- SqliteSelect::Core::JoinSourceOther* src =
- new SqliteSelect::Core::JoinSourceOther(O, S, C);
-
- L->append(src);
- X = L;
- objectForTokens = src;
- DONT_INHERIT_TOKENS("seltablist");
- }
-seltablist(X) ::= . {
- X = new ParserOtherSourceList();
- }
-
-%type singlesrc {SqliteSelect::Core::SingleSource*}
-%destructor singlesrc {delete $$;}
-singlesrc(X) ::= nm(N1) dbnm(N2) as(A). {
- X = new SqliteSelect::Core::SingleSource(
- *(N1),
- *(N2),
- A ? A->asKw : false,
- A ? A->name : QString::null,
- false,
- QString::null
- );
- delete N1;
- delete N2;
- delete A;
- objectForTokens = X;
- }
-singlesrc(X) ::= LP select(S) RP as(A). {
- X = new SqliteSelect::Core::SingleSource(
- S,
- A ? A->asKw : false,
- A ? A->name : QString::null
- );
- delete A;
- objectForTokens = X;
- }
-singlesrc(X) ::= LP joinsrc(J) RP as(A). {
- X = new SqliteSelect::Core::SingleSource(
- J,
- A ? A->asKw : false,
- A ? A->name : QString::null
- );
- delete A;
- objectForTokens = X;
- }
-singlesrc(X) ::= . {
- parserContext->minorErrorBeforeNextToken("Syntax error");
- X = new SqliteSelect::Core::SingleSource();
- objectForTokens = X;
- }
-singlesrc(X) ::= nm(N) DOT. {
- parserContext->minorErrorBeforeNextToken("Syntax error");
- X = new SqliteSelect::Core::SingleSource();
- X->database = *(N);
- delete N;
- objectForTokens = X;
- }
-
-singlesrc ::= nm DOT ID_TAB. {}
-singlesrc ::= ID_DB|ID_TAB. {}
-singlesrc ::= nm DOT ID_VIEW. {}
-singlesrc ::= ID_DB|ID_VIEW. {}
-
-%type joinconstr_opt {SqliteSelect::Core::JoinConstraint*}
-%destructor joinconstr_opt {delete $$;}
-joinconstr_opt(X) ::= ON expr(E). {
- X = new SqliteSelect::Core::JoinConstraint(E);
- objectForTokens = X;
- }
-joinconstr_opt(X) ::= USING LP
- idlist(L) RP. {
- X = new SqliteSelect::Core::JoinConstraint(*(L));
- delete L;
- objectForTokens = X;
- }
-joinconstr_opt(X) ::= . {X = nullptr;}
-
-%type dbnm {QString*}
-%destructor dbnm {delete $$;}
-dbnm(X) ::= . {X = new QString();}
-dbnm(X) ::= DOT nm(N). {X = N;}
-
-%type fullname {ParserFullName*}
-%destructor fullname {delete $$;}
-fullname(X) ::= nm(N1) dbnm(N2). {
- X = new ParserFullName();
- X->name1 = *(N1);
- X->name2 = *(N2);
- delete N1;
- delete N2;
- }
-
-%type joinop {SqliteSelect::Core::JoinOp*}
-%destructor joinop {delete $$;}
-joinop(X) ::= COMMA. {
- X = new SqliteSelect::Core::JoinOp(true);
- objectForTokens = X;
- }
-joinop(X) ::= JOIN. {
- X = new SqliteSelect::Core::JoinOp(false);
- objectForTokens = X;
- }
-joinop(X) ::= JOIN_KW(K) JOIN. {
- X = new SqliteSelect::Core::JoinOp(K->value);
- objectForTokens = X;
- }
-joinop(X) ::= JOIN_KW(K) nm(N) JOIN. {
- X = new SqliteSelect::Core::JoinOp(K->value, *(N));
- delete N;
- objectForTokens = X;
- }
-joinop(X) ::= JOIN_KW(K) nm(N1) nm(N2)
- JOIN. {
- X = new SqliteSelect::Core::JoinOp(K->value, *(N1), *(N2));
- delete N1;
- delete N1;
- objectForTokens = X;
- }
-
-joinop ::= ID_JOIN_OPTS. {}
-
-%type orderby_opt {ParserOrderByList*}
-%destructor orderby_opt {delete $$;}
-orderby_opt(X) ::= . {X = new ParserOrderByList();}
-orderby_opt(X) ::= ORDER BY sortlist(L). {X = L;}
-
-%type sortlist {ParserOrderByList*}
-%destructor sortlist {delete $$;}
-sortlist(X) ::= sortlist(L) COMMA
- collate(C)
- expr(E) sortorder(O). {
- SqliteOrderBy* obj;
- if (C)
- {
- SqliteExpr* coll = new SqliteExpr();
- coll->initCollate(E, *(C));
- delete C;
- obj = new SqliteOrderBy(coll, *(O));
- }
- else
- {
- obj = new SqliteOrderBy(E, *(O));
- }
- L->append(obj);
- X = L;
- delete O;
- objectForTokens = obj;
- DONT_INHERIT_TOKENS("sortlist");
- }
-sortlist(X) ::= expr(E) collate(C)
- sortorder(O). {
- SqliteOrderBy* obj;
- if (C)
- {
- SqliteExpr* coll = new SqliteExpr();
- coll->initCollate(E, *(C));
- delete C;
- obj = new SqliteOrderBy(coll, *(O));
- }
- else
- {
- obj = new SqliteOrderBy(E, *(O));
- }
- X = new ParserOrderByList();
- X->append(obj);
- delete O;
- objectForTokens = obj;
- }
-
-%type collate {QString*}
-%destructor collate {if ($$) delete $$;}
-collate(X) ::= . {X = nullptr;}
-collate(X) ::= COLLATE id(I). {X = I;}
-
-%type sortorder {SqliteSortOrder*}
-%destructor sortorder {delete $$;}
-sortorder(X) ::= ASC. {X = new SqliteSortOrder(SqliteSortOrder::ASC);}
-sortorder(X) ::= DESC. {X = new SqliteSortOrder(SqliteSortOrder::DESC);}
-sortorder(X) ::= . {X = new SqliteSortOrder(SqliteSortOrder::null);}
-
-%type groupby_opt {ParserExprList*}
-%destructor groupby_opt {delete $$;}
-groupby_opt(X) ::= . {X = new ParserExprList();}
-groupby_opt(X) ::= GROUP BY nexprlist(L). {X = L;}
-groupby_opt(X) ::= GROUP BY. {
- parserContext->minorErrorBeforeNextToken("Syntax error");
- X = new ParserExprList();
- }
-%type having_opt {SqliteExpr*}
-%destructor having_opt {delete $$;}
-having_opt(X) ::= . {X = nullptr;}
-having_opt(X) ::= HAVING expr(E). {X = E;}
-
-%type limit_opt {SqliteLimit*}
-%destructor limit_opt {delete $$;}
-limit_opt(X) ::= . {X = nullptr;}
-limit_opt(X) ::= LIMIT signed(V). {
- X = new SqliteLimit(*(V));
- delete V;
- objectForTokens = X;
- }
-limit_opt(X) ::= LIMIT signed(V1) OFFSET
- signed(V2). {
- SqliteExpr* expr1 = new SqliteExpr();
- expr1->initLiteral(*(V1));
- expr1->setParent(X);
-
- SqliteExpr* expr2 = new SqliteExpr();
- expr1->initLiteral(*(V2));
- expr1->setParent(X);
-
- X = new SqliteLimit(expr1, expr2, true);
-
- TokenPtr limitToken = TokenPtr::create(Token::INTEGER, V1->toString());
- parserContext->addManagedToken(limitToken);
- expr1->tokens << limitToken;
- expr1->tokensMap["term"] << limitToken;
-
- TokenPtr offsetToken = TokenPtr::create(Token::INTEGER, V2->toString());
- parserContext->addManagedToken(offsetToken);
- expr2->tokens << offsetToken;
- expr2->tokensMap["term"] << offsetToken;
-
- delete V1;
- delete V2;
- objectForTokens = X;
- }
-limit_opt(X) ::= LIMIT signed(V1) COMMA
- signed(V2). {
- SqliteExpr* expr1 = new SqliteExpr();
- expr1->initLiteral(*(V1));
- expr1->setParent(X);
-
- SqliteExpr* expr2 = new SqliteExpr();
- expr1->initLiteral(*(V2));
- expr1->setParent(X);
-
- X = new SqliteLimit(expr1, expr2, false);
-
- TokenPtr limitToken = TokenPtr::create(Token::INTEGER, V1->toString());
- parserContext->addManagedToken(limitToken);
- expr1->tokens << limitToken;
- expr1->tokensMap["term"] << limitToken;
-
- TokenPtr offsetToken = TokenPtr::create(Token::INTEGER, V2->toString());
- parserContext->addManagedToken(offsetToken);
- expr2->tokens << offsetToken;
- expr2->tokensMap["term"] << offsetToken;
-
- delete V1;
- delete V2;
- objectForTokens = X;
- }
-
-/////////////////////////// The DELETE statement /////////////////////////////
-
-cmd(X) ::= delete_stmt(S). {
- X = S;
- objectForTokens = X;
- }
-
-%type delete_stmt {SqliteQuery*}
-%destructor delete_stmt {delete $$;}
-delete_stmt(X) ::= DELETE FROM fullname(N)
- where_opt(W). {
- X = new SqliteDelete(
- N->name1,
- N->name2,
- false,
- W,
- nullptr
- );
- delete N;
- // since it's used in trigger:
- objectForTokens = X;
- }
-
-delete_stmt(X) ::= DELETE FROM. {
- parserContext->minorErrorBeforeNextToken("Syntax error");
- SqliteDelete* q = new SqliteDelete();
- X = q;
- objectForTokens = X;
- }
-delete_stmt(X) ::= DELETE FROM nm(N) DOT. {
- parserContext->minorErrorBeforeNextToken("Syntax error");
- SqliteDelete* q = new SqliteDelete();
- q->database = *(N);
- X = q;
- objectForTokens = X;
- delete N;
- }
-delete_stmt ::= DELETE FROM nm DOT ID_TAB. {}
-delete_stmt ::= DELETE FROM ID_DB|ID_TAB. {}
-
-%type where_opt {SqliteExpr*}
-%destructor where_opt {delete $$;}
-where_opt(X) ::= . {X = nullptr;}
-where_opt(X) ::= WHERE expr(E). {X = E;}
-where_opt(X) ::= WHERE. {
- parserContext->minorErrorBeforeNextToken("Syntax error");
- X = new SqliteExpr();
- }
-
-
-////////////////////////// The UPDATE command ////////////////////////////////
-
-cmd(X) ::= update_stmt(S). {
- X = S;
- objectForTokens = X;
- }
-
-%type update_stmt {SqliteQuery*}
-%destructor update_stmt {delete $$;}
-update_stmt(X) ::= UPDATE orconf(C)
- fullname(N) SET
- setlist(L) where_opt(W). {
- X = new SqliteUpdate(
- *(C),
- N->name1,
- N->name2,
- false,
- QString::null,
- *(L),
- W,
- nullptr
- );
- delete C;
- delete N;
- delete L;
- // since it's used in trigger:
- objectForTokens = X;
- }
-
-update_stmt(X) ::= UPDATE
- orconf(C). {
- parserContext->minorErrorBeforeNextToken("Syntax error");
- X = new SqliteUpdate();
- objectForTokens = X;
- delete C;
- }
-update_stmt(X) ::= UPDATE
- orconf(C) nm(N) DOT. {
- parserContext->minorErrorBeforeNextToken("Syntax error");
- SqliteUpdate* q = new SqliteUpdate();
- q->database = *(N);
- X = q;
- objectForTokens = X;
- delete C;
- delete N;
- }
-update_stmt ::= UPDATE orconf nm DOT
- ID_TAB. {}
-update_stmt ::= UPDATE orconf ID_DB|ID_TAB. {}
-
-%type setlist {ParserSetValueList*}
-%destructor setlist {delete $$;}
-setlist(X) ::= setlist(L) COMMA nm(N) EQ
- expr(E). {
- L->append(ParserSetValue(*(N), E));
- X = L;
- delete N;
- DONT_INHERIT_TOKENS("setlist");
- }
-setlist(X) ::= nm(N) EQ expr(E). {
- X = new ParserSetValueList();
- X->append(ParserSetValue(*(N), E));
- delete N;
- }
-setlist(X) ::= . {
- parserContext->minorErrorBeforeNextToken("Syntax error");
- X = new ParserSetValueList();
- }
-setlist(X) ::= setlist(L) COMMA. {
- parserContext->minorErrorBeforeNextToken("Syntax error");
- X = L;
- }
-
-setlist ::= setlist COMMA ID_COL. {}
-setlist ::= ID_COL. {}
-
-////////////////////////// The INSERT command /////////////////////////////////
-
-cmd(X) ::= insert_stmt(S). {
- X = S;
- objectForTokens = X;
- }
-
-%type insert_stmt {SqliteQuery*}
-%destructor insert_stmt {delete $$;}
-insert_stmt(X) ::= insert_cmd(C) INTO
- fullname(N) idlist_opt(I)
- VALUES LP exprlist(L) RP. {
- X = new SqliteInsert(
- C->replace,
- C->orConflict,
- N->name1,
- N->name2,
- *(I),
- *(L),
- nullptr
- );
- delete N;
- delete C;
- delete L;
- delete I;
- // since it's used in trigger:
- objectForTokens = X;
- }
-insert_stmt(X) ::= insert_cmd(C) INTO
- fullname(N) idlist_opt(I)
- select(S). {
- X = new SqliteInsert(
- C->replace,
- C->orConflict,
- N->name1,
- N->name2,
- *(I),
- S,
- nullptr
- );
- delete N;
- delete C;
- delete I;
- // since it's used in trigger:
- objectForTokens = X;
- }
-
-insert_stmt(X) ::= insert_cmd(C) INTO. {
- parserContext->minorErrorBeforeNextToken("Syntax error");
- SqliteInsert* q = new SqliteInsert();
- q->replaceKw = C->replace;
- q->onConflict = C->orConflict;
- X = q;
- objectForTokens = X;
- delete C;
- }
-insert_stmt(X) ::= insert_cmd(C) INTO nm(N)
- DOT. {
- parserContext->minorErrorBeforeNextToken("Syntax error");
- SqliteInsert* q = new SqliteInsert();
- q->replaceKw = C->replace;
- q->onConflict = C->orConflict;
- q->database = *(N);
- X = q;
- objectForTokens = X;
- delete C;
- delete N;
- }
-insert_stmt ::= insert_cmd INTO
- ID_DB|ID_TAB. {}
-insert_stmt ::= insert_cmd INTO
- nm DOT ID_TAB. {}
-
-%type insert_cmd {ParserStubInsertOrReplace*}
-%destructor insert_cmd {delete $$;}
-insert_cmd(X) ::= INSERT orconf(C). {
- X = new ParserStubInsertOrReplace(false, *(C));
- delete C;
- }
-insert_cmd(X) ::= REPLACE. {X = new ParserStubInsertOrReplace(true);}
-
-%type idlist_opt {QStringList*}
-%destructor idlist_opt {delete $$;}
-idlist_opt(X) ::= . {X = new QStringList();}
-idlist_opt(X) ::= LP idlist(L) RP. {X = L;}
-
-%type idlist {QStringList*}
-%destructor idlist {delete $$;}
-idlist(X) ::= idlist(L) COMMA
- nm(N). {
- L->append(*(N));
- X = L;
- delete N;
- DONT_INHERIT_TOKENS("idlist");
- }
-idlist(X) ::= nm(N). {
- X = new QStringList();
- X->append(*(N));
- delete N;
- }
-idlist(X) ::= . {
- parserContext->minorErrorBeforeNextToken("Syntax error");
- X = new QStringList();
- }
-
-idlist ::= idlist COMMA ID_COL. {}
-idlist ::= ID_COL. {}
-
-/////////////////////////// Expression Processing /////////////////////////////
-
-%type exprx {SqliteExpr*}
-%destructor exprx {delete $$;}
-exprx(X) ::= NULL. {
- X = new SqliteExpr();
- X->initNull();
- objectForTokens = X;
- }
-exprx(X) ::= INTEGER(I). {
- X = new SqliteExpr();
- QVariant val = QVariant(I->value).toLongLong();
- X->initLiteral(val);
- objectForTokens = X;
- }
-exprx(X) ::= FLOAT(F). {
- X = new SqliteExpr();
- QVariant val = QVariant(F->value).toDouble();
- X->initLiteral(val);
- objectForTokens = X;
- }
-exprx(X) ::= STRING(S). {
- X = new SqliteExpr();
- X->initLiteral(QVariant(S->value));
- objectForTokens = X;
- }
-exprx(X) ::= LP expr(E) RP. {
- X = new SqliteExpr();
- X->initSubExpr(E);
- objectForTokens = X;
- }
-exprx(X) ::= id(N). {
- X = new SqliteExpr();
- X->initId(*(N));
- delete N;
- objectForTokens = X;
- }
-exprx(X) ::= JOIN_KW(N). {
- X = new SqliteExpr();
- X->initId(N->value);
- objectForTokens = X;
- }
-exprx(X) ::= nm(N1) DOT nm(N2). {
- X = new SqliteExpr();
- X->initId(*(N1), *(N2));
- delete N1;
- delete N2;
- objectForTokens = X;
- }
-exprx(X) ::= nm(N1) DOT nm(N2) DOT nm(N3). {
- X = new SqliteExpr();
- X->initId(*(N1), *(N2), *(N3));
- delete N1;
- delete N2;
- delete N3;
- objectForTokens = X;
- }
-exprx(X) ::= VARIABLE(V). {
- X = new SqliteExpr();
- X->initBindParam(V->value);
- objectForTokens = X;
- }
-exprx(X) ::= ID(I) LP exprlist(L) RP. {
- X = new SqliteExpr();
- X->initFunction(I->value, false, *(L));
- delete L;
- objectForTokens = X;
- }
-exprx(X) ::= ID(I) LP STAR RP. {
- X = new SqliteExpr();
- X->initFunction(I->value, true);
- objectForTokens = X;
- }
-exprx(X) ::= expr(E1) AND(O) expr(E2). {
- X = new SqliteExpr();
- X->initBinOp(E1, O->value, E2);
- objectForTokens = X;
- }
-exprx(X) ::= expr(E1) OR(O) expr(E2). {
- X = new SqliteExpr();
- X->initBinOp(E1, O->value, E2);
- objectForTokens = X;
- }
-exprx(X) ::= expr(E1) LT|GT|GE|LE(O)
- expr(E2). {
- X = new SqliteExpr();
- X->initBinOp(E1, O->value, E2);
- objectForTokens = X;
- }
-exprx(X) ::= expr(E1) EQ|NE(O) expr(E2). {
- X = new SqliteExpr();
- X->initBinOp(E1, O->value, E2);
- objectForTokens = X;
- }
-exprx(X) ::= expr(E1)
- BITAND|BITOR|LSHIFT|RSHIFT(O)
- expr(E2). {
- X = new SqliteExpr();
- X->initBinOp(E1, O->value, E2);
- objectForTokens = X;
- }
-exprx(X) ::= expr(E1) PLUS|MINUS(O)
- expr(E2). {
- X = new SqliteExpr();
- X->initBinOp(E1, O->value, E2);
- objectForTokens = X;
- }
-exprx(X) ::= expr(E1) STAR|SLASH|REM(O)
- expr(E2). {
- X = new SqliteExpr();
- X->initBinOp(E1, O->value, E2);
- objectForTokens = X;
- }
-exprx(X) ::= expr(E1) CONCAT(O) expr(E2). {
- X = new SqliteExpr();
- X->initBinOp(E1, O->value, E2);
- objectForTokens = X;
- }
-exprx(X) ::= expr(E1) not_opt(N) likeop(L)
- expr(E2). [LIKE_KW] {
- X = new SqliteExpr();
- X->initLike(E1, *(N), *(L), E2);
- delete N;
- delete L;
- objectForTokens = X;
- }
-exprx(X) ::= expr(E) ISNULL|NOTNULL(N). {
- X = new SqliteExpr();
- X->initNull(E, N->value);
- objectForTokens = X;
- }
-exprx(X) ::= expr(E) NOT NULL. {
- X = new SqliteExpr();
- X->initNull(E, "NOT NULL");
- objectForTokens = X;
- }
-exprx(X) ::= expr(E1) IS not_opt(N)
- expr(E2). {
- X = new SqliteExpr();
- X->initIs(E1, *(N), E2);
- delete N;
- objectForTokens = X;
- }
-exprx(X) ::= NOT(O) expr(E). {
- X = new SqliteExpr();
- X->initUnaryOp(E, O->value);
- }
-exprx(X) ::= BITNOT(O) expr(E). {
- X = new SqliteExpr();
- X->initUnaryOp(E, O->value);
- objectForTokens = X;
- }
-exprx(X) ::= MINUS(O) expr(E). [BITNOT] {
- X = new SqliteExpr();
- X->initUnaryOp(E, O->value);
- objectForTokens = X;
- }
-exprx(X) ::= PLUS(O) expr(E). [BITNOT] {
- X = new SqliteExpr();
- X->initUnaryOp(E, O->value);
- objectForTokens = X;
- }
-exprx(X) ::= expr(E1) not_opt(N) BETWEEN
- expr(E2) AND
- expr(E3). [BETWEEN] {
- X = new SqliteExpr();
- X->initBetween(E1, *(N), E2, E3);
- delete N;
- objectForTokens = X;
- }
-exprx(X) ::= expr(E) not_opt(N) IN LP
- exprlist(L) RP. [IN] {
- X = new SqliteExpr();
- X->initIn(E, *(N), *(L));
- delete N;
- delete L;
- objectForTokens = X;
- }
-exprx(X) ::= expr(E) not_opt(N) IN LP
- select(S) RP. [IN] {
- X = new SqliteExpr();
- X->initIn(E, *(N), S);
- delete N;
- objectForTokens = X;
- }
-exprx(X) ::= expr(E) not_opt(N) IN nm(N1)
- dbnm(N2). [IN] {
- X = new SqliteExpr();
- X->initIn(E, *(N), *(N1), *(N2));
- delete N;
- delete N1;
- objectForTokens = X;
- }
-exprx(X) ::= LP select(S) RP. {
- X = new SqliteExpr();
- X->initSubSelect(S);
- objectForTokens = X;
- }
-exprx(X) ::= CASE case_operand(O)
- case_exprlist(L)
- case_else(E) END. {
- X = new SqliteExpr();
- X->initCase(O, *(L), E);
- delete L;
- objectForTokens = X;
- }
-exprx(X) ::= RAISE LP raisetype(R) COMMA
- nm(N) RP. {
- X = new SqliteExpr();
- X->initRaise(R->value, *(N));
- delete N;
- objectForTokens = X;
- }
-exprx(X) ::= RAISE LP IGNORE(R) RP. {
- X = new SqliteExpr();
- X->initRaise(R->value);
- objectForTokens = X;
- }
-exprx(X) ::= nm(N1) DOT. {
- X = new SqliteExpr();
- X->initId(*(N1), QString::null, QString::null);
- delete N1;
- objectForTokens = X;
- parserContext->minorErrorBeforeNextToken("Syntax error");
- }
-exprx(X) ::= nm(N1) DOT nm(N2) DOT. {
- X = new SqliteExpr();
- X->initId(*(N1), *(N2), QString::null);
- delete N1;
- delete N2;
- objectForTokens = X;
- parserContext->minorErrorBeforeNextToken("Syntax error");
- }
-exprx(X) ::= expr(E1) not_opt(N) BETWEEN
- expr(E2) AND. {
- X = new SqliteExpr();
- delete N;
- delete E1;
- delete E2;
- objectForTokens = X;
- parserContext->minorErrorBeforeNextToken("Syntax error");
- }
-exprx(X) ::= CASE case_operand(O)
- case_exprlist(L)
- case_else(E). {
- X = new SqliteExpr();
- delete L;
- delete O;
- delete E;
- objectForTokens = X;
- parserContext->minorErrorBeforeNextToken("Syntax error");
- }
-exprx(X) ::= expr(E) not_opt(N) IN LP
- exprlist(L). [IN] {
- X = new SqliteExpr();
- delete N;
- delete L;
- delete E;
- objectForTokens = X;
- parserContext->minorErrorBeforeNextToken("Syntax error");
- }
-/*
-This introduces premature reduce for LP-expr and causes bug #2755
-exprx(X) ::= LP expr(E). {
- X = new SqliteExpr();
- X->initSubExpr(E);
- objectForTokens = X;
- parserContext->minorErrorBeforeNextToken("Syntax error");
- }
-*/
-
-exprx ::= expr not_opt IN ID_DB. [IN] {}
-exprx ::= expr not_opt IN nm DOT
- ID_TAB. [IN] {}
-exprx ::= ID_DB|ID_TAB|ID_COL|ID_FN. {}
-exprx ::= nm DOT ID_TAB|ID_COL. {}
-exprx ::= nm DOT nm DOT ID_COL. {}
-exprx ::= RAISE LP raisetype COMMA
- ID_ERR_MSG RP. {}
-
-%type expr {SqliteExpr*}
-%destructor expr {delete $$;}
-expr(X) ::= exprx(E). {X = E;}
-expr(X) ::= . {
- X = new SqliteExpr();
- objectForTokens = X;
- parserContext->minorErrorAfterLastToken("Syntax error");
- }
-%type not_opt {bool*}
-%destructor not_opt {delete $$;}
-not_opt(X) ::= . {X = new bool(false);}
-not_opt(X) ::= NOT. {X = new bool(true);}
-
-%type likeop {SqliteExpr::LikeOp*}
-%destructor likeop {delete $$;}
-likeop(X) ::= LIKE|GLOB(T). {X = new SqliteExpr::LikeOp(SqliteExpr::likeOp(T->value));}
-
-%type case_exprlist {ParserExprList*}
-%destructor case_exprlist {delete $$;}
-case_exprlist(X) ::= case_exprlist(L) WHEN
- expr(E1) THEN expr(E2). {
- L->append(E1);
- L->append(E2);
- X = L;
- }
-case_exprlist(X) ::= WHEN expr(E1) THEN
- expr(E2). {
- X = new ParserExprList();
- X->append(E1);
- X->append(E2);
- }
-
-%type case_else {SqliteExpr*}
-%destructor case_else {delete $$;}
-case_else(X) ::= ELSE expr(E). {X = E;}
-case_else(X) ::= . {X = nullptr;}
-
-%type case_operand {SqliteExpr*}
-%destructor case_operand {delete $$;}
-case_operand(X) ::= exprx(E). {X = E;}
-case_operand(X) ::= . {X = nullptr;}
-
-%type exprlist {ParserExprList*}
-%destructor exprlist {delete $$;}
-exprlist(X) ::= nexprlist(L). {X = L;}
-exprlist(X) ::= . {X = new ParserExprList();}
-
-%type nexprlist {ParserExprList*}
-%destructor nexprlist {delete $$;}
-nexprlist(X) ::= nexprlist(L) COMMA
- expr(E). {
- L->append(E);
- X = L;
- DONT_INHERIT_TOKENS("nexprlist");
- }
-nexprlist(X) ::= exprx(E). {
- X = new ParserExprList();
- X->append(E);
- }
-
-///////////////////////////// The CREATE INDEX command ///////////////////////
-
-cmd(X) ::= CREATE uniqueflag(U) INDEX
- nm(N1) ON nm(N2) dbnm(N3)
- LP idxlist(L) RP onconf(C). {
- X = new SqliteCreateIndex(
- *(U),
- false,
- *(N1),
- *(N2),
- *(N3),
- *(L),
- *(C)
- );
- delete U;
- delete N1;
- delete N2;
- delete N3;
- delete L;
- delete C;
- objectForTokens = X;
- }
-
-cmd ::= CREATE uniqueflag INDEX nm dbnm
- ON ID_TAB. {}
-cmd ::= CREATE uniqueflag INDEX nm DOT
- ID_IDX_NEW. {}
-cmd ::= CREATE uniqueflag INDEX
- ID_DB|ID_IDX_NEW. {}
-
-%type uniqueflag {bool*}
-%destructor uniqueflag {delete $$;}
-uniqueflag(X) ::= UNIQUE. {X = new bool(true);}
-uniqueflag(X) ::= . {X = new bool(false);}
-
-%type idxlist_opt {ParserIndexedColumnList*}
-%destructor idxlist_opt {delete $$;}
-idxlist_opt(X) ::= . {X = new ParserIndexedColumnList();}
-idxlist_opt(X) ::= LP idxlist(I) RP. {X = I;}
-
-%type idxlist {ParserIndexedColumnList*}
-%destructor idxlist {delete $$;}
-idxlist(X) ::= idxlist(L) COMMA
- idxlist_single(S). {
- L->append(S);
- X = L;
- DONT_INHERIT_TOKENS("idxlist");
- }
-idxlist(X) ::= idxlist_single(S). {
- X = new ParserIndexedColumnList();
- X->append(S);
- }
-
-%type idxlist_single {SqliteIndexedColumn*}
-%destructor idxlist_single {delete $$;}
-idxlist_single(X) ::= nm(N) sortorder(S). {
- SqliteIndexedColumn* obj =
- new SqliteIndexedColumn(
- *(N),
- QString::null,
- *(S)
- );
- X = obj;
- delete S;
- delete N;
- objectForTokens = X;
- }
-
-idxlist_single ::= ID_COL. {}
-
-///////////////////////////// The DROP INDEX command /////////////////////////
-
-cmd(X) ::= DROP INDEX fullname(N). {
- X = new SqliteDropIndex(false, N->name1, N->name2);
- delete N;
- objectForTokens = X;
- }
-
-cmd ::= DROP INDEX nm DOT ID_IDX. {}
-cmd ::= DROP INDEX ID_DB|ID_IDX. {}
-
-///////////////////////////// The COPY command ///////////////////////////////
-
-cmd(X) ::= COPY orconf(C) nm(N1) dbnm(N2)
- FROM nm(N3) USING DELIMITERS
- STRING(S). {
- X = new SqliteCopy(
- *(C),
- *(N1),
- *(N2),
- *(N3),
- S->value
- );
- delete C;
- delete N1;
- delete N2;
- delete N3;
- objectForTokens = X;
- }
-cmd(X) ::= COPY orconf(C) nm(N1) dbnm(N2)
- FROM nm(N3). {
- X = new SqliteCopy(
- *(C),
- *(N1),
- *(N2),
- *(N3)
- );
- delete C;
- delete N1;
- delete N2;
- delete N3;
- objectForTokens = X;
- }
-
-///////////////////////////// The VACUUM command /////////////////////////////
-
-cmd(X) ::= VACUUM. {
- X = new SqliteVacuum();
- objectForTokens = X;
- }
-cmd(X) ::= VACUUM nm(N). {
- X = new SqliteVacuum(*(N));
- delete N;
- objectForTokens = X;
- }
-
-///////////////////////////// The PRAGMA command /////////////////////////////
-
-cmd(X) ::= PRAGMA ids(I). {
- X = new SqlitePragma(*(I), QString::null);
- delete I;
- objectForTokens = X;
- }
-
-cmd(X) ::= PRAGMA nm(N) EQ nmnum(V). {
- X = new SqlitePragma(*(N), QString::null, *(V), true);
- delete N;
- delete V;
- objectForTokens = X;
- }
-cmd(X) ::= PRAGMA nm(N) LP nmnum(V) RP. {
- X = new SqlitePragma(*(N), QString::null, *(V), false);
- delete N;
- delete V;
- objectForTokens = X;
- }
-cmd(X) ::= PRAGMA nm(N) EQ minus_num(V). {
- X = new SqlitePragma(*(N), QString::null, *(V), true);
- delete N;
- delete V;
- objectForTokens = X;
- }
-cmd(X) ::= PRAGMA nm(N) LP minus_num(V) RP. {
- X = new SqlitePragma(*(N), QString::null, *(V), false);
- delete N;
- delete V;
- objectForTokens = X;
- }
-
-cmd ::= PRAGMA nm DOT ID_PRAGMA. {}
-cmd ::= PRAGMA ID_DB|ID_PRAGMA. {}
-
-%type nmnum {QVariant*}
-%destructor nmnum {delete $$;}
-nmnum(X) ::= plus_num(N). {X = N;}
-nmnum(X) ::= nm(N). {
- X = new QVariant(*(N));
- delete N;
- }
-nmnum(X) ::= ON(T). {X = new QVariant(T->value);}
-nmnum(X) ::= DELETE(T). {X = new QVariant(T->value);}
-nmnum(X) ::= DEFAULT(T). {X = new QVariant(T->value);}
-
-%type plus_num {QVariant*}
-%destructor plus_num {delete $$;}
-plus_num(X) ::= PLUS number(N). {X = N;}
-plus_num(X) ::= number(N). {X = N;}
-
-%type minus_num {QVariant*}
-%destructor minus_num {delete $$;}
-minus_num(X) ::= MINUS number(N). {
- if (N->type() == QVariant::Double)
- *(N) = -(N->toDouble());
- else if (N->type() == QVariant::LongLong)
- *(N) = -(N->toLongLong());
- else
- Q_ASSERT_X(true, "producing minus number", "QVariant is neither of Double or LongLong.");
-
- X = N;
- }
-
-%type number {QVariant*}
-%destructor number {delete $$;}
-number(X) ::= INTEGER(N). {X = new QVariant(QVariant(N->value).toLongLong());}
-number(X) ::= FLOAT(N). {X = new QVariant(QVariant(N->value).toDouble());}
-
-//////////////////////////// The CREATE TRIGGER command /////////////////////
-
-cmd(X) ::= CREATE temp(T) TRIGGER
- nm(N) trigger_time(TT)
- trigger_event(EV) ON nm(N1)
- dbnm(N2) foreach_clause(FC)
- when_clause(WC) BEGIN
- trigger_cmd_list(CL) END. {
- X = new SqliteCreateTrigger(
- *(T),
- false,
- *(N),
- *(N1),
- *(N2),
- *(TT),
- EV,
- *(FC),
- WC,
- *(CL),
- 2
- );
- delete T;
- delete TT;
- delete FC;
- delete N1;
- delete N;
- delete N2;
- delete CL;
- objectForTokens = X;
- }
-
-// Support full parsing when no BEGIN and END are present (for completion helper)
-cmd(X) ::= CREATE temp(T) TRIGGER
- nm(N) trigger_time(TT)
- trigger_event(EV) ON nm(N1)
- dbnm(N2) foreach_clause(FC)
- when_clause(WC). {
- QList<SqliteQuery *> CL;
-
- X = new SqliteCreateTrigger(
- *(T),
- false,
- *(N),
- *(N1),
- *(N2),
- *(TT),
- EV,
- *(FC),
- WC,
- CL,
- 2
- );
- delete T;
- delete TT;
- delete FC;
- delete N1;
- delete N;
- delete N2;
- objectForTokens = X;
- parserContext->minorErrorAfterLastToken("Syntax error");
- }
-
-// Support full parsing when no END is present (for completion helper)
-cmd(X) ::= CREATE temp(T) TRIGGER
- nm(N) trigger_time(TT)
- trigger_event(EV) ON nm(N1)
- dbnm(N2) foreach_clause(FC)
- when_clause(WC) BEGIN
- trigger_cmd_list(CL). {
- X = new SqliteCreateTrigger(
- *(T),
- false,
- *(N),
- *(N1),
- *(N2),
- *(TT),
- EV,
- *(FC),
- WC,
- *(CL),
- 2
- );
- delete T;
- delete TT;
- delete FC;
- delete N1;
- delete N;
- delete N2;
- delete CL;
- objectForTokens = X;
- parserContext->minorErrorAfterLastToken("Syntax error");
- }
-
-cmd ::= CREATE temp TRIGGER nm
- trigger_time trigger_event
- ON ID_TAB|ID_DB. {}
-cmd ::= CREATE temp TRIGGER nm
- trigger_time trigger_event
- ON nm DOT ID_TAB. {}
-cmd ::= CREATE temp TRIGGER ID_TRIG_NEW. {}
-
-%type trigger_time {SqliteCreateTrigger::Time*}
-%destructor trigger_time {delete $$;}
-trigger_time(X) ::= BEFORE. {X = new SqliteCreateTrigger::Time(SqliteCreateTrigger::Time::BEFORE);}
-trigger_time(X) ::= AFTER. {X = new SqliteCreateTrigger::Time(SqliteCreateTrigger::Time::AFTER);}
-trigger_time(X) ::= INSTEAD OF. {X = new SqliteCreateTrigger::Time(SqliteCreateTrigger::Time::INSTEAD_OF);}
-trigger_time(X) ::= . {X = new SqliteCreateTrigger::Time(SqliteCreateTrigger::Time::null);}
-
-%type trigger_event {SqliteCreateTrigger::Event*}
-%destructor trigger_event {delete $$;}
-trigger_event(X) ::= DELETE. {
- X = new SqliteCreateTrigger::Event(SqliteCreateTrigger::Event::DELETE);
- objectForTokens = X;
- }
-trigger_event(X) ::= INSERT. {
- X = new SqliteCreateTrigger::Event(SqliteCreateTrigger::Event::INSERT);
- objectForTokens = X;
- }
-trigger_event(X) ::= UPDATE. {
- X = new SqliteCreateTrigger::Event(SqliteCreateTrigger::Event::UPDATE);
- objectForTokens = X;
- }
-trigger_event(X) ::= UPDATE OF
- idlist(L). {
- X = new SqliteCreateTrigger::Event(*(L));
- delete L;
- objectForTokens = X;
- }
-
-%type foreach_clause {SqliteCreateTrigger::Scope*}
-%destructor foreach_clause {delete $$;}
-foreach_clause(X) ::= . {X = new SqliteCreateTrigger::Scope(SqliteCreateTrigger::Scope::null);}
-foreach_clause(X) ::= FOR EACH ROW. {X = new SqliteCreateTrigger::Scope(SqliteCreateTrigger::Scope::FOR_EACH_ROW);}
-foreach_clause(X) ::= FOR EACH STATEMENT. {X = new SqliteCreateTrigger::Scope(SqliteCreateTrigger::Scope::FOR_EACH_STATEMENT);}
-
-%type when_clause {SqliteExpr*}
-%destructor when_clause {if ($$) delete $$;}
-when_clause(X) ::= . {X = nullptr;}
-when_clause(X) ::= WHEN expr(E). {X = E;}
-
-%type trigger_cmd_list {ParserQueryList*}
-%destructor trigger_cmd_list {delete $$;}
-trigger_cmd_list(X) ::= trigger_cmd_list(L)
- trigger_cmd(C) SEMI. {
- L->append(C);
- X = L;
- DONT_INHERIT_TOKENS("trigger_cmd_list");
- }
-trigger_cmd_list(X) ::= trigger_cmd(C)
- SEMI. {
- X = new ParserQueryList();
- X->append(C);
- }
-
-%type trigger_cmd {SqliteQuery*}
-%destructor trigger_cmd {delete $$;}
-trigger_cmd(X) ::= update_stmt(S). {X = S;}
-trigger_cmd(X) ::= insert_stmt(S). {X = S;}
-trigger_cmd(X) ::= delete_stmt(S). {X = S;}
-trigger_cmd(X) ::= select_stmt(S). {X = S;}
-
-%type raisetype {Token*}
-raisetype(X) ::= ROLLBACK|ABORT|FAIL(V). {X = V;}
-
-//////////////////////// DROP TRIGGER statement //////////////////////////////
-cmd(X) ::= DROP TRIGGER fullname(N). {
- X = new SqliteDropTrigger(false, N->name1, N->name2);
- delete N;
- objectForTokens = X;
- }
-
-cmd ::= DROP TRIGGER nm DOT ID_TRIG. {}
-cmd ::= DROP TRIGGER ID_DB|ID_TRIG. {}
-
-//////////////////////// ATTACH DATABASE file AS name /////////////////////////
-cmd(X) ::= ATTACH database_kw_opt(D)
- ids(I1) AS ids(I2) key_opt(K). {
- SqliteExpr* e1 = new SqliteExpr();
- SqliteExpr* e2 = new SqliteExpr();
- e1->initLiteral(*(I1));
- e2->initLiteral(*(I2));
- X = new SqliteAttach(*(D), e1, e2, K);
- delete D;
- delete I1;
- delete I2;
- objectForTokens = X;
- }
-
-%type key_opt {SqliteExpr*}
-%destructor key_opt {if ($$) delete $$;}
-key_opt(X) ::= . {X = nullptr;}
-key_opt(X) ::= USING ids(I). {
- SqliteExpr* e = new SqliteExpr();
- e->initLiteral(*(I));
- delete I;
- X = e;
- }
-
-%type database_kw_opt {bool*}
-%destructor database_kw_opt {delete $$;}
-database_kw_opt(X) ::= DATABASE. {X = new bool(true);}
-database_kw_opt(X) ::= . {X = new bool(false);}
-
-
-//////////////////////// DETACH DATABASE name /////////////////////////////////
-cmd(X) ::= DETACH database_kw_opt(D)
- nm(N). {
- SqliteExpr* e = new SqliteExpr();
- e->initLiteral(*(N));
- delete N;
- X = new SqliteDetach(*(D), e);
- delete D;
- objectForTokens = X;
- }
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/sqlite3_parse.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/sqlite3_parse.cpp
index ffe6981..c980096 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/sqlite3_parse.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/sqlite3_parse.cpp
@@ -15,6 +15,8 @@
#include "parsercontext.h"
#include "parser_helper_stubs.h"
#include "common/utils_sql.h"
+#include "common/global.h"
+#include "common/unused.h"
#include "parser/ast/sqlitealtertable.h"
#include "parser/ast/sqliteanalyze.h"
#include "parser/ast/sqliteattach.h"
@@ -50,6 +52,9 @@
#include "parser/ast/sqliteforeignkey.h"
#include "parser/ast/sqlitewith.h"
#include "parser/ast/sqliteupsert.h"
+#include "parser/ast/sqlitewindowdefinition.h"
+#include "parser/ast/sqlitefilterover.h"
+#include "parser/ast/sqlitenulls.h"
#include <QObject>
#include <QDebug>
#include <limits.h>
@@ -107,63 +112,77 @@
** defined, then do no error processing.
*/
#define YYCODETYPE unsigned short int
-#define YYNOCODE 281
+#define YYNOCODE 321
#define YYACTIONTYPE unsigned short int
-#define YYWILDCARD 61
+#define YYWILDCARD 78
#define sqlite3_parseTOKENTYPE Token*
typedef union {
int yyinit;
sqlite3_parseTOKENTYPE yy0;
- SqliteCreateTrigger::Scope* yy3;
+ SqliteWith* yy1;
+ SqliteLimit* yy4;
+ ParserDeferSubClause* yy9;
+ SqliteSelect::Core::JoinSource* yy31;
+ SqliteExpr::LikeOp* yy40;
+ SqliteWindowDefinition::Window::Frame* yy41;
+ ParserCreateTableColumnList* yy42;
ParserCreateTableColumnConstraintList* yy51;
- QStringList* yy95;
+ ParserResultColumnList* yy53;
+ SqliteColumnType* yy57;
+ SqliteWindowDefinition::Window::Frame::Exclude* yy63;
+ ParserExprList* yy71;
+ SqliteCreateTrigger::Scope* yy83;
+ ParserStubTransDetails* yy84;
+ ParserStubExplain* yy91;
SqliteForeignKey::Condition::Reaction* yy104;
- ParserStubInsertOrReplace* yy105;
- SqliteIndexedColumn* yy108;
- ParserOtherSourceList* yy131;
- SqliteCreateTrigger::Time* yy132;
- int* yy146;
- ParserOrderByList* yy163;
- ParserExprNestedList* yy166;
- ParserFkConditionList* yy184;
- ParserIndexedBy* yy192;
+ ParserQueryList* yy110;
+ SqliteCreateTable::Column* yy147;
+ SqliteCreateTrigger::Event* yy151;
ParserStubAlias* yy200;
- SqliteSelect::Core::SingleSource* yy201;
- ParserCreateTableColumnList* yy202;
+ ParserSetValueList* yy201;
+ SqliteSelect::Core::JoinOp* yy221;
ParserIndexedColumnList* yy223;
- SqliteCreateTable::Column* yy227;
- SqliteQuery* yy283;
+ QVariant* yy229;
+ SqliteCreateTable::Constraint* yy246;
+ SqliteFilterOver* yy247;
+ SqliteFilterOver::Over* yy248;
+ SqliteWindowDefinition* yy266;
+ SqliteIndexedColumn* yy268;
SqliteSelect::Core::JoinConstraint* yy295;
- SqliteSelect::Core::JoinOp* yy301;
- SqliteCreateTable::Column::Constraint* yy304;
- SqliteSortOrder* yy309;
- SqliteSelect::Core* yy310;
- SqliteWith* yy321;
- ParserDeferSubClause* yy329;
- ParserCreateTableConstraintList* yy333;
- SqliteConflictAlgo* yy338;
- SqliteForeignKey::Condition* yy347;
- SqliteExpr* yy352;
- ParserFullName* yy360;
- ParserResultColumnList* yy373;
- SqliteInitially* yy392;
- QString* yy399;
- ParserStubTransDetails* yy404;
- SqliteCreateTable::Constraint* yy406;
- ParserStubExplain* yy411;
- ParserQueryList* yy430;
- bool* yy451;
- SqliteSelect::CompoundOperator* yy462;
- QVariant* yy469;
- SqliteSelect* yy473;
- SqliteLimit* yy484;
- SqliteSelect::Core::JoinSource* yy511;
- SqliteExpr::LikeOp* yy520;
- ParserSetValueList* yy521;
- SqliteColumnType* yy537;
- ParserExprList* yy551;
- SqliteCreateTrigger::Event* yy552;
- SqliteUpsert* yy560;
+ ParserWindowDefList* yy299;
+ SqliteInitially* yy312;
+ SqliteSelect* yy313;
+ QString* yy319;
+ SqliteWindowDefinition::Window* yy334;
+ SqliteQuery* yy363;
+ SqliteSelect::CompoundOperator* yy382;
+ int* yy386;
+ SqliteFilterOver::Filter* yy397;
+ SqliteUpsert* yy400;
+ ParserOrderByList* yy403;
+ SqliteConflictAlgo* yy418;
+ SqliteWindowDefinition::Window::Frame::RangeOrRows* yy419;
+ ParserFullName* yy440;
+ SqliteSelect::Core::SingleSource* yy441;
+ SqliteWindowDefinition::Window::Frame::Bound* yy442;
+ SqliteWith::CommonTableExpression* yy446;
+ ParserOtherSourceList* yy451;
+ SqliteCreateTable::Column::Constraint* yy464;
+ SqliteSelect::Core* yy470;
+ ParserExprNestedList* yy486;
+ ParserCreateTableConstraintList* yy493;
+ ParserStubInsertOrReplace* yy504;
+ SqliteForeignKey::Condition* yy507;
+ SqliteExpr* yy512;
+ SqliteCreateTrigger::Time* yy532;
+ SqliteSortOrder* yy549;
+ QStringList* yy575;
+ SqliteNulls* yy579;
+ ParserFkConditionList* yy584;
+ ParserTermOrLiteral* yy590;
+ ParserIndexedBy* yy592;
+ ParserCteList* yy593;
+ bool* yy611;
} YYMINORTYPE;
#ifndef YYSTACKDEPTH
#define YYSTACKDEPTH 100
@@ -172,8 +191,8 @@ typedef union {
#define sqlite3_parseARG_PDECL ,ParserContext* parserContext
#define sqlite3_parseARG_FETCH ParserContext* parserContext = yypParser->parserContext
#define sqlite3_parseARG_STORE yypParser->parserContext = parserContext
-#define YYNSTATE 754
-#define YYNRULE 431
+#define YYNSTATE 844
+#define YYNRULE 472
#define YYFALLBACK 1
#define YY_NO_ACTION (YYNSTATE+YYNRULE+2)
#define YY_ACCEPT_ACTION (YYNSTATE+YYNRULE+1)
@@ -245,658 +264,806 @@ static const YYMINORTYPE yyzerominor = { 0 };
** shifting non-terminals after a reduce.
** yy_default[] Default action for each state.
*/
-#define YY_ACTTAB_COUNT (2384)
+#define YY_ACTTAB_COUNT (3037)
static const YYACTIONTYPE yy_action[] = {
- /* 0 */ 457, 54, 54, 53, 53, 53, 52, 225, 277, 746,
- /* 10 */ 280, 445, 57, 57, 57, 57, 32, 55, 55, 55,
- /* 20 */ 55, 54, 54, 53, 53, 53, 52, 225, 658, 1062,
- /* 30 */ 1062, 63, 746, 165, 57, 57, 57, 57, 450, 55,
- /* 40 */ 55, 55, 55, 54, 54, 53, 53, 53, 52, 225,
- /* 50 */ 697, 87, 312, 644, 746, 701, 143, 71, 1062, 1062,
- /* 60 */ 45, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062,
- /* 70 */ 1062, 1062, 652, 1062, 1062, 1062, 1062, 42, 43, 1062,
- /* 80 */ 1062, 1062, 1062, 1062, 44, 457, 53, 53, 53, 52,
- /* 90 */ 225, 746, 3, 643, 639, 717, 445, 707, 751, 442,
- /* 100 */ 720, 1, 717, 455, 293, 454, 623, 720, 719, 718,
- /* 110 */ 717, 744, 743, 411, 707, 719, 718, 717, 456, 746,
- /* 120 */ 454, 683, 292, 450, 15, 485, 702, 196, 96, 645,
- /* 130 */ 1179, 1179, 665, 456, 744, 743, 378, 454, 745, 149,
- /* 140 */ 701, 702, 196, 486, 487, 45, 646, 98, 707, 537,
- /* 150 */ 456, 473, 10, 707, 658, 698, 744, 743, 702, 196,
- /* 160 */ 350, 645, 42, 43, 637, 543, 298, 474, 473, 44,
- /* 170 */ 914, 721, 931, 931, 722, 424, 407, 3, 914, 745,
- /* 180 */ 329, 87, 707, 746, 442, 914, 138, 717, 455, 401,
- /* 190 */ 398, 397, 720, 744, 743, 329, 473, 457, 638, 707,
- /* 200 */ 719, 718, 717, 724, 914, 454, 139, 396, 445, 488,
- /* 210 */ 690, 92, 410, 349, 307, 1116, 219, 914, 456, 914,
- /* 220 */ 914, 744, 743, 914, 746, 241, 702, 99, 914, 914,
- /* 230 */ 914, 914, 914, 707, 19, 450, 222, 10, 707, 314,
- /* 240 */ 698, 55, 55, 55, 55, 54, 54, 53, 53, 53,
- /* 250 */ 52, 225, 701, 427, 746, 454, 746, 45, 152, 102,
- /* 260 */ 294, 404, 289, 403, 140, 310, 436, 550, 456, 215,
- /* 270 */ 214, 213, 431, 296, 42, 43, 702, 196, 287, 746,
- /* 280 */ 671, 44, 977, 746, 580, 744, 743, 426, 138, 3,
- /* 290 */ 977, 401, 398, 397, 707, 333, 442, 977, 509, 717,
- /* 300 */ 455, 593, 594, 557, 720, 413, 668, 631, 630, 396,
- /* 310 */ 351, 707, 719, 718, 717, 521, 977, 457, 509, 365,
- /* 320 */ 508, 508, 526, 527, 371, 713, 744, 743, 445, 977,
- /* 330 */ 329, 977, 977, 319, 511, 636, 532, 65, 613, 226,
- /* 340 */ 977, 977, 977, 977, 64, 707, 15, 977, 703, 10,
- /* 350 */ 707, 645, 698, 319, 510, 450, 744, 743, 744, 743,
- /* 360 */ 209, 208, 524, 533, 535, 746, 525, 534, 646, 703,
- /* 370 */ 714, 609, 701, 52, 225, 61, 470, 45, 516, 620,
- /* 380 */ 620, 744, 743, 645, 454, 717, 375, 369, 608, 633,
- /* 390 */ 720, 703, 408, 470, 42, 43, 38, 456, 719, 718,
- /* 400 */ 717, 44, 962, 746, 714, 702, 196, 358, 605, 3,
- /* 410 */ 962, 512, 60, 116, 707, 713, 442, 962, 604, 717,
- /* 420 */ 455, 470, 538, 801, 720, 742, 98, 713, 1082, 686,
- /* 430 */ 740, 707, 719, 718, 717, 741, 962, 485, 328, 424,
- /* 440 */ 409, 687, 582, 224, 1064, 1064, 320, 1171, 297, 962,
- /* 450 */ 745, 962, 962, 300, 1171, 486, 360, 91, 12, 329,
- /* 460 */ 962, 745, 962, 962, 628, 707, 745, 744, 743, 10,
- /* 470 */ 707, 38, 698, 58, 59, 452, 308, 1064, 1064, 710,
- /* 480 */ 710, 56, 56, 57, 57, 57, 57, 219, 55, 55,
- /* 490 */ 55, 55, 54, 54, 53, 53, 53, 52, 225, 563,
- /* 500 */ 563, 265, 387, 271, 478, 744, 743, 667, 324, 148,
- /* 510 */ 581, 242, 414, 549, 803, 311, 377, 713, 245, 567,
- /* 520 */ 73, 361, 690, 745, 1064, 1064, 58, 59, 452, 308,
- /* 530 */ 119, 47, 710, 710, 56, 56, 57, 57, 57, 57,
- /* 540 */ 406, 55, 55, 55, 55, 54, 54, 53, 53, 53,
- /* 550 */ 52, 225, 657, 58, 59, 452, 308, 1064, 1064, 710,
- /* 560 */ 710, 56, 56, 57, 57, 57, 57, 334, 55, 55,
- /* 570 */ 55, 55, 54, 54, 53, 53, 53, 52, 225, 681,
- /* 580 */ 687, 443, 224, 581, 1186, 162, 461, 2, 240, 239,
- /* 590 */ 680, 285, 466, 73, 721, 41, 745, 722, 96, 58,
- /* 600 */ 59, 452, 308, 1064, 1064, 710, 710, 56, 56, 57,
- /* 610 */ 57, 57, 57, 96, 55, 55, 55, 55, 54, 54,
- /* 620 */ 53, 53, 53, 52, 225, 49, 692, 691, 151, 1063,
- /* 630 */ 1063, 602, 58, 59, 452, 308, 1064, 1064, 710, 710,
- /* 640 */ 56, 56, 57, 57, 57, 57, 368, 55, 55, 55,
- /* 650 */ 55, 54, 54, 53, 53, 53, 52, 225, 1063, 1063,
- /* 660 */ 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063,
- /* 670 */ 1063, 1063, 746, 1063, 1063, 1063, 1063, 1063, 1063, 1063,
- /* 680 */ 1063, 1063, 1063, 1063, 1064, 1064, 452, 308, 692, 691,
- /* 690 */ 710, 710, 56, 56, 57, 57, 57, 57, 34, 55,
- /* 700 */ 55, 55, 55, 54, 54, 53, 53, 53, 52, 225,
- /* 710 */ 713, 95, 709, 58, 59, 452, 308, 1064, 1064, 710,
- /* 720 */ 710, 56, 56, 57, 57, 57, 57, 708, 55, 55,
- /* 730 */ 55, 55, 54, 54, 53, 53, 53, 52, 225, 58,
- /* 740 */ 59, 452, 308, 746, 218, 710, 710, 56, 56, 57,
- /* 750 */ 57, 57, 57, 150, 55, 55, 55, 55, 54, 54,
- /* 760 */ 53, 53, 53, 52, 225, 658, 984, 253, 672, 257,
- /* 770 */ 512, 50, 706, 36, 744, 743, 58, 59, 452, 308,
- /* 780 */ 746, 984, 710, 710, 56, 56, 57, 57, 57, 57,
- /* 790 */ 161, 55, 55, 55, 55, 54, 54, 53, 53, 53,
- /* 800 */ 52, 225, 6, 985, 148, 320, 1170, 217, 629, 648,
- /* 810 */ 412, 259, 713, 1170, 58, 59, 452, 308, 985, 17,
- /* 820 */ 710, 710, 56, 56, 57, 57, 57, 57, 984, 55,
- /* 830 */ 55, 55, 55, 54, 54, 53, 53, 53, 52, 225,
- /* 840 */ 498, 986, 299, 394, 16, 744, 743, 657, 1131, 438,
- /* 850 */ 96, 58, 59, 452, 308, 745, 986, 710, 710, 56,
- /* 860 */ 56, 57, 57, 57, 57, 985, 55, 55, 55, 55,
- /* 870 */ 54, 54, 53, 53, 53, 52, 225, 554, 987, 255,
- /* 880 */ 337, 211, 744, 743, 383, 498, 658, 354, 695, 694,
- /* 890 */ 444, 695, 694, 987, 554, 746, 705, 745, 58, 59,
- /* 900 */ 452, 308, 24, 986, 710, 710, 56, 56, 57, 57,
- /* 910 */ 57, 57, 112, 55, 55, 55, 55, 54, 54, 53,
- /* 920 */ 53, 53, 52, 225, 682, 1131, 58, 59, 452, 308,
- /* 930 */ 647, 746, 710, 710, 56, 56, 57, 57, 57, 57,
- /* 940 */ 987, 55, 55, 55, 55, 54, 54, 53, 53, 53,
- /* 950 */ 52, 225, 457, 1145, 229, 690, 704, 441, 690, 20,
- /* 960 */ 571, 598, 46, 445, 58, 59, 452, 308, 572, 139,
- /* 970 */ 710, 710, 56, 56, 57, 57, 57, 57, 746, 55,
- /* 980 */ 55, 55, 55, 54, 54, 53, 53, 53, 52, 225,
- /* 990 */ 450, 98, 746, 37, 713, 696, 580, 744, 743, 393,
- /* 1000 */ 97, 454, 298, 87, 454, 685, 662, 701, 240, 239,
- /* 1010 */ 754, 581, 45, 428, 456, 745, 168, 456, 454, 745,
- /* 1020 */ 727, 73, 702, 196, 745, 702, 99, 557, 281, 42,
- /* 1030 */ 43, 456, 355, 744, 743, 357, 44, 482, 684, 702,
- /* 1040 */ 196, 745, 703, 233, 3, 568, 692, 691, 746, 707,
- /* 1050 */ 484, 442, 483, 167, 717, 455, 424, 425, 333, 720,
- /* 1060 */ 532, 65, 87, 703, 287, 446, 707, 719, 718, 717,
- /* 1070 */ 384, 340, 352, 424, 415, 517, 329, 149, 674, 671,
- /* 1080 */ 744, 743, 1179, 1179, 297, 703, 72, 533, 535, 746,
- /* 1090 */ 383, 534, 423, 329, 744, 743, 713, 745, 363, 752,
- /* 1100 */ 707, 382, 440, 745, 10, 707, 714, 698, 149, 8,
- /* 1110 */ 374, 745, 58, 59, 452, 308, 434, 376, 710, 710,
- /* 1120 */ 56, 56, 57, 57, 57, 57, 98, 55, 55, 55,
- /* 1130 */ 55, 54, 54, 53, 53, 53, 52, 225, 517, 166,
- /* 1140 */ 714, 662, 681, 422, 324, 278, 454, 617, 273, 279,
- /* 1150 */ 744, 743, 231, 680, 745, 437, 746, 673, 745, 456,
- /* 1160 */ 228, 745, 651, 58, 59, 452, 308, 702, 204, 710,
- /* 1170 */ 710, 56, 56, 57, 57, 57, 57, 650, 55, 55,
- /* 1180 */ 55, 55, 54, 54, 53, 53, 53, 52, 225, 98,
- /* 1190 */ 546, 744, 743, 58, 59, 452, 308, 149, 600, 710,
- /* 1200 */ 710, 56, 56, 57, 57, 57, 57, 344, 55, 55,
- /* 1210 */ 55, 55, 54, 54, 53, 53, 53, 52, 225, 14,
- /* 1220 */ 746, 671, 433, 566, 40, 726, 659, 266, 284, 58,
- /* 1230 */ 59, 452, 308, 586, 40, 710, 710, 56, 56, 57,
- /* 1240 */ 57, 57, 57, 747, 55, 55, 55, 55, 54, 54,
- /* 1250 */ 53, 53, 53, 52, 225, 9, 98, 98, 744, 743,
- /* 1260 */ 38, 58, 59, 452, 308, 25, 94, 710, 710, 56,
- /* 1270 */ 56, 57, 57, 57, 57, 653, 55, 55, 55, 55,
- /* 1280 */ 54, 54, 53, 53, 53, 52, 225, 561, 1146, 262,
- /* 1290 */ 713, 58, 59, 452, 308, 267, 40, 710, 710, 56,
- /* 1300 */ 56, 57, 57, 57, 57, 147, 55, 55, 55, 55,
- /* 1310 */ 54, 54, 53, 53, 53, 52, 225, 522, 1144, 746,
- /* 1320 */ 614, 98, 744, 743, 58, 59, 452, 308, 723, 98,
- /* 1330 */ 710, 710, 56, 56, 57, 57, 57, 57, 146, 55,
- /* 1340 */ 55, 55, 55, 54, 54, 53, 53, 53, 52, 225,
- /* 1350 */ 670, 58, 62, 452, 308, 357, 746, 710, 710, 56,
- /* 1360 */ 56, 57, 57, 57, 57, 454, 55, 55, 55, 55,
- /* 1370 */ 54, 54, 53, 53, 53, 52, 225, 457, 456, 611,
- /* 1380 */ 746, 610, 522, 106, 148, 746, 702, 196, 445, 59,
- /* 1390 */ 452, 308, 713, 746, 710, 710, 56, 56, 57, 57,
- /* 1400 */ 57, 57, 219, 55, 55, 55, 55, 54, 54, 53,
- /* 1410 */ 53, 53, 52, 225, 592, 450, 559, 514, 297, 752,
- /* 1420 */ 429, 744, 743, 750, 321, 490, 145, 657, 460, 299,
- /* 1430 */ 454, 745, 701, 144, 859, 402, 635, 45, 745, 557,
- /* 1440 */ 329, 569, 745, 456, 87, 640, 591, 559, 746, 753,
- /* 1450 */ 2, 702, 99, 479, 42, 43, 669, 418, 744, 743,
- /* 1460 */ 457, 44, 748, 746, 353, 416, 746, 735, 746, 3,
- /* 1470 */ 599, 445, 494, 65, 707, 745, 442, 746, 237, 717,
- /* 1480 */ 455, 746, 744, 743, 720, 15, 924, 744, 743, 5,
- /* 1490 */ 645, 707, 719, 718, 717, 744, 743, 338, 450, 493,
- /* 1500 */ 492, 736, 746, 491, 746, 671, 299, 646, 219, 217,
- /* 1510 */ 629, 675, 412, 634, 745, 701, 553, 479, 610, 745,
- /* 1520 */ 45, 13, 645, 1179, 1179, 707, 463, 746, 347, 10,
- /* 1530 */ 707, 746, 698, 716, 454, 746, 662, 42, 43, 381,
- /* 1540 */ 632, 232, 627, 457, 44, 495, 1071, 456, 662, 745,
- /* 1550 */ 744, 743, 3, 283, 445, 702, 191, 707, 625, 442,
- /* 1560 */ 501, 745, 717, 455, 728, 744, 743, 720, 744, 743,
- /* 1570 */ 744, 743, 115, 662, 707, 719, 718, 717, 624, 744,
- /* 1580 */ 743, 450, 619, 744, 743, 746, 745, 734, 675, 235,
- /* 1590 */ 746, 476, 501, 618, 286, 472, 590, 732, 701, 548,
- /* 1600 */ 745, 540, 343, 45, 744, 743, 744, 743, 707, 671,
- /* 1610 */ 745, 495, 10, 707, 342, 698, 548, 22, 540, 476,
- /* 1620 */ 42, 43, 448, 472, 505, 457, 658, 44, 69, 744,
- /* 1630 */ 743, 454, 464, 744, 743, 3, 445, 744, 743, 370,
- /* 1640 */ 707, 505, 442, 87, 456, 717, 455, 242, 414, 464,
- /* 1650 */ 720, 454, 702, 195, 454, 400, 68, 707, 719, 718,
- /* 1660 */ 717, 454, 21, 450, 456, 299, 395, 456, 746, 67,
- /* 1670 */ 236, 729, 702, 199, 456, 702, 197, 530, 745, 663,
- /* 1680 */ 701, 725, 702, 205, 745, 45, 137, 744, 743, 391,
- /* 1690 */ 292, 707, 744, 743, 745, 10, 707, 577, 698, 1072,
- /* 1700 */ 346, 746, 42, 43, 570, 4, 671, 713, 457, 44,
- /* 1710 */ 562, 746, 454, 164, 133, 31, 85, 3, 1074, 445,
- /* 1720 */ 83, 30, 707, 29, 442, 456, 671, 717, 455, 671,
- /* 1730 */ 28, 454, 720, 702, 203, 715, 671, 454, 746, 707,
- /* 1740 */ 719, 718, 717, 454, 456, 341, 450, 675, 745, 746,
- /* 1750 */ 456, 82, 702, 206, 454, 733, 456, 339, 702, 210,
- /* 1760 */ 81, 454, 541, 701, 702, 244, 447, 456, 45, 542,
- /* 1770 */ 744, 743, 372, 707, 456, 702, 309, 10, 707, 745,
- /* 1780 */ 698, 664, 702, 202, 660, 42, 43, 671, 731, 270,
- /* 1790 */ 457, 536, 44, 230, 745, 454, 529, 745, 531, 149,
- /* 1800 */ 3, 445, 745, 744, 743, 707, 671, 442, 456, 713,
- /* 1810 */ 717, 455, 671, 744, 743, 720, 702, 194, 671, 655,
- /* 1820 */ 712, 454, 707, 719, 718, 717, 454, 89, 450, 671,
- /* 1830 */ 523, 264, 745, 457, 456, 128, 671, 11, 261, 456,
- /* 1840 */ 744, 743, 702, 180, 445, 701, 76, 702, 171, 160,
- /* 1850 */ 45, 744, 743, 654, 169, 504, 707, 120, 481, 356,
- /* 1860 */ 10, 707, 454, 698, 480, 103, 746, 42, 43, 462,
- /* 1870 */ 671, 450, 596, 746, 44, 456, 216, 269, 642, 219,
- /* 1880 */ 746, 268, 3, 702, 179, 234, 93, 707, 701, 442,
- /* 1890 */ 745, 332, 744, 455, 212, 749, 671, 720, 331, 454,
- /* 1900 */ 158, 671, 454, 739, 707, 719, 718, 717, 737, 258,
- /* 1910 */ 42, 43, 456, 507, 256, 456, 738, 44, 503, 157,
- /* 1920 */ 702, 193, 745, 702, 198, 3, 459, 745, 88, 713,
- /* 1930 */ 707, 392, 442, 155, 18, 717, 455, 671, 707, 454,
- /* 1940 */ 720, 454, 10, 707, 458, 698, 746, 707, 719, 718,
- /* 1950 */ 717, 105, 456, 250, 456, 227, 746, 454, 142, 421,
- /* 1960 */ 702, 327, 702, 326, 249, 153, 316, 730, 744, 743,
- /* 1970 */ 456, 745, 745, 225, 671, 744, 743, 671, 702, 325,
- /* 1980 */ 454, 707, 744, 743, 109, 10, 707, 313, 698, 243,
- /* 1990 */ 454, 315, 156, 456, 622, 159, 454, 649, 87, 51,
- /* 2000 */ 104, 702, 178, 456, 626, 35, 454, 700, 242, 456,
- /* 2010 */ 745, 702, 100, 641, 671, 20, 671, 702, 177, 456,
- /* 2020 */ 303, 299, 304, 454, 301, 454, 520, 702, 176, 430,
- /* 2030 */ 454, 713, 671, 746, 745, 317, 456, 154, 456, 302,
- /* 2040 */ 454, 39, 677, 456, 702, 174, 702, 173, 744, 743,
- /* 2050 */ 432, 702, 192, 456, 454, 671, 345, 288, 744, 743,
- /* 2060 */ 587, 702, 172, 746, 454, 671, 746, 456, 699, 454,
- /* 2070 */ 745, 671, 746, 48, 330, 702, 200, 456, 439, 254,
- /* 2080 */ 70, 671, 456, 499, 560, 702, 201, 238, 223, 252,
- /* 2090 */ 702, 184, 745, 496, 597, 454, 746, 454, 671, 435,
- /* 2100 */ 671, 454, 745, 675, 117, 671, 746, 745, 456, 118,
- /* 2110 */ 456, 359, 454, 746, 456, 671, 702, 183, 702, 182,
- /* 2120 */ 746, 417, 702, 181, 713, 456, 414, 454, 746, 671,
- /* 2130 */ 454, 621, 454, 702, 185, 744, 743, 454, 746, 671,
- /* 2140 */ 456, 746, 454, 456, 671, 456, 746, 141, 702, 188,
- /* 2150 */ 456, 702, 101, 702, 187, 456, 746, 612, 702, 186,
- /* 2160 */ 454, 746, 565, 702, 190, 744, 743, 454, 744, 743,
- /* 2170 */ 671, 420, 671, 456, 744, 743, 671, 528, 746, 405,
- /* 2180 */ 456, 702, 189, 746, 456, 607, 556, 671, 702, 175,
- /* 2190 */ 578, 746, 702, 74, 746, 558, 746, 606, 744, 743,
- /* 2200 */ 348, 282, 671, 745, 290, 671, 275, 671, 744, 743,
- /* 2210 */ 552, 603, 671, 602, 745, 744, 743, 671, 601, 745,
- /* 2220 */ 547, 576, 744, 743, 515, 246, 713, 518, 323, 335,
- /* 2230 */ 744, 743, 366, 575, 506, 671, 583, 584, 745, 468,
- /* 2240 */ 744, 743, 671, 744, 743, 745, 671, 574, 744, 743,
- /* 2250 */ 136, 573, 745, 564, 86, 453, 295, 276, 744, 743,
- /* 2260 */ 322, 135, 390, 744, 743, 385, 263, 502, 745, 745,
- /* 2270 */ 745, 114, 134, 221, 467, 469, 260, 251, 745, 745,
- /* 2280 */ 744, 743, 247, 500, 274, 744, 743, 672, 373, 745,
- /* 2290 */ 745, 248, 388, 744, 743, 745, 744, 743, 744, 743,
- /* 2300 */ 27, 132, 555, 113, 745, 84, 131, 130, 163, 497,
- /* 2310 */ 90, 380, 379, 539, 545, 111, 129, 489, 367, 519,
- /* 2320 */ 110, 127, 364, 80, 362, 126, 79, 125, 124, 78,
- /* 2330 */ 77, 676, 123, 122, 26, 477, 336, 23, 475, 108,
- /* 2340 */ 66, 107, 661, 471, 121, 465, 305, 170, 693, 689,
- /* 2350 */ 679, 291, 451, 598, 399, 666, 207, 551, 656, 272,
- /* 2360 */ 544, 386, 318, 711, 688, 7, 220, 33, 678, 585,
- /* 2370 */ 306, 389, 449, 75, 595, 589, 588, 616, 615, 87,
- /* 2380 */ 1187, 579, 1187, 513,
+ /* 0 */ 510, 625, 284, 836, 655, 288, 841, 64, 65, 509,
+ /* 10 */ 339, 626, 501, 795, 795, 62, 62, 63, 63, 63,
+ /* 20 */ 63, 351, 61, 61, 61, 61, 60, 60, 59, 59,
+ /* 30 */ 59, 58, 253, 485, 1085, 61, 61, 61, 61, 60,
+ /* 40 */ 60, 59, 59, 59, 58, 253, 835, 290, 794, 1085,
+ /* 50 */ 71, 506, 63, 63, 63, 63, 40, 61, 61, 61,
+ /* 60 */ 61, 60, 60, 59, 59, 59, 58, 253, 805, 635,
+ /* 70 */ 836, 347, 785, 836, 592, 70, 452, 54, 817, 88,
+ /* 80 */ 338, 835, 835, 59, 59, 59, 58, 253, 1085, 836,
+ /* 90 */ 806, 223, 836, 835, 51, 52, 693, 1085, 635, 508,
+ /* 100 */ 325, 53, 1012, 348, 261, 415, 622, 621, 88, 2,
+ /* 110 */ 1012, 835, 681, 117, 793, 286, 498, 1012, 324, 807,
+ /* 120 */ 833, 634, 834, 833, 510, 810, 157, 466, 453, 439,
+ /* 130 */ 436, 435, 793, 809, 808, 807, 501, 1012, 563, 682,
+ /* 140 */ 682, 611, 486, 746, 1078, 327, 677, 434, 366, 575,
+ /* 150 */ 1012, 254, 1012, 1012, 396, 403, 1012, 296, 425, 303,
+ /* 160 */ 749, 1012, 1012, 1012, 1012, 1012, 793, 274, 456, 793,
+ /* 170 */ 748, 783, 12, 356, 565, 506, 273, 586, 77, 69,
+ /* 180 */ 39, 138, 69, 1012, 701, 440, 22, 701, 768, 834,
+ /* 190 */ 833, 805, 834, 833, 14, 836, 785, 111, 1, 489,
+ /* 200 */ 798, 54, 702, 804, 835, 702, 587, 589, 834, 833,
+ /* 210 */ 588, 834, 833, 806, 223, 570, 659, 701, 51, 52,
+ /* 220 */ 701, 137, 508, 649, 706, 53, 1078, 836, 1029, 1029,
+ /* 230 */ 21, 412, 386, 2, 1078, 172, 117, 328, 793, 705,
+ /* 240 */ 498, 1078, 157, 807, 833, 439, 436, 435, 510, 810,
+ /* 250 */ 392, 75, 443, 188, 421, 250, 793, 809, 808, 807,
+ /* 260 */ 501, 1078, 784, 434, 1178, 275, 935, 835, 648, 56,
+ /* 270 */ 455, 366, 687, 686, 1078, 130, 1078, 1078, 174, 121,
+ /* 280 */ 326, 445, 321, 444, 159, 1078, 1078, 1078, 1078, 811,
+ /* 290 */ 793, 700, 812, 793, 162, 783, 12, 245, 319, 506,
+ /* 300 */ 60, 60, 59, 59, 59, 58, 253, 1078, 840, 526,
+ /* 310 */ 836, 650, 651, 513, 834, 833, 563, 805, 836, 798,
+ /* 320 */ 785, 717, 805, 23, 611, 54, 527, 526, 158, 257,
+ /* 330 */ 835, 797, 699, 695, 835, 835, 242, 241, 240, 806,
+ /* 340 */ 223, 523, 51, 52, 806, 208, 834, 833, 508, 53,
+ /* 350 */ 1063, 356, 564, 508, 384, 526, 171, 2, 1063, 523,
+ /* 360 */ 548, 77, 793, 786, 498, 1063, 431, 807, 833, 798,
+ /* 370 */ 578, 329, 836, 810, 723, 579, 466, 451, 729, 465,
+ /* 380 */ 793, 809, 808, 807, 835, 1063, 789, 523, 786, 547,
+ /* 390 */ 546, 388, 788, 545, 502, 475, 497, 366, 1063, 729,
+ /* 400 */ 1063, 1063, 754, 407, 798, 729, 692, 1160, 1160, 1063,
+ /* 410 */ 329, 1063, 1063, 76, 793, 635, 117, 793, 516, 783,
+ /* 420 */ 12, 786, 787, 835, 519, 88, 370, 108, 835, 834,
+ /* 430 */ 833, 1063, 319, 117, 464, 361, 479, 834, 833, 731,
+ /* 440 */ 836, 1163, 792, 836, 64, 65, 509, 339, 1160, 1160,
+ /* 450 */ 795, 795, 62, 62, 63, 63, 63, 63, 781, 61,
+ /* 460 */ 61, 61, 61, 60, 60, 59, 59, 59, 58, 253,
+ /* 470 */ 836, 807, 729, 722, 361, 55, 792, 810, 58, 253,
+ /* 480 */ 167, 73, 777, 776, 604, 809, 808, 807, 798, 1160,
+ /* 490 */ 1160, 834, 833, 729, 64, 65, 509, 339, 66, 729,
+ /* 500 */ 795, 795, 62, 62, 63, 63, 63, 63, 474, 61,
+ /* 510 */ 61, 61, 61, 60, 60, 59, 59, 59, 58, 253,
+ /* 520 */ 836, 770, 836, 798, 712, 771, 64, 65, 509, 339,
+ /* 530 */ 1160, 1160, 795, 795, 62, 62, 63, 63, 63, 63,
+ /* 540 */ 765, 61, 61, 61, 61, 60, 60, 59, 59, 59,
+ /* 550 */ 58, 253, 764, 729, 613, 836, 562, 562, 44, 834,
+ /* 560 */ 833, 191, 834, 833, 566, 805, 246, 685, 45, 454,
+ /* 570 */ 482, 365, 1160, 1160, 729, 772, 636, 252, 835, 662,
+ /* 580 */ 729, 1317, 184, 514, 3, 538, 613, 806, 208, 834,
+ /* 590 */ 833, 765, 1163, 313, 1163, 661, 508, 393, 835, 357,
+ /* 600 */ 1269, 742, 792, 764, 539, 540, 835, 1269, 130, 64,
+ /* 610 */ 65, 509, 339, 1160, 1160, 795, 795, 62, 62, 63,
+ /* 620 */ 63, 63, 63, 742, 61, 61, 61, 61, 60, 60,
+ /* 630 */ 59, 59, 59, 58, 253, 818, 792, 769, 158, 834,
+ /* 640 */ 833, 834, 833, 113, 566, 754, 836, 76, 64, 65,
+ /* 650 */ 509, 339, 1160, 1160, 795, 795, 62, 62, 63, 63,
+ /* 660 */ 63, 63, 488, 61, 61, 61, 61, 60, 60, 59,
+ /* 670 */ 59, 59, 58, 253, 834, 833, 541, 775, 836, 357,
+ /* 680 */ 1268, 330, 734, 473, 87, 814, 836, 1268, 836, 64,
+ /* 690 */ 65, 509, 339, 1160, 1160, 795, 795, 62, 62, 63,
+ /* 700 */ 63, 63, 63, 447, 61, 61, 61, 61, 60, 60,
+ /* 710 */ 59, 59, 59, 58, 253, 63, 63, 63, 63, 56,
+ /* 720 */ 61, 61, 61, 61, 60, 60, 59, 59, 59, 58,
+ /* 730 */ 253, 494, 64, 65, 509, 339, 370, 671, 795, 795,
+ /* 740 */ 62, 62, 63, 63, 63, 63, 813, 61, 61, 61,
+ /* 750 */ 61, 60, 60, 59, 59, 59, 58, 253, 811, 1086,
+ /* 760 */ 571, 812, 190, 488, 309, 834, 833, 312, 591, 64,
+ /* 770 */ 65, 509, 339, 469, 1086, 795, 795, 62, 62, 63,
+ /* 780 */ 63, 63, 63, 836, 61, 61, 61, 61, 60, 60,
+ /* 790 */ 59, 59, 59, 58, 253, 107, 1087, 834, 833, 836,
+ /* 800 */ 758, 798, 1164, 836, 485, 834, 833, 834, 833, 349,
+ /* 810 */ 802, 1087, 755, 1086, 78, 836, 468, 835, 64, 65,
+ /* 820 */ 509, 339, 1086, 571, 795, 795, 62, 62, 63, 63,
+ /* 830 */ 63, 63, 510, 61, 61, 61, 61, 60, 60, 59,
+ /* 840 */ 59, 59, 58, 253, 501, 1088, 271, 270, 1214, 836,
+ /* 850 */ 1087, 78, 603, 493, 791, 64, 65, 509, 339, 1087,
+ /* 860 */ 1088, 795, 795, 62, 62, 63, 63, 63, 63, 538,
+ /* 870 */ 61, 61, 61, 61, 60, 60, 59, 59, 59, 58,
+ /* 880 */ 253, 798, 835, 506, 1167, 777, 776, 20, 539, 398,
+ /* 890 */ 117, 675, 69, 1022, 580, 581, 409, 701, 337, 1088,
+ /* 900 */ 78, 753, 834, 833, 785, 391, 780, 779, 1088, 54,
+ /* 910 */ 8, 835, 167, 576, 745, 702, 805, 620, 834, 833,
+ /* 920 */ 798, 670, 834, 833, 327, 677, 51, 52, 44, 835,
+ /* 930 */ 701, 1277, 1277, 53, 834, 833, 390, 112, 806, 223,
+ /* 940 */ 1229, 2, 1170, 236, 235, 484, 793, 508, 498, 836,
+ /* 950 */ 282, 807, 833, 1164, 117, 1164, 712, 810, 68, 136,
+ /* 960 */ 399, 775, 782, 835, 793, 809, 808, 807, 807, 85,
+ /* 970 */ 714, 836, 835, 504, 810, 466, 467, 42, 576, 775,
+ /* 980 */ 1277, 1277, 809, 808, 807, 816, 759, 772, 499, 252,
+ /* 990 */ 86, 19, 767, 643, 442, 832, 366, 470, 793, 111,
+ /* 1000 */ 798, 793, 830, 783, 12, 27, 64, 65, 509, 339,
+ /* 1010 */ 836, 831, 795, 795, 62, 62, 63, 63, 63, 63,
+ /* 1020 */ 836, 61, 61, 61, 61, 60, 60, 59, 59, 59,
+ /* 1030 */ 58, 253, 50, 1229, 48, 64, 65, 509, 339, 74,
+ /* 1040 */ 544, 795, 795, 62, 62, 63, 63, 63, 63, 510,
+ /* 1050 */ 61, 61, 61, 61, 60, 60, 59, 59, 59, 58,
+ /* 1060 */ 253, 501, 1243, 532, 477, 136, 836, 329, 834, 833,
+ /* 1070 */ 483, 724, 4, 83, 836, 500, 780, 779, 835, 341,
+ /* 1080 */ 835, 335, 611, 798, 617, 617, 64, 65, 509, 339,
+ /* 1090 */ 834, 833, 795, 795, 62, 62, 63, 63, 63, 63,
+ /* 1100 */ 506, 61, 61, 61, 61, 60, 60, 59, 59, 59,
+ /* 1110 */ 58, 253, 480, 476, 798, 668, 720, 667, 586, 77,
+ /* 1120 */ 739, 785, 114, 168, 608, 1172, 54, 532, 6, 834,
+ /* 1130 */ 833, 265, 310, 756, 836, 744, 311, 481, 615, 834,
+ /* 1140 */ 833, 78, 608, 51, 52, 835, 1172, 587, 589, 775,
+ /* 1150 */ 53, 588, 1172, 374, 238, 510, 738, 805, 2, 736,
+ /* 1160 */ 271, 270, 836, 793, 689, 498, 836, 501, 807, 833,
+ /* 1170 */ 835, 56, 413, 247, 810, 117, 450, 724, 4, 806,
+ /* 1180 */ 223, 793, 809, 808, 807, 834, 833, 836, 508, 5,
+ /* 1190 */ 535, 836, 531, 834, 833, 717, 1172, 414, 836, 777,
+ /* 1200 */ 776, 729, 798, 537, 1172, 536, 506, 844, 835, 733,
+ /* 1210 */ 416, 1172, 805, 371, 761, 793, 466, 457, 793, 730,
+ /* 1220 */ 783, 12, 729, 78, 732, 835, 338, 785, 729, 805,
+ /* 1230 */ 18, 1172, 54, 798, 806, 118, 395, 366, 597, 835,
+ /* 1240 */ 718, 786, 835, 508, 1172, 641, 1172, 1172, 549, 51,
+ /* 1250 */ 52, 806, 118, 834, 833, 1172, 53, 1172, 1172, 737,
+ /* 1260 */ 508, 317, 17, 305, 2, 381, 786, 259, 111, 793,
+ /* 1270 */ 837, 498, 666, 713, 807, 833, 835, 1172, 843, 3,
+ /* 1280 */ 810, 834, 833, 487, 432, 834, 833, 793, 809, 808,
+ /* 1290 */ 807, 111, 754, 836, 529, 665, 713, 836, 406, 786,
+ /* 1300 */ 170, 602, 1165, 1277, 1277, 594, 834, 833, 110, 754,
+ /* 1310 */ 834, 833, 338, 842, 549, 640, 639, 834, 833, 602,
+ /* 1320 */ 707, 793, 529, 594, 793, 835, 783, 12, 631, 64,
+ /* 1330 */ 65, 509, 339, 492, 757, 795, 795, 62, 62, 63,
+ /* 1340 */ 63, 63, 63, 704, 61, 61, 61, 61, 60, 60,
+ /* 1350 */ 59, 59, 59, 58, 253, 64, 65, 509, 339, 298,
+ /* 1360 */ 16, 795, 795, 62, 62, 63, 63, 63, 63, 11,
+ /* 1370 */ 61, 61, 61, 61, 60, 60, 59, 59, 59, 58,
+ /* 1380 */ 253, 395, 64, 65, 509, 339, 743, 4, 795, 795,
+ /* 1390 */ 62, 62, 63, 63, 63, 63, 117, 61, 61, 61,
+ /* 1400 */ 61, 60, 60, 59, 59, 59, 58, 253, 422, 728,
+ /* 1410 */ 4, 559, 834, 833, 166, 168, 834, 833, 56, 496,
+ /* 1420 */ 757, 836, 727, 4, 64, 65, 509, 339, 49, 559,
+ /* 1430 */ 795, 795, 62, 62, 63, 63, 63, 63, 165, 61,
+ /* 1440 */ 61, 61, 61, 60, 60, 59, 59, 59, 58, 253,
+ /* 1450 */ 607, 836, 667, 709, 64, 65, 509, 339, 842, 676,
+ /* 1460 */ 795, 795, 62, 62, 63, 63, 63, 63, 708, 61,
+ /* 1470 */ 61, 61, 61, 60, 60, 59, 59, 59, 58, 253,
+ /* 1480 */ 164, 46, 725, 4, 64, 65, 509, 339, 163, 674,
+ /* 1490 */ 795, 795, 62, 62, 63, 63, 63, 63, 696, 61,
+ /* 1500 */ 61, 61, 61, 60, 60, 59, 59, 59, 58, 253,
+ /* 1510 */ 246, 685, 836, 454, 64, 65, 509, 339, 124, 657,
+ /* 1520 */ 795, 795, 62, 62, 63, 63, 63, 63, 460, 61,
+ /* 1530 */ 61, 61, 61, 60, 60, 59, 59, 59, 58, 253,
+ /* 1540 */ 834, 833, 419, 691, 64, 65, 509, 339, 458, 189,
+ /* 1550 */ 795, 795, 62, 62, 63, 63, 63, 63, 7, 61,
+ /* 1560 */ 61, 61, 61, 60, 60, 59, 59, 59, 58, 253,
+ /* 1570 */ 834, 833, 726, 4, 64, 65, 509, 339, 690, 316,
+ /* 1580 */ 795, 795, 62, 62, 63, 63, 63, 63, 15, 61,
+ /* 1590 */ 61, 61, 61, 60, 60, 59, 59, 59, 58, 253,
+ /* 1600 */ 612, 1193, 64, 65, 509, 339, 274, 456, 795, 795,
+ /* 1610 */ 62, 62, 63, 63, 63, 63, 825, 61, 61, 61,
+ /* 1620 */ 61, 60, 60, 59, 59, 59, 58, 253, 574, 688,
+ /* 1630 */ 836, 834, 833, 64, 65, 509, 339, 836, 28, 795,
+ /* 1640 */ 795, 62, 62, 63, 63, 63, 63, 684, 61, 61,
+ /* 1650 */ 61, 61, 60, 60, 59, 59, 59, 58, 253, 836,
+ /* 1660 */ 1244, 64, 65, 509, 339, 683, 836, 795, 795, 62,
+ /* 1670 */ 62, 63, 63, 63, 63, 510, 61, 61, 61, 61,
+ /* 1680 */ 60, 60, 59, 59, 59, 58, 253, 501, 1242, 420,
+ /* 1690 */ 477, 64, 65, 509, 339, 116, 168, 795, 795, 62,
+ /* 1700 */ 62, 63, 63, 63, 63, 798, 61, 61, 61, 61,
+ /* 1710 */ 60, 60, 59, 59, 59, 58, 253, 123, 600, 280,
+ /* 1720 */ 302, 255, 679, 805, 258, 168, 506, 421, 297, 401,
+ /* 1730 */ 337, 279, 115, 835, 353, 44, 835, 448, 337, 476,
+ /* 1740 */ 835, 823, 835, 835, 836, 806, 208, 785, 836, 834,
+ /* 1750 */ 833, 835, 54, 37, 508, 25, 834, 833, 293, 133,
+ /* 1760 */ 300, 127, 525, 821, 299, 44, 350, 836, 260, 51,
+ /* 1770 */ 52, 352, 178, 835, 263, 805, 53, 104, 834, 833,
+ /* 1780 */ 78, 510, 122, 441, 2, 834, 833, 333, 835, 793,
+ /* 1790 */ 525, 498, 805, 501, 807, 833, 477, 806, 223, 805,
+ /* 1800 */ 810, 713, 256, 754, 568, 835, 508, 793, 809, 808,
+ /* 1810 */ 807, 358, 835, 556, 806, 223, 167, 354, 759, 176,
+ /* 1820 */ 956, 806, 118, 508, 798, 78, 766, 623, 647, 836,
+ /* 1830 */ 508, 36, 506, 713, 267, 836, 638, 331, 438, 717,
+ /* 1840 */ 731, 793, 82, 247, 793, 478, 783, 12, 703, 836,
+ /* 1850 */ 318, 266, 835, 785, 433, 366, 836, 367, 54, 584,
+ /* 1860 */ 712, 836, 332, 834, 833, 81, 634, 834, 833, 24,
+ /* 1870 */ 169, 838, 366, 160, 449, 51, 52, 80, 826, 754,
+ /* 1880 */ 264, 517, 53, 824, 835, 289, 834, 833, 156, 561,
+ /* 1890 */ 2, 835, 324, 397, 717, 793, 835, 498, 835, 517,
+ /* 1900 */ 807, 833, 698, 616, 10, 510, 810, 835, 429, 380,
+ /* 1910 */ 187, 152, 822, 793, 809, 808, 807, 501, 247, 101,
+ /* 1920 */ 99, 64, 38, 509, 339, 835, 35, 795, 795, 62,
+ /* 1930 */ 62, 63, 63, 63, 63, 836, 61, 61, 61, 61,
+ /* 1940 */ 60, 60, 59, 59, 59, 58, 253, 793, 834, 833,
+ /* 1950 */ 793, 713, 783, 12, 834, 833, 506, 34, 33, 836,
+ /* 1960 */ 819, 805, 32, 555, 379, 98, 805, 644, 834, 833,
+ /* 1970 */ 552, 836, 805, 835, 835, 834, 833, 785, 717, 835,
+ /* 1980 */ 834, 833, 54, 806, 223, 835, 378, 697, 806, 223,
+ /* 1990 */ 836, 835, 508, 376, 806, 118, 555, 508, 694, 51,
+ /* 2000 */ 52, 97, 653, 508, 836, 805, 53, 595, 596, 590,
+ /* 2010 */ 585, 510, 410, 337, 2, 656, 552, 247, 835, 793,
+ /* 2020 */ 387, 498, 805, 501, 807, 833, 835, 806, 223, 836,
+ /* 2030 */ 810, 583, 105, 168, 805, 835, 508, 793, 809, 808,
+ /* 2040 */ 807, 366, 577, 377, 806, 118, 490, 835, 408, 336,
+ /* 2050 */ 147, 383, 754, 508, 834, 833, 806, 216, 295, 13,
+ /* 2060 */ 815, 292, 506, 181, 471, 508, 192, 624, 558, 92,
+ /* 2070 */ 534, 793, 619, 835, 793, 533, 783, 12, 834, 833,
+ /* 2080 */ 394, 337, 287, 785, 836, 366, 557, 803, 54, 139,
+ /* 2090 */ 834, 833, 515, 375, 835, 835, 90, 247, 790, 262,
+ /* 2100 */ 835, 759, 754, 582, 243, 51, 52, 109, 836, 834,
+ /* 2110 */ 833, 835, 53, 503, 754, 239, 369, 510, 368, 382,
+ /* 2120 */ 2, 315, 610, 834, 833, 793, 835, 498, 805, 501,
+ /* 2130 */ 807, 833, 839, 179, 805, 180, 810, 829, 827, 805,
+ /* 2140 */ 828, 835, 719, 793, 809, 808, 807, 835, 834, 833,
+ /* 2150 */ 806, 194, 835, 836, 177, 835, 806, 204, 836, 508,
+ /* 2160 */ 512, 806, 226, 285, 554, 508, 430, 553, 506, 759,
+ /* 2170 */ 508, 511, 715, 836, 805, 614, 835, 793, 836, 805,
+ /* 2180 */ 793, 72, 783, 12, 836, 835, 103, 835, 836, 785,
+ /* 2190 */ 175, 820, 835, 836, 54, 801, 806, 224, 800, 173,
+ /* 2200 */ 710, 806, 232, 834, 833, 508, 274, 836, 754, 836,
+ /* 2210 */ 508, 51, 52, 835, 754, 343, 606, 23, 53, 754,
+ /* 2220 */ 43, 569, 472, 510, 342, 805, 2, 834, 833, 67,
+ /* 2230 */ 836, 793, 186, 498, 253, 501, 807, 833, 835, 799,
+ /* 2240 */ 805, 836, 810, 752, 495, 805, 84, 806, 231, 793,
+ /* 2250 */ 809, 808, 807, 835, 754, 251, 508, 283, 835, 754,
+ /* 2260 */ 269, 550, 806, 233, 268, 47, 334, 806, 237, 57,
+ /* 2270 */ 835, 508, 834, 833, 506, 751, 508, 834, 833, 488,
+ /* 2280 */ 750, 161, 836, 793, 747, 601, 793, 389, 783, 12,
+ /* 2290 */ 1168, 741, 834, 833, 835, 785, 244, 834, 833, 134,
+ /* 2300 */ 54, 520, 463, 834, 833, 754, 756, 834, 833, 678,
+ /* 2310 */ 522, 735, 834, 833, 135, 835, 572, 51, 52, 459,
+ /* 2320 */ 754, 320, 835, 654, 53, 754, 834, 833, 834, 833,
+ /* 2330 */ 456, 805, 2, 1170, 835, 680, 835, 793, 551, 498,
+ /* 2340 */ 160, 560, 807, 833, 835, 663, 669, 510, 810, 834,
+ /* 2350 */ 833, 542, 664, 806, 272, 793, 809, 808, 807, 501,
+ /* 2360 */ 834, 833, 508, 446, 65, 509, 339, 385, 322, 795,
+ /* 2370 */ 795, 62, 62, 63, 63, 63, 63, 805, 61, 61,
+ /* 2380 */ 61, 61, 60, 60, 59, 59, 59, 58, 253, 793,
+ /* 2390 */ 835, 660, 793, 276, 783, 12, 760, 372, 506, 806,
+ /* 2400 */ 340, 834, 833, 632, 659, 805, 835, 716, 508, 314,
+ /* 2410 */ 307, 754, 805, 404, 658, 637, 835, 618, 835, 785,
+ /* 2420 */ 630, 360, 835, 835, 54, 835, 835, 806, 230, 155,
+ /* 2430 */ 629, 521, 628, 346, 806, 203, 508, 805, 507, 627,
+ /* 2440 */ 154, 51, 52, 508, 835, 308, 835, 359, 53, 30,
+ /* 2450 */ 835, 835, 102, 510, 428, 132, 2, 754, 835, 806,
+ /* 2460 */ 221, 793, 423, 498, 153, 501, 807, 833, 508, 249,
+ /* 2470 */ 294, 805, 810, 291, 281, 835, 805, 411, 277, 793,
+ /* 2480 */ 809, 808, 807, 835, 835, 754, 835, 835, 278, 835,
+ /* 2490 */ 306, 835, 754, 806, 225, 426, 31, 151, 806, 364,
+ /* 2500 */ 609, 835, 508, 131, 506, 100, 150, 508, 605, 149,
+ /* 2510 */ 185, 106, 418, 793, 599, 148, 793, 754, 783, 12,
+ /* 2520 */ 417, 593, 129, 128, 405, 785, 402, 146, 573, 96,
+ /* 2530 */ 54, 145, 400, 95, 144, 94, 143, 93, 142, 30,
+ /* 2540 */ 543, 141, 29, 530, 518, 26, 126, 51, 52, 373,
+ /* 2550 */ 528, 754, 524, 805, 53, 125, 754, 140, 805, 193,
+ /* 2560 */ 79, 778, 2, 344, 774, 763, 835, 793, 721, 498,
+ /* 2570 */ 491, 835, 834, 833, 711, 806, 363, 183, 810, 323,
+ /* 2580 */ 806, 362, 182, 655, 508, 793, 809, 808, 807, 508,
+ /* 2590 */ 437, 234, 598, 304, 424, 509, 339, 301, 355, 795,
+ /* 2600 */ 795, 62, 62, 63, 63, 63, 63, 9, 61, 61,
+ /* 2610 */ 61, 61, 60, 60, 59, 59, 59, 58, 253, 793,
+ /* 2620 */ 796, 773, 793, 762, 783, 12, 642, 805, 248, 345,
+ /* 2630 */ 427, 41, 505, 754, 805, 740, 652, 91, 754, 567,
+ /* 2640 */ 835, 805, 646, 78, 673, 645, 836, 835, 672, 806,
+ /* 2650 */ 220, 1318, 633, 805, 835, 1318, 806, 206, 508, 1318,
+ /* 2660 */ 805, 1318, 1318, 806, 219, 508, 835, 805, 1318, 1318,
+ /* 2670 */ 1318, 1318, 508, 835, 1318, 806, 218, 1318, 1318, 805,
+ /* 2680 */ 835, 805, 806, 205, 508, 1318, 1318, 1318, 1318, 806,
+ /* 2690 */ 202, 508, 835, 805, 835, 1318, 1318, 1318, 508, 1318,
+ /* 2700 */ 1318, 806, 119, 806, 201, 1318, 835, 754, 1318, 1318,
+ /* 2710 */ 508, 1318, 508, 1318, 754, 806, 199, 1318, 1318, 805,
+ /* 2720 */ 1318, 754, 1318, 1318, 508, 1318, 1318, 1318, 1318, 1318,
+ /* 2730 */ 1318, 1318, 835, 754, 1318, 1318, 1318, 1318, 1318, 1318,
+ /* 2740 */ 754, 806, 227, 1318, 1318, 1318, 1318, 754, 1318, 1318,
+ /* 2750 */ 508, 1318, 1318, 805, 1318, 1318, 805, 1318, 805, 754,
+ /* 2760 */ 1318, 754, 1318, 1318, 1318, 1318, 835, 1318, 1318, 835,
+ /* 2770 */ 1318, 835, 805, 754, 1318, 806, 229, 1318, 806, 222,
+ /* 2780 */ 806, 228, 1318, 1318, 508, 835, 1318, 508, 805, 508,
+ /* 2790 */ 1318, 1318, 1318, 1318, 806, 217, 1318, 1318, 1318, 754,
+ /* 2800 */ 805, 835, 1318, 508, 805, 1318, 1318, 1318, 1318, 1318,
+ /* 2810 */ 806, 214, 1318, 835, 1318, 1318, 1318, 835, 1318, 508,
+ /* 2820 */ 1318, 1318, 806, 198, 805, 1318, 806, 197, 1318, 1318,
+ /* 2830 */ 1318, 508, 1318, 754, 1318, 508, 754, 835, 754, 1318,
+ /* 2840 */ 805, 1318, 1318, 1318, 1318, 1318, 806, 196, 1318, 1318,
+ /* 2850 */ 1318, 1318, 754, 835, 805, 508, 805, 1318, 1318, 1318,
+ /* 2860 */ 805, 1318, 806, 195, 1318, 1318, 1318, 835, 754, 835,
+ /* 2870 */ 1318, 508, 1318, 835, 1318, 805, 806, 207, 806, 212,
+ /* 2880 */ 754, 1318, 806, 211, 754, 508, 1318, 508, 835, 1318,
+ /* 2890 */ 805, 508, 805, 1318, 805, 1318, 1318, 806, 120, 1318,
+ /* 2900 */ 1318, 1318, 1318, 835, 754, 835, 508, 835, 1318, 1318,
+ /* 2910 */ 1318, 1318, 806, 210, 806, 209, 806, 215, 1318, 805,
+ /* 2920 */ 754, 508, 1318, 508, 1318, 508, 1318, 1318, 1318, 1318,
+ /* 2930 */ 1318, 1318, 835, 1318, 754, 1318, 754, 1318, 1318, 1318,
+ /* 2940 */ 754, 806, 213, 1318, 1318, 1318, 1318, 1318, 1318, 1318,
+ /* 2950 */ 508, 1318, 1318, 805, 1318, 754, 805, 1318, 1318, 1318,
+ /* 2960 */ 1318, 1318, 1318, 1318, 1318, 1318, 835, 1318, 1318, 835,
+ /* 2970 */ 754, 1318, 754, 1318, 754, 806, 200, 1318, 806, 89,
+ /* 2980 */ 1318, 1318, 1318, 1318, 508, 1318, 1318, 462, 1318, 1318,
+ /* 2990 */ 1318, 1318, 1318, 1318, 1318, 1318, 1318, 1318, 1318, 754,
+ /* 3000 */ 1318, 1318, 1318, 1318, 1318, 1318, 1318, 1318, 1318, 1318,
+ /* 3010 */ 1318, 1318, 1318, 1318, 1318, 1318, 1318, 1318, 1318, 1318,
+ /* 3020 */ 1318, 1318, 1318, 1318, 1318, 1318, 1318, 1318, 1318, 1318,
+ /* 3030 */ 1318, 1318, 1318, 754, 1318, 1318, 754,
};
static const YYCODETYPE yy_lookahead[] = {
- /* 0 */ 4, 81, 82, 83, 84, 85, 86, 87, 51, 4,
- /* 10 */ 53, 15, 72, 73, 74, 75, 76, 77, 78, 79,
- /* 20 */ 80, 81, 82, 83, 84, 85, 86, 87, 193, 33,
- /* 30 */ 34, 96, 4, 98, 72, 73, 74, 75, 42, 77,
- /* 40 */ 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
- /* 50 */ 97, 55, 95, 104, 4, 59, 107, 104, 62, 63,
- /* 60 */ 64, 65, 66, 67, 68, 69, 70, 71, 72, 73,
- /* 70 */ 74, 75, 237, 77, 78, 79, 80, 81, 82, 83,
- /* 80 */ 84, 85, 86, 87, 88, 4, 83, 84, 85, 86,
- /* 90 */ 87, 4, 96, 144, 145, 106, 15, 101, 89, 103,
- /* 100 */ 111, 96, 106, 107, 111, 179, 101, 111, 119, 120,
- /* 110 */ 121, 106, 107, 187, 118, 119, 120, 121, 192, 4,
- /* 120 */ 179, 97, 129, 42, 96, 179, 200, 201, 104, 101,
- /* 130 */ 134, 135, 97, 192, 106, 107, 126, 179, 192, 104,
- /* 140 */ 59, 200, 201, 197, 198, 64, 118, 221, 152, 23,
- /* 150 */ 192, 101, 156, 157, 193, 159, 106, 107, 200, 201,
- /* 160 */ 234, 133, 81, 82, 83, 155, 179, 117, 118, 88,
- /* 170 */ 89, 137, 144, 145, 140, 234, 235, 96, 97, 192,
- /* 180 */ 254, 55, 101, 4, 103, 104, 109, 106, 107, 112,
- /* 190 */ 113, 114, 111, 106, 107, 254, 146, 4, 237, 118,
- /* 200 */ 119, 120, 121, 116, 123, 179, 34, 130, 15, 263,
- /* 210 */ 264, 96, 254, 64, 256, 89, 255, 136, 192, 138,
- /* 220 */ 139, 106, 107, 142, 4, 227, 200, 201, 147, 148,
- /* 230 */ 149, 150, 151, 152, 236, 42, 87, 156, 157, 93,
- /* 240 */ 159, 77, 78, 79, 80, 81, 82, 83, 84, 85,
- /* 250 */ 86, 87, 59, 30, 4, 179, 4, 64, 109, 110,
- /* 260 */ 111, 112, 113, 114, 115, 97, 279, 152, 192, 124,
- /* 270 */ 125, 126, 246, 104, 81, 82, 200, 201, 129, 4,
- /* 280 */ 254, 88, 89, 4, 105, 106, 107, 64, 109, 96,
- /* 290 */ 97, 112, 113, 114, 101, 123, 103, 104, 61, 106,
- /* 300 */ 107, 110, 111, 187, 111, 136, 104, 138, 139, 130,
- /* 310 */ 234, 118, 119, 120, 121, 50, 123, 4, 61, 54,
- /* 320 */ 100, 101, 124, 125, 126, 4, 106, 107, 15, 136,
- /* 330 */ 254, 138, 139, 96, 97, 83, 220, 221, 59, 96,
- /* 340 */ 147, 148, 149, 150, 142, 152, 96, 154, 5, 156,
- /* 350 */ 157, 101, 159, 96, 97, 42, 106, 107, 106, 107,
- /* 360 */ 81, 82, 7, 247, 248, 4, 11, 251, 118, 26,
- /* 370 */ 118, 28, 59, 86, 87, 96, 101, 64, 113, 33,
- /* 380 */ 34, 106, 107, 133, 179, 106, 270, 32, 45, 97,
- /* 390 */ 111, 48, 187, 118, 81, 82, 104, 192, 119, 120,
- /* 400 */ 121, 88, 89, 4, 152, 200, 201, 58, 19, 96,
- /* 410 */ 97, 61, 66, 67, 101, 4, 103, 104, 29, 106,
- /* 420 */ 107, 146, 45, 99, 111, 19, 221, 106, 163, 108,
- /* 430 */ 24, 118, 119, 120, 121, 29, 123, 179, 190, 234,
- /* 440 */ 235, 193, 194, 195, 33, 34, 96, 97, 179, 136,
- /* 450 */ 192, 138, 139, 179, 104, 197, 198, 96, 96, 254,
- /* 460 */ 147, 192, 149, 150, 97, 152, 192, 106, 107, 156,
- /* 470 */ 157, 104, 159, 62, 63, 64, 65, 66, 67, 68,
- /* 480 */ 69, 70, 71, 72, 73, 74, 75, 255, 77, 78,
- /* 490 */ 79, 80, 81, 82, 83, 84, 85, 86, 87, 100,
- /* 500 */ 101, 124, 125, 126, 272, 106, 107, 238, 239, 98,
- /* 510 */ 179, 134, 135, 152, 99, 184, 154, 106, 169, 188,
- /* 520 */ 189, 263, 264, 192, 33, 34, 62, 63, 64, 65,
- /* 530 */ 99, 40, 68, 69, 70, 71, 72, 73, 74, 75,
- /* 540 */ 83, 77, 78, 79, 80, 81, 82, 83, 84, 85,
- /* 550 */ 86, 87, 141, 62, 63, 64, 65, 66, 67, 68,
- /* 560 */ 69, 70, 71, 72, 73, 74, 75, 181, 77, 78,
- /* 570 */ 79, 80, 81, 82, 83, 84, 85, 86, 87, 9,
- /* 580 */ 193, 194, 195, 179, 172, 173, 174, 175, 81, 82,
- /* 590 */ 20, 97, 188, 189, 137, 104, 192, 140, 104, 62,
- /* 600 */ 63, 64, 65, 33, 34, 68, 69, 70, 71, 72,
- /* 610 */ 73, 74, 75, 104, 77, 78, 79, 80, 81, 82,
- /* 620 */ 83, 84, 85, 86, 87, 161, 119, 120, 99, 33,
- /* 630 */ 34, 122, 62, 63, 64, 65, 66, 67, 68, 69,
- /* 640 */ 70, 71, 72, 73, 74, 75, 260, 77, 78, 79,
- /* 650 */ 80, 81, 82, 83, 84, 85, 86, 87, 62, 63,
- /* 660 */ 64, 65, 66, 67, 68, 69, 70, 71, 72, 73,
- /* 670 */ 74, 75, 4, 77, 78, 79, 80, 81, 82, 83,
- /* 680 */ 84, 85, 86, 87, 33, 34, 64, 65, 119, 120,
- /* 690 */ 68, 69, 70, 71, 72, 73, 74, 75, 161, 77,
- /* 700 */ 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
- /* 710 */ 4, 43, 111, 62, 63, 64, 65, 66, 67, 68,
- /* 720 */ 69, 70, 71, 72, 73, 74, 75, 23, 77, 78,
- /* 730 */ 79, 80, 81, 82, 83, 84, 85, 86, 87, 62,
- /* 740 */ 63, 64, 65, 4, 96, 68, 69, 70, 71, 72,
- /* 750 */ 73, 74, 75, 104, 77, 78, 79, 80, 81, 82,
- /* 760 */ 83, 84, 85, 86, 87, 193, 89, 51, 100, 53,
- /* 770 */ 61, 160, 97, 162, 106, 107, 62, 63, 64, 65,
- /* 780 */ 4, 104, 68, 69, 70, 71, 72, 73, 74, 75,
- /* 790 */ 104, 77, 78, 79, 80, 81, 82, 83, 84, 85,
- /* 800 */ 86, 87, 96, 89, 98, 96, 97, 222, 223, 237,
- /* 810 */ 225, 95, 106, 104, 62, 63, 64, 65, 104, 71,
- /* 820 */ 68, 69, 70, 71, 72, 73, 74, 75, 151, 77,
- /* 830 */ 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
- /* 840 */ 101, 89, 179, 97, 96, 106, 107, 141, 12, 98,
- /* 850 */ 104, 62, 63, 64, 65, 192, 104, 68, 69, 70,
- /* 860 */ 71, 72, 73, 74, 75, 151, 77, 78, 79, 80,
- /* 870 */ 81, 82, 83, 84, 85, 86, 87, 101, 89, 163,
- /* 880 */ 275, 276, 106, 107, 179, 146, 193, 196, 197, 198,
- /* 890 */ 196, 197, 198, 104, 118, 4, 97, 192, 62, 63,
- /* 900 */ 64, 65, 38, 151, 68, 69, 70, 71, 72, 73,
- /* 910 */ 74, 75, 104, 77, 78, 79, 80, 81, 82, 83,
- /* 920 */ 84, 85, 86, 87, 261, 89, 62, 63, 64, 65,
- /* 930 */ 237, 4, 68, 69, 70, 71, 72, 73, 74, 75,
- /* 940 */ 151, 77, 78, 79, 80, 81, 82, 83, 84, 85,
- /* 950 */ 86, 87, 4, 89, 249, 264, 97, 187, 264, 151,
- /* 960 */ 207, 208, 96, 15, 62, 63, 64, 65, 215, 34,
- /* 970 */ 68, 69, 70, 71, 72, 73, 74, 75, 4, 77,
- /* 980 */ 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
- /* 990 */ 42, 221, 4, 123, 4, 97, 105, 106, 107, 64,
- /* 1000 */ 98, 179, 179, 55, 179, 97, 179, 59, 81, 82,
- /* 1010 */ 0, 179, 64, 143, 192, 192, 96, 192, 179, 192,
- /* 1020 */ 188, 189, 200, 201, 192, 200, 201, 187, 179, 81,
- /* 1030 */ 82, 192, 183, 106, 107, 25, 88, 110, 97, 200,
- /* 1040 */ 201, 192, 5, 211, 96, 213, 119, 120, 4, 101,
- /* 1050 */ 123, 103, 125, 96, 106, 107, 234, 235, 123, 111,
- /* 1060 */ 220, 221, 55, 26, 129, 28, 118, 119, 120, 121,
- /* 1070 */ 97, 246, 245, 234, 235, 101, 254, 104, 97, 254,
- /* 1080 */ 106, 107, 134, 135, 179, 48, 96, 247, 248, 4,
- /* 1090 */ 179, 251, 187, 254, 106, 107, 106, 192, 179, 89,
- /* 1100 */ 152, 97, 279, 192, 156, 157, 118, 159, 104, 269,
- /* 1110 */ 270, 192, 62, 63, 64, 65, 98, 110, 68, 69,
- /* 1120 */ 70, 71, 72, 73, 74, 75, 221, 77, 78, 79,
- /* 1130 */ 80, 81, 82, 83, 84, 85, 86, 87, 164, 96,
- /* 1140 */ 152, 179, 9, 238, 239, 179, 179, 97, 179, 183,
- /* 1150 */ 106, 107, 183, 20, 192, 187, 4, 97, 192, 192,
- /* 1160 */ 249, 192, 118, 62, 63, 64, 65, 200, 201, 68,
- /* 1170 */ 69, 70, 71, 72, 73, 74, 75, 133, 77, 78,
- /* 1180 */ 79, 80, 81, 82, 83, 84, 85, 86, 87, 221,
- /* 1190 */ 97, 106, 107, 62, 63, 64, 65, 104, 97, 68,
- /* 1200 */ 69, 70, 71, 72, 73, 74, 75, 245, 77, 78,
- /* 1210 */ 79, 80, 81, 82, 83, 84, 85, 86, 87, 13,
- /* 1220 */ 4, 254, 187, 187, 104, 199, 141, 97, 97, 62,
- /* 1230 */ 63, 64, 65, 207, 104, 68, 69, 70, 71, 72,
- /* 1240 */ 73, 74, 75, 91, 77, 78, 79, 80, 81, 82,
- /* 1250 */ 83, 84, 85, 86, 87, 13, 221, 221, 106, 107,
- /* 1260 */ 104, 62, 63, 64, 65, 98, 96, 68, 69, 70,
- /* 1270 */ 71, 72, 73, 74, 75, 30, 77, 78, 79, 80,
- /* 1280 */ 81, 82, 83, 84, 85, 86, 87, 187, 89, 97,
- /* 1290 */ 4, 62, 63, 64, 65, 187, 104, 68, 69, 70,
- /* 1300 */ 71, 72, 73, 74, 75, 13, 77, 78, 79, 80,
- /* 1310 */ 81, 82, 83, 84, 85, 86, 87, 101, 89, 4,
- /* 1320 */ 192, 221, 106, 107, 62, 63, 64, 65, 200, 221,
- /* 1330 */ 68, 69, 70, 71, 72, 73, 74, 75, 97, 77,
- /* 1340 */ 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
- /* 1350 */ 203, 62, 63, 64, 65, 25, 4, 68, 69, 70,
- /* 1360 */ 71, 72, 73, 74, 75, 179, 77, 78, 79, 80,
- /* 1370 */ 81, 82, 83, 84, 85, 86, 87, 4, 192, 216,
- /* 1380 */ 4, 218, 166, 99, 98, 4, 200, 201, 15, 63,
- /* 1390 */ 64, 65, 106, 4, 68, 69, 70, 71, 72, 73,
- /* 1400 */ 74, 75, 255, 77, 78, 79, 80, 81, 82, 83,
- /* 1410 */ 84, 85, 86, 87, 14, 42, 101, 97, 179, 89,
- /* 1420 */ 234, 106, 107, 171, 104, 179, 97, 141, 176, 179,
- /* 1430 */ 179, 192, 59, 97, 97, 35, 83, 64, 192, 187,
- /* 1440 */ 254, 104, 192, 192, 55, 144, 46, 132, 4, 174,
- /* 1450 */ 175, 200, 201, 101, 81, 82, 203, 99, 106, 107,
- /* 1460 */ 4, 88, 179, 4, 214, 104, 4, 91, 4, 96,
- /* 1470 */ 97, 15, 220, 221, 101, 192, 103, 4, 239, 106,
- /* 1480 */ 107, 4, 106, 107, 111, 96, 97, 106, 107, 96,
- /* 1490 */ 101, 118, 119, 120, 121, 106, 107, 246, 42, 247,
- /* 1500 */ 248, 179, 4, 251, 4, 254, 179, 118, 255, 222,
- /* 1510 */ 223, 261, 225, 97, 192, 59, 216, 165, 218, 192,
- /* 1520 */ 64, 96, 133, 134, 135, 152, 274, 4, 128, 156,
- /* 1530 */ 157, 4, 159, 152, 179, 4, 179, 81, 82, 252,
- /* 1540 */ 137, 214, 97, 4, 88, 101, 160, 192, 179, 192,
- /* 1550 */ 106, 107, 96, 97, 15, 200, 201, 101, 97, 103,
- /* 1560 */ 101, 192, 106, 107, 102, 106, 107, 111, 106, 107,
- /* 1570 */ 106, 107, 17, 179, 118, 119, 120, 121, 97, 106,
- /* 1580 */ 107, 42, 97, 106, 107, 4, 192, 179, 261, 38,
- /* 1590 */ 4, 118, 133, 97, 97, 118, 6, 179, 59, 101,
- /* 1600 */ 192, 101, 245, 64, 106, 107, 106, 107, 152, 254,
- /* 1610 */ 192, 167, 156, 157, 245, 159, 118, 96, 118, 146,
- /* 1620 */ 81, 82, 158, 146, 101, 4, 193, 88, 96, 106,
- /* 1630 */ 107, 179, 101, 106, 107, 96, 15, 106, 107, 245,
- /* 1640 */ 101, 118, 103, 55, 192, 106, 107, 134, 135, 118,
- /* 1650 */ 111, 179, 200, 201, 179, 38, 96, 118, 119, 120,
- /* 1660 */ 121, 179, 96, 42, 192, 179, 38, 192, 4, 96,
- /* 1670 */ 237, 179, 200, 201, 192, 200, 201, 89, 192, 152,
- /* 1680 */ 59, 179, 200, 201, 192, 64, 115, 106, 107, 64,
- /* 1690 */ 129, 152, 106, 107, 192, 156, 157, 116, 159, 160,
- /* 1700 */ 214, 4, 81, 82, 118, 12, 254, 4, 4, 88,
- /* 1710 */ 103, 4, 179, 98, 123, 71, 142, 96, 97, 15,
- /* 1720 */ 128, 71, 101, 71, 103, 192, 254, 106, 107, 254,
- /* 1730 */ 71, 179, 111, 200, 201, 179, 254, 179, 4, 118,
- /* 1740 */ 119, 120, 121, 179, 192, 17, 42, 261, 192, 4,
- /* 1750 */ 192, 153, 200, 201, 179, 91, 192, 154, 200, 201,
- /* 1760 */ 128, 179, 135, 59, 200, 201, 179, 192, 64, 155,
- /* 1770 */ 106, 107, 22, 152, 192, 200, 201, 156, 157, 192,
- /* 1780 */ 159, 179, 200, 201, 179, 81, 82, 254, 91, 179,
- /* 1790 */ 4, 89, 88, 183, 192, 179, 47, 192, 89, 104,
- /* 1800 */ 96, 15, 192, 106, 107, 101, 254, 103, 192, 106,
- /* 1810 */ 106, 107, 254, 106, 107, 111, 200, 201, 254, 179,
- /* 1820 */ 117, 179, 118, 119, 120, 121, 179, 39, 42, 254,
- /* 1830 */ 39, 163, 192, 4, 192, 123, 254, 96, 95, 192,
- /* 1840 */ 106, 107, 200, 201, 15, 59, 95, 200, 201, 143,
- /* 1850 */ 64, 106, 107, 146, 96, 103, 152, 93, 97, 37,
- /* 1860 */ 156, 157, 179, 159, 97, 191, 4, 81, 82, 36,
- /* 1870 */ 254, 42, 127, 4, 88, 192, 240, 179, 144, 255,
- /* 1880 */ 4, 183, 96, 200, 201, 206, 206, 101, 59, 103,
- /* 1890 */ 192, 278, 106, 107, 276, 178, 254, 111, 278, 179,
- /* 1900 */ 90, 254, 179, 178, 118, 119, 120, 121, 49, 179,
- /* 1910 */ 81, 82, 192, 183, 179, 192, 178, 88, 183, 180,
- /* 1920 */ 200, 201, 192, 200, 201, 96, 178, 192, 182, 4,
- /* 1930 */ 101, 60, 103, 180, 104, 106, 107, 254, 152, 179,
- /* 1940 */ 111, 179, 156, 157, 185, 159, 4, 118, 119, 120,
- /* 1950 */ 121, 8, 192, 10, 192, 12, 4, 179, 179, 179,
- /* 1960 */ 200, 201, 200, 201, 21, 56, 23, 186, 106, 107,
- /* 1970 */ 192, 192, 192, 87, 254, 106, 107, 254, 200, 201,
- /* 1980 */ 179, 152, 106, 107, 41, 156, 157, 44, 159, 257,
- /* 1990 */ 179, 48, 49, 192, 118, 52, 179, 179, 55, 255,
- /* 2000 */ 57, 200, 201, 192, 64, 160, 179, 223, 134, 192,
- /* 2010 */ 192, 200, 201, 144, 254, 151, 254, 200, 201, 192,
- /* 2020 */ 230, 179, 229, 179, 232, 179, 164, 200, 201, 148,
- /* 2030 */ 179, 106, 254, 4, 192, 92, 192, 94, 192, 231,
- /* 2040 */ 179, 149, 117, 192, 200, 201, 200, 201, 106, 107,
- /* 2050 */ 147, 200, 201, 192, 179, 254, 214, 179, 106, 107,
- /* 2060 */ 118, 200, 201, 4, 179, 254, 4, 192, 233, 179,
- /* 2070 */ 192, 254, 4, 150, 131, 200, 201, 192, 205, 179,
- /* 2080 */ 96, 254, 192, 183, 132, 200, 201, 262, 87, 179,
- /* 2090 */ 200, 201, 192, 183, 179, 179, 4, 179, 254, 205,
- /* 2100 */ 254, 179, 192, 261, 99, 254, 4, 192, 192, 243,
- /* 2110 */ 192, 168, 179, 4, 192, 254, 200, 201, 200, 201,
- /* 2120 */ 4, 225, 200, 201, 4, 192, 135, 179, 4, 254,
- /* 2130 */ 179, 243, 179, 200, 201, 106, 107, 179, 4, 254,
- /* 2140 */ 192, 4, 179, 192, 254, 192, 4, 99, 200, 201,
- /* 2150 */ 192, 200, 201, 200, 201, 192, 4, 202, 200, 201,
- /* 2160 */ 179, 4, 100, 200, 201, 106, 107, 179, 106, 107,
- /* 2170 */ 254, 179, 254, 192, 106, 107, 254, 118, 4, 123,
- /* 2180 */ 192, 200, 201, 4, 192, 202, 118, 254, 200, 201,
- /* 2190 */ 179, 4, 200, 201, 4, 166, 4, 210, 106, 107,
- /* 2200 */ 31, 179, 254, 192, 202, 254, 179, 254, 106, 107,
- /* 2210 */ 118, 204, 254, 122, 192, 106, 107, 254, 202, 192,
- /* 2220 */ 118, 202, 106, 107, 100, 179, 106, 118, 205, 183,
- /* 2230 */ 106, 107, 179, 202, 118, 254, 210, 117, 192, 179,
- /* 2240 */ 106, 107, 254, 106, 107, 192, 254, 202, 106, 107,
- /* 2250 */ 99, 202, 192, 243, 182, 179, 179, 179, 106, 107,
- /* 2260 */ 205, 99, 205, 106, 107, 179, 179, 133, 192, 192,
- /* 2270 */ 192, 182, 99, 243, 100, 118, 179, 179, 192, 192,
- /* 2280 */ 106, 107, 179, 146, 267, 106, 107, 100, 27, 192,
- /* 2290 */ 192, 179, 268, 106, 107, 192, 106, 107, 106, 107,
- /* 2300 */ 160, 99, 229, 62, 192, 217, 99, 99, 250, 167,
- /* 2310 */ 96, 123, 229, 217, 253, 182, 99, 165, 243, 229,
- /* 2320 */ 182, 99, 243, 219, 60, 99, 219, 99, 99, 219,
- /* 2330 */ 219, 152, 99, 99, 271, 18, 243, 271, 243, 99,
- /* 2340 */ 273, 99, 152, 243, 99, 16, 228, 226, 264, 264,
- /* 2350 */ 203, 203, 258, 208, 204, 242, 212, 229, 244, 244,
- /* 2360 */ 229, 244, 177, 193, 193, 226, 265, 259, 193, 193,
- /* 2370 */ 224, 266, 218, 241, 209, 209, 209, 200, 200, 55,
- /* 2380 */ 280, 213, 280, 277,
+ /* 0 */ 4, 228, 67, 4, 231, 70, 106, 79, 80, 81,
+ /* 10 */ 82, 238, 16, 85, 86, 87, 88, 89, 90, 91,
+ /* 20 */ 92, 110, 94, 95, 96, 97, 98, 99, 100, 101,
+ /* 30 */ 102, 103, 104, 199, 106, 94, 95, 96, 97, 98,
+ /* 40 */ 99, 100, 101, 102, 103, 104, 212, 112, 129, 121,
+ /* 50 */ 88, 55, 89, 90, 91, 92, 93, 94, 95, 96,
+ /* 60 */ 97, 98, 99, 100, 101, 102, 103, 104, 199, 199,
+ /* 70 */ 4, 114, 76, 4, 59, 113, 207, 81, 208, 209,
+ /* 80 */ 199, 212, 212, 100, 101, 102, 103, 104, 160, 4,
+ /* 90 */ 221, 222, 4, 212, 98, 99, 100, 169, 199, 230,
+ /* 100 */ 129, 105, 106, 204, 234, 24, 236, 208, 209, 113,
+ /* 110 */ 114, 212, 285, 244, 118, 180, 120, 121, 147, 123,
+ /* 120 */ 124, 122, 123, 124, 4, 129, 127, 258, 259, 130,
+ /* 130 */ 131, 132, 136, 137, 138, 139, 16, 141, 78, 42,
+ /* 140 */ 43, 207, 308, 309, 24, 318, 319, 148, 279, 65,
+ /* 150 */ 154, 113, 156, 157, 75, 71, 160, 142, 143, 144,
+ /* 160 */ 31, 165, 166, 167, 168, 169, 170, 152, 153, 173,
+ /* 170 */ 41, 175, 176, 113, 114, 55, 250, 243, 244, 113,
+ /* 180 */ 83, 84, 113, 187, 118, 34, 260, 118, 307, 123,
+ /* 190 */ 124, 199, 123, 124, 113, 4, 76, 121, 113, 207,
+ /* 200 */ 4, 81, 136, 118, 212, 136, 272, 273, 123, 124,
+ /* 210 */ 276, 123, 124, 221, 222, 131, 140, 151, 98, 99,
+ /* 220 */ 151, 116, 230, 15, 136, 105, 106, 4, 162, 163,
+ /* 230 */ 296, 297, 81, 113, 114, 116, 244, 121, 118, 151,
+ /* 240 */ 120, 121, 127, 123, 124, 130, 131, 132, 4, 129,
+ /* 250 */ 258, 113, 44, 115, 199, 104, 136, 137, 138, 139,
+ /* 260 */ 16, 141, 114, 148, 180, 186, 115, 212, 60, 121,
+ /* 270 */ 154, 279, 156, 157, 154, 121, 156, 157, 127, 128,
+ /* 280 */ 129, 130, 131, 132, 133, 165, 166, 167, 168, 155,
+ /* 290 */ 170, 121, 158, 173, 124, 175, 176, 113, 147, 55,
+ /* 300 */ 98, 99, 100, 101, 102, 103, 104, 187, 191, 118,
+ /* 310 */ 4, 128, 129, 196, 123, 124, 78, 199, 4, 123,
+ /* 320 */ 76, 199, 199, 169, 207, 81, 135, 136, 43, 274,
+ /* 330 */ 212, 135, 162, 163, 212, 212, 142, 143, 144, 221,
+ /* 340 */ 222, 118, 98, 99, 221, 222, 123, 124, 230, 105,
+ /* 350 */ 106, 113, 114, 230, 146, 164, 121, 113, 114, 136,
+ /* 360 */ 243, 244, 118, 5, 120, 121, 81, 123, 124, 4,
+ /* 370 */ 7, 199, 4, 129, 121, 12, 258, 259, 35, 207,
+ /* 380 */ 136, 137, 138, 139, 212, 141, 114, 164, 30, 272,
+ /* 390 */ 273, 269, 114, 276, 36, 52, 207, 279, 154, 56,
+ /* 400 */ 156, 157, 279, 40, 4, 62, 100, 42, 43, 165,
+ /* 410 */ 199, 167, 168, 160, 170, 199, 244, 173, 301, 175,
+ /* 420 */ 176, 63, 114, 212, 208, 209, 141, 113, 212, 123,
+ /* 430 */ 124, 187, 147, 244, 262, 263, 313, 123, 124, 316,
+ /* 440 */ 4, 26, 136, 4, 79, 80, 81, 82, 83, 84,
+ /* 450 */ 85, 86, 87, 88, 89, 90, 91, 92, 114, 94,
+ /* 460 */ 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
+ /* 470 */ 4, 123, 35, 262, 263, 113, 170, 129, 103, 104,
+ /* 480 */ 115, 113, 137, 138, 170, 137, 138, 139, 123, 42,
+ /* 490 */ 43, 123, 124, 56, 79, 80, 81, 82, 51, 62,
+ /* 500 */ 85, 86, 87, 88, 89, 90, 91, 92, 165, 94,
+ /* 510 */ 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
+ /* 520 */ 4, 114, 4, 123, 159, 125, 79, 80, 81, 82,
+ /* 530 */ 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
+ /* 540 */ 10, 94, 95, 96, 97, 98, 99, 100, 101, 102,
+ /* 550 */ 103, 104, 22, 35, 118, 4, 117, 118, 121, 123,
+ /* 560 */ 124, 113, 123, 124, 78, 199, 245, 246, 121, 248,
+ /* 570 */ 52, 210, 42, 43, 56, 214, 215, 216, 212, 21,
+ /* 580 */ 62, 192, 193, 194, 195, 199, 150, 221, 222, 123,
+ /* 590 */ 124, 10, 177, 199, 179, 37, 230, 203, 212, 113,
+ /* 600 */ 114, 32, 136, 22, 218, 219, 212, 121, 121, 79,
+ /* 610 */ 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
+ /* 620 */ 90, 91, 92, 54, 94, 95, 96, 97, 98, 99,
+ /* 630 */ 100, 101, 102, 103, 104, 119, 170, 114, 43, 123,
+ /* 640 */ 124, 123, 124, 121, 78, 279, 4, 160, 79, 80,
+ /* 650 */ 81, 82, 42, 43, 85, 86, 87, 88, 89, 90,
+ /* 660 */ 91, 92, 165, 94, 95, 96, 97, 98, 99, 100,
+ /* 670 */ 101, 102, 103, 104, 123, 124, 290, 291, 4, 113,
+ /* 680 */ 114, 315, 316, 165, 187, 134, 4, 121, 4, 79,
+ /* 690 */ 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
+ /* 700 */ 90, 91, 92, 100, 94, 95, 96, 97, 98, 99,
+ /* 710 */ 100, 101, 102, 103, 104, 89, 90, 91, 92, 121,
+ /* 720 */ 94, 95, 96, 97, 98, 99, 100, 101, 102, 103,
+ /* 730 */ 104, 115, 79, 80, 81, 82, 141, 212, 85, 86,
+ /* 740 */ 87, 88, 89, 90, 91, 92, 221, 94, 95, 96,
+ /* 750 */ 97, 98, 99, 100, 101, 102, 103, 104, 155, 106,
+ /* 760 */ 118, 158, 113, 165, 67, 123, 124, 70, 26, 79,
+ /* 770 */ 80, 81, 82, 38, 121, 85, 86, 87, 88, 89,
+ /* 780 */ 90, 91, 92, 4, 94, 95, 96, 97, 98, 99,
+ /* 790 */ 100, 101, 102, 103, 104, 113, 106, 123, 124, 4,
+ /* 800 */ 114, 4, 26, 4, 199, 123, 124, 123, 124, 112,
+ /* 810 */ 136, 121, 26, 160, 72, 4, 81, 212, 79, 80,
+ /* 820 */ 81, 82, 169, 181, 85, 86, 87, 88, 89, 90,
+ /* 830 */ 91, 92, 4, 94, 95, 96, 97, 98, 99, 100,
+ /* 840 */ 101, 102, 103, 104, 16, 106, 98, 99, 106, 4,
+ /* 850 */ 160, 72, 170, 207, 170, 79, 80, 81, 82, 169,
+ /* 860 */ 121, 85, 86, 87, 88, 89, 90, 91, 92, 199,
+ /* 870 */ 94, 95, 96, 97, 98, 99, 100, 101, 102, 103,
+ /* 880 */ 104, 4, 212, 55, 177, 137, 138, 14, 218, 219,
+ /* 890 */ 244, 285, 113, 114, 142, 143, 144, 118, 199, 160,
+ /* 900 */ 72, 114, 123, 124, 76, 217, 218, 219, 169, 81,
+ /* 910 */ 113, 212, 115, 118, 309, 136, 199, 207, 123, 124,
+ /* 920 */ 123, 76, 123, 124, 318, 319, 98, 99, 121, 212,
+ /* 930 */ 151, 152, 153, 105, 123, 124, 237, 121, 221, 222,
+ /* 940 */ 13, 113, 114, 98, 99, 115, 118, 230, 120, 4,
+ /* 950 */ 199, 123, 124, 177, 244, 179, 159, 129, 113, 199,
+ /* 960 */ 290, 291, 114, 212, 136, 137, 138, 139, 123, 121,
+ /* 970 */ 159, 4, 212, 174, 129, 258, 259, 141, 183, 291,
+ /* 980 */ 152, 153, 137, 138, 139, 220, 287, 214, 215, 216,
+ /* 990 */ 113, 14, 114, 228, 229, 21, 279, 161, 170, 121,
+ /* 1000 */ 123, 173, 28, 175, 176, 49, 79, 80, 81, 82,
+ /* 1010 */ 4, 37, 85, 86, 87, 88, 89, 90, 91, 92,
+ /* 1020 */ 4, 94, 95, 96, 97, 98, 99, 100, 101, 102,
+ /* 1030 */ 103, 104, 177, 106, 179, 79, 80, 81, 82, 113,
+ /* 1040 */ 289, 85, 86, 87, 88, 89, 90, 91, 92, 4,
+ /* 1050 */ 94, 95, 96, 97, 98, 99, 100, 101, 102, 103,
+ /* 1060 */ 104, 16, 106, 118, 19, 199, 4, 199, 123, 124,
+ /* 1070 */ 310, 311, 312, 57, 4, 217, 218, 219, 212, 255,
+ /* 1080 */ 212, 257, 207, 4, 117, 118, 79, 80, 81, 82,
+ /* 1090 */ 123, 124, 85, 86, 87, 88, 89, 90, 91, 92,
+ /* 1100 */ 55, 94, 95, 96, 97, 98, 99, 100, 101, 102,
+ /* 1110 */ 103, 104, 19, 68, 4, 239, 114, 241, 243, 244,
+ /* 1120 */ 46, 76, 115, 121, 118, 35, 81, 182, 83, 123,
+ /* 1130 */ 124, 263, 199, 117, 4, 114, 203, 44, 207, 123,
+ /* 1140 */ 124, 72, 136, 98, 99, 212, 56, 272, 273, 291,
+ /* 1150 */ 105, 276, 62, 302, 303, 4, 61, 199, 113, 66,
+ /* 1160 */ 98, 99, 4, 118, 114, 120, 4, 16, 123, 124,
+ /* 1170 */ 212, 121, 297, 280, 129, 244, 310, 311, 312, 221,
+ /* 1180 */ 222, 136, 137, 138, 139, 123, 124, 4, 230, 80,
+ /* 1190 */ 128, 4, 299, 123, 124, 199, 106, 128, 4, 137,
+ /* 1200 */ 138, 35, 123, 141, 114, 143, 55, 0, 212, 32,
+ /* 1210 */ 144, 121, 199, 201, 135, 170, 258, 259, 173, 54,
+ /* 1220 */ 175, 176, 56, 72, 61, 212, 199, 76, 62, 199,
+ /* 1230 */ 14, 141, 81, 123, 221, 222, 29, 279, 172, 212,
+ /* 1240 */ 170, 5, 212, 230, 154, 135, 156, 157, 118, 98,
+ /* 1250 */ 99, 221, 222, 123, 124, 165, 105, 167, 168, 166,
+ /* 1260 */ 230, 114, 14, 199, 113, 269, 30, 203, 121, 118,
+ /* 1270 */ 108, 120, 36, 214, 123, 124, 212, 187, 194, 195,
+ /* 1280 */ 129, 123, 124, 270, 114, 123, 124, 136, 137, 138,
+ /* 1290 */ 139, 121, 279, 4, 136, 59, 214, 4, 286, 63,
+ /* 1300 */ 270, 118, 26, 152, 153, 118, 123, 124, 113, 279,
+ /* 1310 */ 123, 124, 199, 106, 184, 212, 213, 123, 124, 136,
+ /* 1320 */ 261, 170, 164, 136, 173, 212, 175, 176, 134, 79,
+ /* 1330 */ 80, 81, 82, 306, 307, 85, 86, 87, 88, 89,
+ /* 1340 */ 90, 91, 92, 261, 94, 95, 96, 97, 98, 99,
+ /* 1350 */ 100, 101, 102, 103, 104, 79, 80, 81, 82, 207,
+ /* 1360 */ 14, 85, 86, 87, 88, 89, 90, 91, 92, 14,
+ /* 1370 */ 94, 95, 96, 97, 98, 99, 100, 101, 102, 103,
+ /* 1380 */ 104, 29, 79, 80, 81, 82, 311, 312, 85, 86,
+ /* 1390 */ 87, 88, 89, 90, 91, 92, 244, 94, 95, 96,
+ /* 1400 */ 97, 98, 99, 100, 101, 102, 103, 104, 114, 311,
+ /* 1410 */ 312, 118, 123, 124, 14, 121, 123, 124, 121, 306,
+ /* 1420 */ 307, 4, 311, 312, 79, 80, 81, 82, 178, 136,
+ /* 1430 */ 85, 86, 87, 88, 89, 90, 91, 92, 114, 94,
+ /* 1440 */ 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
+ /* 1450 */ 239, 4, 241, 164, 79, 80, 81, 82, 106, 114,
+ /* 1460 */ 85, 86, 87, 88, 89, 90, 91, 92, 38, 94,
+ /* 1470 */ 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
+ /* 1480 */ 114, 178, 311, 312, 79, 80, 81, 82, 114, 114,
+ /* 1490 */ 85, 86, 87, 88, 89, 90, 91, 92, 162, 94,
+ /* 1500 */ 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
+ /* 1510 */ 245, 246, 4, 248, 79, 80, 81, 82, 116, 114,
+ /* 1520 */ 85, 86, 87, 88, 89, 90, 91, 92, 116, 94,
+ /* 1530 */ 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
+ /* 1540 */ 123, 124, 277, 100, 79, 80, 81, 82, 121, 114,
+ /* 1550 */ 85, 86, 87, 88, 89, 90, 91, 92, 113, 94,
+ /* 1560 */ 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
+ /* 1570 */ 123, 124, 311, 312, 79, 80, 81, 82, 114, 114,
+ /* 1580 */ 85, 86, 87, 88, 89, 90, 91, 92, 113, 94,
+ /* 1590 */ 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
+ /* 1600 */ 183, 106, 79, 80, 81, 82, 152, 153, 85, 86,
+ /* 1610 */ 87, 88, 89, 90, 91, 92, 108, 94, 95, 96,
+ /* 1620 */ 97, 98, 99, 100, 101, 102, 103, 104, 181, 155,
+ /* 1630 */ 4, 123, 124, 79, 80, 81, 82, 4, 115, 85,
+ /* 1640 */ 86, 87, 88, 89, 90, 91, 92, 114, 94, 95,
+ /* 1650 */ 96, 97, 98, 99, 100, 101, 102, 103, 104, 4,
+ /* 1660 */ 106, 79, 80, 81, 82, 114, 4, 85, 86, 87,
+ /* 1670 */ 88, 89, 90, 91, 92, 4, 94, 95, 96, 97,
+ /* 1680 */ 98, 99, 100, 101, 102, 103, 104, 16, 106, 114,
+ /* 1690 */ 19, 79, 80, 81, 82, 114, 121, 85, 86, 87,
+ /* 1700 */ 88, 89, 90, 91, 92, 4, 94, 95, 96, 97,
+ /* 1710 */ 98, 99, 100, 101, 102, 103, 104, 9, 114, 11,
+ /* 1720 */ 199, 13, 114, 199, 203, 121, 55, 199, 114, 199,
+ /* 1730 */ 199, 23, 114, 212, 26, 121, 212, 113, 199, 68,
+ /* 1740 */ 212, 108, 212, 212, 4, 221, 222, 76, 4, 123,
+ /* 1750 */ 124, 212, 81, 169, 230, 113, 123, 124, 114, 18,
+ /* 1760 */ 199, 53, 136, 108, 203, 121, 58, 4, 237, 98,
+ /* 1770 */ 99, 63, 64, 212, 49, 199, 105, 69, 123, 124,
+ /* 1780 */ 72, 4, 74, 115, 113, 123, 124, 224, 212, 118,
+ /* 1790 */ 164, 120, 199, 16, 123, 124, 19, 221, 222, 199,
+ /* 1800 */ 129, 214, 274, 279, 114, 212, 230, 136, 137, 138,
+ /* 1810 */ 139, 121, 212, 151, 221, 222, 115, 109, 287, 111,
+ /* 1820 */ 114, 221, 222, 230, 123, 72, 287, 121, 6, 4,
+ /* 1830 */ 230, 113, 55, 214, 258, 4, 8, 313, 49, 199,
+ /* 1840 */ 316, 170, 113, 280, 173, 68, 175, 176, 261, 4,
+ /* 1850 */ 114, 258, 212, 76, 49, 279, 4, 149, 81, 106,
+ /* 1860 */ 159, 4, 224, 123, 124, 113, 122, 123, 124, 113,
+ /* 1870 */ 270, 199, 279, 188, 189, 98, 99, 113, 199, 279,
+ /* 1880 */ 261, 118, 105, 199, 212, 199, 123, 124, 133, 203,
+ /* 1890 */ 113, 212, 147, 185, 199, 118, 212, 120, 212, 136,
+ /* 1900 */ 123, 124, 162, 120, 13, 4, 129, 212, 81, 269,
+ /* 1910 */ 115, 141, 199, 136, 137, 138, 139, 16, 280, 160,
+ /* 1920 */ 146, 79, 80, 81, 82, 212, 88, 85, 86, 87,
+ /* 1930 */ 88, 89, 90, 91, 92, 4, 94, 95, 96, 97,
+ /* 1940 */ 98, 99, 100, 101, 102, 103, 104, 170, 123, 124,
+ /* 1950 */ 173, 214, 175, 176, 123, 124, 55, 88, 88, 4,
+ /* 1960 */ 199, 199, 88, 118, 269, 171, 199, 136, 123, 124,
+ /* 1970 */ 118, 4, 199, 212, 212, 123, 124, 76, 199, 212,
+ /* 1980 */ 123, 124, 81, 221, 222, 212, 18, 162, 221, 222,
+ /* 1990 */ 4, 212, 230, 24, 221, 222, 151, 230, 261, 98,
+ /* 2000 */ 99, 146, 145, 230, 4, 199, 105, 153, 172, 106,
+ /* 2010 */ 106, 4, 25, 199, 113, 114, 164, 280, 212, 118,
+ /* 2020 */ 258, 120, 199, 16, 123, 124, 212, 221, 222, 4,
+ /* 2030 */ 129, 61, 50, 121, 199, 212, 230, 136, 137, 138,
+ /* 2040 */ 139, 279, 50, 270, 221, 222, 279, 212, 269, 282,
+ /* 2050 */ 141, 237, 279, 230, 123, 124, 221, 222, 180, 113,
+ /* 2060 */ 199, 112, 55, 161, 258, 230, 113, 136, 120, 112,
+ /* 2070 */ 114, 170, 117, 212, 173, 114, 175, 176, 123, 124,
+ /* 2080 */ 48, 199, 199, 76, 4, 279, 203, 199, 81, 110,
+ /* 2090 */ 123, 124, 47, 270, 212, 212, 211, 280, 199, 227,
+ /* 2100 */ 212, 287, 279, 136, 264, 98, 99, 227, 4, 123,
+ /* 2110 */ 124, 212, 105, 199, 279, 303, 305, 4, 305, 237,
+ /* 2120 */ 113, 114, 136, 123, 124, 118, 212, 120, 199, 16,
+ /* 2130 */ 123, 124, 198, 200, 199, 107, 129, 198, 64, 199,
+ /* 2140 */ 198, 212, 199, 136, 137, 138, 139, 212, 123, 124,
+ /* 2150 */ 221, 222, 212, 4, 200, 212, 221, 222, 4, 230,
+ /* 2160 */ 198, 221, 222, 199, 164, 230, 77, 203, 55, 287,
+ /* 2170 */ 230, 205, 199, 4, 199, 150, 212, 170, 4, 199,
+ /* 2180 */ 173, 121, 175, 176, 4, 212, 202, 212, 4, 76,
+ /* 2190 */ 73, 206, 212, 4, 81, 267, 221, 222, 246, 116,
+ /* 2200 */ 199, 221, 222, 123, 124, 230, 152, 4, 279, 4,
+ /* 2210 */ 230, 98, 99, 212, 279, 252, 136, 169, 105, 279,
+ /* 2220 */ 167, 117, 166, 4, 253, 199, 113, 123, 124, 168,
+ /* 2230 */ 4, 118, 254, 120, 104, 16, 123, 124, 212, 256,
+ /* 2240 */ 199, 4, 129, 81, 226, 199, 113, 221, 222, 136,
+ /* 2250 */ 137, 138, 139, 212, 279, 104, 230, 199, 212, 279,
+ /* 2260 */ 288, 203, 221, 222, 283, 177, 255, 221, 222, 280,
+ /* 2270 */ 212, 230, 123, 124, 55, 256, 230, 123, 124, 165,
+ /* 2280 */ 271, 199, 4, 170, 271, 136, 173, 45, 175, 176,
+ /* 2290 */ 177, 314, 123, 124, 212, 76, 27, 123, 124, 116,
+ /* 2300 */ 81, 117, 199, 123, 124, 279, 117, 123, 124, 199,
+ /* 2310 */ 136, 314, 123, 124, 267, 212, 136, 98, 99, 248,
+ /* 2320 */ 279, 199, 212, 199, 105, 279, 123, 124, 123, 124,
+ /* 2330 */ 153, 199, 113, 114, 212, 319, 212, 118, 184, 120,
+ /* 2340 */ 188, 136, 123, 124, 212, 233, 223, 4, 129, 123,
+ /* 2350 */ 124, 182, 223, 221, 222, 136, 137, 138, 139, 16,
+ /* 2360 */ 123, 124, 230, 141, 80, 81, 82, 39, 223, 85,
+ /* 2370 */ 86, 87, 88, 89, 90, 91, 92, 199, 94, 95,
+ /* 2380 */ 96, 97, 98, 99, 100, 101, 102, 103, 104, 170,
+ /* 2390 */ 212, 225, 173, 199, 175, 176, 170, 203, 55, 221,
+ /* 2400 */ 222, 123, 124, 199, 140, 199, 212, 170, 230, 199,
+ /* 2410 */ 199, 279, 199, 199, 223, 233, 212, 267, 212, 76,
+ /* 2420 */ 223, 226, 212, 212, 81, 212, 212, 221, 222, 116,
+ /* 2430 */ 223, 199, 223, 199, 221, 222, 230, 199, 199, 223,
+ /* 2440 */ 116, 98, 99, 230, 212, 199, 212, 226, 105, 171,
+ /* 2450 */ 212, 212, 202, 4, 226, 202, 113, 279, 212, 221,
+ /* 2460 */ 222, 118, 199, 120, 116, 16, 123, 124, 230, 267,
+ /* 2470 */ 199, 199, 129, 199, 199, 212, 199, 33, 199, 136,
+ /* 2480 */ 137, 138, 139, 212, 212, 279, 212, 212, 199, 212,
+ /* 2490 */ 294, 212, 279, 221, 222, 295, 177, 116, 221, 222,
+ /* 2500 */ 252, 212, 230, 79, 55, 240, 116, 230, 252, 116,
+ /* 2510 */ 275, 113, 141, 170, 278, 116, 173, 279, 175, 176,
+ /* 2520 */ 252, 240, 202, 202, 267, 76, 267, 116, 252, 242,
+ /* 2530 */ 81, 116, 77, 242, 116, 242, 116, 242, 116, 171,
+ /* 2540 */ 289, 116, 298, 20, 17, 298, 116, 98, 99, 267,
+ /* 2550 */ 267, 279, 267, 199, 105, 116, 279, 116, 199, 249,
+ /* 2560 */ 300, 291, 113, 251, 291, 224, 212, 118, 266, 120,
+ /* 2570 */ 284, 212, 123, 124, 268, 221, 222, 255, 129, 224,
+ /* 2580 */ 221, 222, 255, 231, 230, 136, 137, 138, 139, 230,
+ /* 2590 */ 225, 235, 252, 268, 268, 81, 82, 251, 197, 85,
+ /* 2600 */ 86, 87, 88, 89, 90, 91, 92, 249, 94, 95,
+ /* 2610 */ 96, 97, 98, 99, 100, 101, 102, 103, 104, 170,
+ /* 2620 */ 214, 214, 173, 214, 175, 176, 214, 199, 292, 247,
+ /* 2630 */ 293, 281, 241, 279, 199, 317, 232, 265, 279, 304,
+ /* 2640 */ 212, 199, 232, 72, 221, 232, 4, 212, 221, 221,
+ /* 2650 */ 222, 320, 236, 199, 212, 320, 221, 222, 230, 320,
+ /* 2660 */ 199, 320, 320, 221, 222, 230, 212, 199, 320, 320,
+ /* 2670 */ 320, 320, 230, 212, 320, 221, 222, 320, 320, 199,
+ /* 2680 */ 212, 199, 221, 222, 230, 320, 320, 320, 320, 221,
+ /* 2690 */ 222, 230, 212, 199, 212, 320, 320, 320, 230, 320,
+ /* 2700 */ 320, 221, 222, 221, 222, 320, 212, 279, 320, 320,
+ /* 2710 */ 230, 320, 230, 320, 279, 221, 222, 320, 320, 199,
+ /* 2720 */ 320, 279, 320, 320, 230, 320, 320, 320, 320, 320,
+ /* 2730 */ 320, 320, 212, 279, 320, 320, 320, 320, 320, 320,
+ /* 2740 */ 279, 221, 222, 320, 320, 320, 320, 279, 320, 320,
+ /* 2750 */ 230, 320, 320, 199, 320, 320, 199, 320, 199, 279,
+ /* 2760 */ 320, 279, 320, 320, 320, 320, 212, 320, 320, 212,
+ /* 2770 */ 320, 212, 199, 279, 320, 221, 222, 320, 221, 222,
+ /* 2780 */ 221, 222, 320, 320, 230, 212, 320, 230, 199, 230,
+ /* 2790 */ 320, 320, 320, 320, 221, 222, 320, 320, 320, 279,
+ /* 2800 */ 199, 212, 320, 230, 199, 320, 320, 320, 320, 320,
+ /* 2810 */ 221, 222, 320, 212, 320, 320, 320, 212, 320, 230,
+ /* 2820 */ 320, 320, 221, 222, 199, 320, 221, 222, 320, 320,
+ /* 2830 */ 320, 230, 320, 279, 320, 230, 279, 212, 279, 320,
+ /* 2840 */ 199, 320, 320, 320, 320, 320, 221, 222, 320, 320,
+ /* 2850 */ 320, 320, 279, 212, 199, 230, 199, 320, 320, 320,
+ /* 2860 */ 199, 320, 221, 222, 320, 320, 320, 212, 279, 212,
+ /* 2870 */ 320, 230, 320, 212, 320, 199, 221, 222, 221, 222,
+ /* 2880 */ 279, 320, 221, 222, 279, 230, 320, 230, 212, 320,
+ /* 2890 */ 199, 230, 199, 320, 199, 320, 320, 221, 222, 320,
+ /* 2900 */ 320, 320, 320, 212, 279, 212, 230, 212, 320, 320,
+ /* 2910 */ 320, 320, 221, 222, 221, 222, 221, 222, 320, 199,
+ /* 2920 */ 279, 230, 320, 230, 320, 230, 320, 320, 320, 320,
+ /* 2930 */ 320, 320, 212, 320, 279, 320, 279, 320, 320, 320,
+ /* 2940 */ 279, 221, 222, 320, 320, 320, 320, 320, 320, 320,
+ /* 2950 */ 230, 320, 320, 199, 320, 279, 199, 320, 320, 320,
+ /* 2960 */ 320, 320, 320, 320, 320, 320, 212, 320, 320, 212,
+ /* 2970 */ 279, 320, 279, 320, 279, 221, 222, 320, 221, 222,
+ /* 2980 */ 320, 320, 320, 320, 230, 320, 320, 230, 320, 320,
+ /* 2990 */ 320, 320, 320, 320, 320, 320, 320, 320, 320, 279,
+ /* 3000 */ 320, 320, 320, 320, 320, 320, 320, 320, 320, 320,
+ /* 3010 */ 320, 320, 320, 320, 320, 320, 320, 320, 320, 320,
+ /* 3020 */ 320, 320, 320, 320, 320, 320, 320, 320, 320, 320,
+ /* 3030 */ 320, 320, 320, 279, 320, 320, 279,
};
-#define YY_SHIFT_USE_DFLT (-81)
-#define YY_SHIFT_COUNT (460)
-#define YY_SHIFT_MIN (-80)
-#define YY_SHIFT_MAX (2329)
+#define YY_SHIFT_USE_DFLT (-101)
+#define YY_SHIFT_COUNT (513)
+#define YY_SHIFT_MIN (-100)
+#define YY_SHIFT_MAX (2642)
static const short yy_shift_ofst[] = {
- /* 0 */ 1330, -4, 1943, 948, 1588, 1621, 1621, 1621, 126, 313,
- /* 10 */ 1539, 1704, 1704, 1704, 1704, 1389, 927, 927, 179, 81,
- /* 20 */ 193, 1456, 1373, 1704, 1704, 1704, 1704, 1704, 1704, 1704,
- /* 30 */ 1704, 1704, 1704, 1704, 1704, 1704, 1704, 1704, 1704, 1704,
- /* 40 */ 1786, 1704, 1704, 1704, 1704, 1786, 1704, 1704, 1704, 1704,
- /* 50 */ 1704, 1704, 1704, 1704, 1704, 1704, 1704, 1704, 1704, 1704,
- /* 60 */ 1704, 1704, 1829, 891, 28, 377, 891, 2179, 2179, 2179,
- /* 70 */ 2179, 507, 507, 321, 411, 250, 1531, 1444, 739, 1459,
- /* 80 */ 1523, 361, 1500, 361, 1498, 776, 1315, 668, 399, 2190,
- /* 90 */ 2190, 2190, 2190, 935, 2190, 2187, 2179, 321, 1513, 570,
- /* 100 */ 570, 864, 279, 149, 50, 275, 252, 1477, 1473, 1352,
- /* 110 */ 220, 974, 115, 343, 1216, 343, 5, 1044, 706, 988,
- /* 120 */ 2174, 2157, 2152, 2142, 2137, 2134, 2116, 2124, 2109, 1862,
- /* 130 */ 2102, 2092, 2068, 2059, 2029, 1952, 2062, 1586, 1581, 1745,
- /* 140 */ 1942, 1876, 1869, 1734, 1286, 1286, 1286, 1707, 1085, 1527,
- /* 150 */ 1464, 1381, 87, 1462, 265, 1697, 1664, 1376, 1152, 2192,
- /* 160 */ 2192, 2192, 1010, 1007, 2324, 2324, 2324, 2324, 2324, -81,
- /* 170 */ -81, 491, 651, 651, 651, 651, 651, 651, 651, 651,
- /* 180 */ 651, 789, 752, 714, 677, 836, 1229, 1199, 1167, 1131,
- /* 190 */ 1101, 1050, 537, 902, 464, 1289, 1262, 1326, 622, 622,
- /* 200 */ -60, -38, -38, -38, -38, 164, -80, 77, -11, -11,
- /* 210 */ 3, 709, 350, 1400, 1400, 1400, -51, 169, 1037, 346,
- /* 220 */ 198, 355, 2120, 1925, 990, 1703, 457, 406, 808, 808,
- /* 230 */ 223, 223, 509, 1337, 172, 1133, 223, 870, 1133, 569,
- /* 240 */ 569, 202, 34, 611, 287, 2329, 2245, 2242, 2240, 2317,
- /* 250 */ 2317, 2234, 2233, 2264, 2229, 2264, 2228, 2264, 2226, 2264,
- /* 260 */ 2222, 1871, 1864, 2217, 1871, 2241, 1864, 2188, 2214, 2208,
- /* 270 */ 2207, 2241, 1864, 2202, 2140, 2261, 2173, 1871, 2162, 1984,
- /* 280 */ 1871, 2151, 1984, 2056, 2056, 2056, 2056, 2169, 1984, 2056,
- /* 290 */ 2091, 2056, 2169, 2056, 2056, 2048, 1991, 2005, 1984, 2001,
- /* 300 */ 1984, 1923, 1903, 1892, 1881, 1864, 1874, 1845, 1940, 1886,
- /* 310 */ 1909, 1830, 1871, 1859, 1859, 1810, 1810, 1810, 1810, -81,
- /* 320 */ -81, -81, -81, -81, -81, -81, -81, -81, -81, 596,
- /* 330 */ 716, 257, 237, 145, -43, 349, 748, 1320, 1192, 10,
- /* 340 */ 1130, 362, 1093, 1004, 973, 746, 494, 191, 389, -7,
- /* 350 */ 367, 292, 35, 24, -47, -65, 1833, 1822, 1764, 1751,
- /* 360 */ 1767, 1761, 1752, 1758, 1706, 1743, 1741, 1712, 1668, 1791,
- /* 370 */ 1695, 1788, 1749, 1750, 1709, 1702, 1627, 1614, 1632, 1603,
- /* 380 */ 1728, 1598, 1659, 1652, 1650, 1644, 1592, 1574, 1693, 1591,
- /* 390 */ 1615, 1607, 1625, 1561, 1571, 1573, 1628, 1566, 1560, 1497,
- /* 400 */ 1532, 1617, 1590, 1521, 1551, 1555, 1496, 1485, 1481, 1461,
- /* 410 */ 1386, 1445, 1361, 1403, 1425, 1416, 1393, 1361, 1353, 1358,
- /* 420 */ 1284, 1301, 1336, 1329, 1156, 1241, 1245, 1292, 1170, 1156,
- /* 430 */ 1242, 1120, 1206, 1060, 1043, 1018, 686, 981, 957, 751,
- /* 440 */ 686, 941, 920, 908, 898, 866, 859, 799, 675, 649,
- /* 450 */ 648, 704, 601, 529, 431, 415, 324, 243, 168, 146,
- /* 460 */ 9,
+ /* 0 */ 1352, 828, 1151, 1708, 1045, 1777, 1671, 2219, 2219, 2219,
+ /* 10 */ 1753, 244, 2113, 2343, 2343, 2343, 2343, 2343, 2343, 2449,
+ /* 20 */ 2343, 742, -4, 120, 2007, 1901, 2343, 2343, 2343, 2343,
+ /* 30 */ 2343, 2343, 2343, 2343, 2343, 2343, 2343, 2343, 2343, 2343,
+ /* 40 */ 2343, 2343, 2343, 2343, 2343, 2343, 2343, 2343, 2343, 2343,
+ /* 50 */ 2343, 2343, 2343, 2343, 2343, 2343, 2343, 2343, 2343, 2343,
+ /* 60 */ 2343, 2343, 2343, 2343, 2343, 2343, 2343, 2343, 2343, 779,
+ /* 70 */ 1062, 1062, -1, 518, 518, 1744, 66, 15, 1016, 1744,
+ /* 80 */ 2226, 2226, 2226, 2189, 2226, 748, 748, 2203, 400, 365,
+ /* 90 */ 151, 69, 1763, 1130, 1852, 1845, 1293, 682, 1187, 682,
+ /* 100 */ 1183, 1006, 436, 967, 2278, 2237, 2237, 2237, 2237, 285,
+ /* 110 */ 2237, 2226, 2203, 2203, 400, 1685, 1685, 1454, 530, 530,
+ /* 120 */ 956, 845, 191, 223, 306, 1626, 1158, 945, 439, 642,
+ /* 130 */ 314, 1236, 795, 1236, 88, 797, 343, 466, 85, 2184,
+ /* 140 */ 2174, 2169, 2154, 2000, 1662, 2205, 2104, 2180, 1447, 2149,
+ /* 150 */ 2080, 1986, 1967, 1417, 2025, 1955, 1931, 1194, 1857, 1831,
+ /* 160 */ 368, 1825, 1740, 1701, 1701, 1701, 1289, 811, 1070, 437,
+ /* 170 */ 437, 799, 684, 674, 551, 516, 84, 1655, 1633, 1508,
+ /* 180 */ 1162, 2203, 1166, 1166, 1207, 1069, 497, 2571, 2571, 2642,
+ /* 190 */ 2571, 2571, -101, -101, 447, 739, 690, 653, -72, 610,
+ /* 200 */ 610, 610, 610, 610, 610, 776, 415, 927, 569, 1582,
+ /* 210 */ 1554, 1523, 1495, 1465, 1435, 1405, 1375, 1345, 1303, 1276,
+ /* 220 */ 1250, 1007, 1842, 1612, 2284, 2514, 2514, -37, 626, 626,
+ /* 230 */ 626, 626, -59, 202, 115, 348, 348, -17, 566, 486,
+ /* 240 */ 208, 208, 208, 170, 1093, 358, 116, 97, 752, 363,
+ /* 250 */ 1110, 1079, 877, 196, 603, 974, 154, 487, 735, 735,
+ /* 260 */ 76, 1706, 595, 581, 735, 836, 598, 598, 855, 581,
+ /* 270 */ 345, 345, 375, 253, 134, 2527, 2441, 2439, 2430, 2523,
+ /* 280 */ 2523, 2425, 2368, 2422, 2455, 2420, 2455, 2418, 2455, 2415,
+ /* 290 */ 2455, 2411, 2089, 2048, 2399, 2089, 2424, 2048, 2371, 2398,
+ /* 300 */ 2393, 2048, 2390, 2424, 2048, 2381, 2319, 2444, 2348, 2089,
+ /* 310 */ 2324, 2133, 2089, 2313, 2133, 2222, 2222, 2222, 2222, 2328,
+ /* 320 */ 2133, 2222, 2264, 2222, 2328, 2222, 2222, 2152, 2177, 2183,
+ /* 330 */ 2269, 2269, 2242, 2242, 2061, 2114, 2088, 2151, 2133, 2162,
+ /* 340 */ 2130, 2061, 2053, 2056, 2048, 2054, 2083, 2117, 2060, 2089,
+ /* 350 */ 2074, 2074, 2028, 2028, 2028, 2028, -101, -101, -101, -101,
+ /* 360 */ -101, -101, -101, -101, -101, -101, 1090, -65, 238, 60,
+ /* 370 */ 194, 697, 79, -38, 1690, 1644, 1066, 1614, 81, 1604,
+ /* 380 */ 1575, 1294, 1170, 1147, 183, 558, -29, 1050, 1002, 129,
+ /* 390 */ 878, 848, 148, 138, 2045, 2032, 1979, 1957, 1961, 1956,
+ /* 400 */ 1948, 1953, 1902, 1949, 1946, 1909, 1878, 1992, 1912, 1982,
+ /* 410 */ 1970, 1987, 1904, 1903, 1854, 1836, 1855, 1969, 1968, 1794,
+ /* 420 */ 1874, 1870, 1869, 1838, 1774, 1759, 1891, 1770, 1795, 1783,
+ /* 430 */ 1827, 1745, 1755, 1764, 1805, 1756, 1752, 1736, 1729, 1789,
+ /* 440 */ 1828, 1718, 1668, 1822, 1642, 1725, 1741, 1618, 1584, 1624,
+ /* 450 */ 1608, 1581, 1551, 1533, 1427, 1474, 1475, 1464, 1445, 1427,
+ /* 460 */ 1443, 1412, 1402, 1336, 1374, 1366, 1297, 1324, 1430, 1400,
+ /* 470 */ 1195, 1297, 1355, 1346, 1248, 1216, 1165, 1163, 1177, 1109,
+ /* 480 */ 1095, 1074, 977, 1021, 926, 830, 816, 807, 873, 787,
+ /* 490 */ 707, 786, 522, 686, 649, 616, 522, 523, 448, 407,
+ /* 500 */ 344, 362, 308, 278, 272, 235, 184, 119, 105, -81,
+ /* 510 */ 38, -43, -89, -100,
};
-#define YY_REDUCE_USE_DFLT (-166)
-#define YY_REDUCE_COUNT (328)
-#define YY_REDUCE_MIN (-165)
-#define YY_REDUCE_MAX (2185)
+#define YY_REDUCE_USE_DFLT (-228)
+#define YY_REDUCE_COUNT (365)
+#define YY_REDUCE_MIN (-227)
+#define YY_REDUCE_MAX (2757)
static const short yy_reduce_ofst[] = {
- /* 0 */ 412, 205, 1252, -74, 840, 839, 822, -59, 116, 1186,
- /* 10 */ -42, 1251, 825, 76, 26, 905, 258, -54, 832, 1992,
- /* 20 */ 1988, 1981, 1963, 1958, 1953, 1951, 1948, 1933, 1922, 1918,
- /* 30 */ 1916, 1890, 1885, 1875, 1861, 1851, 1846, 1844, 1827, 1817,
- /* 40 */ 1811, 1801, 1778, 1762, 1760, 1723, 1720, 1683, 1647, 1642,
- /* 50 */ 1616, 1582, 1575, 1564, 1558, 1552, 1533, 1482, 1475, 1472,
- /* 60 */ 1452, 1355, 967, 331, 269, 1287, 404, 1842, 1486, 1327,
- /* 70 */ 1250, 694, 691, 248, -39, 1239, 2046, 1910, 1900, 1735,
- /* 80 */ 1730, 911, 1698, 705, 1610, 969, 966, 823, 849, 1394,
- /* 90 */ 1369, 1357, 962, 753, 827, -13, 663, 387, 585, 1253,
- /* 100 */ 1147, 232, 1128, 1026, 2112, 2103, 2076, 1818, 1818, 2098,
- /* 110 */ 2097, 2087, 2086, 1300, 2078, 1163, 2077, 1818, 1433, 2076,
- /* 120 */ 2060, 1818, 1818, 1818, 1818, 1818, 1818, 1818, 2053, 1818,
- /* 130 */ 1818, 1818, 1818, 2027, 1818, 1818, 1818, 2022, 2011, 1915,
- /* 140 */ 1878, 1818, 1780, 1779, 693, 572, -165, 1640, 1605, 1602,
- /* 150 */ 1587, 1556, 1502, 1492, 386, 1418, 1408, 1322, 1283, 1246,
- /* 160 */ 919, 274, 1275, 1108, 1100, 1036, 1035, 968, 770, 605,
- /* 170 */ -2, 1624, 1624, 1624, 1624, 1624, 1624, 1624, 1624, 1624,
- /* 180 */ 1624, 1624, 1624, 1624, 1624, 1624, 1624, 1624, 1624, 1624,
- /* 190 */ 1624, 1624, 1624, 1624, 1624, 1624, 1624, 1624, 1624, 1624,
- /* 200 */ 1624, 1624, 1624, 1624, 1624, 1624, 1624, 2168, 2178, 2177,
- /* 210 */ 1624, 2106, 2106, 2167, 2166, 2165, 2132, 2146, 2154, 2108,
- /* 220 */ 2105, 2101, 2176, 2175, 2171, 2170, 2139, 2185, 2131, 2128,
- /* 230 */ 2117, 2115, 2150, 2144, 2145, 2148, 2114, 2113, 2147, 2085,
- /* 240 */ 2084, 2118, 2121, 2094, 1624, 2067, 2010, 2100, 2095, 2066,
- /* 250 */ 2063, 2093, 2010, 2111, 2010, 2110, 2010, 2107, 2010, 2104,
- /* 260 */ 2079, 2138, 2090, 2075, 2133, 2096, 2083, 2061, 2058, 2010,
- /* 270 */ 2010, 2088, 2073, 2010, 2024, 2017, 2030, 2089, 2010, 2057,
- /* 280 */ 2072, 2010, 2055, 2049, 2045, 2031, 2019, 2026, 2023, 2016,
- /* 290 */ 2007, 2002, 1987, 1983, 1955, 1888, 1896, 1866, 1894, 1825,
- /* 300 */ 1873, 1835, 1792, 1808, 1790, 1793, 1784, 1732, 1744, 1624,
- /* 310 */ 1781, 1759, 1746, 1753, 1739, 1748, 1738, 1725, 1717, 1620,
- /* 320 */ 1613, 1618, 1680, 1679, 1636, 1624, 1624, 1624, 1674,
+ /* 0 */ 389, -131, -8, 117, 1524, 366, 123, 958, 717, 118,
+ /* 10 */ -66, 1806, 1767, 1823, 1773, 1762, 1600, 1030, 1593, 1576,
+ /* 20 */ 1013, 875, 2757, 2754, 2720, 2695, 2693, 2691, 2676, 2661,
+ /* 30 */ 2657, 2655, 2641, 2625, 2605, 2601, 2589, 2573, 2559, 2557,
+ /* 40 */ 2554, 2520, 2494, 2482, 2480, 2468, 2461, 2454, 2442, 2435,
+ /* 50 */ 2428, 2359, 2354, 2277, 2272, 2238, 2213, 2206, 2178, 2132,
+ /* 60 */ 2046, 2041, 2026, 1980, 1975, 1940, 1935, 1929, 1835, 172,
+ /* 70 */ 670, 386, -130, 866, 760, -101, 211, 1265, 1113, 216,
+ /* 80 */ 1882, 1814, 1531, 1027, 699, 858, 688, -166, 361, 1737,
+ /* 90 */ 765, 868, 2194, 2058, 1964, 1883, 1686, 1528, 1561, 55,
+ /* 100 */ 1521, 1064, 933, 394, 751, 1779, 1695, 1640, 996, -227,
+ /* 110 */ 122, 1539, 605, -119, 773, 606, -173, 321, 1638, 1563,
+ /* 120 */ 893, 525, 2289, 2279, 2239, 1888, 1888, 2275, 2274, 2271,
+ /* 130 */ 2263, 1211, 2246, 876, 1888, 1619, 1261, 2239, 2234, 2232,
+ /* 140 */ 1888, 1888, 1888, 1888, 1888, 1888, 1888, 2214, 1888, 1888,
+ /* 150 */ 1888, 1888, 2211, 1888, 1888, 1888, 2210, 2204, 2124, 2122,
+ /* 160 */ 2110, 2103, 2082, 1587, 1082, 1059, 2001, 1973, 1943, 1171,
+ /* 170 */ 1111, 1914, 1899, 1888, 1861, 1761, 1012, 1713, 1684, 1679,
+ /* 180 */ 1672, 1530, 1098, 1075, 1084, 1152, 824, 931, 710, 1103,
+ /* 190 */ 646, 189, 851, -74, 1817, 1817, 1817, 1817, 1817, 1817,
+ /* 200 */ 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817,
+ /* 210 */ 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817,
+ /* 220 */ 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817,
+ /* 230 */ 1817, 1817, 1817, 1817, 2416, 2427, 2423, 1817, 2335, 2335,
+ /* 240 */ 2413, 2410, 2404, 2372, 2318, 2391, 2382, 2350, 2337, 2336,
+ /* 250 */ 2412, 2409, 2407, 2406, 2358, 2401, 2340, 2346, 2326, 2325,
+ /* 260 */ 2365, 2356, 2352, 2355, 2306, 2302, 2327, 2322, 2286, 2341,
+ /* 270 */ 2273, 2270, 1817, 2312, 2310, 2260, 2150, 2285, 2283, 2247,
+ /* 280 */ 2244, 2282, 2251, 2150, 2295, 2150, 2293, 2150, 2291, 2150,
+ /* 290 */ 2287, 2259, 2321, 2276, 2257, 2320, 2281, 2268, 2236, 2235,
+ /* 300 */ 2150, 2256, 2150, 2265, 2248, 2150, 2200, 2196, 2202, 2253,
+ /* 310 */ 2150, 2228, 2250, 2150, 2221, 2216, 2209, 2207, 2197, 2182,
+ /* 320 */ 2195, 2191, 2166, 2145, 2112, 2129, 2123, 2016, 2071, 2047,
+ /* 330 */ 1997, 1977, 2013, 2009, 2019, 2011, 1981, 1972, 2018, 1989,
+ /* 340 */ 1817, 1983, 1978, 1971, 1963, 1952, 1928, 1985, 1966, 1984,
+ /* 350 */ 1954, 1933, 1962, 1942, 1939, 1934, 1813, 1811, 1812, 1880,
+ /* 360 */ 1872, 1840, 1817, 1817, 1817, 1885,
};
static const YYACTIONTYPE yy_default[] = {
- /* 0 */ 759, 1074, 1179, 1062, 1179, 1062, 1062, 1062, 1179, 1062,
- /* 10 */ 1062, 1062, 1062, 1062, 1062, 931, 1185, 1185, 1185, 1062,
- /* 20 */ 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062,
- /* 30 */ 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062,
- /* 40 */ 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062,
- /* 50 */ 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062,
- /* 60 */ 1062, 1062, 1014, 1185, 924, 1185, 1185, 1185, 1185, 1185,
- /* 70 */ 1185, 1185, 1185, 804, 920, 931, 1185, 1185, 1185, 1185,
- /* 80 */ 1185, 988, 1002, 988, 980, 971, 1185, 1185, 1185, 996,
- /* 90 */ 996, 996, 996, 872, 996, 1185, 1185, 1185, 1185, 959,
- /* 100 */ 959, 1064, 1185, 796, 1149, 1154, 1012, 1185, 1185, 1185,
- /* 110 */ 1185, 1185, 989, 1185, 1185, 1185, 1185, 932, 920, 1012,
- /* 120 */ 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185,
- /* 130 */ 1003, 981, 972, 1185, 1185, 1185, 1185, 1185, 1185, 1185,
- /* 140 */ 1185, 1185, 1185, 1185, 920, 920, 920, 1185, 1185, 1185,
- /* 150 */ 1185, 1013, 1185, 1185, 793, 1185, 1185, 1185, 765, 1095,
- /* 160 */ 1185, 1185, 759, 1179, 1179, 1179, 1179, 1179, 1179, 1172,
- /* 170 */ 910, 966, 1068, 1069, 937, 976, 1075, 964, 968, 967,
- /* 180 */ 1067, 1064, 1064, 1064, 1064, 1064, 1064, 1064, 1064, 1064,
- /* 190 */ 1064, 1064, 1064, 1064, 1064, 1064, 1064, 1037, 1049, 1036,
- /* 200 */ 1044, 1045, 1048, 1039, 1053, 1038, 1040, 1185, 1185, 1185,
- /* 210 */ 1041, 1185, 1185, 1185, 1185, 1185, 923, 894, 1185, 1185,
- /* 220 */ 1185, 1123, 1185, 1185, 806, 1185, 908, 768, 975, 975,
- /* 230 */ 949, 949, 839, 863, 828, 959, 949, 939, 959, 1185,
- /* 240 */ 1185, 921, 908, 1070, 1042, 1163, 940, 940, 940, 1148,
- /* 250 */ 1148, 940, 940, 885, 940, 885, 940, 885, 940, 885,
- /* 260 */ 940, 790, 975, 940, 790, 876, 975, 1008, 992, 940,
- /* 270 */ 940, 876, 975, 940, 1130, 1128, 940, 790, 940, 1083,
- /* 280 */ 790, 940, 1083, 874, 874, 874, 874, 855, 1083, 874,
- /* 290 */ 839, 874, 855, 874, 874, 940, 1185, 940, 1083, 1089,
- /* 300 */ 1083, 965, 953, 963, 960, 975, 1185, 1185, 1064, 1043,
- /* 310 */ 787, 858, 790, 776, 776, 764, 764, 764, 764, 1176,
- /* 320 */ 1176, 1172, 841, 841, 926, 1052, 1051, 1050, 815, 1076,
- /* 330 */ 1185, 1185, 1185, 1185, 1185, 1185, 1097, 1185, 1185, 1185,
- /* 340 */ 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185,
- /* 350 */ 1185, 1185, 1185, 1185, 1185, 1185, 1185, 760, 1185, 1185,
- /* 360 */ 1185, 1185, 1185, 1166, 1185, 1185, 1185, 1185, 1185, 1185,
- /* 370 */ 1127, 1126, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185,
- /* 380 */ 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1115, 1185,
- /* 390 */ 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185,
- /* 400 */ 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1016,
- /* 410 */ 1063, 1185, 897, 902, 1185, 1185, 1185, 898, 1185, 1185,
- /* 420 */ 1185, 1185, 1185, 1185, 1073, 1185, 1185, 1185, 1185, 961,
- /* 430 */ 1185, 954, 1185, 1185, 1185, 1185, 1181, 1185, 1185, 1185,
- /* 440 */ 1180, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185,
- /* 450 */ 1185, 1015, 1065, 1029, 1185, 1028, 1027, 799, 1185, 774,
- /* 460 */ 1185, 756, 761, 1165, 1162, 1164, 1159, 1160, 1158, 1161,
- /* 470 */ 1157, 1155, 1156, 1153, 1151, 1150, 1152, 1147, 1143, 1103,
- /* 480 */ 1101, 1099, 1108, 1107, 1106, 1105, 1104, 1100, 1098, 1102,
- /* 490 */ 1096, 999, 978, 969, 892, 1142, 1140, 1141, 1094, 1092,
- /* 500 */ 1093, 891, 890, 889, 884, 883, 882, 881, 1169, 1178,
- /* 510 */ 1177, 1175, 1174, 1173, 1167, 1168, 1081, 1080, 1078, 1077,
- /* 520 */ 1079, 792, 1119, 1122, 1121, 1120, 1125, 1124, 1117, 1129,
- /* 530 */ 1134, 1133, 1138, 1137, 1136, 1135, 1132, 1114, 1007, 1006,
- /* 540 */ 1004, 1001, 1011, 1010, 1009, 1000, 993, 1005, 983, 991,
- /* 550 */ 990, 979, 982, 877, 974, 970, 973, 893, 1118, 888,
- /* 560 */ 887, 886, 791, 786, 942, 785, 784, 795, 861, 862,
- /* 570 */ 870, 873, 868, 871, 867, 866, 865, 869, 864, 860,
- /* 580 */ 798, 797, 805, 854, 832, 830, 829, 833, 846, 845,
- /* 590 */ 852, 851, 850, 849, 848, 844, 847, 843, 842, 834,
- /* 600 */ 827, 826, 840, 825, 857, 856, 853, 824, 880, 879,
- /* 610 */ 878, 875, 823, 822, 821, 820, 819, 818, 1035, 1034,
- /* 620 */ 1066, 1057, 1018, 1017, 1056, 1054, 1065, 1055, 1026, 895,
- /* 630 */ 905, 904, 903, 900, 901, 915, 913, 912, 911, 948,
- /* 640 */ 947, 946, 945, 944, 943, 936, 934, 929, 928, 941,
- /* 650 */ 935, 933, 930, 951, 952, 950, 927, 919, 917, 918,
- /* 660 */ 916, 998, 995, 997, 994, 938, 925, 922, 909, 956,
- /* 670 */ 955, 1063, 1184, 1182, 1183, 1086, 1088, 1091, 1090, 1087,
- /* 680 */ 958, 957, 1085, 1084, 1058, 1033, 811, 809, 810, 1111,
- /* 690 */ 1110, 1113, 1112, 1109, 813, 812, 808, 807, 1031, 899,
- /* 700 */ 896, 1025, 1024, 1139, 1060, 1061, 1023, 1019, 1059, 1047,
- /* 710 */ 1046, 1032, 1022, 800, 1020, 1030, 1021, 838, 837, 836,
- /* 720 */ 835, 907, 906, 817, 831, 816, 814, 794, 789, 788,
- /* 730 */ 783, 781, 778, 780, 777, 782, 779, 775, 773, 772,
- /* 740 */ 771, 770, 769, 803, 802, 801, 799, 767, 766, 763,
- /* 750 */ 762, 758, 757, 755,
+ /* 0 */ 849, 1158, 1158, 1277, 1158, 1158, 1158, 1158, 1158, 1158,
+ /* 10 */ 1277, 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1158,
+ /* 20 */ 1158, 1277, 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1158,
+ /* 30 */ 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1158,
+ /* 40 */ 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1158,
+ /* 50 */ 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1158,
+ /* 60 */ 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1158, 1029,
+ /* 70 */ 1316, 1316, 1316, 1293, 1293, 1316, 1022, 1316, 1316, 1316,
+ /* 80 */ 1316, 1316, 1316, 1316, 1316, 1316, 1316, 1316, 896, 1018,
+ /* 90 */ 886, 1029, 1316, 1316, 1316, 1316, 1316, 1089, 1103, 1089,
+ /* 100 */ 1081, 1072, 1316, 1316, 1194, 1097, 1097, 1097, 1097, 969,
+ /* 110 */ 1097, 1316, 1316, 1316, 1316, 1129, 1128, 1316, 1057, 1057,
+ /* 120 */ 1160, 1316, 1247, 1252, 1316, 1316, 1316, 1316, 1316, 1316,
+ /* 130 */ 1090, 1316, 1316, 1316, 1030, 1018, 1293, 1316, 1316, 1316,
+ /* 140 */ 1316, 1316, 1316, 1316, 1316, 1316, 1316, 1316, 1316, 1104,
+ /* 150 */ 1082, 1073, 1316, 1316, 1316, 1316, 1316, 1316, 1316, 1316,
+ /* 160 */ 1316, 1316, 1316, 1018, 1018, 1018, 1316, 1316, 1316, 1293,
+ /* 170 */ 1293, 1316, 1316, 1316, 1316, 1316, 883, 1316, 1316, 1316,
+ /* 180 */ 855, 1316, 1293, 1293, 849, 1277, 1051, 1277, 1277, 891,
+ /* 190 */ 1277, 1277, 1270, 1008, 1067, 1160, 1160, 1160, 1160, 1035,
+ /* 200 */ 1077, 1065, 1069, 1171, 1068, 1160, 1160, 1160, 1160, 1160,
+ /* 210 */ 1160, 1160, 1160, 1160, 1160, 1160, 1160, 1160, 1160, 1160,
+ /* 220 */ 1160, 1160, 1160, 1160, 1131, 1143, 1130, 1138, 1147, 1139,
+ /* 230 */ 1142, 1133, 1132, 1134, 1316, 1316, 1316, 1135, 1316, 1316,
+ /* 240 */ 1316, 1316, 1316, 1021, 1316, 1316, 991, 1316, 1316, 1221,
+ /* 250 */ 1316, 1316, 898, 1316, 1006, 858, 1076, 1019, 1047, 1047,
+ /* 260 */ 936, 960, 920, 1057, 1047, 1037, 1051, 1051, 1166, 1057,
+ /* 270 */ 1316, 1316, 1136, 1019, 1006, 1261, 1038, 1038, 1038, 1246,
+ /* 280 */ 1246, 1038, 1194, 1038, 982, 1038, 982, 1038, 982, 1038,
+ /* 290 */ 982, 1038, 880, 1076, 1038, 880, 973, 1076, 1109, 1093,
+ /* 300 */ 1038, 1076, 1038, 973, 1076, 1038, 1228, 1226, 1038, 880,
+ /* 310 */ 1038, 1179, 880, 1038, 1179, 971, 971, 971, 971, 952,
+ /* 320 */ 1179, 971, 936, 971, 952, 971, 971, 1312, 1316, 1038,
+ /* 330 */ 1303, 1303, 1060, 1060, 1066, 1051, 1316, 1185, 1179, 1160,
+ /* 340 */ 1137, 1066, 1064, 1061, 1076, 1316, 1038, 877, 955, 880,
+ /* 350 */ 866, 866, 854, 854, 854, 854, 1274, 1274, 1270, 938,
+ /* 360 */ 938, 1024, 1146, 1145, 1144, 907, 1159, 1316, 1316, 1316,
+ /* 370 */ 1316, 1316, 1316, 1195, 1316, 1316, 1316, 1316, 1316, 1316,
+ /* 380 */ 1316, 1316, 1316, 1316, 1316, 1316, 1316, 1316, 1316, 1316,
+ /* 390 */ 1316, 1316, 1316, 1316, 1316, 850, 1316, 1316, 1316, 1316,
+ /* 400 */ 1316, 1264, 1316, 1316, 1316, 1316, 1316, 1316, 1225, 1224,
+ /* 410 */ 1316, 1316, 1316, 1316, 1316, 1316, 1316, 1316, 1316, 1316,
+ /* 420 */ 1316, 1316, 1316, 1316, 1316, 1316, 1213, 1316, 1316, 1316,
+ /* 430 */ 1316, 1316, 1316, 1316, 1316, 1316, 1316, 1316, 1316, 1316,
+ /* 440 */ 1316, 1316, 1316, 1316, 1316, 1316, 1316, 1316, 1316, 1316,
+ /* 450 */ 1316, 1316, 1316, 1316, 994, 1000, 1316, 1316, 1316, 995,
+ /* 460 */ 1316, 1316, 1122, 1316, 1316, 1316, 1169, 1316, 1316, 1316,
+ /* 470 */ 1316, 1062, 1316, 1316, 1316, 1316, 1316, 1316, 1316, 1316,
+ /* 480 */ 1316, 1316, 1316, 1316, 1316, 1316, 1309, 1052, 1316, 1316,
+ /* 490 */ 1159, 1316, 1279, 1316, 1316, 1316, 1278, 1316, 1316, 1316,
+ /* 500 */ 1316, 1316, 1316, 1316, 1316, 1316, 1316, 1123, 1122, 1161,
+ /* 510 */ 889, 1316, 864, 1316, 846, 851, 1263, 1260, 1262, 1257,
+ /* 520 */ 1258, 1256, 1259, 1255, 1253, 1254, 1251, 1249, 1248, 1250,
+ /* 530 */ 1245, 1241, 1201, 1199, 1197, 1206, 1205, 1204, 1203, 1202,
+ /* 540 */ 1198, 1196, 1200, 1192, 1191, 1100, 1079, 1070, 989, 1240,
+ /* 550 */ 1238, 1239, 1190, 1188, 1189, 988, 987, 986, 981, 980,
+ /* 560 */ 979, 978, 1267, 1276, 1275, 1273, 1272, 1271, 1265, 1266,
+ /* 570 */ 1177, 1176, 1174, 1173, 1175, 882, 1217, 1220, 1219, 1218,
+ /* 580 */ 1223, 1222, 1215, 1227, 1232, 1231, 1236, 1235, 1234, 1233,
+ /* 590 */ 1230, 1212, 1108, 1107, 1105, 1102, 1112, 1111, 1110, 1101,
+ /* 600 */ 1094, 1106, 1084, 1092, 1091, 1080, 1083, 974, 1075, 1071,
+ /* 610 */ 1074, 990, 1216, 985, 984, 983, 881, 876, 1040, 875,
+ /* 620 */ 874, 885, 958, 959, 967, 970, 965, 968, 964, 963,
+ /* 630 */ 962, 966, 961, 957, 888, 887, 897, 951, 934, 923,
+ /* 640 */ 890, 925, 922, 921, 926, 943, 942, 949, 948, 947,
+ /* 650 */ 946, 945, 941, 944, 940, 939, 927, 919, 918, 937,
+ /* 660 */ 917, 954, 953, 950, 916, 977, 976, 975, 972, 915,
+ /* 670 */ 914, 913, 912, 911, 910, 1157, 1315, 1311, 1314, 1313,
+ /* 680 */ 1310, 1156, 1162, 1150, 1148, 992, 1003, 1002, 1001, 998,
+ /* 690 */ 999, 1013, 1011, 1010, 1009, 1046, 1045, 1044, 1043, 1042,
+ /* 700 */ 1041, 1034, 1032, 1027, 1026, 1033, 1031, 1028, 1049, 1050,
+ /* 710 */ 1048, 1025, 1017, 1015, 1016, 1014, 1099, 1096, 1098, 1095,
+ /* 720 */ 1036, 1023, 1020, 1007, 1291, 1289, 1292, 1290, 1288, 1296,
+ /* 730 */ 1298, 1297, 1302, 1300, 1299, 1295, 1308, 1307, 1306, 1305,
+ /* 740 */ 1304, 1294, 1301, 1287, 1286, 1285, 1284, 1054, 1059, 1058,
+ /* 750 */ 1053, 997, 1161, 1149, 1159, 1153, 1282, 1280, 1283, 1182,
+ /* 760 */ 1184, 1187, 1186, 1183, 1056, 1055, 1181, 1180, 1281, 1152,
+ /* 770 */ 1127, 903, 901, 902, 1209, 1208, 1211, 1210, 1207, 905,
+ /* 780 */ 904, 900, 899, 1125, 1121, 1120, 1237, 1154, 1155, 1119,
+ /* 790 */ 1124, 1117, 1116, 1115, 1141, 1140, 1126, 1118, 892, 996,
+ /* 800 */ 993, 1151, 1114, 1039, 1113, 933, 932, 931, 930, 929,
+ /* 810 */ 928, 1005, 1004, 909, 924, 908, 906, 884, 879, 878,
+ /* 820 */ 873, 871, 868, 870, 867, 872, 869, 865, 863, 862,
+ /* 830 */ 861, 860, 859, 895, 894, 893, 889, 857, 856, 853,
+ /* 840 */ 852, 848, 847, 845,
};
/* The next table maps tokens into fallback tokens. If a construct
@@ -919,6 +1086,7 @@ static const YYCODETYPE yyFallback[] = {
4, /* ABORT => ID */
4, /* ACTION => ID */
4, /* AFTER => ID */
+ 4, /* ALWAYS => ID */
4, /* ANALYZE => ID */
4, /* ASC => ID */
4, /* ATTACH => ID */
@@ -929,40 +1097,56 @@ static const YYCODETYPE yyFallback[] = {
4, /* CAST => ID */
4, /* COLUMNKW => ID */
4, /* CONFLICT => ID */
+ 4, /* CURRENT => ID */
4, /* DATABASE => ID */
4, /* DEFERRED => ID */
4, /* DESC => ID */
4, /* DETACH => ID */
+ 4, /* DO => ID */
4, /* EACH => ID */
4, /* END => ID */
+ 4, /* EXCLUDE => ID */
4, /* EXCLUSIVE => ID */
4, /* EXPLAIN => ID */
4, /* FAIL => ID */
+ 4, /* FIRST => ID */
+ 4, /* FOLLOWING => ID */
4, /* FOR => ID */
+ 4, /* GENERATED => ID */
+ 4, /* GROUPS => ID */
4, /* IGNORE => ID */
4, /* IMMEDIATE => ID */
4, /* INDEXED => ID */
4, /* INITIALLY => ID */
4, /* INSTEAD => ID */
+ 4, /* LAST => ID */
4, /* LIKE_KW => ID */
4, /* MATCH => ID */
4, /* NO => ID */
+ 4, /* NULLS => ID */
+ 4, /* OTHERS => ID */
4, /* PLAN => ID */
4, /* QUERY => ID */
4, /* KEY => ID */
4, /* OF => ID */
4, /* OFFSET => ID */
+ 4, /* PARTITION => ID */
4, /* PRAGMA => ID */
+ 4, /* PRECEDING => ID */
4, /* RAISE => ID */
+ 4, /* RANGE => ID */
4, /* RECURSIVE => ID */
4, /* RELEASE => ID */
4, /* REPLACE => ID */
4, /* RESTRICT => ID */
4, /* ROW => ID */
+ 4, /* ROWS => ID */
4, /* ROLLBACK => ID */
4, /* SAVEPOINT => ID */
4, /* TEMP => ID */
+ 4, /* TIES => ID */
4, /* TRIGGER => ID */
+ 4, /* UNBOUNDED => ID */
4, /* VACUUM => ID */
4, /* VIEW => ID */
4, /* VIRTUAL => ID */
@@ -1123,74 +1307,84 @@ void sqlite3_parseTrace(FILE *TraceFILE, char *zTracePrompt){
static const char *const yyTokenName[] = {
"$", "ILLEGAL", "COMMENT", "SPACE",
"ID", "ABORT", "ACTION", "AFTER",
- "ANALYZE", "ASC", "ATTACH", "BEFORE",
- "BEGIN", "BY", "CASCADE", "CAST",
- "COLUMNKW", "CONFLICT", "DATABASE", "DEFERRED",
- "DESC", "DETACH", "EACH", "END",
- "EXCLUSIVE", "EXPLAIN", "FAIL", "FOR",
+ "ALWAYS", "ANALYZE", "ASC", "ATTACH",
+ "BEFORE", "BEGIN", "BY", "CASCADE",
+ "CAST", "COLUMNKW", "CONFLICT", "CURRENT",
+ "DATABASE", "DEFERRED", "DESC", "DETACH",
+ "DO", "EACH", "END", "EXCLUDE",
+ "EXCLUSIVE", "EXPLAIN", "FAIL", "FIRST",
+ "FOLLOWING", "FOR", "GENERATED", "GROUPS",
"IGNORE", "IMMEDIATE", "INDEXED", "INITIALLY",
- "INSTEAD", "LIKE_KW", "MATCH", "NO",
- "PLAN", "QUERY", "KEY", "OF",
- "OFFSET", "PRAGMA", "RAISE", "RECURSIVE",
- "RELEASE", "REPLACE", "RESTRICT", "ROW",
- "ROLLBACK", "SAVEPOINT", "TEMP", "TRIGGER",
- "VACUUM", "VIEW", "VIRTUAL", "WITH",
- "WITHOUT", "REINDEX", "RENAME", "CTIME_KW",
- "IF", "ANY", "OR", "AND",
- "NOT", "IS", "BETWEEN", "IN",
- "ISNULL", "NOTNULL", "NE", "EQ",
- "GT", "LE", "LT", "GE",
- "ESCAPE", "BITAND", "BITOR", "LSHIFT",
- "RSHIFT", "PLUS", "MINUS", "STAR",
- "SLASH", "REM", "CONCAT", "COLLATE",
- "BITNOT", "SEMI", "TRANSACTION", "ID_TRANS",
- "COMMIT", "TO", "CREATE", "TABLE",
- "LP", "RP", "AS", "DOT",
- "ID_TAB_NEW", "ID_DB", "CTX_ROWID_KW", "EXISTS",
- "COMMA", "ID_COL_NEW", "STRING", "JOIN_KW",
- "ID_COL_TYPE", "CONSTRAINT", "DEFAULT", "NULL",
- "PRIMARY", "UNIQUE", "CHECK", "REFERENCES",
- "ID_CONSTR", "ID_COLLATE", "ID_TAB", "INTEGER",
- "FLOAT", "BLOB", "AUTOINCR", "ON",
- "INSERT", "DELETE", "UPDATE", "ID_FK_MATCH",
- "SET", "DEFERRABLE", "FOREIGN", "DROP",
- "ID_VIEW_NEW", "ID_VIEW", "SELECT", "VALUES",
- "UNION", "ALL", "EXCEPT", "INTERSECT",
- "DISTINCT", "ID_ALIAS", "FROM", "USING",
- "JOIN", "ID_JOIN_OPTS", "ID_IDX", "ORDER",
- "GROUP", "HAVING", "LIMIT", "WHERE",
- "ID_COL", "INTO", "DO", "NOTHING",
- "CASE", "ID_FN", "ID_ERR_MSG", "VARIABLE",
- "WHEN", "THEN", "ELSE", "INDEX",
- "ID_IDX_NEW", "ID_PRAGMA", "ID_TRIG_NEW", "ID_TRIG",
- "ALTER", "ADD", "error", "cmd",
+ "INSTEAD", "LAST", "LIKE_KW", "MATCH",
+ "NO", "NULLS", "OTHERS", "PLAN",
+ "QUERY", "KEY", "OF", "OFFSET",
+ "PARTITION", "PRAGMA", "PRECEDING", "RAISE",
+ "RANGE", "RECURSIVE", "RELEASE", "REPLACE",
+ "RESTRICT", "ROW", "ROWS", "ROLLBACK",
+ "SAVEPOINT", "TEMP", "TIES", "TRIGGER",
+ "UNBOUNDED", "VACUUM", "VIEW", "VIRTUAL",
+ "WITH", "WITHOUT", "REINDEX", "RENAME",
+ "CTIME_KW", "IF", "ANY", "OR",
+ "AND", "NOT", "IS", "BETWEEN",
+ "IN", "ISNULL", "NOTNULL", "NE",
+ "EQ", "GT", "LE", "LT",
+ "GE", "ESCAPE", "BITAND", "BITOR",
+ "LSHIFT", "RSHIFT", "PLUS", "MINUS",
+ "STAR", "SLASH", "REM", "CONCAT",
+ "COLLATE", "BITNOT", "SEMI", "TRANSACTION",
+ "ID_TRANS", "COMMIT", "TO", "CREATE",
+ "TABLE", "LP", "RP", "AS",
+ "DOT", "ID_TAB_NEW", "ID_DB", "CTX_ROWID_KW",
+ "EXISTS", "COMMA", "ID_COL_NEW", "STRING",
+ "JOIN_KW", "ID_COL_TYPE", "RIGHT_ASSOC", "CONSTRAINT",
+ "DEFAULT", "NULL", "PRIMARY", "UNIQUE",
+ "CHECK", "REFERENCES", "ID_CONSTR", "ID_COLLATE",
+ "ID_TAB", "INTEGER", "FLOAT", "BLOB",
+ "AUTOINCR", "ON", "INSERT", "DELETE",
+ "UPDATE", "ID_FK_MATCH", "SET", "DEFERRABLE",
+ "FOREIGN", "DROP", "ID_VIEW_NEW", "ID_VIEW",
+ "SELECT", "VALUES", "UNION", "ALL",
+ "EXCEPT", "INTERSECT", "DISTINCT", "ID_ALIAS",
+ "FROM", "USING", "JOIN", "ID_JOIN_OPTS",
+ "ID_IDX", "ORDER", "GROUP", "HAVING",
+ "LIMIT", "WHERE", "ID_COL", "INTO",
+ "NOTHING", "ID_FN", "ID_ERR_MSG", "VARIABLE",
+ "CASE", "WHEN", "THEN", "ELSE",
+ "INDEX", "ID_IDX_NEW", "ID_PRAGMA", "ID_TRIG_NEW",
+ "ID_TRIG", "ALTER", "ADD", "WINDOW",
+ "OVER", "FILTER", "error", "cmd",
"input", "cmdlist", "ecmd", "explain",
"cmdx", "transtype", "trans_opt", "nm",
"savepoint_opt", "temp", "ifnotexists", "fullname",
"columnlist", "conslist_opt", "table_options", "select",
"column", "columnid", "type", "carglist",
- "id", "ids", "typetoken", "typename",
- "signed", "plus_num", "minus_num", "ccons",
- "term", "expr", "onconf", "sortorder",
- "autoinc", "idxlist_opt", "refargs", "defer_subclause",
- "refarg", "refact", "init_deferred_pred_opt", "conslist",
- "tconscomma", "tcons", "idxlist", "defer_subclause_opt",
- "resolvetype", "orconf", "raisetype", "ifexists",
- "select_stmt", "with", "selectnowith", "oneselect",
- "multiselect_op", "values", "distinct", "selcollist",
- "from", "where_opt", "groupby_opt", "having_opt",
- "orderby_opt", "limit_opt", "nexprlist", "exprlist",
+ "id", "id_opt", "ids", "typetoken",
+ "typename", "signed", "plus_num", "minus_num",
+ "ccons", "term", "expr", "onconf",
+ "sortorder", "autoinc", "idxlist_opt", "refargs",
+ "defer_subclause", "gen_always", "tnm", "refarg",
+ "refact", "init_deferred_pred_opt", "conslist", "tconscomma",
+ "tcons", "idxlist", "defer_subclause_opt", "resolvetype",
+ "orconf", "raisetype", "ifexists", "select_stmt",
+ "with", "selectnowith", "oneselect", "multiselect_op",
+ "values", "distinct", "selcollist", "from",
+ "where_opt", "groupby_opt", "having_opt", "orderby_opt",
+ "limit_opt", "window_clause", "nexprlist", "exprlist",
"sclp", "as", "joinsrc", "singlesrc",
"seltablist", "joinop", "joinconstr_opt", "dbnm",
- "indexed_opt", "idlist", "sortlist", "delete_stmt",
- "update_stmt", "setlist", "idlist_opt", "insert_stmt",
- "insert_cmd", "upsert", "exprx", "not_opt",
- "case_operand", "case_exprlist", "case_else", "likeop",
- "uniqueflag", "idxlist_single", "collate", "nmnum",
- "number", "trigger_time", "trigger_event", "foreach_clause",
- "when_clause", "trigger_cmd_list", "trigger_cmd", "database_kw_opt",
- "key_opt", "kwcolumn_opt", "create_vtab", "vtabarglist",
- "vtabarg", "vtabargtoken", "anylist", "wqlist",
+ "indexed_opt", "idlist", "sortlist", "nulls",
+ "delete_stmt", "update_stmt", "setlist", "idlist_opt",
+ "insert_stmt", "insert_cmd", "upsert", "exprx",
+ "not_opt", "likeop", "case_operand", "case_exprlist",
+ "case_else", "filter_over", "uniqueflag", "idxlist_single",
+ "collate", "vinto", "nmnum", "number",
+ "trigger_time", "trigger_event", "foreach_clause", "when_clause",
+ "trigger_cmd_list", "trigger_cmd", "database_kw_opt", "key_opt",
+ "kwcolumn_opt", "create_vtab", "vtabarglist", "vtabarg",
+ "vtabargtoken", "anylist", "wqlist", "wqcte",
+ "windowdefn_list", "windowdefn", "window", "frame_opt",
+ "range_or_rows", "frame_bound_s", "frame_exclude_opt", "frame_bound_e",
+ "frame_bound", "frame_exclude", "filter_clause", "over_clause",
};
#endif /* NDEBUG */
@@ -1244,391 +1438,432 @@ static const char *const yyRuleName[] = {
/* 43 */ "columnid ::= nm",
/* 44 */ "columnid ::= ID_COL_NEW",
/* 45 */ "id ::= ID",
- /* 46 */ "ids ::= ID|STRING",
- /* 47 */ "nm ::= id",
- /* 48 */ "nm ::= STRING",
- /* 49 */ "nm ::= JOIN_KW",
- /* 50 */ "type ::=",
- /* 51 */ "type ::= typetoken",
- /* 52 */ "typetoken ::= typename",
- /* 53 */ "typetoken ::= typename LP signed RP",
- /* 54 */ "typetoken ::= typename LP signed COMMA signed RP",
- /* 55 */ "typename ::= ids",
- /* 56 */ "typename ::= typename ids",
- /* 57 */ "typename ::= ID_COL_TYPE",
- /* 58 */ "signed ::= plus_num",
- /* 59 */ "signed ::= minus_num",
- /* 60 */ "carglist ::= carglist ccons",
- /* 61 */ "carglist ::=",
- /* 62 */ "ccons ::= CONSTRAINT nm",
- /* 63 */ "ccons ::= DEFAULT term",
- /* 64 */ "ccons ::= DEFAULT LP expr RP",
- /* 65 */ "ccons ::= DEFAULT PLUS term",
- /* 66 */ "ccons ::= DEFAULT MINUS term",
- /* 67 */ "ccons ::= DEFAULT id",
- /* 68 */ "ccons ::= DEFAULT CTIME_KW",
- /* 69 */ "ccons ::= NULL onconf",
- /* 70 */ "ccons ::= NOT NULL onconf",
- /* 71 */ "ccons ::= PRIMARY KEY sortorder onconf autoinc",
- /* 72 */ "ccons ::= UNIQUE onconf",
- /* 73 */ "ccons ::= CHECK LP expr RP",
- /* 74 */ "ccons ::= REFERENCES nm idxlist_opt refargs",
- /* 75 */ "ccons ::= defer_subclause",
- /* 76 */ "ccons ::= COLLATE ids",
- /* 77 */ "ccons ::= CONSTRAINT ID_CONSTR",
- /* 78 */ "ccons ::= COLLATE ID_COLLATE",
- /* 79 */ "ccons ::= REFERENCES ID_TAB",
- /* 80 */ "ccons ::= CHECK LP RP",
- /* 81 */ "term ::= NULL",
- /* 82 */ "term ::= INTEGER",
- /* 83 */ "term ::= FLOAT",
- /* 84 */ "term ::= STRING|BLOB",
- /* 85 */ "autoinc ::=",
- /* 86 */ "autoinc ::= AUTOINCR",
- /* 87 */ "refargs ::=",
- /* 88 */ "refargs ::= refargs refarg",
- /* 89 */ "refarg ::= MATCH nm",
- /* 90 */ "refarg ::= ON INSERT refact",
- /* 91 */ "refarg ::= ON DELETE refact",
- /* 92 */ "refarg ::= ON UPDATE refact",
- /* 93 */ "refarg ::= MATCH ID_FK_MATCH",
- /* 94 */ "refact ::= SET NULL",
- /* 95 */ "refact ::= SET DEFAULT",
- /* 96 */ "refact ::= CASCADE",
- /* 97 */ "refact ::= RESTRICT",
- /* 98 */ "refact ::= NO ACTION",
- /* 99 */ "defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt",
- /* 100 */ "defer_subclause ::= DEFERRABLE init_deferred_pred_opt",
- /* 101 */ "init_deferred_pred_opt ::=",
- /* 102 */ "init_deferred_pred_opt ::= INITIALLY DEFERRED",
- /* 103 */ "init_deferred_pred_opt ::= INITIALLY IMMEDIATE",
- /* 104 */ "conslist_opt ::=",
- /* 105 */ "conslist_opt ::= COMMA conslist",
- /* 106 */ "conslist ::= conslist tconscomma tcons",
- /* 107 */ "conslist ::= tcons",
- /* 108 */ "tconscomma ::= COMMA",
- /* 109 */ "tconscomma ::=",
- /* 110 */ "tcons ::= CONSTRAINT nm",
- /* 111 */ "tcons ::= PRIMARY KEY LP idxlist autoinc RP onconf",
- /* 112 */ "tcons ::= UNIQUE LP idxlist RP onconf",
- /* 113 */ "tcons ::= CHECK LP expr RP onconf",
- /* 114 */ "tcons ::= FOREIGN KEY LP idxlist RP REFERENCES nm idxlist_opt refargs defer_subclause_opt",
- /* 115 */ "tcons ::= CONSTRAINT ID_CONSTR",
- /* 116 */ "tcons ::= FOREIGN KEY LP idxlist RP REFERENCES ID_TAB",
- /* 117 */ "tcons ::= CHECK LP RP onconf",
- /* 118 */ "defer_subclause_opt ::=",
- /* 119 */ "defer_subclause_opt ::= defer_subclause",
- /* 120 */ "onconf ::=",
- /* 121 */ "onconf ::= ON CONFLICT resolvetype",
- /* 122 */ "orconf ::=",
- /* 123 */ "orconf ::= OR resolvetype",
- /* 124 */ "resolvetype ::= raisetype",
- /* 125 */ "resolvetype ::= IGNORE",
- /* 126 */ "resolvetype ::= REPLACE",
- /* 127 */ "cmd ::= DROP TABLE ifexists fullname",
- /* 128 */ "cmd ::= DROP TABLE ifexists nm DOT ID_TAB",
- /* 129 */ "cmd ::= DROP TABLE ifexists ID_DB|ID_TAB",
- /* 130 */ "ifexists ::= IF EXISTS",
- /* 131 */ "ifexists ::=",
- /* 132 */ "cmd ::= CREATE temp VIEW ifnotexists fullname idxlist_opt AS select",
- /* 133 */ "cmd ::= CREATE temp VIEW ifnotexists nm DOT ID_VIEW_NEW",
- /* 134 */ "cmd ::= CREATE temp VIEW ifnotexists ID_DB|ID_VIEW_NEW",
- /* 135 */ "cmd ::= DROP VIEW ifexists fullname",
- /* 136 */ "cmd ::= DROP VIEW ifexists nm DOT ID_VIEW",
- /* 137 */ "cmd ::= DROP VIEW ifexists ID_DB|ID_VIEW",
- /* 138 */ "cmd ::= select_stmt",
- /* 139 */ "select_stmt ::= select",
- /* 140 */ "select ::= with selectnowith",
- /* 141 */ "selectnowith ::= oneselect",
- /* 142 */ "selectnowith ::= selectnowith multiselect_op oneselect",
- /* 143 */ "selectnowith ::= values",
- /* 144 */ "selectnowith ::= selectnowith COMMA values",
- /* 145 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt",
- /* 146 */ "values ::= VALUES LP nexprlist RP",
- /* 147 */ "values ::= values COMMA LP exprlist RP",
- /* 148 */ "multiselect_op ::= UNION",
- /* 149 */ "multiselect_op ::= UNION ALL",
- /* 150 */ "multiselect_op ::= EXCEPT",
- /* 151 */ "multiselect_op ::= INTERSECT",
- /* 152 */ "distinct ::= DISTINCT",
- /* 153 */ "distinct ::= ALL",
- /* 154 */ "distinct ::=",
- /* 155 */ "sclp ::= selcollist COMMA",
- /* 156 */ "sclp ::=",
- /* 157 */ "selcollist ::= sclp expr as",
- /* 158 */ "selcollist ::= sclp STAR",
- /* 159 */ "selcollist ::= sclp nm DOT STAR",
- /* 160 */ "selcollist ::= sclp",
- /* 161 */ "selcollist ::= sclp ID_TAB DOT STAR",
- /* 162 */ "as ::= AS nm",
- /* 163 */ "as ::= ids",
- /* 164 */ "as ::= AS ID_ALIAS",
- /* 165 */ "as ::= ID_ALIAS",
- /* 166 */ "as ::=",
- /* 167 */ "from ::=",
- /* 168 */ "from ::= FROM joinsrc",
- /* 169 */ "joinsrc ::= singlesrc seltablist",
- /* 170 */ "joinsrc ::=",
- /* 171 */ "seltablist ::= seltablist joinop singlesrc joinconstr_opt",
- /* 172 */ "seltablist ::=",
- /* 173 */ "singlesrc ::= nm dbnm as indexed_opt",
- /* 174 */ "singlesrc ::= LP select RP as",
- /* 175 */ "singlesrc ::= LP joinsrc RP as",
- /* 176 */ "singlesrc ::= nm dbnm LP exprlist RP as",
- /* 177 */ "singlesrc ::=",
- /* 178 */ "singlesrc ::= nm DOT",
- /* 179 */ "singlesrc ::= nm DOT ID_TAB",
- /* 180 */ "singlesrc ::= ID_DB|ID_TAB",
- /* 181 */ "singlesrc ::= nm DOT ID_VIEW",
- /* 182 */ "singlesrc ::= ID_DB|ID_VIEW",
- /* 183 */ "joinconstr_opt ::= ON expr",
- /* 184 */ "joinconstr_opt ::= USING LP idlist RP",
- /* 185 */ "joinconstr_opt ::=",
- /* 186 */ "dbnm ::=",
- /* 187 */ "dbnm ::= DOT nm",
- /* 188 */ "fullname ::= nm dbnm",
- /* 189 */ "joinop ::= COMMA",
- /* 190 */ "joinop ::= JOIN",
- /* 191 */ "joinop ::= JOIN_KW JOIN",
- /* 192 */ "joinop ::= JOIN_KW nm JOIN",
- /* 193 */ "joinop ::= JOIN_KW nm nm JOIN",
- /* 194 */ "joinop ::= ID_JOIN_OPTS",
- /* 195 */ "indexed_opt ::=",
- /* 196 */ "indexed_opt ::= INDEXED BY nm",
- /* 197 */ "indexed_opt ::= NOT INDEXED",
- /* 198 */ "indexed_opt ::= INDEXED BY ID_IDX",
- /* 199 */ "orderby_opt ::=",
- /* 200 */ "orderby_opt ::= ORDER BY sortlist",
- /* 201 */ "sortlist ::= sortlist COMMA expr sortorder",
- /* 202 */ "sortlist ::= expr sortorder",
- /* 203 */ "sortorder ::= ASC",
- /* 204 */ "sortorder ::= DESC",
- /* 205 */ "sortorder ::=",
- /* 206 */ "groupby_opt ::=",
- /* 207 */ "groupby_opt ::= GROUP BY nexprlist",
- /* 208 */ "groupby_opt ::= GROUP BY",
- /* 209 */ "having_opt ::=",
- /* 210 */ "having_opt ::= HAVING expr",
- /* 211 */ "limit_opt ::=",
- /* 212 */ "limit_opt ::= LIMIT expr",
- /* 213 */ "limit_opt ::= LIMIT expr OFFSET expr",
- /* 214 */ "limit_opt ::= LIMIT expr COMMA expr",
- /* 215 */ "cmd ::= delete_stmt",
- /* 216 */ "delete_stmt ::= with DELETE FROM fullname indexed_opt where_opt",
- /* 217 */ "delete_stmt ::= with DELETE FROM",
- /* 218 */ "delete_stmt ::= with DELETE FROM nm DOT",
- /* 219 */ "delete_stmt ::= with DELETE FROM nm DOT ID_TAB",
- /* 220 */ "delete_stmt ::= with DELETE FROM ID_DB|ID_TAB",
- /* 221 */ "where_opt ::=",
- /* 222 */ "where_opt ::= WHERE expr",
- /* 223 */ "where_opt ::= WHERE",
- /* 224 */ "cmd ::= update_stmt",
- /* 225 */ "update_stmt ::= with UPDATE orconf fullname indexed_opt SET setlist where_opt",
- /* 226 */ "update_stmt ::= with UPDATE orconf",
- /* 227 */ "update_stmt ::= with UPDATE orconf nm DOT",
- /* 228 */ "update_stmt ::= with UPDATE orconf nm DOT ID_TAB",
- /* 229 */ "update_stmt ::= with UPDATE orconf ID_DB|ID_TAB",
- /* 230 */ "setlist ::= setlist COMMA nm EQ expr",
- /* 231 */ "setlist ::= setlist COMMA LP idlist RP EQ expr",
- /* 232 */ "setlist ::= nm EQ expr",
- /* 233 */ "setlist ::= LP idlist RP EQ expr",
- /* 234 */ "setlist ::=",
- /* 235 */ "setlist ::= setlist COMMA",
- /* 236 */ "setlist ::= setlist COMMA ID_COL",
- /* 237 */ "setlist ::= ID_COL",
- /* 238 */ "idlist_opt ::=",
- /* 239 */ "idlist_opt ::= LP idlist RP",
- /* 240 */ "idlist ::= idlist COMMA nm",
- /* 241 */ "idlist ::= nm",
- /* 242 */ "idlist ::=",
- /* 243 */ "idlist ::= idlist COMMA ID_COL",
- /* 244 */ "idlist ::= ID_COL",
- /* 245 */ "cmd ::= insert_stmt",
- /* 246 */ "insert_stmt ::= with insert_cmd INTO fullname idlist_opt select upsert",
- /* 247 */ "insert_stmt ::= with insert_cmd INTO fullname idlist_opt DEFAULT VALUES",
- /* 248 */ "insert_stmt ::= with insert_cmd INTO",
- /* 249 */ "insert_stmt ::= with insert_cmd INTO nm DOT",
- /* 250 */ "insert_stmt ::= with insert_cmd INTO ID_DB|ID_TAB",
- /* 251 */ "insert_stmt ::= with insert_cmd INTO nm DOT ID_TAB",
- /* 252 */ "insert_cmd ::= INSERT orconf",
- /* 253 */ "insert_cmd ::= REPLACE",
- /* 254 */ "upsert ::=",
- /* 255 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt",
- /* 256 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING",
- /* 257 */ "upsert ::= ON CONFLICT DO NOTHING",
- /* 258 */ "exprx ::= nm DOT",
- /* 259 */ "exprx ::= nm DOT nm DOT",
- /* 260 */ "exprx ::= expr not_opt BETWEEN expr AND",
- /* 261 */ "exprx ::= CASE case_operand case_exprlist case_else",
- /* 262 */ "exprx ::= expr not_opt IN LP exprlist",
- /* 263 */ "exprx ::= expr not_opt IN ID_DB",
- /* 264 */ "exprx ::= expr not_opt IN nm DOT ID_TAB",
- /* 265 */ "exprx ::= ID_DB|ID_TAB|ID_COL|ID_FN",
- /* 266 */ "exprx ::= nm DOT ID_TAB|ID_COL",
- /* 267 */ "exprx ::= nm DOT nm DOT ID_COL",
- /* 268 */ "exprx ::= expr COLLATE ID_COLLATE",
- /* 269 */ "exprx ::= RAISE LP raisetype COMMA ID_ERR_MSG RP",
- /* 270 */ "exprx ::= term",
- /* 271 */ "exprx ::= CTIME_KW",
- /* 272 */ "exprx ::= LP nexprlist RP",
- /* 273 */ "exprx ::= id",
- /* 274 */ "exprx ::= JOIN_KW",
- /* 275 */ "exprx ::= nm DOT nm",
- /* 276 */ "exprx ::= nm DOT nm DOT nm",
- /* 277 */ "exprx ::= VARIABLE",
- /* 278 */ "exprx ::= expr COLLATE ids",
- /* 279 */ "exprx ::= CAST LP expr AS typetoken RP",
- /* 280 */ "exprx ::= ID LP distinct exprlist RP",
- /* 281 */ "exprx ::= ID LP STAR RP",
- /* 282 */ "exprx ::= expr AND expr",
- /* 283 */ "exprx ::= expr OR expr",
- /* 284 */ "exprx ::= expr LT|GT|GE|LE expr",
- /* 285 */ "exprx ::= expr EQ|NE expr",
- /* 286 */ "exprx ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr",
- /* 287 */ "exprx ::= expr PLUS|MINUS expr",
- /* 288 */ "exprx ::= expr STAR|SLASH|REM expr",
- /* 289 */ "exprx ::= expr CONCAT expr",
- /* 290 */ "exprx ::= expr not_opt likeop expr",
- /* 291 */ "exprx ::= expr not_opt likeop expr ESCAPE expr",
- /* 292 */ "exprx ::= expr ISNULL|NOTNULL",
- /* 293 */ "exprx ::= expr NOT NULL",
- /* 294 */ "exprx ::= expr IS not_opt expr",
- /* 295 */ "exprx ::= NOT expr",
- /* 296 */ "exprx ::= BITNOT expr",
- /* 297 */ "exprx ::= MINUS expr",
- /* 298 */ "exprx ::= PLUS expr",
- /* 299 */ "exprx ::= expr not_opt BETWEEN expr AND expr",
- /* 300 */ "exprx ::= expr not_opt IN LP exprlist RP",
- /* 301 */ "exprx ::= LP select RP",
- /* 302 */ "exprx ::= expr not_opt IN LP select RP",
- /* 303 */ "exprx ::= expr not_opt IN nm dbnm",
- /* 304 */ "exprx ::= EXISTS LP select RP",
- /* 305 */ "exprx ::= CASE case_operand case_exprlist case_else END",
- /* 306 */ "exprx ::= RAISE LP IGNORE RP",
- /* 307 */ "exprx ::= RAISE LP raisetype COMMA nm RP",
- /* 308 */ "expr ::=",
- /* 309 */ "expr ::= exprx",
- /* 310 */ "not_opt ::=",
- /* 311 */ "not_opt ::= NOT",
- /* 312 */ "likeop ::= LIKE_KW|MATCH",
- /* 313 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
- /* 314 */ "case_exprlist ::= WHEN expr THEN expr",
- /* 315 */ "case_else ::= ELSE expr",
- /* 316 */ "case_else ::=",
- /* 317 */ "case_operand ::= exprx",
- /* 318 */ "case_operand ::=",
- /* 319 */ "exprlist ::= nexprlist",
- /* 320 */ "exprlist ::=",
- /* 321 */ "nexprlist ::= nexprlist COMMA expr",
- /* 322 */ "nexprlist ::= exprx",
- /* 323 */ "cmd ::= CREATE uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt",
- /* 324 */ "cmd ::= CREATE uniqueflag INDEX ifnotexists nm dbnm ON ID_TAB",
- /* 325 */ "cmd ::= CREATE uniqueflag INDEX ifnotexists nm DOT ID_IDX_NEW",
- /* 326 */ "cmd ::= CREATE uniqueflag INDEX ifnotexists ID_DB|ID_IDX_NEW",
- /* 327 */ "uniqueflag ::= UNIQUE",
- /* 328 */ "uniqueflag ::=",
- /* 329 */ "idxlist_opt ::=",
- /* 330 */ "idxlist_opt ::= LP idxlist RP",
- /* 331 */ "idxlist ::= idxlist COMMA idxlist_single",
- /* 332 */ "idxlist ::= idxlist_single",
- /* 333 */ "idxlist_single ::= nm collate sortorder",
- /* 334 */ "idxlist_single ::= ID_COL",
- /* 335 */ "collate ::=",
- /* 336 */ "collate ::= COLLATE ids",
- /* 337 */ "collate ::= COLLATE ID_COLLATE",
- /* 338 */ "cmd ::= DROP INDEX ifexists fullname",
- /* 339 */ "cmd ::= DROP INDEX ifexists nm DOT ID_IDX",
- /* 340 */ "cmd ::= DROP INDEX ifexists ID_DB|ID_IDX",
- /* 341 */ "cmd ::= VACUUM",
- /* 342 */ "cmd ::= VACUUM nm",
- /* 343 */ "cmd ::= PRAGMA nm dbnm",
- /* 344 */ "cmd ::= PRAGMA nm dbnm EQ nmnum",
- /* 345 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP",
- /* 346 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
- /* 347 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP",
- /* 348 */ "cmd ::= PRAGMA nm DOT ID_PRAGMA",
- /* 349 */ "cmd ::= PRAGMA ID_DB|ID_PRAGMA",
- /* 350 */ "nmnum ::= plus_num",
- /* 351 */ "nmnum ::= nm",
- /* 352 */ "nmnum ::= ON",
- /* 353 */ "nmnum ::= DELETE",
- /* 354 */ "nmnum ::= DEFAULT",
- /* 355 */ "plus_num ::= PLUS number",
- /* 356 */ "plus_num ::= number",
- /* 357 */ "minus_num ::= MINUS number",
- /* 358 */ "number ::= INTEGER",
- /* 359 */ "number ::= FLOAT",
- /* 360 */ "cmd ::= CREATE temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON nm foreach_clause when_clause BEGIN trigger_cmd_list END",
- /* 361 */ "cmd ::= CREATE temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON nm foreach_clause when_clause",
- /* 362 */ "cmd ::= CREATE temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON nm foreach_clause when_clause BEGIN trigger_cmd_list",
- /* 363 */ "cmd ::= CREATE temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON ID_TAB",
- /* 364 */ "cmd ::= CREATE temp TRIGGER ifnotexists nm DOT ID_TRIG_NEW",
- /* 365 */ "cmd ::= CREATE temp TRIGGER ifnotexists ID_DB|ID_TRIG_NEW",
- /* 366 */ "trigger_time ::= BEFORE",
- /* 367 */ "trigger_time ::= AFTER",
- /* 368 */ "trigger_time ::= INSTEAD OF",
- /* 369 */ "trigger_time ::=",
- /* 370 */ "trigger_event ::= DELETE",
- /* 371 */ "trigger_event ::= INSERT",
- /* 372 */ "trigger_event ::= UPDATE",
- /* 373 */ "trigger_event ::= UPDATE OF idlist",
- /* 374 */ "foreach_clause ::=",
- /* 375 */ "foreach_clause ::= FOR EACH ROW",
- /* 376 */ "when_clause ::=",
- /* 377 */ "when_clause ::= WHEN expr",
- /* 378 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
- /* 379 */ "trigger_cmd_list ::= trigger_cmd SEMI",
- /* 380 */ "trigger_cmd_list ::= SEMI",
- /* 381 */ "trigger_cmd ::= update_stmt",
- /* 382 */ "trigger_cmd ::= insert_stmt",
- /* 383 */ "trigger_cmd ::= delete_stmt",
- /* 384 */ "trigger_cmd ::= select_stmt",
- /* 385 */ "raisetype ::= ROLLBACK|ABORT|FAIL",
- /* 386 */ "cmd ::= DROP TRIGGER ifexists fullname",
- /* 387 */ "cmd ::= DROP TRIGGER ifexists nm DOT ID_TRIG",
- /* 388 */ "cmd ::= DROP TRIGGER ifexists ID_DB|ID_TRIG",
- /* 389 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
- /* 390 */ "cmd ::= DETACH database_kw_opt expr",
- /* 391 */ "key_opt ::=",
- /* 392 */ "key_opt ::= KEY expr",
- /* 393 */ "database_kw_opt ::= DATABASE",
- /* 394 */ "database_kw_opt ::=",
- /* 395 */ "cmd ::= REINDEX",
- /* 396 */ "cmd ::= REINDEX nm dbnm",
- /* 397 */ "cmd ::= REINDEX ID_COLLATE",
- /* 398 */ "cmd ::= REINDEX nm DOT ID_TAB|ID_IDX",
- /* 399 */ "cmd ::= REINDEX ID_DB|ID_IDX|ID_TAB",
- /* 400 */ "cmd ::= ANALYZE",
- /* 401 */ "cmd ::= ANALYZE nm dbnm",
- /* 402 */ "cmd ::= ANALYZE nm DOT ID_TAB|ID_IDX",
- /* 403 */ "cmd ::= ANALYZE ID_DB|ID_IDX|ID_TAB",
- /* 404 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
- /* 405 */ "cmd ::= ALTER TABLE fullname ADD kwcolumn_opt column",
- /* 406 */ "cmd ::= ALTER TABLE fullname RENAME TO ID_TAB_NEW",
- /* 407 */ "cmd ::= ALTER TABLE nm DOT ID_TAB",
- /* 408 */ "cmd ::= ALTER TABLE ID_DB|ID_TAB",
- /* 409 */ "kwcolumn_opt ::=",
- /* 410 */ "kwcolumn_opt ::= COLUMNKW",
- /* 411 */ "cmd ::= create_vtab",
- /* 412 */ "create_vtab ::= CREATE VIRTUAL TABLE ifnotexists nm dbnm USING nm",
- /* 413 */ "create_vtab ::= CREATE VIRTUAL TABLE ifnotexists nm dbnm USING nm LP vtabarglist RP",
- /* 414 */ "create_vtab ::= CREATE VIRTUAL TABLE ifnotexists nm DOT ID_TAB_NEW",
- /* 415 */ "create_vtab ::= CREATE VIRTUAL TABLE ifnotexists ID_DB|ID_TAB_NEW",
- /* 416 */ "vtabarglist ::= vtabarg",
- /* 417 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
- /* 418 */ "vtabarg ::=",
- /* 419 */ "vtabarg ::= vtabarg vtabargtoken",
- /* 420 */ "vtabargtoken ::= ANY",
- /* 421 */ "vtabargtoken ::= LP anylist RP",
- /* 422 */ "anylist ::=",
- /* 423 */ "anylist ::= anylist LP anylist RP",
- /* 424 */ "anylist ::= anylist ANY",
- /* 425 */ "with ::=",
- /* 426 */ "with ::= WITH wqlist",
- /* 427 */ "with ::= WITH RECURSIVE wqlist",
- /* 428 */ "wqlist ::= nm idxlist_opt AS LP select RP",
- /* 429 */ "wqlist ::= wqlist COMMA nm idxlist_opt AS LP select RP",
- /* 430 */ "wqlist ::= ID_TAB_NEW",
+ /* 46 */ "id_opt ::= id",
+ /* 47 */ "id_opt ::=",
+ /* 48 */ "ids ::= ID|STRING",
+ /* 49 */ "nm ::= id",
+ /* 50 */ "nm ::= STRING",
+ /* 51 */ "nm ::= JOIN_KW",
+ /* 52 */ "type ::=",
+ /* 53 */ "type ::= typetoken",
+ /* 54 */ "typetoken ::= typename",
+ /* 55 */ "typetoken ::= typename LP signed RP",
+ /* 56 */ "typetoken ::= typename LP signed COMMA signed RP",
+ /* 57 */ "typename ::= ids",
+ /* 58 */ "typename ::= typename ids",
+ /* 59 */ "typename ::= ID_COL_TYPE",
+ /* 60 */ "signed ::= plus_num",
+ /* 61 */ "signed ::= minus_num",
+ /* 62 */ "carglist ::= carglist ccons",
+ /* 63 */ "carglist ::=",
+ /* 64 */ "ccons ::= CONSTRAINT nm",
+ /* 65 */ "ccons ::= DEFAULT term",
+ /* 66 */ "ccons ::= DEFAULT LP expr RP",
+ /* 67 */ "ccons ::= DEFAULT PLUS term",
+ /* 68 */ "ccons ::= DEFAULT MINUS term",
+ /* 69 */ "ccons ::= DEFAULT id",
+ /* 70 */ "ccons ::= DEFAULT CTIME_KW",
+ /* 71 */ "ccons ::= NULL onconf",
+ /* 72 */ "ccons ::= NOT NULL onconf",
+ /* 73 */ "ccons ::= PRIMARY KEY sortorder onconf autoinc",
+ /* 74 */ "ccons ::= UNIQUE onconf",
+ /* 75 */ "ccons ::= CHECK LP expr RP",
+ /* 76 */ "ccons ::= REFERENCES nm idxlist_opt refargs",
+ /* 77 */ "ccons ::= defer_subclause",
+ /* 78 */ "ccons ::= COLLATE ids",
+ /* 79 */ "ccons ::= gen_always AS LP expr RP id_opt",
+ /* 80 */ "ccons ::= CONSTRAINT ID_CONSTR",
+ /* 81 */ "ccons ::= COLLATE ID_COLLATE",
+ /* 82 */ "ccons ::= REFERENCES ID_TAB",
+ /* 83 */ "ccons ::= CHECK LP RP",
+ /* 84 */ "term ::= NULL",
+ /* 85 */ "term ::= INTEGER",
+ /* 86 */ "term ::= FLOAT",
+ /* 87 */ "term ::= STRING|BLOB",
+ /* 88 */ "tnm ::= term",
+ /* 89 */ "tnm ::= nm",
+ /* 90 */ "gen_always ::= GENERATED ALWAYS",
+ /* 91 */ "gen_always ::=",
+ /* 92 */ "autoinc ::=",
+ /* 93 */ "autoinc ::= AUTOINCR",
+ /* 94 */ "refargs ::=",
+ /* 95 */ "refargs ::= refargs refarg",
+ /* 96 */ "refarg ::= MATCH nm",
+ /* 97 */ "refarg ::= ON INSERT refact",
+ /* 98 */ "refarg ::= ON DELETE refact",
+ /* 99 */ "refarg ::= ON UPDATE refact",
+ /* 100 */ "refarg ::= MATCH ID_FK_MATCH",
+ /* 101 */ "refact ::= SET NULL",
+ /* 102 */ "refact ::= SET DEFAULT",
+ /* 103 */ "refact ::= CASCADE",
+ /* 104 */ "refact ::= RESTRICT",
+ /* 105 */ "refact ::= NO ACTION",
+ /* 106 */ "defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt",
+ /* 107 */ "defer_subclause ::= DEFERRABLE init_deferred_pred_opt",
+ /* 108 */ "init_deferred_pred_opt ::=",
+ /* 109 */ "init_deferred_pred_opt ::= INITIALLY DEFERRED",
+ /* 110 */ "init_deferred_pred_opt ::= INITIALLY IMMEDIATE",
+ /* 111 */ "conslist_opt ::=",
+ /* 112 */ "conslist_opt ::= COMMA conslist",
+ /* 113 */ "conslist ::= conslist tconscomma tcons",
+ /* 114 */ "conslist ::= tcons",
+ /* 115 */ "tconscomma ::= COMMA",
+ /* 116 */ "tconscomma ::=",
+ /* 117 */ "tcons ::= CONSTRAINT nm",
+ /* 118 */ "tcons ::= PRIMARY KEY LP idxlist autoinc RP onconf",
+ /* 119 */ "tcons ::= UNIQUE LP idxlist RP onconf",
+ /* 120 */ "tcons ::= CHECK LP expr RP onconf",
+ /* 121 */ "tcons ::= FOREIGN KEY LP idxlist RP REFERENCES nm idxlist_opt refargs defer_subclause_opt",
+ /* 122 */ "tcons ::= CONSTRAINT ID_CONSTR",
+ /* 123 */ "tcons ::= FOREIGN KEY LP idxlist RP REFERENCES ID_TAB",
+ /* 124 */ "tcons ::= CHECK LP RP onconf",
+ /* 125 */ "defer_subclause_opt ::=",
+ /* 126 */ "defer_subclause_opt ::= defer_subclause",
+ /* 127 */ "onconf ::=",
+ /* 128 */ "onconf ::= ON CONFLICT resolvetype",
+ /* 129 */ "orconf ::=",
+ /* 130 */ "orconf ::= OR resolvetype",
+ /* 131 */ "resolvetype ::= raisetype",
+ /* 132 */ "resolvetype ::= IGNORE",
+ /* 133 */ "resolvetype ::= REPLACE",
+ /* 134 */ "cmd ::= DROP TABLE ifexists fullname",
+ /* 135 */ "cmd ::= DROP TABLE ifexists nm DOT ID_TAB",
+ /* 136 */ "cmd ::= DROP TABLE ifexists ID_DB|ID_TAB",
+ /* 137 */ "ifexists ::= IF EXISTS",
+ /* 138 */ "ifexists ::=",
+ /* 139 */ "cmd ::= CREATE temp VIEW ifnotexists fullname idxlist_opt AS select",
+ /* 140 */ "cmd ::= CREATE temp VIEW ifnotexists nm DOT ID_VIEW_NEW",
+ /* 141 */ "cmd ::= CREATE temp VIEW ifnotexists ID_DB|ID_VIEW_NEW",
+ /* 142 */ "cmd ::= DROP VIEW ifexists fullname",
+ /* 143 */ "cmd ::= DROP VIEW ifexists nm DOT ID_VIEW",
+ /* 144 */ "cmd ::= DROP VIEW ifexists ID_DB|ID_VIEW",
+ /* 145 */ "cmd ::= select_stmt",
+ /* 146 */ "select_stmt ::= select",
+ /* 147 */ "select ::= with selectnowith",
+ /* 148 */ "selectnowith ::= oneselect",
+ /* 149 */ "selectnowith ::= selectnowith multiselect_op oneselect",
+ /* 150 */ "selectnowith ::= values",
+ /* 151 */ "selectnowith ::= selectnowith COMMA values",
+ /* 152 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt",
+ /* 153 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt",
+ /* 154 */ "values ::= VALUES LP nexprlist RP",
+ /* 155 */ "values ::= values COMMA LP exprlist RP",
+ /* 156 */ "multiselect_op ::= UNION",
+ /* 157 */ "multiselect_op ::= UNION ALL",
+ /* 158 */ "multiselect_op ::= EXCEPT",
+ /* 159 */ "multiselect_op ::= INTERSECT",
+ /* 160 */ "distinct ::= DISTINCT",
+ /* 161 */ "distinct ::= ALL",
+ /* 162 */ "distinct ::=",
+ /* 163 */ "sclp ::= selcollist COMMA",
+ /* 164 */ "sclp ::=",
+ /* 165 */ "selcollist ::= sclp expr as",
+ /* 166 */ "selcollist ::= sclp STAR",
+ /* 167 */ "selcollist ::= sclp tnm DOT STAR",
+ /* 168 */ "selcollist ::= sclp",
+ /* 169 */ "selcollist ::= sclp ID_TAB DOT STAR",
+ /* 170 */ "as ::= AS nm",
+ /* 171 */ "as ::= ids",
+ /* 172 */ "as ::= AS ID_ALIAS",
+ /* 173 */ "as ::= ID_ALIAS",
+ /* 174 */ "as ::=",
+ /* 175 */ "from ::=",
+ /* 176 */ "from ::= FROM joinsrc",
+ /* 177 */ "joinsrc ::= singlesrc seltablist",
+ /* 178 */ "joinsrc ::=",
+ /* 179 */ "seltablist ::= seltablist joinop singlesrc joinconstr_opt",
+ /* 180 */ "seltablist ::=",
+ /* 181 */ "singlesrc ::= nm dbnm as indexed_opt",
+ /* 182 */ "singlesrc ::= LP select RP as",
+ /* 183 */ "singlesrc ::= LP joinsrc RP as",
+ /* 184 */ "singlesrc ::= nm dbnm LP exprlist RP as",
+ /* 185 */ "singlesrc ::=",
+ /* 186 */ "singlesrc ::= nm DOT",
+ /* 187 */ "singlesrc ::= nm DOT ID_TAB",
+ /* 188 */ "singlesrc ::= ID_DB|ID_TAB",
+ /* 189 */ "singlesrc ::= nm DOT ID_VIEW",
+ /* 190 */ "singlesrc ::= ID_DB|ID_VIEW",
+ /* 191 */ "joinconstr_opt ::= ON expr",
+ /* 192 */ "joinconstr_opt ::= USING LP idlist RP",
+ /* 193 */ "joinconstr_opt ::=",
+ /* 194 */ "dbnm ::=",
+ /* 195 */ "dbnm ::= DOT nm",
+ /* 196 */ "fullname ::= nm dbnm",
+ /* 197 */ "joinop ::= COMMA",
+ /* 198 */ "joinop ::= JOIN",
+ /* 199 */ "joinop ::= JOIN_KW JOIN",
+ /* 200 */ "joinop ::= JOIN_KW nm JOIN",
+ /* 201 */ "joinop ::= JOIN_KW nm nm JOIN",
+ /* 202 */ "joinop ::= ID_JOIN_OPTS",
+ /* 203 */ "indexed_opt ::=",
+ /* 204 */ "indexed_opt ::= INDEXED BY nm",
+ /* 205 */ "indexed_opt ::= NOT INDEXED",
+ /* 206 */ "indexed_opt ::= INDEXED BY ID_IDX",
+ /* 207 */ "orderby_opt ::=",
+ /* 208 */ "orderby_opt ::= ORDER BY sortlist",
+ /* 209 */ "sortlist ::= sortlist COMMA expr sortorder nulls",
+ /* 210 */ "sortlist ::= expr sortorder nulls",
+ /* 211 */ "sortorder ::= ASC",
+ /* 212 */ "sortorder ::= DESC",
+ /* 213 */ "sortorder ::=",
+ /* 214 */ "nulls ::= NULLS FIRST",
+ /* 215 */ "nulls ::= NULLS LAST",
+ /* 216 */ "nulls ::=",
+ /* 217 */ "groupby_opt ::=",
+ /* 218 */ "groupby_opt ::= GROUP BY nexprlist",
+ /* 219 */ "groupby_opt ::= GROUP BY",
+ /* 220 */ "having_opt ::=",
+ /* 221 */ "having_opt ::= HAVING expr",
+ /* 222 */ "limit_opt ::=",
+ /* 223 */ "limit_opt ::= LIMIT expr",
+ /* 224 */ "limit_opt ::= LIMIT expr OFFSET expr",
+ /* 225 */ "limit_opt ::= LIMIT expr COMMA expr",
+ /* 226 */ "cmd ::= delete_stmt",
+ /* 227 */ "delete_stmt ::= with DELETE FROM fullname indexed_opt where_opt",
+ /* 228 */ "delete_stmt ::= with DELETE FROM",
+ /* 229 */ "delete_stmt ::= with DELETE FROM nm DOT",
+ /* 230 */ "delete_stmt ::= with DELETE FROM nm DOT ID_TAB",
+ /* 231 */ "delete_stmt ::= with DELETE FROM ID_DB|ID_TAB",
+ /* 232 */ "where_opt ::=",
+ /* 233 */ "where_opt ::= WHERE expr",
+ /* 234 */ "where_opt ::= WHERE",
+ /* 235 */ "cmd ::= update_stmt",
+ /* 236 */ "update_stmt ::= with UPDATE orconf fullname indexed_opt SET setlist from where_opt",
+ /* 237 */ "update_stmt ::= with UPDATE orconf",
+ /* 238 */ "update_stmt ::= with UPDATE orconf nm DOT",
+ /* 239 */ "update_stmt ::= with UPDATE orconf nm DOT ID_TAB",
+ /* 240 */ "update_stmt ::= with UPDATE orconf ID_DB|ID_TAB",
+ /* 241 */ "setlist ::= setlist COMMA nm EQ expr",
+ /* 242 */ "setlist ::= setlist COMMA LP idlist RP EQ expr",
+ /* 243 */ "setlist ::= nm EQ expr",
+ /* 244 */ "setlist ::= LP idlist RP EQ expr",
+ /* 245 */ "setlist ::=",
+ /* 246 */ "setlist ::= setlist COMMA",
+ /* 247 */ "setlist ::= setlist COMMA ID_COL",
+ /* 248 */ "setlist ::= ID_COL",
+ /* 249 */ "idlist_opt ::=",
+ /* 250 */ "idlist_opt ::= LP idlist RP",
+ /* 251 */ "idlist ::= idlist COMMA nm",
+ /* 252 */ "idlist ::= nm",
+ /* 253 */ "idlist ::=",
+ /* 254 */ "idlist ::= idlist COMMA ID_COL",
+ /* 255 */ "idlist ::= ID_COL",
+ /* 256 */ "cmd ::= insert_stmt",
+ /* 257 */ "insert_stmt ::= with insert_cmd INTO fullname idlist_opt select upsert",
+ /* 258 */ "insert_stmt ::= with insert_cmd INTO fullname idlist_opt DEFAULT VALUES",
+ /* 259 */ "insert_stmt ::= with insert_cmd INTO",
+ /* 260 */ "insert_stmt ::= with insert_cmd INTO nm DOT",
+ /* 261 */ "insert_stmt ::= with insert_cmd INTO ID_DB|ID_TAB",
+ /* 262 */ "insert_stmt ::= with insert_cmd INTO nm DOT ID_TAB",
+ /* 263 */ "insert_cmd ::= INSERT orconf",
+ /* 264 */ "insert_cmd ::= REPLACE",
+ /* 265 */ "upsert ::=",
+ /* 266 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt",
+ /* 267 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING",
+ /* 268 */ "upsert ::= ON CONFLICT DO NOTHING",
+ /* 269 */ "exprx ::= expr not_opt IN ID_DB",
+ /* 270 */ "exprx ::= expr not_opt IN nm DOT ID_TAB",
+ /* 271 */ "exprx ::= ID_DB|ID_TAB|ID_COL|ID_FN",
+ /* 272 */ "exprx ::= tnm DOT ID_TAB|ID_COL",
+ /* 273 */ "exprx ::= tnm DOT nm DOT ID_COL",
+ /* 274 */ "exprx ::= expr COLLATE ID_COLLATE",
+ /* 275 */ "exprx ::= RAISE LP raisetype COMMA ID_ERR_MSG RP",
+ /* 276 */ "exprx ::= CTIME_KW",
+ /* 277 */ "exprx ::= LP nexprlist RP",
+ /* 278 */ "exprx ::= tnm",
+ /* 279 */ "exprx ::= tnm DOT nm",
+ /* 280 */ "exprx ::= tnm DOT nm DOT nm",
+ /* 281 */ "exprx ::= VARIABLE",
+ /* 282 */ "exprx ::= expr COLLATE ids",
+ /* 283 */ "exprx ::= CAST LP expr AS typetoken RP",
+ /* 284 */ "exprx ::= ID LP distinct exprlist RP",
+ /* 285 */ "exprx ::= ID LP STAR RP",
+ /* 286 */ "exprx ::= expr AND expr",
+ /* 287 */ "exprx ::= expr OR expr",
+ /* 288 */ "exprx ::= expr LT|GT|GE|LE expr",
+ /* 289 */ "exprx ::= expr EQ|NE expr",
+ /* 290 */ "exprx ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr",
+ /* 291 */ "exprx ::= expr PLUS|MINUS expr",
+ /* 292 */ "exprx ::= expr STAR|SLASH|REM expr",
+ /* 293 */ "exprx ::= expr CONCAT expr",
+ /* 294 */ "exprx ::= expr not_opt likeop expr",
+ /* 295 */ "exprx ::= expr not_opt likeop expr ESCAPE expr",
+ /* 296 */ "exprx ::= expr ISNULL|NOTNULL",
+ /* 297 */ "exprx ::= expr NOT NULL",
+ /* 298 */ "exprx ::= expr IS not_opt expr",
+ /* 299 */ "exprx ::= NOT expr",
+ /* 300 */ "exprx ::= BITNOT expr",
+ /* 301 */ "exprx ::= MINUS expr",
+ /* 302 */ "exprx ::= PLUS expr",
+ /* 303 */ "exprx ::= expr not_opt BETWEEN expr AND expr",
+ /* 304 */ "exprx ::= expr not_opt IN LP exprlist RP",
+ /* 305 */ "exprx ::= LP select RP",
+ /* 306 */ "exprx ::= expr not_opt IN LP select RP",
+ /* 307 */ "exprx ::= expr not_opt IN nm dbnm",
+ /* 308 */ "exprx ::= EXISTS LP select RP",
+ /* 309 */ "exprx ::= CASE case_operand case_exprlist case_else END",
+ /* 310 */ "exprx ::= RAISE LP IGNORE RP",
+ /* 311 */ "exprx ::= RAISE LP raisetype COMMA nm RP",
+ /* 312 */ "exprx ::= ID LP distinct exprlist RP filter_over",
+ /* 313 */ "exprx ::= ID LP STAR RP filter_over",
+ /* 314 */ "expr ::=",
+ /* 315 */ "expr ::= exprx",
+ /* 316 */ "not_opt ::=",
+ /* 317 */ "not_opt ::= NOT",
+ /* 318 */ "likeop ::= LIKE_KW|MATCH",
+ /* 319 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
+ /* 320 */ "case_exprlist ::= WHEN expr THEN expr",
+ /* 321 */ "case_else ::= ELSE expr",
+ /* 322 */ "case_else ::=",
+ /* 323 */ "case_operand ::= exprx",
+ /* 324 */ "case_operand ::=",
+ /* 325 */ "exprlist ::= nexprlist",
+ /* 326 */ "exprlist ::=",
+ /* 327 */ "nexprlist ::= nexprlist COMMA expr",
+ /* 328 */ "nexprlist ::= exprx",
+ /* 329 */ "cmd ::= CREATE uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt",
+ /* 330 */ "cmd ::= CREATE uniqueflag INDEX ifnotexists nm dbnm ON ID_TAB",
+ /* 331 */ "cmd ::= CREATE uniqueflag INDEX ifnotexists nm DOT ID_IDX_NEW",
+ /* 332 */ "cmd ::= CREATE uniqueflag INDEX ifnotexists ID_DB|ID_IDX_NEW",
+ /* 333 */ "uniqueflag ::= UNIQUE",
+ /* 334 */ "uniqueflag ::=",
+ /* 335 */ "idxlist_opt ::=",
+ /* 336 */ "idxlist_opt ::= LP idxlist RP",
+ /* 337 */ "idxlist ::= idxlist COMMA idxlist_single",
+ /* 338 */ "idxlist ::= idxlist_single",
+ /* 339 */ "idxlist_single ::= nm collate sortorder",
+ /* 340 */ "idxlist_single ::= ID_COL",
+ /* 341 */ "collate ::=",
+ /* 342 */ "collate ::= COLLATE ids",
+ /* 343 */ "collate ::= COLLATE ID_COLLATE",
+ /* 344 */ "cmd ::= DROP INDEX ifexists fullname",
+ /* 345 */ "cmd ::= DROP INDEX ifexists nm DOT ID_IDX",
+ /* 346 */ "cmd ::= DROP INDEX ifexists ID_DB|ID_IDX",
+ /* 347 */ "cmd ::= VACUUM vinto",
+ /* 348 */ "cmd ::= VACUUM nm vinto",
+ /* 349 */ "vinto ::= INTO expr",
+ /* 350 */ "vinto ::=",
+ /* 351 */ "cmd ::= PRAGMA nm dbnm",
+ /* 352 */ "cmd ::= PRAGMA nm dbnm EQ nmnum",
+ /* 353 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP",
+ /* 354 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
+ /* 355 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP",
+ /* 356 */ "cmd ::= PRAGMA nm DOT ID_PRAGMA",
+ /* 357 */ "cmd ::= PRAGMA ID_DB|ID_PRAGMA",
+ /* 358 */ "nmnum ::= plus_num",
+ /* 359 */ "nmnum ::= nm",
+ /* 360 */ "nmnum ::= ON",
+ /* 361 */ "nmnum ::= DELETE",
+ /* 362 */ "nmnum ::= DEFAULT",
+ /* 363 */ "plus_num ::= PLUS number",
+ /* 364 */ "plus_num ::= number",
+ /* 365 */ "minus_num ::= MINUS number",
+ /* 366 */ "number ::= INTEGER",
+ /* 367 */ "number ::= FLOAT",
+ /* 368 */ "cmd ::= CREATE temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON nm foreach_clause when_clause BEGIN trigger_cmd_list END",
+ /* 369 */ "cmd ::= CREATE temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON nm foreach_clause when_clause",
+ /* 370 */ "cmd ::= CREATE temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON nm foreach_clause when_clause BEGIN trigger_cmd_list",
+ /* 371 */ "cmd ::= CREATE temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON ID_TAB",
+ /* 372 */ "cmd ::= CREATE temp TRIGGER ifnotexists nm DOT ID_TRIG_NEW",
+ /* 373 */ "cmd ::= CREATE temp TRIGGER ifnotexists ID_DB|ID_TRIG_NEW",
+ /* 374 */ "trigger_time ::= BEFORE",
+ /* 375 */ "trigger_time ::= AFTER",
+ /* 376 */ "trigger_time ::= INSTEAD OF",
+ /* 377 */ "trigger_time ::=",
+ /* 378 */ "trigger_event ::= DELETE",
+ /* 379 */ "trigger_event ::= INSERT",
+ /* 380 */ "trigger_event ::= UPDATE",
+ /* 381 */ "trigger_event ::= UPDATE OF idlist",
+ /* 382 */ "foreach_clause ::=",
+ /* 383 */ "foreach_clause ::= FOR EACH ROW",
+ /* 384 */ "when_clause ::=",
+ /* 385 */ "when_clause ::= WHEN expr",
+ /* 386 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
+ /* 387 */ "trigger_cmd_list ::= trigger_cmd SEMI",
+ /* 388 */ "trigger_cmd_list ::= SEMI",
+ /* 389 */ "trigger_cmd ::= update_stmt",
+ /* 390 */ "trigger_cmd ::= insert_stmt",
+ /* 391 */ "trigger_cmd ::= delete_stmt",
+ /* 392 */ "trigger_cmd ::= select_stmt",
+ /* 393 */ "raisetype ::= ROLLBACK|ABORT|FAIL",
+ /* 394 */ "cmd ::= DROP TRIGGER ifexists fullname",
+ /* 395 */ "cmd ::= DROP TRIGGER ifexists nm DOT ID_TRIG",
+ /* 396 */ "cmd ::= DROP TRIGGER ifexists ID_DB|ID_TRIG",
+ /* 397 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
+ /* 398 */ "cmd ::= DETACH database_kw_opt expr",
+ /* 399 */ "key_opt ::=",
+ /* 400 */ "key_opt ::= KEY expr",
+ /* 401 */ "database_kw_opt ::= DATABASE",
+ /* 402 */ "database_kw_opt ::=",
+ /* 403 */ "cmd ::= REINDEX",
+ /* 404 */ "cmd ::= REINDEX nm dbnm",
+ /* 405 */ "cmd ::= REINDEX ID_COLLATE",
+ /* 406 */ "cmd ::= REINDEX nm DOT ID_TAB|ID_IDX",
+ /* 407 */ "cmd ::= REINDEX ID_DB|ID_IDX|ID_TAB",
+ /* 408 */ "cmd ::= ANALYZE",
+ /* 409 */ "cmd ::= ANALYZE nm dbnm",
+ /* 410 */ "cmd ::= ANALYZE nm DOT ID_TAB|ID_IDX",
+ /* 411 */ "cmd ::= ANALYZE ID_DB|ID_IDX|ID_TAB",
+ /* 412 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
+ /* 413 */ "cmd ::= ALTER TABLE fullname ADD kwcolumn_opt column",
+ /* 414 */ "cmd ::= ALTER TABLE fullname RENAME TO ID_TAB_NEW",
+ /* 415 */ "cmd ::= ALTER TABLE nm DOT ID_TAB",
+ /* 416 */ "cmd ::= ALTER TABLE ID_DB|ID_TAB",
+ /* 417 */ "kwcolumn_opt ::=",
+ /* 418 */ "kwcolumn_opt ::= COLUMNKW",
+ /* 419 */ "cmd ::= create_vtab",
+ /* 420 */ "create_vtab ::= CREATE VIRTUAL TABLE ifnotexists nm dbnm USING nm",
+ /* 421 */ "create_vtab ::= CREATE VIRTUAL TABLE ifnotexists nm dbnm USING nm LP vtabarglist RP",
+ /* 422 */ "create_vtab ::= CREATE VIRTUAL TABLE ifnotexists nm DOT ID_TAB_NEW",
+ /* 423 */ "create_vtab ::= CREATE VIRTUAL TABLE ifnotexists ID_DB|ID_TAB_NEW",
+ /* 424 */ "vtabarglist ::= vtabarg",
+ /* 425 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
+ /* 426 */ "vtabarg ::=",
+ /* 427 */ "vtabarg ::= vtabarg vtabargtoken",
+ /* 428 */ "vtabargtoken ::= ANY",
+ /* 429 */ "vtabargtoken ::= LP anylist RP",
+ /* 430 */ "anylist ::=",
+ /* 431 */ "anylist ::= anylist LP anylist RP",
+ /* 432 */ "anylist ::= anylist ANY",
+ /* 433 */ "with ::=",
+ /* 434 */ "with ::= WITH wqlist",
+ /* 435 */ "with ::= WITH RECURSIVE wqlist",
+ /* 436 */ "wqlist ::= wqcte",
+ /* 437 */ "wqlist ::= wqlist COMMA wqcte",
+ /* 438 */ "wqlist ::= ID_TAB_NEW",
+ /* 439 */ "wqcte ::= nm idxlist_opt AS LP select RP",
+ /* 440 */ "windowdefn_list ::= windowdefn",
+ /* 441 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn",
+ /* 442 */ "windowdefn ::= nm AS LP window RP",
+ /* 443 */ "window ::= PARTITION BY nexprlist orderby_opt frame_opt",
+ /* 444 */ "window ::= nm PARTITION BY nexprlist orderby_opt frame_opt",
+ /* 445 */ "window ::= ORDER BY sortlist frame_opt",
+ /* 446 */ "window ::= nm ORDER BY sortlist frame_opt",
+ /* 447 */ "window ::= frame_opt",
+ /* 448 */ "window ::= nm frame_opt",
+ /* 449 */ "frame_opt ::=",
+ /* 450 */ "frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt",
+ /* 451 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt",
+ /* 452 */ "range_or_rows ::= RANGE|ROWS|GROUPS",
+ /* 453 */ "frame_bound_s ::= frame_bound",
+ /* 454 */ "frame_bound_s ::= UNBOUNDED PRECEDING",
+ /* 455 */ "frame_bound_e ::= frame_bound",
+ /* 456 */ "frame_bound_e ::= UNBOUNDED FOLLOWING",
+ /* 457 */ "frame_bound ::= expr PRECEDING|FOLLOWING",
+ /* 458 */ "frame_bound ::= CURRENT ROW",
+ /* 459 */ "frame_exclude_opt ::=",
+ /* 460 */ "frame_exclude_opt ::= EXCLUDE frame_exclude",
+ /* 461 */ "frame_exclude ::= NO OTHERS",
+ /* 462 */ "frame_exclude ::= CURRENT ROW",
+ /* 463 */ "frame_exclude ::= GROUP",
+ /* 464 */ "frame_exclude ::= TIES",
+ /* 465 */ "window_clause ::= WINDOW windowdefn_list",
+ /* 466 */ "filter_over ::= filter_clause over_clause",
+ /* 467 */ "filter_over ::= over_clause",
+ /* 468 */ "filter_over ::= filter_clause",
+ /* 469 */ "over_clause ::= OVER LP window RP",
+ /* 470 */ "over_clause ::= OVER nm",
+ /* 471 */ "filter_clause ::= FILTER LP WHERE expr RP",
};
#endif /* NDEBUG */
@@ -1709,314 +1944,384 @@ static void yy_destructor(
** which appear on the RHS of the rule, but which are not used
** inside the C code.
*/
- case 171: /* cmd */
- case 174: /* ecmd */
- case 176: /* cmdx */
- case 220: /* select_stmt */
- case 247: /* delete_stmt */
- case 248: /* update_stmt */
- case 251: /* insert_stmt */
- case 270: /* trigger_cmd */
- case 274: /* create_vtab */
-{
-delete (yypminor->yy283);
+ case 191: /* cmd */
+ case 194: /* ecmd */
+ case 196: /* cmdx */
+ case 243: /* select_stmt */
+ case 272: /* delete_stmt */
+ case 273: /* update_stmt */
+ case 276: /* insert_stmt */
+ case 297: /* trigger_cmd */
+ case 301: /* create_vtab */
+{
+parser_safe_delete((yypminor->yy363));
}
break;
- case 175: /* explain */
+ case 195: /* explain */
{
-delete (yypminor->yy411);
+parser_safe_delete((yypminor->yy91));
}
break;
- case 177: /* transtype */
- case 178: /* trans_opt */
+ case 197: /* transtype */
+ case 198: /* trans_opt */
{
-delete (yypminor->yy404);
+parser_safe_delete((yypminor->yy84));
}
break;
- case 179: /* nm */
- case 186: /* table_options */
- case 189: /* columnid */
- case 192: /* id */
- case 193: /* ids */
- case 195: /* typename */
- case 243: /* dbnm */
- case 262: /* collate */
- case 276: /* vtabarg */
- case 277: /* vtabargtoken */
- case 278: /* anylist */
-{
-delete (yypminor->yy399);
+ case 199: /* nm */
+ case 206: /* table_options */
+ case 209: /* columnid */
+ case 212: /* id */
+ case 213: /* id_opt */
+ case 214: /* ids */
+ case 216: /* typename */
+ case 267: /* dbnm */
+ case 288: /* collate */
+ case 303: /* vtabarg */
+ case 304: /* vtabargtoken */
+ case 305: /* anylist */
+{
+parser_safe_delete((yypminor->yy319));
}
break;
- case 180: /* savepoint_opt */
- case 182: /* ifnotexists */
- case 204: /* autoinc */
- case 212: /* tconscomma */
- case 219: /* ifexists */
- case 255: /* not_opt */
- case 260: /* uniqueflag */
- case 271: /* database_kw_opt */
- case 273: /* kwcolumn_opt */
-{
-delete (yypminor->yy451);
+ case 200: /* savepoint_opt */
+ case 202: /* ifnotexists */
+ case 225: /* autoinc */
+ case 229: /* gen_always */
+ case 235: /* tconscomma */
+ case 242: /* ifexists */
+ case 280: /* not_opt */
+ case 286: /* uniqueflag */
+ case 298: /* database_kw_opt */
+ case 300: /* kwcolumn_opt */
+{
+parser_safe_delete((yypminor->yy611));
}
break;
- case 181: /* temp */
- case 226: /* distinct */
+ case 201: /* temp */
+ case 249: /* distinct */
{
-delete (yypminor->yy146);
+parser_safe_delete((yypminor->yy386));
}
break;
- case 183: /* fullname */
+ case 203: /* fullname */
{
-delete (yypminor->yy360);
+parser_safe_delete((yypminor->yy440));
}
break;
- case 184: /* columnlist */
+ case 204: /* columnlist */
{
-delete (yypminor->yy202);
+parser_safe_delete((yypminor->yy42));
}
break;
- case 185: /* conslist_opt */
- case 211: /* conslist */
+ case 205: /* conslist_opt */
+ case 234: /* conslist */
{
-delete (yypminor->yy333);
+parser_safe_delete((yypminor->yy493));
}
break;
- case 187: /* select */
- case 222: /* selectnowith */
+ case 207: /* select */
+ case 245: /* selectnowith */
{
-delete (yypminor->yy473);
+parser_safe_delete((yypminor->yy313));
}
break;
- case 188: /* column */
+ case 208: /* column */
{
-delete (yypminor->yy227);
+parser_safe_delete((yypminor->yy147));
}
break;
- case 190: /* type */
- case 194: /* typetoken */
+ case 210: /* type */
+ case 215: /* typetoken */
{
-delete (yypminor->yy537);
+parser_safe_delete((yypminor->yy57));
}
break;
- case 191: /* carglist */
+ case 211: /* carglist */
{
-delete (yypminor->yy51);
+parser_safe_delete((yypminor->yy51));
}
break;
- case 196: /* signed */
- case 197: /* plus_num */
- case 198: /* minus_num */
- case 200: /* term */
- case 263: /* nmnum */
- case 264: /* number */
-{
-delete (yypminor->yy469);
+ case 217: /* signed */
+ case 218: /* plus_num */
+ case 219: /* minus_num */
+ case 221: /* term */
+ case 290: /* nmnum */
+ case 291: /* number */
+{
+parser_safe_delete((yypminor->yy229));
}
break;
- case 199: /* ccons */
+ case 220: /* ccons */
{
-delete (yypminor->yy304);
+parser_safe_delete((yypminor->yy464));
}
break;
- case 201: /* expr */
- case 229: /* where_opt */
- case 231: /* having_opt */
- case 254: /* exprx */
- case 256: /* case_operand */
- case 258: /* case_else */
-{
-delete (yypminor->yy352);
+ case 222: /* expr */
+ case 252: /* where_opt */
+ case 254: /* having_opt */
+ case 279: /* exprx */
+ case 282: /* case_operand */
+ case 284: /* case_else */
+ case 289: /* vinto */
+ case 295: /* when_clause */
+ case 299: /* key_opt */
+{
+parser_safe_delete((yypminor->yy512));
}
break;
- case 202: /* onconf */
- case 216: /* resolvetype */
- case 217: /* orconf */
+ case 223: /* onconf */
+ case 239: /* resolvetype */
+ case 240: /* orconf */
{
-delete (yypminor->yy338);
+parser_safe_delete((yypminor->yy418));
}
break;
- case 203: /* sortorder */
+ case 224: /* sortorder */
{
-delete (yypminor->yy309);
+parser_safe_delete((yypminor->yy549));
}
break;
- case 205: /* idxlist_opt */
- case 214: /* idxlist */
+ case 226: /* idxlist_opt */
+ case 237: /* idxlist */
{
-delete (yypminor->yy223);
+parser_safe_delete((yypminor->yy223));
}
break;
- case 206: /* refargs */
+ case 227: /* refargs */
{
-delete (yypminor->yy184);
+parser_safe_delete((yypminor->yy584));
}
break;
- case 207: /* defer_subclause */
- case 215: /* defer_subclause_opt */
+ case 228: /* defer_subclause */
+ case 238: /* defer_subclause_opt */
{
-delete (yypminor->yy329);
+parser_safe_delete((yypminor->yy9));
}
break;
- case 208: /* refarg */
+ case 230: /* tnm */
{
-delete (yypminor->yy347);
+parser_safe_delete((yypminor->yy590));
}
break;
- case 209: /* refact */
+ case 231: /* refarg */
{
-delete (yypminor->yy104);
+parser_safe_delete((yypminor->yy507));
}
break;
- case 210: /* init_deferred_pred_opt */
+ case 232: /* refact */
{
-delete (yypminor->yy392);
+parser_safe_delete((yypminor->yy104));
}
break;
- case 213: /* tcons */
+ case 233: /* init_deferred_pred_opt */
{
-delete (yypminor->yy406);
+parser_safe_delete((yypminor->yy312));
}
break;
- case 221: /* with */
- case 279: /* wqlist */
+ case 236: /* tcons */
{
-delete (yypminor->yy321);
+parser_safe_delete((yypminor->yy246));
}
break;
- case 223: /* oneselect */
+ case 244: /* with */
{
-delete (yypminor->yy310);
+parser_safe_delete((yypminor->yy1));
}
break;
- case 224: /* multiselect_op */
+ case 246: /* oneselect */
{
-delete (yypminor->yy462);
+parser_safe_delete((yypminor->yy470));
}
break;
- case 225: /* values */
+ case 247: /* multiselect_op */
{
-delete (yypminor->yy166);
+parser_safe_delete((yypminor->yy382));
}
break;
- case 227: /* selcollist */
- case 236: /* sclp */
+ case 248: /* values */
{
-delete (yypminor->yy373);
+parser_safe_delete((yypminor->yy486));
}
break;
- case 228: /* from */
- case 238: /* joinsrc */
+ case 250: /* selcollist */
+ case 260: /* sclp */
{
-delete (yypminor->yy511);
+parser_safe_delete((yypminor->yy53));
}
break;
- case 230: /* groupby_opt */
- case 234: /* nexprlist */
- case 235: /* exprlist */
- case 257: /* case_exprlist */
+ case 251: /* from */
+ case 262: /* joinsrc */
{
-delete (yypminor->yy551);
+parser_safe_delete((yypminor->yy31));
}
break;
- case 232: /* orderby_opt */
- case 246: /* sortlist */
+ case 253: /* groupby_opt */
+ case 258: /* nexprlist */
+ case 259: /* exprlist */
+ case 283: /* case_exprlist */
{
-delete (yypminor->yy163);
+parser_safe_delete((yypminor->yy71));
}
break;
- case 233: /* limit_opt */
+ case 255: /* orderby_opt */
+ case 270: /* sortlist */
{
-delete (yypminor->yy484);
+parser_safe_delete((yypminor->yy403));
}
break;
- case 237: /* as */
+ case 256: /* limit_opt */
{
-delete (yypminor->yy200);
+parser_safe_delete((yypminor->yy4));
}
break;
- case 239: /* singlesrc */
+ case 257: /* window_clause */
+ case 308: /* windowdefn_list */
{
-delete (yypminor->yy201);
+parser_safe_delete((yypminor->yy299));
}
break;
- case 240: /* seltablist */
+ case 261: /* as */
{
-delete (yypminor->yy131);
+parser_safe_delete((yypminor->yy200));
}
break;
- case 241: /* joinop */
+ case 263: /* singlesrc */
{
-delete (yypminor->yy301);
+parser_safe_delete((yypminor->yy441));
}
break;
- case 242: /* joinconstr_opt */
+ case 264: /* seltablist */
{
-delete (yypminor->yy295);
+parser_safe_delete((yypminor->yy451));
}
break;
- case 244: /* indexed_opt */
+ case 265: /* joinop */
{
-delete (yypminor->yy192);
+parser_safe_delete((yypminor->yy221));
}
break;
- case 245: /* idlist */
- case 250: /* idlist_opt */
- case 275: /* vtabarglist */
+ case 266: /* joinconstr_opt */
{
-delete (yypminor->yy95);
+parser_safe_delete((yypminor->yy295));
}
break;
- case 249: /* setlist */
+ case 268: /* indexed_opt */
{
-delete (yypminor->yy521);
+parser_safe_delete((yypminor->yy592));
}
break;
- case 252: /* insert_cmd */
+ case 269: /* idlist */
+ case 275: /* idlist_opt */
+ case 302: /* vtabarglist */
{
-delete (yypminor->yy105);
+parser_safe_delete((yypminor->yy575));
}
break;
- case 253: /* upsert */
+ case 271: /* nulls */
{
-delete (yypminor->yy560);
+parser_safe_delete((yypminor->yy579));
}
break;
- case 259: /* likeop */
+ case 274: /* setlist */
{
-delete (yypminor->yy520);
+parser_safe_delete((yypminor->yy201));
}
break;
- case 261: /* idxlist_single */
+ case 277: /* insert_cmd */
{
-delete (yypminor->yy108);
+parser_safe_delete((yypminor->yy504));
}
break;
- case 265: /* trigger_time */
+ case 278: /* upsert */
{
-delete (yypminor->yy132);
+parser_safe_delete((yypminor->yy400));
}
break;
- case 266: /* trigger_event */
+ case 281: /* likeop */
{
-delete (yypminor->yy552);
+parser_safe_delete((yypminor->yy40));
}
break;
- case 267: /* foreach_clause */
+ case 285: /* filter_over */
{
-delete (yypminor->yy3);
+parser_safe_delete((yypminor->yy247));
}
break;
- case 268: /* when_clause */
- case 272: /* key_opt */
+ case 287: /* idxlist_single */
{
-if ((yypminor->yy352)) delete (yypminor->yy352);
+parser_safe_delete((yypminor->yy268));
}
break;
- case 269: /* trigger_cmd_list */
+ case 292: /* trigger_time */
{
-delete (yypminor->yy430);
+parser_safe_delete((yypminor->yy532));
+}
+ break;
+ case 293: /* trigger_event */
+{
+parser_safe_delete((yypminor->yy151));
+}
+ break;
+ case 294: /* foreach_clause */
+{
+parser_safe_delete((yypminor->yy83));
+}
+ break;
+ case 296: /* trigger_cmd_list */
+{
+parser_safe_delete((yypminor->yy110));
+}
+ break;
+ case 306: /* wqlist */
+{
+parser_safe_delete((yypminor->yy593));
+}
+ break;
+ case 307: /* wqcte */
+{
+parser_safe_delete((yypminor->yy446));
+}
+ break;
+ case 309: /* windowdefn */
+{
+parser_safe_delete((yypminor->yy266));
+}
+ break;
+ case 310: /* window */
+{
+parser_safe_delete((yypminor->yy334));
+}
+ break;
+ case 311: /* frame_opt */
+{
+parser_safe_delete((yypminor->yy41));
+}
+ break;
+ case 312: /* range_or_rows */
+{
+parser_safe_delete((yypminor->yy419));
+}
+ break;
+ case 313: /* frame_bound_s */
+ case 315: /* frame_bound_e */
+{
+parser_safe_delete((yypminor->yy442));
+}
+ break;
+ case 316: /* frame_bound */
+{
+parser_safe_delete((yypminor->yy442));parser_safe_delete((yypminor->yy442));parser_safe_delete((yypminor->yy442));
+}
+ break;
+ case 318: /* filter_clause */
+{
+parser_safe_delete((yypminor->yy397));
+}
+ break;
+ case 319: /* over_clause */
+{
+parser_safe_delete((yypminor->yy248));
}
break;
default: break; /* If no destructor action specified: do nothing */
@@ -2197,6 +2502,7 @@ static int yy_find_reduce_action(
** The following routine is called if the stack overflows.
*/
static void yyStackOverflow(yyParser *yypParser, YYMINORTYPE *yypMinor){
+ UNUSED(yypMinor);
sqlite3_parseARG_FETCH;
yypParser->yyidx--;
#ifndef NDEBUG
@@ -2208,7 +2514,6 @@ static void yyStackOverflow(yyParser *yypParser, YYMINORTYPE *yypMinor){
/* Here code is inserted which will execute if the parser
** stack every overflows */
- UNUSED_PARAMETER(yypMinor);
parserContext->error(QObject::tr("Parser stack overflow"));
sqlite3_parseARG_STORE; /* Suppress warning about unused %extra_argument var */
}
@@ -2267,437 +2572,478 @@ static const struct {
YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */
unsigned char nrhs; /* Number of right-hand side symbols in the rule */
} yyRuleInfo[] = {
- { 172, 1 },
- { 173, 2 },
- { 173, 1 },
- { 174, 1 },
- { 174, 3 },
- { 175, 0 },
- { 175, 1 },
- { 175, 3 },
- { 176, 1 },
- { 171, 3 },
- { 178, 0 },
- { 178, 1 },
- { 178, 2 },
- { 178, 2 },
- { 177, 0 },
- { 177, 1 },
- { 177, 1 },
- { 177, 1 },
- { 171, 2 },
- { 171, 2 },
- { 171, 2 },
- { 180, 1 },
- { 180, 0 },
- { 171, 2 },
- { 171, 3 },
- { 171, 5 },
- { 171, 2 },
- { 171, 3 },
- { 171, 5 },
- { 171, 10 },
- { 171, 7 },
- { 171, 7 },
- { 171, 5 },
- { 186, 0 },
- { 186, 2 },
- { 186, 2 },
- { 182, 0 },
- { 182, 3 },
- { 181, 1 },
- { 181, 0 },
- { 184, 3 },
- { 184, 1 },
- { 188, 3 },
- { 189, 1 },
- { 189, 1 },
{ 192, 1 },
+ { 193, 2 },
{ 193, 1 },
- { 179, 1 },
- { 179, 1 },
- { 179, 1 },
- { 190, 0 },
- { 190, 1 },
{ 194, 1 },
- { 194, 4 },
- { 194, 6 },
+ { 194, 3 },
+ { 195, 0 },
{ 195, 1 },
- { 195, 2 },
- { 195, 1 },
- { 196, 1 },
+ { 195, 3 },
{ 196, 1 },
+ { 191, 3 },
+ { 198, 0 },
+ { 198, 1 },
+ { 198, 2 },
+ { 198, 2 },
+ { 197, 0 },
+ { 197, 1 },
+ { 197, 1 },
+ { 197, 1 },
+ { 191, 2 },
+ { 191, 2 },
{ 191, 2 },
- { 191, 0 },
- { 199, 2 },
- { 199, 2 },
- { 199, 4 },
- { 199, 3 },
- { 199, 3 },
- { 199, 2 },
- { 199, 2 },
- { 199, 2 },
- { 199, 3 },
- { 199, 5 },
- { 199, 2 },
- { 199, 4 },
- { 199, 4 },
- { 199, 1 },
- { 199, 2 },
- { 199, 2 },
- { 199, 2 },
- { 199, 2 },
- { 199, 3 },
- { 200, 1 },
- { 200, 1 },
- { 200, 1 },
{ 200, 1 },
- { 204, 0 },
- { 204, 1 },
+ { 200, 0 },
+ { 191, 2 },
+ { 191, 3 },
+ { 191, 5 },
+ { 191, 2 },
+ { 191, 3 },
+ { 191, 5 },
+ { 191, 10 },
+ { 191, 7 },
+ { 191, 7 },
+ { 191, 5 },
{ 206, 0 },
{ 206, 2 },
- { 208, 2 },
- { 208, 3 },
- { 208, 3 },
+ { 206, 2 },
+ { 202, 0 },
+ { 202, 3 },
+ { 201, 1 },
+ { 201, 0 },
+ { 204, 3 },
+ { 204, 1 },
{ 208, 3 },
- { 208, 2 },
- { 209, 2 },
- { 209, 2 },
{ 209, 1 },
{ 209, 1 },
- { 209, 2 },
- { 207, 3 },
- { 207, 2 },
- { 210, 0 },
- { 210, 2 },
- { 210, 2 },
- { 185, 0 },
- { 185, 2 },
- { 211, 3 },
- { 211, 1 },
{ 212, 1 },
- { 212, 0 },
- { 213, 2 },
- { 213, 7 },
- { 213, 5 },
- { 213, 5 },
- { 213, 10 },
- { 213, 2 },
- { 213, 7 },
- { 213, 4 },
- { 215, 0 },
+ { 213, 1 },
+ { 213, 0 },
+ { 214, 1 },
+ { 199, 1 },
+ { 199, 1 },
+ { 199, 1 },
+ { 210, 0 },
+ { 210, 1 },
{ 215, 1 },
- { 202, 0 },
- { 202, 3 },
- { 217, 0 },
- { 217, 2 },
+ { 215, 4 },
+ { 215, 6 },
{ 216, 1 },
+ { 216, 2 },
{ 216, 1 },
- { 216, 1 },
- { 171, 4 },
- { 171, 6 },
- { 171, 4 },
- { 219, 2 },
- { 219, 0 },
- { 171, 8 },
- { 171, 7 },
- { 171, 5 },
- { 171, 4 },
- { 171, 6 },
- { 171, 4 },
- { 171, 1 },
+ { 217, 1 },
+ { 217, 1 },
+ { 211, 2 },
+ { 211, 0 },
+ { 220, 2 },
+ { 220, 2 },
+ { 220, 4 },
+ { 220, 3 },
+ { 220, 3 },
+ { 220, 2 },
+ { 220, 2 },
+ { 220, 2 },
+ { 220, 3 },
+ { 220, 5 },
+ { 220, 2 },
+ { 220, 4 },
+ { 220, 4 },
{ 220, 1 },
- { 187, 2 },
- { 222, 1 },
- { 222, 3 },
- { 222, 1 },
- { 222, 3 },
- { 223, 9 },
- { 225, 4 },
- { 225, 5 },
- { 224, 1 },
- { 224, 2 },
- { 224, 1 },
- { 224, 1 },
- { 226, 1 },
- { 226, 1 },
- { 226, 0 },
- { 236, 2 },
- { 236, 0 },
- { 227, 3 },
+ { 220, 2 },
+ { 220, 6 },
+ { 220, 2 },
+ { 220, 2 },
+ { 220, 2 },
+ { 220, 3 },
+ { 221, 1 },
+ { 221, 1 },
+ { 221, 1 },
+ { 221, 1 },
+ { 230, 1 },
+ { 230, 1 },
+ { 229, 2 },
+ { 229, 0 },
+ { 225, 0 },
+ { 225, 1 },
+ { 227, 0 },
{ 227, 2 },
- { 227, 4 },
- { 227, 1 },
- { 227, 4 },
- { 237, 2 },
- { 237, 1 },
- { 237, 2 },
- { 237, 1 },
- { 237, 0 },
- { 228, 0 },
+ { 231, 2 },
+ { 231, 3 },
+ { 231, 3 },
+ { 231, 3 },
+ { 231, 2 },
+ { 232, 2 },
+ { 232, 2 },
+ { 232, 1 },
+ { 232, 1 },
+ { 232, 2 },
+ { 228, 3 },
{ 228, 2 },
- { 238, 2 },
+ { 233, 0 },
+ { 233, 2 },
+ { 233, 2 },
+ { 205, 0 },
+ { 205, 2 },
+ { 234, 3 },
+ { 234, 1 },
+ { 235, 1 },
+ { 235, 0 },
+ { 236, 2 },
+ { 236, 7 },
+ { 236, 5 },
+ { 236, 5 },
+ { 236, 10 },
+ { 236, 2 },
+ { 236, 7 },
+ { 236, 4 },
{ 238, 0 },
- { 240, 4 },
+ { 238, 1 },
+ { 223, 0 },
+ { 223, 3 },
{ 240, 0 },
- { 239, 4 },
- { 239, 4 },
- { 239, 4 },
- { 239, 6 },
- { 239, 0 },
- { 239, 2 },
- { 239, 3 },
+ { 240, 2 },
+ { 239, 1 },
{ 239, 1 },
- { 239, 3 },
{ 239, 1 },
+ { 191, 4 },
+ { 191, 6 },
+ { 191, 4 },
{ 242, 2 },
- { 242, 4 },
{ 242, 0 },
- { 243, 0 },
- { 243, 2 },
- { 183, 2 },
- { 241, 1 },
- { 241, 1 },
- { 241, 2 },
- { 241, 3 },
- { 241, 4 },
- { 241, 1 },
- { 244, 0 },
- { 244, 3 },
- { 244, 2 },
- { 244, 3 },
- { 232, 0 },
- { 232, 3 },
- { 246, 4 },
- { 246, 2 },
- { 203, 1 },
- { 203, 1 },
- { 203, 0 },
- { 230, 0 },
- { 230, 3 },
- { 230, 2 },
- { 231, 0 },
- { 231, 2 },
- { 233, 0 },
- { 233, 2 },
- { 233, 4 },
- { 233, 4 },
- { 171, 1 },
- { 247, 6 },
- { 247, 3 },
- { 247, 5 },
- { 247, 6 },
- { 247, 4 },
- { 229, 0 },
- { 229, 2 },
- { 229, 1 },
- { 171, 1 },
- { 248, 8 },
- { 248, 3 },
- { 248, 5 },
- { 248, 6 },
- { 248, 4 },
- { 249, 5 },
- { 249, 7 },
- { 249, 3 },
- { 249, 5 },
- { 249, 0 },
- { 249, 2 },
- { 249, 3 },
- { 249, 1 },
- { 250, 0 },
- { 250, 3 },
- { 245, 3 },
+ { 191, 8 },
+ { 191, 7 },
+ { 191, 5 },
+ { 191, 4 },
+ { 191, 6 },
+ { 191, 4 },
+ { 191, 1 },
+ { 243, 1 },
+ { 207, 2 },
{ 245, 1 },
- { 245, 0 },
{ 245, 3 },
{ 245, 1 },
- { 171, 1 },
- { 251, 7 },
- { 251, 7 },
- { 251, 3 },
- { 251, 5 },
- { 251, 4 },
- { 251, 6 },
- { 252, 2 },
- { 252, 1 },
- { 253, 0 },
- { 253, 11 },
- { 253, 8 },
- { 253, 4 },
- { 254, 2 },
- { 254, 4 },
- { 254, 5 },
- { 254, 4 },
- { 254, 5 },
- { 254, 4 },
- { 254, 6 },
- { 254, 1 },
- { 254, 3 },
- { 254, 5 },
- { 254, 3 },
- { 254, 6 },
- { 254, 1 },
- { 254, 1 },
- { 254, 3 },
- { 254, 1 },
- { 254, 1 },
- { 254, 3 },
- { 254, 5 },
- { 254, 1 },
- { 254, 3 },
- { 254, 6 },
- { 254, 5 },
- { 254, 4 },
- { 254, 3 },
- { 254, 3 },
- { 254, 3 },
- { 254, 3 },
- { 254, 3 },
- { 254, 3 },
- { 254, 3 },
- { 254, 3 },
- { 254, 4 },
- { 254, 6 },
- { 254, 2 },
- { 254, 3 },
- { 254, 4 },
- { 254, 2 },
- { 254, 2 },
- { 254, 2 },
- { 254, 2 },
- { 254, 6 },
- { 254, 6 },
- { 254, 3 },
- { 254, 6 },
- { 254, 5 },
- { 254, 4 },
- { 254, 5 },
- { 254, 4 },
- { 254, 6 },
- { 201, 0 },
- { 201, 1 },
- { 255, 0 },
- { 255, 1 },
- { 259, 1 },
- { 257, 5 },
- { 257, 4 },
- { 258, 2 },
- { 258, 0 },
- { 256, 1 },
- { 256, 0 },
- { 235, 1 },
- { 235, 0 },
- { 234, 3 },
- { 234, 1 },
- { 171, 12 },
- { 171, 8 },
- { 171, 7 },
- { 171, 5 },
- { 260, 1 },
+ { 245, 3 },
+ { 246, 9 },
+ { 246, 10 },
+ { 248, 4 },
+ { 248, 5 },
+ { 247, 1 },
+ { 247, 2 },
+ { 247, 1 },
+ { 247, 1 },
+ { 249, 1 },
+ { 249, 1 },
+ { 249, 0 },
+ { 260, 2 },
{ 260, 0 },
- { 205, 0 },
- { 205, 3 },
- { 214, 3 },
- { 214, 1 },
- { 261, 3 },
+ { 250, 3 },
+ { 250, 2 },
+ { 250, 4 },
+ { 250, 1 },
+ { 250, 4 },
+ { 261, 2 },
{ 261, 1 },
- { 262, 0 },
- { 262, 2 },
+ { 261, 2 },
+ { 261, 1 },
+ { 261, 0 },
+ { 251, 0 },
+ { 251, 2 },
{ 262, 2 },
- { 171, 4 },
- { 171, 6 },
- { 171, 4 },
- { 171, 1 },
- { 171, 2 },
- { 171, 3 },
- { 171, 5 },
- { 171, 6 },
- { 171, 5 },
- { 171, 6 },
- { 171, 4 },
- { 171, 2 },
- { 263, 1 },
- { 263, 1 },
- { 263, 1 },
+ { 262, 0 },
+ { 264, 4 },
+ { 264, 0 },
+ { 263, 4 },
+ { 263, 4 },
+ { 263, 4 },
+ { 263, 6 },
+ { 263, 0 },
+ { 263, 2 },
+ { 263, 3 },
{ 263, 1 },
+ { 263, 3 },
{ 263, 1 },
- { 197, 2 },
- { 197, 1 },
- { 198, 2 },
- { 264, 1 },
- { 264, 1 },
- { 171, 15 },
- { 171, 12 },
- { 171, 14 },
- { 171, 10 },
- { 171, 7 },
- { 171, 5 },
+ { 266, 2 },
+ { 266, 4 },
+ { 266, 0 },
+ { 267, 0 },
+ { 267, 2 },
+ { 203, 2 },
{ 265, 1 },
{ 265, 1 },
{ 265, 2 },
- { 265, 0 },
- { 266, 1 },
- { 266, 1 },
- { 266, 1 },
- { 266, 3 },
- { 267, 0 },
- { 267, 3 },
+ { 265, 3 },
+ { 265, 4 },
+ { 265, 1 },
{ 268, 0 },
+ { 268, 3 },
{ 268, 2 },
- { 269, 3 },
- { 269, 2 },
- { 269, 1 },
- { 270, 1 },
- { 270, 1 },
- { 270, 1 },
- { 270, 1 },
- { 218, 1 },
- { 171, 4 },
- { 171, 6 },
- { 171, 4 },
- { 171, 6 },
- { 171, 3 },
- { 272, 0 },
- { 272, 2 },
- { 271, 1 },
+ { 268, 3 },
+ { 255, 0 },
+ { 255, 3 },
+ { 270, 5 },
+ { 270, 3 },
+ { 224, 1 },
+ { 224, 1 },
+ { 224, 0 },
+ { 271, 2 },
+ { 271, 2 },
{ 271, 0 },
- { 171, 1 },
- { 171, 3 },
- { 171, 2 },
- { 171, 4 },
- { 171, 2 },
- { 171, 1 },
- { 171, 3 },
- { 171, 4 },
- { 171, 2 },
- { 171, 6 },
- { 171, 6 },
- { 171, 6 },
- { 171, 5 },
- { 171, 3 },
- { 273, 0 },
- { 273, 1 },
- { 171, 1 },
- { 274, 8 },
- { 274, 11 },
+ { 253, 0 },
+ { 253, 3 },
+ { 253, 2 },
+ { 254, 0 },
+ { 254, 2 },
+ { 256, 0 },
+ { 256, 2 },
+ { 256, 4 },
+ { 256, 4 },
+ { 191, 1 },
+ { 272, 6 },
+ { 272, 3 },
+ { 272, 5 },
+ { 272, 6 },
+ { 272, 4 },
+ { 252, 0 },
+ { 252, 2 },
+ { 252, 1 },
+ { 191, 1 },
+ { 273, 9 },
+ { 273, 3 },
+ { 273, 5 },
+ { 273, 6 },
+ { 273, 4 },
+ { 274, 5 },
{ 274, 7 },
+ { 274, 3 },
{ 274, 5 },
- { 275, 1 },
+ { 274, 0 },
+ { 274, 2 },
+ { 274, 3 },
+ { 274, 1 },
+ { 275, 0 },
{ 275, 3 },
- { 276, 0 },
- { 276, 2 },
+ { 269, 3 },
+ { 269, 1 },
+ { 269, 0 },
+ { 269, 3 },
+ { 269, 1 },
+ { 191, 1 },
+ { 276, 7 },
+ { 276, 7 },
+ { 276, 3 },
+ { 276, 5 },
+ { 276, 4 },
+ { 276, 6 },
+ { 277, 2 },
{ 277, 1 },
- { 277, 3 },
{ 278, 0 },
+ { 278, 11 },
+ { 278, 8 },
{ 278, 4 },
- { 278, 2 },
- { 221, 0 },
- { 221, 2 },
- { 221, 3 },
+ { 279, 4 },
+ { 279, 6 },
+ { 279, 1 },
+ { 279, 3 },
+ { 279, 5 },
+ { 279, 3 },
{ 279, 6 },
- { 279, 8 },
{ 279, 1 },
+ { 279, 3 },
+ { 279, 1 },
+ { 279, 3 },
+ { 279, 5 },
+ { 279, 1 },
+ { 279, 3 },
+ { 279, 6 },
+ { 279, 5 },
+ { 279, 4 },
+ { 279, 3 },
+ { 279, 3 },
+ { 279, 3 },
+ { 279, 3 },
+ { 279, 3 },
+ { 279, 3 },
+ { 279, 3 },
+ { 279, 3 },
+ { 279, 4 },
+ { 279, 6 },
+ { 279, 2 },
+ { 279, 3 },
+ { 279, 4 },
+ { 279, 2 },
+ { 279, 2 },
+ { 279, 2 },
+ { 279, 2 },
+ { 279, 6 },
+ { 279, 6 },
+ { 279, 3 },
+ { 279, 6 },
+ { 279, 5 },
+ { 279, 4 },
+ { 279, 5 },
+ { 279, 4 },
+ { 279, 6 },
+ { 279, 6 },
+ { 279, 5 },
+ { 222, 0 },
+ { 222, 1 },
+ { 280, 0 },
+ { 280, 1 },
+ { 281, 1 },
+ { 283, 5 },
+ { 283, 4 },
+ { 284, 2 },
+ { 284, 0 },
+ { 282, 1 },
+ { 282, 0 },
+ { 259, 1 },
+ { 259, 0 },
+ { 258, 3 },
+ { 258, 1 },
+ { 191, 12 },
+ { 191, 8 },
+ { 191, 7 },
+ { 191, 5 },
+ { 286, 1 },
+ { 286, 0 },
+ { 226, 0 },
+ { 226, 3 },
+ { 237, 3 },
+ { 237, 1 },
+ { 287, 3 },
+ { 287, 1 },
+ { 288, 0 },
+ { 288, 2 },
+ { 288, 2 },
+ { 191, 4 },
+ { 191, 6 },
+ { 191, 4 },
+ { 191, 2 },
+ { 191, 3 },
+ { 289, 2 },
+ { 289, 0 },
+ { 191, 3 },
+ { 191, 5 },
+ { 191, 6 },
+ { 191, 5 },
+ { 191, 6 },
+ { 191, 4 },
+ { 191, 2 },
+ { 290, 1 },
+ { 290, 1 },
+ { 290, 1 },
+ { 290, 1 },
+ { 290, 1 },
+ { 218, 2 },
+ { 218, 1 },
+ { 219, 2 },
+ { 291, 1 },
+ { 291, 1 },
+ { 191, 15 },
+ { 191, 12 },
+ { 191, 14 },
+ { 191, 10 },
+ { 191, 7 },
+ { 191, 5 },
+ { 292, 1 },
+ { 292, 1 },
+ { 292, 2 },
+ { 292, 0 },
+ { 293, 1 },
+ { 293, 1 },
+ { 293, 1 },
+ { 293, 3 },
+ { 294, 0 },
+ { 294, 3 },
+ { 295, 0 },
+ { 295, 2 },
+ { 296, 3 },
+ { 296, 2 },
+ { 296, 1 },
+ { 297, 1 },
+ { 297, 1 },
+ { 297, 1 },
+ { 297, 1 },
+ { 241, 1 },
+ { 191, 4 },
+ { 191, 6 },
+ { 191, 4 },
+ { 191, 6 },
+ { 191, 3 },
+ { 299, 0 },
+ { 299, 2 },
+ { 298, 1 },
+ { 298, 0 },
+ { 191, 1 },
+ { 191, 3 },
+ { 191, 2 },
+ { 191, 4 },
+ { 191, 2 },
+ { 191, 1 },
+ { 191, 3 },
+ { 191, 4 },
+ { 191, 2 },
+ { 191, 6 },
+ { 191, 6 },
+ { 191, 6 },
+ { 191, 5 },
+ { 191, 3 },
+ { 300, 0 },
+ { 300, 1 },
+ { 191, 1 },
+ { 301, 8 },
+ { 301, 11 },
+ { 301, 7 },
+ { 301, 5 },
+ { 302, 1 },
+ { 302, 3 },
+ { 303, 0 },
+ { 303, 2 },
+ { 304, 1 },
+ { 304, 3 },
+ { 305, 0 },
+ { 305, 4 },
+ { 305, 2 },
+ { 244, 0 },
+ { 244, 2 },
+ { 244, 3 },
+ { 306, 1 },
+ { 306, 3 },
+ { 306, 1 },
+ { 307, 6 },
+ { 308, 1 },
+ { 308, 3 },
+ { 309, 5 },
+ { 310, 5 },
+ { 310, 6 },
+ { 310, 4 },
+ { 310, 5 },
+ { 310, 1 },
+ { 310, 2 },
+ { 311, 0 },
+ { 311, 3 },
+ { 311, 6 },
+ { 312, 1 },
+ { 313, 1 },
+ { 313, 2 },
+ { 315, 1 },
+ { 315, 2 },
+ { 316, 2 },
+ { 316, 2 },
+ { 314, 0 },
+ { 314, 2 },
+ { 317, 2 },
+ { 317, 2 },
+ { 317, 1 },
+ { 317, 1 },
+ { 257, 2 },
+ { 285, 2 },
+ { 285, 1 },
+ { 285, 1 },
+ { 319, 4 },
+ { 319, 2 },
+ { 318, 5 },
};
static void yy_accept(yyParser*); /* Forward Declaration */
@@ -2757,2305 +3103,2557 @@ static void yy_reduce(
** break;
*/
case 1: /* cmdlist ::= cmdlist ecmd */
-{parserContext->addQuery(yymsp[0].minor.yy283); DONT_INHERIT_TOKENS("cmdlist");}
+{parserContext->addQuery(yymsp[0].minor.yy363); DONT_INHERIT_TOKENS("cmdlist");}
break;
case 2: /* cmdlist ::= ecmd */
-{parserContext->addQuery(yymsp[0].minor.yy283);}
+{parserContext->addQuery(yymsp[0].minor.yy363);}
break;
case 3: /* ecmd ::= SEMI */
-{yygotominor.yy283 = new SqliteEmptyQuery();}
+{yygotominor.yy363 = new SqliteEmptyQuery();}
break;
case 4: /* ecmd ::= explain cmdx SEMI */
{
- yygotominor.yy283 = yymsp[-1].minor.yy283;
- yygotominor.yy283->explain = yymsp[-2].minor.yy411->explain;
- yygotominor.yy283->queryPlan = yymsp[-2].minor.yy411->queryPlan;
- delete yymsp[-2].minor.yy411;
- objectForTokens = yygotominor.yy283;
+ yygotominor.yy363 = yymsp[-1].minor.yy363;
+ yygotominor.yy363->explain = yymsp[-2].minor.yy91->explain;
+ yygotominor.yy363->queryPlan = yymsp[-2].minor.yy91->queryPlan;
+ delete yymsp[-2].minor.yy91;
+ objectForTokens = yygotominor.yy363;
}
break;
case 5: /* explain ::= */
-{yygotominor.yy411 = new ParserStubExplain(false, false);}
+{yygotominor.yy91 = new ParserStubExplain(false, false);}
break;
case 6: /* explain ::= EXPLAIN */
-{yygotominor.yy411 = new ParserStubExplain(true, false);}
+{yygotominor.yy91 = new ParserStubExplain(true, false);}
break;
case 7: /* explain ::= EXPLAIN QUERY PLAN */
-{yygotominor.yy411 = new ParserStubExplain(true, true);}
+{yygotominor.yy91 = new ParserStubExplain(true, true);}
break;
case 8: /* cmdx ::= cmd */
- case 381: /* trigger_cmd ::= update_stmt */ yytestcase(yyruleno==381);
- case 382: /* trigger_cmd ::= insert_stmt */ yytestcase(yyruleno==382);
- case 383: /* trigger_cmd ::= delete_stmt */ yytestcase(yyruleno==383);
- case 384: /* trigger_cmd ::= select_stmt */ yytestcase(yyruleno==384);
- case 411: /* cmd ::= create_vtab */ yytestcase(yyruleno==411);
-{yygotominor.yy283 = yymsp[0].minor.yy283;}
+ case 389: /* trigger_cmd ::= update_stmt */ yytestcase(yyruleno==389);
+ case 390: /* trigger_cmd ::= insert_stmt */ yytestcase(yyruleno==390);
+ case 391: /* trigger_cmd ::= delete_stmt */ yytestcase(yyruleno==391);
+ case 392: /* trigger_cmd ::= select_stmt */ yytestcase(yyruleno==392);
+ case 419: /* cmd ::= create_vtab */ yytestcase(yyruleno==419);
+{yygotominor.yy363 = yymsp[0].minor.yy363;}
break;
case 9: /* cmd ::= BEGIN transtype trans_opt */
{
- yygotominor.yy283 = new SqliteBeginTrans(
- yymsp[-1].minor.yy404->type,
- yymsp[0].minor.yy404->transactionKw,
- yymsp[0].minor.yy404->name
+ yygotominor.yy363 = new SqliteBeginTrans(
+ yymsp[-1].minor.yy84->type,
+ yymsp[0].minor.yy84->transactionKw,
+ yymsp[0].minor.yy84->name
);
- delete yymsp[0].minor.yy404;
- delete yymsp[-1].minor.yy404;
- objectForTokens = yygotominor.yy283;
+ delete yymsp[0].minor.yy84;
+ delete yymsp[-1].minor.yy84;
+ objectForTokens = yygotominor.yy363;
}
break;
case 10: /* trans_opt ::= */
case 14: /* transtype ::= */ yytestcase(yyruleno==14);
-{yygotominor.yy404 = new ParserStubTransDetails();}
+{yygotominor.yy84 = new ParserStubTransDetails();}
break;
case 11: /* trans_opt ::= TRANSACTION */
{
- yygotominor.yy404 = new ParserStubTransDetails();
- yygotominor.yy404->transactionKw = true;
+ yygotominor.yy84 = new ParserStubTransDetails();
+ yygotominor.yy84->transactionKw = true;
}
break;
case 12: /* trans_opt ::= TRANSACTION nm */
case 13: /* trans_opt ::= TRANSACTION ID_TRANS */ yytestcase(yyruleno==13);
{
- yygotominor.yy404 = new ParserStubTransDetails();
- yygotominor.yy404->transactionKw = true;
- yygotominor.yy404->name = *(yymsp[0].minor.yy399);
- delete yymsp[0].minor.yy399;
+ yygotominor.yy84 = new ParserStubTransDetails();
+ yygotominor.yy84->transactionKw = true;
+ yygotominor.yy84->name = *(yymsp[0].minor.yy319);
+ delete yymsp[0].minor.yy319;
}
break;
case 15: /* transtype ::= DEFERRED */
{
- yygotominor.yy404 = new ParserStubTransDetails();
- yygotominor.yy404->type = SqliteBeginTrans::Type::DEFERRED;
+ yygotominor.yy84 = new ParserStubTransDetails();
+ yygotominor.yy84->type = SqliteBeginTrans::Type::DEFERRED;
}
break;
case 16: /* transtype ::= IMMEDIATE */
{
- yygotominor.yy404 = new ParserStubTransDetails();
- yygotominor.yy404->type = SqliteBeginTrans::Type::IMMEDIATE;
+ yygotominor.yy84 = new ParserStubTransDetails();
+ yygotominor.yy84->type = SqliteBeginTrans::Type::IMMEDIATE;
}
break;
case 17: /* transtype ::= EXCLUSIVE */
{
- yygotominor.yy404 = new ParserStubTransDetails();
- yygotominor.yy404->type = SqliteBeginTrans::Type::EXCLUSIVE;
+ yygotominor.yy84 = new ParserStubTransDetails();
+ yygotominor.yy84->type = SqliteBeginTrans::Type::EXCLUSIVE;
}
break;
case 18: /* cmd ::= COMMIT trans_opt */
{
- yygotominor.yy283 = new SqliteCommitTrans(
- yymsp[0].minor.yy404->transactionKw,
- yymsp[0].minor.yy404->name,
+ yygotominor.yy363 = new SqliteCommitTrans(
+ yymsp[0].minor.yy84->transactionKw,
+ yymsp[0].minor.yy84->name,
false
);
- delete yymsp[0].minor.yy404;
- objectForTokens = yygotominor.yy283;
+ delete yymsp[0].minor.yy84;
+ objectForTokens = yygotominor.yy363;
}
break;
case 19: /* cmd ::= END trans_opt */
{
- yygotominor.yy283 = new SqliteCommitTrans(
- yymsp[0].minor.yy404->transactionKw,
- yymsp[0].minor.yy404->name,
+ yygotominor.yy363 = new SqliteCommitTrans(
+ yymsp[0].minor.yy84->transactionKw,
+ yymsp[0].minor.yy84->name,
true
);
- delete yymsp[0].minor.yy404;
- objectForTokens = yygotominor.yy283;
+ delete yymsp[0].minor.yy84;
+ objectForTokens = yygotominor.yy363;
}
break;
case 20: /* cmd ::= ROLLBACK trans_opt */
{
- yygotominor.yy283 = new SqliteRollback(
- yymsp[0].minor.yy404->transactionKw,
- yymsp[0].minor.yy404->name
+ yygotominor.yy363 = new SqliteRollback(
+ yymsp[0].minor.yy84->transactionKw,
+ yymsp[0].minor.yy84->name
);
- delete yymsp[0].minor.yy404;
- objectForTokens = yygotominor.yy283;
+ delete yymsp[0].minor.yy84;
+ objectForTokens = yygotominor.yy363;
}
break;
case 21: /* savepoint_opt ::= SAVEPOINT */
case 37: /* ifnotexists ::= IF NOT EXISTS */ yytestcase(yyruleno==37);
- case 86: /* autoinc ::= AUTOINCR */ yytestcase(yyruleno==86);
- case 108: /* tconscomma ::= COMMA */ yytestcase(yyruleno==108);
- case 130: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==130);
- case 311: /* not_opt ::= NOT */ yytestcase(yyruleno==311);
- case 327: /* uniqueflag ::= UNIQUE */ yytestcase(yyruleno==327);
- case 393: /* database_kw_opt ::= DATABASE */ yytestcase(yyruleno==393);
- case 409: /* kwcolumn_opt ::= */ yytestcase(yyruleno==409);
-{yygotominor.yy451 = new bool(true);}
+ case 90: /* gen_always ::= GENERATED ALWAYS */ yytestcase(yyruleno==90);
+ case 93: /* autoinc ::= AUTOINCR */ yytestcase(yyruleno==93);
+ case 115: /* tconscomma ::= COMMA */ yytestcase(yyruleno==115);
+ case 137: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==137);
+ case 317: /* not_opt ::= NOT */ yytestcase(yyruleno==317);
+ case 333: /* uniqueflag ::= UNIQUE */ yytestcase(yyruleno==333);
+ case 401: /* database_kw_opt ::= DATABASE */ yytestcase(yyruleno==401);
+ case 417: /* kwcolumn_opt ::= */ yytestcase(yyruleno==417);
+{yygotominor.yy611 = new bool(true);}
break;
case 22: /* savepoint_opt ::= */
case 36: /* ifnotexists ::= */ yytestcase(yyruleno==36);
- case 85: /* autoinc ::= */ yytestcase(yyruleno==85);
- case 109: /* tconscomma ::= */ yytestcase(yyruleno==109);
- case 131: /* ifexists ::= */ yytestcase(yyruleno==131);
- case 310: /* not_opt ::= */ yytestcase(yyruleno==310);
- case 328: /* uniqueflag ::= */ yytestcase(yyruleno==328);
- case 394: /* database_kw_opt ::= */ yytestcase(yyruleno==394);
- case 410: /* kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==410);
-{yygotominor.yy451 = new bool(false);}
+ case 91: /* gen_always ::= */ yytestcase(yyruleno==91);
+ case 92: /* autoinc ::= */ yytestcase(yyruleno==92);
+ case 116: /* tconscomma ::= */ yytestcase(yyruleno==116);
+ case 138: /* ifexists ::= */ yytestcase(yyruleno==138);
+ case 316: /* not_opt ::= */ yytestcase(yyruleno==316);
+ case 334: /* uniqueflag ::= */ yytestcase(yyruleno==334);
+ case 402: /* database_kw_opt ::= */ yytestcase(yyruleno==402);
+ case 418: /* kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==418);
+{yygotominor.yy611 = new bool(false);}
break;
case 23: /* cmd ::= SAVEPOINT nm */
{
- yygotominor.yy283 = new SqliteSavepoint(*(yymsp[0].minor.yy399));
- delete yymsp[0].minor.yy399;
- objectForTokens = yygotominor.yy283;
+ yygotominor.yy363 = new SqliteSavepoint(*(yymsp[0].minor.yy319));
+ delete yymsp[0].minor.yy319;
+ objectForTokens = yygotominor.yy363;
}
break;
case 24: /* cmd ::= RELEASE savepoint_opt nm */
{
- yygotominor.yy283 = new SqliteRelease(*(yymsp[-1].minor.yy451), *(yymsp[0].minor.yy399));
- delete yymsp[0].minor.yy399;
- objectForTokens = yygotominor.yy283;
+ yygotominor.yy363 = new SqliteRelease(*(yymsp[-1].minor.yy611), *(yymsp[0].minor.yy319));
+ delete yymsp[0].minor.yy319;
+ objectForTokens = yygotominor.yy363;
}
break;
case 25: /* cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */
case 26: /* cmd ::= SAVEPOINT ID_TRANS */ yytestcase(yyruleno==26);
{
- yygotominor.yy283 = new SqliteRollback(
- yymsp[-3].minor.yy404->transactionKw,
- *(yymsp[-1].minor.yy451),
- *(yymsp[0].minor.yy399)
+ yygotominor.yy363 = new SqliteRollback(
+ yymsp[-3].minor.yy84->transactionKw,
+ *(yymsp[-1].minor.yy611),
+ *(yymsp[0].minor.yy319)
);
- delete yymsp[-1].minor.yy451;
- delete yymsp[-3].minor.yy404;
- objectForTokens = yygotominor.yy283;
+ delete yymsp[-1].minor.yy611;
+ delete yymsp[-3].minor.yy84;
+ objectForTokens = yygotominor.yy363;
}
break;
case 27: /* cmd ::= RELEASE savepoint_opt ID_TRANS */
case 28: /* cmd ::= ROLLBACK trans_opt TO savepoint_opt ID_TRANS */ yytestcase(yyruleno==28);
-{ yy_destructor(yypParser,180,&yymsp[-1].minor);
+{ yy_destructor(yypParser,200,&yymsp[-1].minor);
}
break;
case 29: /* cmd ::= CREATE temp TABLE ifnotexists fullname LP columnlist conslist_opt RP table_options */
{
- yygotominor.yy283 = new SqliteCreateTable(
- *(yymsp[-6].minor.yy451),
- *(yymsp[-8].minor.yy146),
- yymsp[-5].minor.yy360->name1,
- yymsp[-5].minor.yy360->name2,
- *(yymsp[-3].minor.yy202),
- *(yymsp[-2].minor.yy333),
- *(yymsp[0].minor.yy399)
+ yygotominor.yy363 = new SqliteCreateTable(
+ *(yymsp[-6].minor.yy611),
+ *(yymsp[-8].minor.yy386),
+ yymsp[-5].minor.yy440->name1,
+ yymsp[-5].minor.yy440->name2,
+ *(yymsp[-3].minor.yy42),
+ *(yymsp[-2].minor.yy493),
+ *(yymsp[0].minor.yy319)
);
- delete yymsp[-6].minor.yy451;
- delete yymsp[-8].minor.yy146;
- delete yymsp[-3].minor.yy202;
- delete yymsp[-2].minor.yy333;
- delete yymsp[-5].minor.yy360;
- delete yymsp[0].minor.yy399;
- objectForTokens = yygotominor.yy283;
+ delete yymsp[-6].minor.yy611;
+ delete yymsp[-8].minor.yy386;
+ delete yymsp[-3].minor.yy42;
+ delete yymsp[-2].minor.yy493;
+ delete yymsp[-5].minor.yy440;
+ delete yymsp[0].minor.yy319;
+ objectForTokens = yygotominor.yy363;
}
break;
case 30: /* cmd ::= CREATE temp TABLE ifnotexists fullname AS select */
{
- yygotominor.yy283 = new SqliteCreateTable(
- *(yymsp[-3].minor.yy451),
- *(yymsp[-5].minor.yy146),
- yymsp[-2].minor.yy360->name1,
- yymsp[-2].minor.yy360->name2,
- yymsp[0].minor.yy473
+ yygotominor.yy363 = new SqliteCreateTable(
+ *(yymsp[-3].minor.yy611),
+ *(yymsp[-5].minor.yy386),
+ yymsp[-2].minor.yy440->name1,
+ yymsp[-2].minor.yy440->name2,
+ yymsp[0].minor.yy313
);
- delete yymsp[-3].minor.yy451;
- delete yymsp[-5].minor.yy146;
- delete yymsp[-2].minor.yy360;
- objectForTokens = yygotominor.yy283;
+ delete yymsp[-3].minor.yy611;
+ delete yymsp[-5].minor.yy386;
+ delete yymsp[-2].minor.yy440;
+ objectForTokens = yygotominor.yy363;
}
break;
case 31: /* cmd ::= CREATE temp TABLE ifnotexists nm DOT ID_TAB_NEW */
- case 133: /* cmd ::= CREATE temp VIEW ifnotexists nm DOT ID_VIEW_NEW */ yytestcase(yyruleno==133);
- case 364: /* cmd ::= CREATE temp TRIGGER ifnotexists nm DOT ID_TRIG_NEW */ yytestcase(yyruleno==364);
-{ yy_destructor(yypParser,181,&yymsp[-5].minor);
- yy_destructor(yypParser,179,&yymsp[-2].minor);
+ case 140: /* cmd ::= CREATE temp VIEW ifnotexists nm DOT ID_VIEW_NEW */ yytestcase(yyruleno==140);
+ case 372: /* cmd ::= CREATE temp TRIGGER ifnotexists nm DOT ID_TRIG_NEW */ yytestcase(yyruleno==372);
+{ yy_destructor(yypParser,201,&yymsp[-5].minor);
+ yy_destructor(yypParser,199,&yymsp[-2].minor);
}
break;
case 32: /* cmd ::= CREATE temp TABLE ifnotexists ID_DB|ID_TAB_NEW */
- case 134: /* cmd ::= CREATE temp VIEW ifnotexists ID_DB|ID_VIEW_NEW */ yytestcase(yyruleno==134);
- case 365: /* cmd ::= CREATE temp TRIGGER ifnotexists ID_DB|ID_TRIG_NEW */ yytestcase(yyruleno==365);
-{ yy_destructor(yypParser,181,&yymsp[-3].minor);
+ case 141: /* cmd ::= CREATE temp VIEW ifnotexists ID_DB|ID_VIEW_NEW */ yytestcase(yyruleno==141);
+ case 373: /* cmd ::= CREATE temp TRIGGER ifnotexists ID_DB|ID_TRIG_NEW */ yytestcase(yyruleno==373);
+{ yy_destructor(yypParser,201,&yymsp[-3].minor);
}
break;
case 33: /* table_options ::= */
- case 186: /* dbnm ::= */ yytestcase(yyruleno==186);
- case 335: /* collate ::= */ yytestcase(yyruleno==335);
- case 418: /* vtabarg ::= */ yytestcase(yyruleno==418);
- case 422: /* anylist ::= */ yytestcase(yyruleno==422);
-{yygotominor.yy399 = new QString();}
+ case 194: /* dbnm ::= */ yytestcase(yyruleno==194);
+ case 341: /* collate ::= */ yytestcase(yyruleno==341);
+ case 426: /* vtabarg ::= */ yytestcase(yyruleno==426);
+ case 430: /* anylist ::= */ yytestcase(yyruleno==430);
+{yygotominor.yy319 = new QString();}
break;
case 34: /* table_options ::= WITHOUT nm */
case 35: /* table_options ::= WITHOUT CTX_ROWID_KW */ yytestcase(yyruleno==35);
{
- if (yymsp[0].minor.yy399->toLower() != "rowid")
- parserContext->errorAtToken(QString("Invalid table option: %1").arg(*(yymsp[0].minor.yy399)));
+ if (yymsp[0].minor.yy319->toLower() != "rowid")
+ parserContext->errorAtToken(QString("Invalid table option: %1").arg(*(yymsp[0].minor.yy319)));
- yygotominor.yy399 = yymsp[0].minor.yy399;
+ yygotominor.yy319 = yymsp[0].minor.yy319;
}
break;
case 38: /* temp ::= TEMP */
-{yygotominor.yy146 = new int( (yymsp[0].minor.yy0->value.length() > 4) ? 2 : 1 );}
+{yygotominor.yy386 = new int( (yymsp[0].minor.yy0->value.length() > 4) ? 2 : 1 );}
break;
case 39: /* temp ::= */
- case 154: /* distinct ::= */ yytestcase(yyruleno==154);
-{yygotominor.yy146 = new int(0);}
+ case 162: /* distinct ::= */ yytestcase(yyruleno==162);
+{yygotominor.yy386 = new int(0);}
break;
case 40: /* columnlist ::= columnlist COMMA column */
{
- yymsp[-2].minor.yy202->append(yymsp[0].minor.yy227);
- yygotominor.yy202 = yymsp[-2].minor.yy202;
+ yymsp[-2].minor.yy42->append(yymsp[0].minor.yy147);
+ yygotominor.yy42 = yymsp[-2].minor.yy42;
DONT_INHERIT_TOKENS("columnlist");
}
break;
case 41: /* columnlist ::= column */
{
- yygotominor.yy202 = new ParserCreateTableColumnList();
- yygotominor.yy202->append(yymsp[0].minor.yy227);
+ yygotominor.yy42 = new ParserCreateTableColumnList();
+ yygotominor.yy42->append(yymsp[0].minor.yy147);
}
break;
case 42: /* column ::= columnid type carglist */
{
- yygotominor.yy227 = new SqliteCreateTable::Column(*(yymsp[-2].minor.yy399), yymsp[-1].minor.yy537, *(yymsp[0].minor.yy51));
- delete yymsp[-2].minor.yy399;
+ yygotominor.yy147 = new SqliteCreateTable::Column(*(yymsp[-2].minor.yy319), yymsp[-1].minor.yy57, *(yymsp[0].minor.yy51));
+ delete yymsp[-2].minor.yy319;
delete yymsp[0].minor.yy51;
- objectForTokens = yygotominor.yy227;
+ objectForTokens = yygotominor.yy147;
}
break;
case 43: /* columnid ::= nm */
case 44: /* columnid ::= ID_COL_NEW */ yytestcase(yyruleno==44);
- case 47: /* nm ::= id */ yytestcase(yyruleno==47);
- case 55: /* typename ::= ids */ yytestcase(yyruleno==55);
- case 187: /* dbnm ::= DOT nm */ yytestcase(yyruleno==187);
- case 336: /* collate ::= COLLATE ids */ yytestcase(yyruleno==336);
- case 337: /* collate ::= COLLATE ID_COLLATE */ yytestcase(yyruleno==337);
-{yygotominor.yy399 = yymsp[0].minor.yy399;}
+ case 49: /* nm ::= id */ yytestcase(yyruleno==49);
+ case 57: /* typename ::= ids */ yytestcase(yyruleno==57);
+ case 195: /* dbnm ::= DOT nm */ yytestcase(yyruleno==195);
+ case 342: /* collate ::= COLLATE ids */ yytestcase(yyruleno==342);
+ case 343: /* collate ::= COLLATE ID_COLLATE */ yytestcase(yyruleno==343);
+{yygotominor.yy319 = yymsp[0].minor.yy319;}
break;
case 45: /* id ::= ID */
{
- yygotominor.yy399 = new QString(
+ yygotominor.yy319 = new QString(
stripObjName(
- yymsp[0].minor.yy0->value,
- parserContext->dialect
+ yymsp[0].minor.yy0->value
)
);
}
break;
- case 46: /* ids ::= ID|STRING */
- case 49: /* nm ::= JOIN_KW */ yytestcase(yyruleno==49);
-{yygotominor.yy399 = new QString(yymsp[0].minor.yy0->value);}
+ case 46: /* id_opt ::= id */
+{
+ yygotominor.yy319 = yymsp[0].minor.yy319;
+ }
+ break;
+ case 47: /* id_opt ::= */
+{
+ yygotominor.yy319 = new QString();
+ }
+ break;
+ case 48: /* ids ::= ID|STRING */
+ case 51: /* nm ::= JOIN_KW */ yytestcase(yyruleno==51);
+{yygotominor.yy319 = new QString(yymsp[0].minor.yy0->value);}
break;
- case 48: /* nm ::= STRING */
-{yygotominor.yy399 = new QString(stripString(yymsp[0].minor.yy0->value));}
+ case 50: /* nm ::= STRING */
+{yygotominor.yy319 = new QString(stripString(yymsp[0].minor.yy0->value));}
break;
- case 50: /* type ::= */
-{yygotominor.yy537 = nullptr;}
+ case 52: /* type ::= */
+{yygotominor.yy57 = nullptr;}
break;
- case 51: /* type ::= typetoken */
-{yygotominor.yy537 = yymsp[0].minor.yy537;}
+ case 53: /* type ::= typetoken */
+{yygotominor.yy57 = yymsp[0].minor.yy57;}
break;
- case 52: /* typetoken ::= typename */
+ case 54: /* typetoken ::= typename */
{
- yygotominor.yy537 = new SqliteColumnType(*(yymsp[0].minor.yy399));
- delete yymsp[0].minor.yy399;
- objectForTokens = yygotominor.yy537;
+ yygotominor.yy57 = new SqliteColumnType(*(yymsp[0].minor.yy319));
+ delete yymsp[0].minor.yy319;
+ objectForTokens = yygotominor.yy57;
}
break;
- case 53: /* typetoken ::= typename LP signed RP */
+ case 55: /* typetoken ::= typename LP signed RP */
{
- yygotominor.yy537 = new SqliteColumnType(*(yymsp[-3].minor.yy399), *(yymsp[-1].minor.yy469));
- delete yymsp[-3].minor.yy399;
- delete yymsp[-1].minor.yy469;
- objectForTokens = yygotominor.yy537;
+ yygotominor.yy57 = new SqliteColumnType(*(yymsp[-3].minor.yy319), *(yymsp[-1].minor.yy229));
+ delete yymsp[-3].minor.yy319;
+ delete yymsp[-1].minor.yy229;
+ objectForTokens = yygotominor.yy57;
}
break;
- case 54: /* typetoken ::= typename LP signed COMMA signed RP */
+ case 56: /* typetoken ::= typename LP signed COMMA signed RP */
{
- yygotominor.yy537 = new SqliteColumnType(*(yymsp[-5].minor.yy399), *(yymsp[-3].minor.yy469), *(yymsp[-1].minor.yy469));
- delete yymsp[-5].minor.yy399;
- delete yymsp[-3].minor.yy469;
- delete yymsp[-1].minor.yy469;
- objectForTokens = yygotominor.yy537;
+ yygotominor.yy57 = new SqliteColumnType(*(yymsp[-5].minor.yy319), *(yymsp[-3].minor.yy229), *(yymsp[-1].minor.yy229));
+ delete yymsp[-5].minor.yy319;
+ delete yymsp[-3].minor.yy229;
+ delete yymsp[-1].minor.yy229;
+ objectForTokens = yygotominor.yy57;
}
break;
- case 56: /* typename ::= typename ids */
- case 57: /* typename ::= ID_COL_TYPE */ yytestcase(yyruleno==57);
+ case 58: /* typename ::= typename ids */
+ case 59: /* typename ::= ID_COL_TYPE */ yytestcase(yyruleno==59);
{
- yymsp[-1].minor.yy399->append(" " + *(yymsp[0].minor.yy399));
- delete yymsp[0].minor.yy399;
- yygotominor.yy399 = yymsp[-1].minor.yy399;
+ yymsp[-1].minor.yy319->append(" " + *(yymsp[0].minor.yy319));
+ delete yymsp[0].minor.yy319;
+ yygotominor.yy319 = yymsp[-1].minor.yy319;
}
break;
- case 58: /* signed ::= plus_num */
- case 59: /* signed ::= minus_num */ yytestcase(yyruleno==59);
- case 350: /* nmnum ::= plus_num */ yytestcase(yyruleno==350);
- case 355: /* plus_num ::= PLUS number */ yytestcase(yyruleno==355);
- case 356: /* plus_num ::= number */ yytestcase(yyruleno==356);
-{yygotominor.yy469 = yymsp[0].minor.yy469;}
+ case 60: /* signed ::= plus_num */
+ case 61: /* signed ::= minus_num */ yytestcase(yyruleno==61);
+ case 358: /* nmnum ::= plus_num */ yytestcase(yyruleno==358);
+ case 363: /* plus_num ::= PLUS number */ yytestcase(yyruleno==363);
+ case 364: /* plus_num ::= number */ yytestcase(yyruleno==364);
+{yygotominor.yy229 = yymsp[0].minor.yy229;}
break;
- case 60: /* carglist ::= carglist ccons */
+ case 62: /* carglist ::= carglist ccons */
{
- yymsp[-1].minor.yy51->append(yymsp[0].minor.yy304);
+ yymsp[-1].minor.yy51->append(yymsp[0].minor.yy464);
yygotominor.yy51 = yymsp[-1].minor.yy51;
DONT_INHERIT_TOKENS("carglist");
}
break;
- case 61: /* carglist ::= */
+ case 63: /* carglist ::= */
{yygotominor.yy51 = new ParserCreateTableColumnConstraintList();}
break;
- case 62: /* ccons ::= CONSTRAINT nm */
+ case 64: /* ccons ::= CONSTRAINT nm */
{
- yygotominor.yy304 = new SqliteCreateTable::Column::Constraint();
- yygotominor.yy304->initDefNameOnly(*(yymsp[0].minor.yy399));
- delete yymsp[0].minor.yy399;
- objectForTokens = yygotominor.yy304;
+ yygotominor.yy464 = new SqliteCreateTable::Column::Constraint();
+ yygotominor.yy464->initDefNameOnly(*(yymsp[0].minor.yy319));
+ delete yymsp[0].minor.yy319;
+ objectForTokens = yygotominor.yy464;
}
break;
- case 63: /* ccons ::= DEFAULT term */
+ case 65: /* ccons ::= DEFAULT term */
{
- yygotominor.yy304 = new SqliteCreateTable::Column::Constraint();
- yygotominor.yy304->initDefTerm(*(yymsp[0].minor.yy469));
- delete yymsp[0].minor.yy469;
- objectForTokens = yygotominor.yy304;
+ yygotominor.yy464 = new SqliteCreateTable::Column::Constraint();
+ yygotominor.yy464->initDefTerm(*(yymsp[0].minor.yy229));
+ delete yymsp[0].minor.yy229;
+ objectForTokens = yygotominor.yy464;
}
break;
- case 64: /* ccons ::= DEFAULT LP expr RP */
+ case 66: /* ccons ::= DEFAULT LP expr RP */
{
- yygotominor.yy304 = new SqliteCreateTable::Column::Constraint();
- yygotominor.yy304->initDefExpr(yymsp[-1].minor.yy352);
- objectForTokens = yygotominor.yy304;
+ yygotominor.yy464 = new SqliteCreateTable::Column::Constraint();
+ yygotominor.yy464->initDefExpr(yymsp[-1].minor.yy512);
+ objectForTokens = yygotominor.yy464;
}
break;
- case 65: /* ccons ::= DEFAULT PLUS term */
+ case 67: /* ccons ::= DEFAULT PLUS term */
{
- yygotominor.yy304 = new SqliteCreateTable::Column::Constraint();
- yygotominor.yy304->initDefTerm(*(yymsp[0].minor.yy469), false);
- delete yymsp[0].minor.yy469;
- objectForTokens = yygotominor.yy304;
+ yygotominor.yy464 = new SqliteCreateTable::Column::Constraint();
+ yygotominor.yy464->initDefTerm(*(yymsp[0].minor.yy229), false);
+ delete yymsp[0].minor.yy229;
+ objectForTokens = yygotominor.yy464;
}
break;
- case 66: /* ccons ::= DEFAULT MINUS term */
+ case 68: /* ccons ::= DEFAULT MINUS term */
{
- yygotominor.yy304 = new SqliteCreateTable::Column::Constraint();
- yygotominor.yy304->initDefTerm(*(yymsp[0].minor.yy469), true);
- delete yymsp[0].minor.yy469;
- objectForTokens = yygotominor.yy304;
+ yygotominor.yy464 = new SqliteCreateTable::Column::Constraint();
+ yygotominor.yy464->initDefTerm(*(yymsp[0].minor.yy229), true);
+ delete yymsp[0].minor.yy229;
+ objectForTokens = yygotominor.yy464;
}
break;
- case 67: /* ccons ::= DEFAULT id */
+ case 69: /* ccons ::= DEFAULT id */
{
- yygotominor.yy304 = new SqliteCreateTable::Column::Constraint();
- yygotominor.yy304->initDefId(*(yymsp[0].minor.yy399));
- delete yymsp[0].minor.yy399;
- objectForTokens = yygotominor.yy304;
+ yygotominor.yy464 = new SqliteCreateTable::Column::Constraint();
+ yygotominor.yy464->initDefId(*(yymsp[0].minor.yy319));
+ delete yymsp[0].minor.yy319;
+ objectForTokens = yygotominor.yy464;
}
break;
- case 68: /* ccons ::= DEFAULT CTIME_KW */
+ case 70: /* ccons ::= DEFAULT CTIME_KW */
{
- yygotominor.yy304 = new SqliteCreateTable::Column::Constraint();
- yygotominor.yy304->initDefCTime(yymsp[0].minor.yy0->value);
- objectForTokens = yygotominor.yy304;
+ yygotominor.yy464 = new SqliteCreateTable::Column::Constraint();
+ yygotominor.yy464->initDefCTime(yymsp[0].minor.yy0->value);
+ objectForTokens = yygotominor.yy464;
}
break;
- case 69: /* ccons ::= NULL onconf */
+ case 71: /* ccons ::= NULL onconf */
{
- yygotominor.yy304 = new SqliteCreateTable::Column::Constraint();
- yygotominor.yy304->initNull(*(yymsp[0].minor.yy338));
- delete yymsp[0].minor.yy338;
- objectForTokens = yygotominor.yy304;
+ yygotominor.yy464 = new SqliteCreateTable::Column::Constraint();
+ yygotominor.yy464->initNull(*(yymsp[0].minor.yy418));
+ delete yymsp[0].minor.yy418;
+ objectForTokens = yygotominor.yy464;
}
break;
- case 70: /* ccons ::= NOT NULL onconf */
+ case 72: /* ccons ::= NOT NULL onconf */
{
- yygotominor.yy304 = new SqliteCreateTable::Column::Constraint();
- yygotominor.yy304->initNotNull(*(yymsp[0].minor.yy338));
- delete yymsp[0].minor.yy338;
- objectForTokens = yygotominor.yy304;
+ yygotominor.yy464 = new SqliteCreateTable::Column::Constraint();
+ yygotominor.yy464->initNotNull(*(yymsp[0].minor.yy418));
+ delete yymsp[0].minor.yy418;
+ objectForTokens = yygotominor.yy464;
}
break;
- case 71: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */
+ case 73: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */
{
- yygotominor.yy304 = new SqliteCreateTable::Column::Constraint();
- yygotominor.yy304->initPk(*(yymsp[-2].minor.yy309), *(yymsp[-1].minor.yy338), *(yymsp[0].minor.yy451));
- delete yymsp[-2].minor.yy309;
- delete yymsp[0].minor.yy451;
- delete yymsp[-1].minor.yy338;
- objectForTokens = yygotominor.yy304;
+ yygotominor.yy464 = new SqliteCreateTable::Column::Constraint();
+ yygotominor.yy464->initPk(*(yymsp[-2].minor.yy549), *(yymsp[-1].minor.yy418), *(yymsp[0].minor.yy611));
+ delete yymsp[-2].minor.yy549;
+ delete yymsp[0].minor.yy611;
+ delete yymsp[-1].minor.yy418;
+ objectForTokens = yygotominor.yy464;
}
break;
- case 72: /* ccons ::= UNIQUE onconf */
+ case 74: /* ccons ::= UNIQUE onconf */
{
- yygotominor.yy304 = new SqliteCreateTable::Column::Constraint();
- yygotominor.yy304->initUnique(*(yymsp[0].minor.yy338));
- delete yymsp[0].minor.yy338;
- objectForTokens = yygotominor.yy304;
+ yygotominor.yy464 = new SqliteCreateTable::Column::Constraint();
+ yygotominor.yy464->initUnique(*(yymsp[0].minor.yy418));
+ delete yymsp[0].minor.yy418;
+ objectForTokens = yygotominor.yy464;
}
break;
- case 73: /* ccons ::= CHECK LP expr RP */
+ case 75: /* ccons ::= CHECK LP expr RP */
{
- yygotominor.yy304 = new SqliteCreateTable::Column::Constraint();
- yygotominor.yy304->initCheck(yymsp[-1].minor.yy352);
- objectForTokens = yygotominor.yy304;
+ yygotominor.yy464 = new SqliteCreateTable::Column::Constraint();
+ yygotominor.yy464->initCheck(yymsp[-1].minor.yy512);
+ objectForTokens = yygotominor.yy464;
}
break;
- case 74: /* ccons ::= REFERENCES nm idxlist_opt refargs */
+ case 76: /* ccons ::= REFERENCES nm idxlist_opt refargs */
{
- yygotominor.yy304 = new SqliteCreateTable::Column::Constraint();
- yygotominor.yy304->initFk(*(yymsp[-2].minor.yy399), *(yymsp[-1].minor.yy223), *(yymsp[0].minor.yy184));
- delete yymsp[-2].minor.yy399;
- delete yymsp[0].minor.yy184;
+ yygotominor.yy464 = new SqliteCreateTable::Column::Constraint();
+ yygotominor.yy464->initFk(*(yymsp[-2].minor.yy319), *(yymsp[-1].minor.yy223), *(yymsp[0].minor.yy584));
+ delete yymsp[-2].minor.yy319;
+ delete yymsp[0].minor.yy584;
delete yymsp[-1].minor.yy223;
- objectForTokens = yygotominor.yy304;
+ objectForTokens = yygotominor.yy464;
}
break;
- case 75: /* ccons ::= defer_subclause */
+ case 77: /* ccons ::= defer_subclause */
{
- yygotominor.yy304 = new SqliteCreateTable::Column::Constraint();
- yygotominor.yy304->initDefer(yymsp[0].minor.yy329->initially, yymsp[0].minor.yy329->deferrable);
- delete yymsp[0].minor.yy329;
- objectForTokens = yygotominor.yy304;
+ yygotominor.yy464 = new SqliteCreateTable::Column::Constraint();
+ yygotominor.yy464->initDefer(yymsp[0].minor.yy9->initially, yymsp[0].minor.yy9->deferrable);
+ delete yymsp[0].minor.yy9;
+ objectForTokens = yygotominor.yy464;
}
break;
- case 76: /* ccons ::= COLLATE ids */
- case 77: /* ccons ::= CONSTRAINT ID_CONSTR */ yytestcase(yyruleno==77);
- case 78: /* ccons ::= COLLATE ID_COLLATE */ yytestcase(yyruleno==78);
- case 79: /* ccons ::= REFERENCES ID_TAB */ yytestcase(yyruleno==79);
+ case 78: /* ccons ::= COLLATE ids */
{
- yygotominor.yy304 = new SqliteCreateTable::Column::Constraint();
- yygotominor.yy304->initColl(*(yymsp[0].minor.yy399));
- delete yymsp[0].minor.yy399;
- objectForTokens = yygotominor.yy304;
+ yygotominor.yy464 = new SqliteCreateTable::Column::Constraint();
+ yygotominor.yy464->initColl(*(yymsp[0].minor.yy319));
+ delete yymsp[0].minor.yy319;
+ objectForTokens = yygotominor.yy464;
}
break;
- case 80: /* ccons ::= CHECK LP RP */
+ case 79: /* ccons ::= gen_always AS LP expr RP id_opt */
+ case 80: /* ccons ::= CONSTRAINT ID_CONSTR */ yytestcase(yyruleno==80);
+ case 81: /* ccons ::= COLLATE ID_COLLATE */ yytestcase(yyruleno==81);
+ case 82: /* ccons ::= REFERENCES ID_TAB */ yytestcase(yyruleno==82);
{
- yygotominor.yy304 = new SqliteCreateTable::Column::Constraint();
- yygotominor.yy304->initCheck();
- objectForTokens = yygotominor.yy304;
+ if (!yymsp[0].minor.yy319->isNull() && yymsp[0].minor.yy319->toLower() != "stored" && yymsp[0].minor.yy319->toLower() != "virtual")
+ parserContext->errorAtToken(QString("Invalid generated column type: %1").arg(*(yymsp[0].minor.yy319)));
+
+ yygotominor.yy464 = new SqliteCreateTable::Column::Constraint();
+ yygotominor.yy464->initGeneratedAs(yymsp[-2].minor.yy512, *(yymsp[-5].minor.yy611), *(yymsp[0].minor.yy319));
+ delete yymsp[-5].minor.yy611;
+ delete yymsp[0].minor.yy319;
+ objectForTokens = yygotominor.yy464;
+ }
+ break;
+ case 83: /* ccons ::= CHECK LP RP */
+{
+ yygotominor.yy464 = new SqliteCreateTable::Column::Constraint();
+ yygotominor.yy464->initCheck();
+ objectForTokens = yygotominor.yy464;
parserContext->minorErrorAfterLastToken("Syntax error");
}
break;
- case 81: /* term ::= NULL */
-{yygotominor.yy469 = new QVariant();}
+ case 84: /* term ::= NULL */
+{yygotominor.yy229 = new QVariant();}
+ break;
+ case 85: /* term ::= INTEGER */
+ case 366: /* number ::= INTEGER */ yytestcase(yyruleno==366);
+{yygotominor.yy229 = parserContext->handleNumberToken(yymsp[0].minor.yy0->value);}
+ break;
+ case 86: /* term ::= FLOAT */
+ case 367: /* number ::= FLOAT */ yytestcase(yyruleno==367);
+{yygotominor.yy229 = new QVariant(QVariant(yymsp[0].minor.yy0->value).toDouble());}
break;
- case 82: /* term ::= INTEGER */
- case 358: /* number ::= INTEGER */ yytestcase(yyruleno==358);
-{yygotominor.yy469 = parserContext->handleNumberToken(yymsp[0].minor.yy0->value);}
+ case 87: /* term ::= STRING|BLOB */
+{yygotominor.yy229 = new QVariant(stripString(yymsp[0].minor.yy0->value));}
break;
- case 83: /* term ::= FLOAT */
- case 359: /* number ::= FLOAT */ yytestcase(yyruleno==359);
-{yygotominor.yy469 = new QVariant(QVariant(yymsp[0].minor.yy0->value).toDouble());}
+ case 88: /* tnm ::= term */
+{
+ yygotominor.yy590 = new ParserTermOrLiteral(*(yymsp[0].minor.yy229));
+ delete yymsp[0].minor.yy229;
+ }
break;
- case 84: /* term ::= STRING|BLOB */
- case 352: /* nmnum ::= ON */ yytestcase(yyruleno==352);
- case 353: /* nmnum ::= DELETE */ yytestcase(yyruleno==353);
- case 354: /* nmnum ::= DEFAULT */ yytestcase(yyruleno==354);
-{yygotominor.yy469 = new QVariant(yymsp[0].minor.yy0->value);}
+ case 89: /* tnm ::= nm */
+{
+ yygotominor.yy590 = new ParserTermOrLiteral(*(yymsp[0].minor.yy319));
+ delete yymsp[0].minor.yy319;
+ }
break;
- case 87: /* refargs ::= */
-{yygotominor.yy184 = new ParserFkConditionList();}
+ case 94: /* refargs ::= */
+{yygotominor.yy584 = new ParserFkConditionList();}
break;
- case 88: /* refargs ::= refargs refarg */
+ case 95: /* refargs ::= refargs refarg */
{
- yymsp[-1].minor.yy184->append(yymsp[0].minor.yy347);
- yygotominor.yy184 = yymsp[-1].minor.yy184;
+ yymsp[-1].minor.yy584->append(yymsp[0].minor.yy507);
+ yygotominor.yy584 = yymsp[-1].minor.yy584;
DONT_INHERIT_TOKENS("refargs");
}
break;
- case 89: /* refarg ::= MATCH nm */
+ case 96: /* refarg ::= MATCH nm */
{
- yygotominor.yy347 = new SqliteForeignKey::Condition(*(yymsp[0].minor.yy399));
- delete yymsp[0].minor.yy399;
+ yygotominor.yy507 = new SqliteForeignKey::Condition(*(yymsp[0].minor.yy319));
+ delete yymsp[0].minor.yy319;
}
break;
- case 90: /* refarg ::= ON INSERT refact */
-{yygotominor.yy347 = new SqliteForeignKey::Condition(SqliteForeignKey::Condition::INSERT, *(yymsp[0].minor.yy104)); delete yymsp[0].minor.yy104;}
+ case 97: /* refarg ::= ON INSERT refact */
+{yygotominor.yy507 = new SqliteForeignKey::Condition(SqliteForeignKey::Condition::INSERT, *(yymsp[0].minor.yy104)); delete yymsp[0].minor.yy104;}
break;
- case 91: /* refarg ::= ON DELETE refact */
-{yygotominor.yy347 = new SqliteForeignKey::Condition(SqliteForeignKey::Condition::DELETE, *(yymsp[0].minor.yy104)); delete yymsp[0].minor.yy104;}
+ case 98: /* refarg ::= ON DELETE refact */
+{yygotominor.yy507 = new SqliteForeignKey::Condition(SqliteForeignKey::Condition::DELETE, *(yymsp[0].minor.yy104)); delete yymsp[0].minor.yy104;}
break;
- case 92: /* refarg ::= ON UPDATE refact */
- case 93: /* refarg ::= MATCH ID_FK_MATCH */ yytestcase(yyruleno==93);
-{yygotominor.yy347 = new SqliteForeignKey::Condition(SqliteForeignKey::Condition::UPDATE, *(yymsp[0].minor.yy104)); delete yymsp[0].minor.yy104;}
+ case 99: /* refarg ::= ON UPDATE refact */
+ case 100: /* refarg ::= MATCH ID_FK_MATCH */ yytestcase(yyruleno==100);
+{yygotominor.yy507 = new SqliteForeignKey::Condition(SqliteForeignKey::Condition::UPDATE, *(yymsp[0].minor.yy104)); delete yymsp[0].minor.yy104;}
break;
- case 94: /* refact ::= SET NULL */
+ case 101: /* refact ::= SET NULL */
{yygotominor.yy104 = new SqliteForeignKey::Condition::Reaction(SqliteForeignKey::Condition::SET_NULL);}
break;
- case 95: /* refact ::= SET DEFAULT */
+ case 102: /* refact ::= SET DEFAULT */
{yygotominor.yy104 = new SqliteForeignKey::Condition::Reaction(SqliteForeignKey::Condition::SET_DEFAULT);}
break;
- case 96: /* refact ::= CASCADE */
+ case 103: /* refact ::= CASCADE */
{yygotominor.yy104 = new SqliteForeignKey::Condition::Reaction(SqliteForeignKey::Condition::CASCADE);}
break;
- case 97: /* refact ::= RESTRICT */
+ case 104: /* refact ::= RESTRICT */
{yygotominor.yy104 = new SqliteForeignKey::Condition::Reaction(SqliteForeignKey::Condition::RESTRICT);}
break;
- case 98: /* refact ::= NO ACTION */
+ case 105: /* refact ::= NO ACTION */
{yygotominor.yy104 = new SqliteForeignKey::Condition::Reaction(SqliteForeignKey::Condition::NO_ACTION);}
break;
- case 99: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
+ case 106: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
{
- yygotominor.yy329 = new ParserDeferSubClause(SqliteDeferrable::NOT_DEFERRABLE, *(yymsp[0].minor.yy392));
- delete yymsp[0].minor.yy392;
+ yygotominor.yy9 = new ParserDeferSubClause(SqliteDeferrable::NOT_DEFERRABLE, *(yymsp[0].minor.yy312));
+ delete yymsp[0].minor.yy312;
}
break;
- case 100: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
+ case 107: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
{
- yygotominor.yy329 = new ParserDeferSubClause(SqliteDeferrable::DEFERRABLE, *(yymsp[0].minor.yy392));
- delete yymsp[0].minor.yy392;
+ yygotominor.yy9 = new ParserDeferSubClause(SqliteDeferrable::DEFERRABLE, *(yymsp[0].minor.yy312));
+ delete yymsp[0].minor.yy312;
}
break;
- case 101: /* init_deferred_pred_opt ::= */
-{yygotominor.yy392 = new SqliteInitially(SqliteInitially::null);}
+ case 108: /* init_deferred_pred_opt ::= */
+{yygotominor.yy312 = new SqliteInitially(SqliteInitially::null);}
break;
- case 102: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */
-{yygotominor.yy392 = new SqliteInitially(SqliteInitially::DEFERRED);}
+ case 109: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */
+{yygotominor.yy312 = new SqliteInitially(SqliteInitially::DEFERRED);}
break;
- case 103: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
-{yygotominor.yy392 = new SqliteInitially(SqliteInitially::IMMEDIATE);}
+ case 110: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
+{yygotominor.yy312 = new SqliteInitially(SqliteInitially::IMMEDIATE);}
break;
- case 104: /* conslist_opt ::= */
-{yygotominor.yy333 = new ParserCreateTableConstraintList();}
+ case 111: /* conslist_opt ::= */
+{yygotominor.yy493 = new ParserCreateTableConstraintList();}
break;
- case 105: /* conslist_opt ::= COMMA conslist */
-{yygotominor.yy333 = yymsp[0].minor.yy333;}
+ case 112: /* conslist_opt ::= COMMA conslist */
+{yygotominor.yy493 = yymsp[0].minor.yy493;}
break;
- case 106: /* conslist ::= conslist tconscomma tcons */
+ case 113: /* conslist ::= conslist tconscomma tcons */
{
- yymsp[0].minor.yy406->afterComma = *(yymsp[-1].minor.yy451);
- yymsp[-2].minor.yy333->append(yymsp[0].minor.yy406);
- yygotominor.yy333 = yymsp[-2].minor.yy333;
- delete yymsp[-1].minor.yy451;
+ yymsp[0].minor.yy246->afterComma = *(yymsp[-1].minor.yy611);
+ yymsp[-2].minor.yy493->append(yymsp[0].minor.yy246);
+ yygotominor.yy493 = yymsp[-2].minor.yy493;
+ delete yymsp[-1].minor.yy611;
DONT_INHERIT_TOKENS("conslist");
}
break;
- case 107: /* conslist ::= tcons */
+ case 114: /* conslist ::= tcons */
{
- yygotominor.yy333 = new ParserCreateTableConstraintList();
- yygotominor.yy333->append(yymsp[0].minor.yy406);
+ yygotominor.yy493 = new ParserCreateTableConstraintList();
+ yygotominor.yy493->append(yymsp[0].minor.yy246);
}
break;
- case 110: /* tcons ::= CONSTRAINT nm */
+ case 117: /* tcons ::= CONSTRAINT nm */
{
- yygotominor.yy406 = new SqliteCreateTable::Constraint();
- yygotominor.yy406->initNameOnly(*(yymsp[0].minor.yy399));
- delete yymsp[0].minor.yy399;
- objectForTokens = yygotominor.yy406;
+ yygotominor.yy246 = new SqliteCreateTable::Constraint();
+ yygotominor.yy246->initNameOnly(*(yymsp[0].minor.yy319));
+ delete yymsp[0].minor.yy319;
+ objectForTokens = yygotominor.yy246;
}
break;
- case 111: /* tcons ::= PRIMARY KEY LP idxlist autoinc RP onconf */
+ case 118: /* tcons ::= PRIMARY KEY LP idxlist autoinc RP onconf */
{
- yygotominor.yy406 = new SqliteCreateTable::Constraint();
- yygotominor.yy406->initPk(*(yymsp[-3].minor.yy223), *(yymsp[-2].minor.yy451), *(yymsp[0].minor.yy338));
- delete yymsp[-2].minor.yy451;
- delete yymsp[0].minor.yy338;
+ yygotominor.yy246 = new SqliteCreateTable::Constraint();
+ yygotominor.yy246->initPk(*(yymsp[-3].minor.yy223), *(yymsp[-2].minor.yy611), *(yymsp[0].minor.yy418));
+ delete yymsp[-2].minor.yy611;
+ delete yymsp[0].minor.yy418;
delete yymsp[-3].minor.yy223;
- objectForTokens = yygotominor.yy406;
+ objectForTokens = yygotominor.yy246;
}
break;
- case 112: /* tcons ::= UNIQUE LP idxlist RP onconf */
+ case 119: /* tcons ::= UNIQUE LP idxlist RP onconf */
{
- yygotominor.yy406 = new SqliteCreateTable::Constraint();
- yygotominor.yy406->initUnique(*(yymsp[-2].minor.yy223), *(yymsp[0].minor.yy338));
- delete yymsp[0].minor.yy338;
+ yygotominor.yy246 = new SqliteCreateTable::Constraint();
+ yygotominor.yy246->initUnique(*(yymsp[-2].minor.yy223), *(yymsp[0].minor.yy418));
+ delete yymsp[0].minor.yy418;
delete yymsp[-2].minor.yy223;
- objectForTokens = yygotominor.yy406;
+ objectForTokens = yygotominor.yy246;
}
break;
- case 113: /* tcons ::= CHECK LP expr RP onconf */
+ case 120: /* tcons ::= CHECK LP expr RP onconf */
{
- yygotominor.yy406 = new SqliteCreateTable::Constraint();
- yygotominor.yy406->initCheck(yymsp[-2].minor.yy352, *(yymsp[0].minor.yy338));
- objectForTokens = yygotominor.yy406;
+ yygotominor.yy246 = new SqliteCreateTable::Constraint();
+ yygotominor.yy246->initCheck(yymsp[-2].minor.yy512, *(yymsp[0].minor.yy418));
+ objectForTokens = yygotominor.yy246;
}
break;
- case 114: /* tcons ::= FOREIGN KEY LP idxlist RP REFERENCES nm idxlist_opt refargs defer_subclause_opt */
- case 115: /* tcons ::= CONSTRAINT ID_CONSTR */ yytestcase(yyruleno==115);
- case 116: /* tcons ::= FOREIGN KEY LP idxlist RP REFERENCES ID_TAB */ yytestcase(yyruleno==116);
+ case 121: /* tcons ::= FOREIGN KEY LP idxlist RP REFERENCES nm idxlist_opt refargs defer_subclause_opt */
+ case 122: /* tcons ::= CONSTRAINT ID_CONSTR */ yytestcase(yyruleno==122);
+ case 123: /* tcons ::= FOREIGN KEY LP idxlist RP REFERENCES ID_TAB */ yytestcase(yyruleno==123);
{
- yygotominor.yy406 = new SqliteCreateTable::Constraint();
- yygotominor.yy406->initFk(
+ yygotominor.yy246 = new SqliteCreateTable::Constraint();
+ yygotominor.yy246->initFk(
*(yymsp[-6].minor.yy223),
- *(yymsp[-3].minor.yy399),
+ *(yymsp[-3].minor.yy319),
*(yymsp[-2].minor.yy223),
- *(yymsp[-1].minor.yy184),
- yymsp[0].minor.yy329->initially,
- yymsp[0].minor.yy329->deferrable
+ *(yymsp[-1].minor.yy584),
+ yymsp[0].minor.yy9->initially,
+ yymsp[0].minor.yy9->deferrable
);
- delete yymsp[-3].minor.yy399;
- delete yymsp[-1].minor.yy184;
- delete yymsp[0].minor.yy329;
+ delete yymsp[-3].minor.yy319;
+ delete yymsp[-1].minor.yy584;
+ delete yymsp[0].minor.yy9;
delete yymsp[-2].minor.yy223;
delete yymsp[-6].minor.yy223;
- objectForTokens = yygotominor.yy406;
+ objectForTokens = yygotominor.yy246;
}
break;
- case 117: /* tcons ::= CHECK LP RP onconf */
+ case 124: /* tcons ::= CHECK LP RP onconf */
{
- yygotominor.yy406 = new SqliteCreateTable::Constraint();
- yygotominor.yy406->initCheck();
- objectForTokens = yygotominor.yy406;
+ yygotominor.yy246 = new SqliteCreateTable::Constraint();
+ yygotominor.yy246->initCheck();
+ objectForTokens = yygotominor.yy246;
parserContext->minorErrorAfterLastToken("Syntax error");
- yy_destructor(yypParser,202,&yymsp[0].minor);
+ yy_destructor(yypParser,223,&yymsp[0].minor);
}
break;
- case 118: /* defer_subclause_opt ::= */
-{yygotominor.yy329 = new ParserDeferSubClause(SqliteDeferrable::null, SqliteInitially::null);}
- break;
- case 119: /* defer_subclause_opt ::= defer_subclause */
-{yygotominor.yy329 = yymsp[0].minor.yy329;}
- break;
- case 120: /* onconf ::= */
- case 122: /* orconf ::= */ yytestcase(yyruleno==122);
-{yygotominor.yy338 = new SqliteConflictAlgo(SqliteConflictAlgo::null);}
- break;
- case 121: /* onconf ::= ON CONFLICT resolvetype */
- case 123: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==123);
-{yygotominor.yy338 = yymsp[0].minor.yy338;}
- break;
- case 124: /* resolvetype ::= raisetype */
- case 125: /* resolvetype ::= IGNORE */ yytestcase(yyruleno==125);
- case 126: /* resolvetype ::= REPLACE */ yytestcase(yyruleno==126);
-{yygotominor.yy338 = new SqliteConflictAlgo(sqliteConflictAlgo(yymsp[0].minor.yy0->value));}
- break;
- case 127: /* cmd ::= DROP TABLE ifexists fullname */
-{
- yygotominor.yy283 = new SqliteDropTable(*(yymsp[-1].minor.yy451), yymsp[0].minor.yy360->name1, yymsp[0].minor.yy360->name2);
- delete yymsp[-1].minor.yy451;
- delete yymsp[0].minor.yy360;
- objectForTokens = yygotominor.yy283;
- }
- break;
- case 128: /* cmd ::= DROP TABLE ifexists nm DOT ID_TAB */
- case 129: /* cmd ::= DROP TABLE ifexists ID_DB|ID_TAB */ yytestcase(yyruleno==129);
- case 136: /* cmd ::= DROP VIEW ifexists nm DOT ID_VIEW */ yytestcase(yyruleno==136);
- case 137: /* cmd ::= DROP VIEW ifexists ID_DB|ID_VIEW */ yytestcase(yyruleno==137);
- case 179: /* singlesrc ::= nm DOT ID_TAB */ yytestcase(yyruleno==179);
- case 180: /* singlesrc ::= ID_DB|ID_TAB */ yytestcase(yyruleno==180);
- case 181: /* singlesrc ::= nm DOT ID_VIEW */ yytestcase(yyruleno==181);
- case 182: /* singlesrc ::= ID_DB|ID_VIEW */ yytestcase(yyruleno==182);
- case 266: /* exprx ::= nm DOT ID_TAB|ID_COL */ yytestcase(yyruleno==266);
- case 325: /* cmd ::= CREATE uniqueflag INDEX ifnotexists nm DOT ID_IDX_NEW */ yytestcase(yyruleno==325);
- case 326: /* cmd ::= CREATE uniqueflag INDEX ifnotexists ID_DB|ID_IDX_NEW */ yytestcase(yyruleno==326);
- case 339: /* cmd ::= DROP INDEX ifexists nm DOT ID_IDX */ yytestcase(yyruleno==339);
- case 340: /* cmd ::= DROP INDEX ifexists ID_DB|ID_IDX */ yytestcase(yyruleno==340);
- case 348: /* cmd ::= PRAGMA nm DOT ID_PRAGMA */ yytestcase(yyruleno==348);
- case 349: /* cmd ::= PRAGMA ID_DB|ID_PRAGMA */ yytestcase(yyruleno==349);
- case 387: /* cmd ::= DROP TRIGGER ifexists nm DOT ID_TRIG */ yytestcase(yyruleno==387);
- case 388: /* cmd ::= DROP TRIGGER ifexists ID_DB|ID_TRIG */ yytestcase(yyruleno==388);
- case 398: /* cmd ::= REINDEX nm DOT ID_TAB|ID_IDX */ yytestcase(yyruleno==398);
- case 399: /* cmd ::= REINDEX ID_DB|ID_IDX|ID_TAB */ yytestcase(yyruleno==399);
- case 402: /* cmd ::= ANALYZE nm DOT ID_TAB|ID_IDX */ yytestcase(yyruleno==402);
- case 403: /* cmd ::= ANALYZE ID_DB|ID_IDX|ID_TAB */ yytestcase(yyruleno==403);
- case 407: /* cmd ::= ALTER TABLE nm DOT ID_TAB */ yytestcase(yyruleno==407);
- case 408: /* cmd ::= ALTER TABLE ID_DB|ID_TAB */ yytestcase(yyruleno==408);
- case 414: /* create_vtab ::= CREATE VIRTUAL TABLE ifnotexists nm DOT ID_TAB_NEW */ yytestcase(yyruleno==414);
- case 415: /* create_vtab ::= CREATE VIRTUAL TABLE ifnotexists ID_DB|ID_TAB_NEW */ yytestcase(yyruleno==415);
-{ yy_destructor(yypParser,179,&yymsp[-2].minor);
+ case 125: /* defer_subclause_opt ::= */
+{yygotominor.yy9 = new ParserDeferSubClause(SqliteDeferrable::null, SqliteInitially::null);}
+ break;
+ case 126: /* defer_subclause_opt ::= defer_subclause */
+{yygotominor.yy9 = yymsp[0].minor.yy9;}
+ break;
+ case 127: /* onconf ::= */
+ case 129: /* orconf ::= */ yytestcase(yyruleno==129);
+{yygotominor.yy418 = new SqliteConflictAlgo(SqliteConflictAlgo::null);}
+ break;
+ case 128: /* onconf ::= ON CONFLICT resolvetype */
+ case 130: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==130);
+{yygotominor.yy418 = yymsp[0].minor.yy418;}
+ break;
+ case 131: /* resolvetype ::= raisetype */
+ case 132: /* resolvetype ::= IGNORE */ yytestcase(yyruleno==132);
+ case 133: /* resolvetype ::= REPLACE */ yytestcase(yyruleno==133);
+{yygotominor.yy418 = new SqliteConflictAlgo(sqliteConflictAlgo(yymsp[0].minor.yy0->value));}
+ break;
+ case 134: /* cmd ::= DROP TABLE ifexists fullname */
+{
+ yygotominor.yy363 = new SqliteDropTable(*(yymsp[-1].minor.yy611), yymsp[0].minor.yy440->name1, yymsp[0].minor.yy440->name2);
+ delete yymsp[-1].minor.yy611;
+ delete yymsp[0].minor.yy440;
+ objectForTokens = yygotominor.yy363;
+ }
+ break;
+ case 135: /* cmd ::= DROP TABLE ifexists nm DOT ID_TAB */
+ case 136: /* cmd ::= DROP TABLE ifexists ID_DB|ID_TAB */ yytestcase(yyruleno==136);
+ case 143: /* cmd ::= DROP VIEW ifexists nm DOT ID_VIEW */ yytestcase(yyruleno==143);
+ case 144: /* cmd ::= DROP VIEW ifexists ID_DB|ID_VIEW */ yytestcase(yyruleno==144);
+ case 187: /* singlesrc ::= nm DOT ID_TAB */ yytestcase(yyruleno==187);
+ case 188: /* singlesrc ::= ID_DB|ID_TAB */ yytestcase(yyruleno==188);
+ case 189: /* singlesrc ::= nm DOT ID_VIEW */ yytestcase(yyruleno==189);
+ case 190: /* singlesrc ::= ID_DB|ID_VIEW */ yytestcase(yyruleno==190);
+ case 331: /* cmd ::= CREATE uniqueflag INDEX ifnotexists nm DOT ID_IDX_NEW */ yytestcase(yyruleno==331);
+ case 332: /* cmd ::= CREATE uniqueflag INDEX ifnotexists ID_DB|ID_IDX_NEW */ yytestcase(yyruleno==332);
+ case 345: /* cmd ::= DROP INDEX ifexists nm DOT ID_IDX */ yytestcase(yyruleno==345);
+ case 346: /* cmd ::= DROP INDEX ifexists ID_DB|ID_IDX */ yytestcase(yyruleno==346);
+ case 356: /* cmd ::= PRAGMA nm DOT ID_PRAGMA */ yytestcase(yyruleno==356);
+ case 357: /* cmd ::= PRAGMA ID_DB|ID_PRAGMA */ yytestcase(yyruleno==357);
+ case 395: /* cmd ::= DROP TRIGGER ifexists nm DOT ID_TRIG */ yytestcase(yyruleno==395);
+ case 396: /* cmd ::= DROP TRIGGER ifexists ID_DB|ID_TRIG */ yytestcase(yyruleno==396);
+ case 406: /* cmd ::= REINDEX nm DOT ID_TAB|ID_IDX */ yytestcase(yyruleno==406);
+ case 407: /* cmd ::= REINDEX ID_DB|ID_IDX|ID_TAB */ yytestcase(yyruleno==407);
+ case 410: /* cmd ::= ANALYZE nm DOT ID_TAB|ID_IDX */ yytestcase(yyruleno==410);
+ case 411: /* cmd ::= ANALYZE ID_DB|ID_IDX|ID_TAB */ yytestcase(yyruleno==411);
+ case 415: /* cmd ::= ALTER TABLE nm DOT ID_TAB */ yytestcase(yyruleno==415);
+ case 416: /* cmd ::= ALTER TABLE ID_DB|ID_TAB */ yytestcase(yyruleno==416);
+ case 422: /* create_vtab ::= CREATE VIRTUAL TABLE ifnotexists nm DOT ID_TAB_NEW */ yytestcase(yyruleno==422);
+ case 423: /* create_vtab ::= CREATE VIRTUAL TABLE ifnotexists ID_DB|ID_TAB_NEW */ yytestcase(yyruleno==423);
+{ yy_destructor(yypParser,199,&yymsp[-2].minor);
}
break;
- case 132: /* cmd ::= CREATE temp VIEW ifnotexists fullname idxlist_opt AS select */
+ case 139: /* cmd ::= CREATE temp VIEW ifnotexists fullname idxlist_opt AS select */
{
- yygotominor.yy283 = new SqliteCreateView(*(yymsp[-6].minor.yy146), *(yymsp[-4].minor.yy451), yymsp[-3].minor.yy360->name1, yymsp[-3].minor.yy360->name2, yymsp[0].minor.yy473, *(yymsp[-2].minor.yy223));
- delete yymsp[-6].minor.yy146;
- delete yymsp[-4].minor.yy451;
- delete yymsp[-3].minor.yy360;
+ yygotominor.yy363 = new SqliteCreateView(*(yymsp[-6].minor.yy386), *(yymsp[-4].minor.yy611), yymsp[-3].minor.yy440->name1, yymsp[-3].minor.yy440->name2, yymsp[0].minor.yy313, *(yymsp[-2].minor.yy223));
+ delete yymsp[-6].minor.yy386;
+ delete yymsp[-4].minor.yy611;
+ delete yymsp[-3].minor.yy440;
delete yymsp[-2].minor.yy223;
- objectForTokens = yygotominor.yy283;
+ objectForTokens = yygotominor.yy363;
}
break;
- case 135: /* cmd ::= DROP VIEW ifexists fullname */
+ case 142: /* cmd ::= DROP VIEW ifexists fullname */
{
- yygotominor.yy283 = new SqliteDropView(*(yymsp[-1].minor.yy451), yymsp[0].minor.yy360->name1, yymsp[0].minor.yy360->name2);
- delete yymsp[-1].minor.yy451;
- delete yymsp[0].minor.yy360;
- objectForTokens = yygotominor.yy283;
+ yygotominor.yy363 = new SqliteDropView(*(yymsp[-1].minor.yy611), yymsp[0].minor.yy440->name1, yymsp[0].minor.yy440->name2);
+ delete yymsp[-1].minor.yy611;
+ delete yymsp[0].minor.yy440;
+ objectForTokens = yygotominor.yy363;
}
break;
- case 138: /* cmd ::= select_stmt */
- case 215: /* cmd ::= delete_stmt */ yytestcase(yyruleno==215);
- case 224: /* cmd ::= update_stmt */ yytestcase(yyruleno==224);
- case 245: /* cmd ::= insert_stmt */ yytestcase(yyruleno==245);
+ case 145: /* cmd ::= select_stmt */
+ case 226: /* cmd ::= delete_stmt */ yytestcase(yyruleno==226);
+ case 235: /* cmd ::= update_stmt */ yytestcase(yyruleno==235);
+ case 256: /* cmd ::= insert_stmt */ yytestcase(yyruleno==256);
{
- yygotominor.yy283 = yymsp[0].minor.yy283;
- objectForTokens = yygotominor.yy283;
+ yygotominor.yy363 = yymsp[0].minor.yy363;
+ objectForTokens = yygotominor.yy363;
}
break;
- case 139: /* select_stmt ::= select */
+ case 146: /* select_stmt ::= select */
{
- yygotominor.yy283 = yymsp[0].minor.yy473;
+ yygotominor.yy363 = yymsp[0].minor.yy313;
// since it's used in trigger:
- objectForTokens = yygotominor.yy283;
+ objectForTokens = yygotominor.yy363;
}
break;
- case 140: /* select ::= with selectnowith */
+ case 147: /* select ::= with selectnowith */
{
- yygotominor.yy473 = yymsp[0].minor.yy473;
- yymsp[0].minor.yy473->setWith(yymsp[-1].minor.yy321);
- objectForTokens = yygotominor.yy473;
+ yygotominor.yy313 = yymsp[0].minor.yy313;
+ yymsp[0].minor.yy313->setWith(yymsp[-1].minor.yy1);
+ objectForTokens = yygotominor.yy313;
}
break;
- case 141: /* selectnowith ::= oneselect */
+ case 148: /* selectnowith ::= oneselect */
{
- yygotominor.yy473 = SqliteSelect::append(yymsp[0].minor.yy310);
- objectForTokens = yygotominor.yy473;
+ yygotominor.yy313 = SqliteSelect::append(yymsp[0].minor.yy470);
+ objectForTokens = yygotominor.yy313;
}
break;
- case 142: /* selectnowith ::= selectnowith multiselect_op oneselect */
+ case 149: /* selectnowith ::= selectnowith multiselect_op oneselect */
{
- yygotominor.yy473 = SqliteSelect::append(yymsp[-2].minor.yy473, *(yymsp[-1].minor.yy462), yymsp[0].minor.yy310);
- delete yymsp[-1].minor.yy462;
- objectForTokens = yygotominor.yy473;
+ yygotominor.yy313 = SqliteSelect::append(yymsp[-2].minor.yy313, *(yymsp[-1].minor.yy382), yymsp[0].minor.yy470);
+ delete yymsp[-1].minor.yy382;
+ objectForTokens = yygotominor.yy313;
}
break;
- case 143: /* selectnowith ::= values */
+ case 150: /* selectnowith ::= values */
{
- yygotominor.yy473 = SqliteSelect::append(*(yymsp[0].minor.yy166));
- delete yymsp[0].minor.yy166;
- objectForTokens = yygotominor.yy473;
+ yygotominor.yy313 = SqliteSelect::append(*(yymsp[0].minor.yy486));
+ delete yymsp[0].minor.yy486;
+ objectForTokens = yygotominor.yy313;
}
break;
- case 144: /* selectnowith ::= selectnowith COMMA values */
+ case 151: /* selectnowith ::= selectnowith COMMA values */
{
- yygotominor.yy473 = SqliteSelect::append(yymsp[-2].minor.yy473, SqliteSelect::CompoundOperator::UNION_ALL, *(yymsp[0].minor.yy166));
- delete yymsp[0].minor.yy166;
- objectForTokens = yygotominor.yy473;
+ yygotominor.yy313 = SqliteSelect::append(yymsp[-2].minor.yy313, SqliteSelect::CompoundOperator::UNION_ALL, *(yymsp[0].minor.yy486));
+ delete yymsp[0].minor.yy486;
+ objectForTokens = yygotominor.yy313;
}
break;
- case 145: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
+ case 152: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
{
- yygotominor.yy310 = new SqliteSelect::Core(
- *(yymsp[-7].minor.yy146),
- *(yymsp[-6].minor.yy373),
- yymsp[-5].minor.yy511,
- yymsp[-4].minor.yy352,
- *(yymsp[-3].minor.yy551),
- yymsp[-2].minor.yy352,
- *(yymsp[-1].minor.yy163),
- yymsp[0].minor.yy484
+ yygotominor.yy470 = new SqliteSelect::Core(
+ *(yymsp[-7].minor.yy386),
+ *(yymsp[-6].minor.yy53),
+ yymsp[-5].minor.yy31,
+ yymsp[-4].minor.yy512,
+ *(yymsp[-3].minor.yy71),
+ yymsp[-2].minor.yy512,
+ *(yymsp[-1].minor.yy403),
+ yymsp[0].minor.yy4
);
- delete yymsp[-6].minor.yy373;
- delete yymsp[-7].minor.yy146;
- delete yymsp[-3].minor.yy551;
- delete yymsp[-1].minor.yy163;
- objectForTokens = yygotominor.yy310;
- }
+ delete yymsp[-6].minor.yy53;
+ delete yymsp[-7].minor.yy386;
+ delete yymsp[-3].minor.yy71;
+ delete yymsp[-1].minor.yy403;
+ objectForTokens = yygotominor.yy470;
+ }
+ break;
+ case 153: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */
+{
+ yygotominor.yy470 = new SqliteSelect::Core(
+ *(yymsp[-8].minor.yy386),
+ *(yymsp[-7].minor.yy53),
+ yymsp[-6].minor.yy31,
+ yymsp[-5].minor.yy512,
+ *(yymsp[-4].minor.yy71),
+ yymsp[-3].minor.yy512,
+ *(yymsp[-2].minor.yy299),
+ *(yymsp[-1].minor.yy403),
+ yymsp[0].minor.yy4
+ );
+ delete yymsp[-7].minor.yy53;
+ delete yymsp[-8].minor.yy386;
+ delete yymsp[-4].minor.yy71;
+ delete yymsp[-1].minor.yy403;
+ delete yymsp[-2].minor.yy299;
+ objectForTokens = yygotominor.yy470;
+ }
break;
- case 146: /* values ::= VALUES LP nexprlist RP */
+ case 154: /* values ::= VALUES LP nexprlist RP */
{
- yygotominor.yy166 = new ParserExprNestedList();
- yygotominor.yy166->append(*(yymsp[-1].minor.yy551));
- delete yymsp[-1].minor.yy551;
+ yygotominor.yy486 = new ParserExprNestedList();
+ yygotominor.yy486->append(*(yymsp[-1].minor.yy71));
+ delete yymsp[-1].minor.yy71;
}
break;
- case 147: /* values ::= values COMMA LP exprlist RP */
+ case 155: /* values ::= values COMMA LP exprlist RP */
{
- yymsp[-4].minor.yy166->append(*(yymsp[-1].minor.yy551));
- yygotominor.yy166 = yymsp[-4].minor.yy166;
- delete yymsp[-1].minor.yy551;
+ yymsp[-4].minor.yy486->append(*(yymsp[-1].minor.yy71));
+ yygotominor.yy486 = yymsp[-4].minor.yy486;
+ delete yymsp[-1].minor.yy71;
DONT_INHERIT_TOKENS("values");
}
break;
- case 148: /* multiselect_op ::= UNION */
-{yygotominor.yy462 = new SqliteSelect::CompoundOperator(SqliteSelect::CompoundOperator::UNION);}
+ case 156: /* multiselect_op ::= UNION */
+{yygotominor.yy382 = new SqliteSelect::CompoundOperator(SqliteSelect::CompoundOperator::UNION);}
break;
- case 149: /* multiselect_op ::= UNION ALL */
-{yygotominor.yy462 = new SqliteSelect::CompoundOperator(SqliteSelect::CompoundOperator::UNION_ALL);}
+ case 157: /* multiselect_op ::= UNION ALL */
+{yygotominor.yy382 = new SqliteSelect::CompoundOperator(SqliteSelect::CompoundOperator::UNION_ALL);}
break;
- case 150: /* multiselect_op ::= EXCEPT */
-{yygotominor.yy462 = new SqliteSelect::CompoundOperator(SqliteSelect::CompoundOperator::EXCEPT);}
+ case 158: /* multiselect_op ::= EXCEPT */
+{yygotominor.yy382 = new SqliteSelect::CompoundOperator(SqliteSelect::CompoundOperator::EXCEPT);}
break;
- case 151: /* multiselect_op ::= INTERSECT */
-{yygotominor.yy462 = new SqliteSelect::CompoundOperator(SqliteSelect::CompoundOperator::INTERSECT);}
+ case 159: /* multiselect_op ::= INTERSECT */
+{yygotominor.yy382 = new SqliteSelect::CompoundOperator(SqliteSelect::CompoundOperator::INTERSECT);}
break;
- case 152: /* distinct ::= DISTINCT */
-{yygotominor.yy146 = new int(1);}
+ case 160: /* distinct ::= DISTINCT */
+{yygotominor.yy386 = new int(1);}
break;
- case 153: /* distinct ::= ALL */
-{yygotominor.yy146 = new int(2);}
+ case 161: /* distinct ::= ALL */
+{yygotominor.yy386 = new int(2);}
break;
- case 155: /* sclp ::= selcollist COMMA */
-{yygotominor.yy373 = yymsp[-1].minor.yy373;}
+ case 163: /* sclp ::= selcollist COMMA */
+{yygotominor.yy53 = yymsp[-1].minor.yy53;}
break;
- case 156: /* sclp ::= */
-{yygotominor.yy373 = new ParserResultColumnList();}
+ case 164: /* sclp ::= */
+{yygotominor.yy53 = new ParserResultColumnList();}
break;
- case 157: /* selcollist ::= sclp expr as */
+ case 165: /* selcollist ::= sclp expr as */
{
SqliteSelect::Core::ResultColumn* obj =
new SqliteSelect::Core::ResultColumn(
- yymsp[-1].minor.yy352,
+ yymsp[-1].minor.yy512,
yymsp[0].minor.yy200 ? yymsp[0].minor.yy200->asKw : false,
- yymsp[0].minor.yy200 ? yymsp[0].minor.yy200->name : QString::null
+ yymsp[0].minor.yy200 ? yymsp[0].minor.yy200->name : QString()
);
- yymsp[-2].minor.yy373->append(obj);
- yygotominor.yy373 = yymsp[-2].minor.yy373;
+ yymsp[-2].minor.yy53->append(obj);
+ yygotominor.yy53 = yymsp[-2].minor.yy53;
delete yymsp[0].minor.yy200;
objectForTokens = obj;
DONT_INHERIT_TOKENS("sclp");
}
break;
- case 158: /* selcollist ::= sclp STAR */
+ case 166: /* selcollist ::= sclp STAR */
{
SqliteSelect::Core::ResultColumn* obj =
new SqliteSelect::Core::ResultColumn(true);
- yymsp[-1].minor.yy373->append(obj);
- yygotominor.yy373 = yymsp[-1].minor.yy373;
+ yymsp[-1].minor.yy53->append(obj);
+ yygotominor.yy53 = yymsp[-1].minor.yy53;
objectForTokens = obj;
DONT_INHERIT_TOKENS("sclp");
}
break;
- case 159: /* selcollist ::= sclp nm DOT STAR */
+ case 167: /* selcollist ::= sclp tnm DOT STAR */
{
SqliteSelect::Core::ResultColumn* obj =
new SqliteSelect::Core::ResultColumn(
true,
- *(yymsp[-2].minor.yy399)
+ yymsp[-2].minor.yy590->toName()
);
- yymsp[-3].minor.yy373->append(obj);
- yygotominor.yy373 = yymsp[-3].minor.yy373;
- delete yymsp[-2].minor.yy399;
+
+ if (!yymsp[-2].minor.yy590->isName())
+ parserContext->errorAtToken("Syntax error <expected name, not literal value>", -3);
+
+ yymsp[-3].minor.yy53->append(obj);
+ yygotominor.yy53 = yymsp[-3].minor.yy53;
+ delete yymsp[-2].minor.yy590;
objectForTokens = obj;
DONT_INHERIT_TOKENS("sclp");
}
break;
- case 160: /* selcollist ::= sclp */
- case 161: /* selcollist ::= sclp ID_TAB DOT STAR */ yytestcase(yyruleno==161);
+ case 168: /* selcollist ::= sclp */
+ case 169: /* selcollist ::= sclp ID_TAB DOT STAR */ yytestcase(yyruleno==169);
{
parserContext->minorErrorBeforeNextToken("Syntax error");
- yygotominor.yy373 = yymsp[0].minor.yy373;
+ yygotominor.yy53 = yymsp[0].minor.yy53;
}
break;
- case 162: /* as ::= AS nm */
+ case 170: /* as ::= AS nm */
{
- yygotominor.yy200 = new ParserStubAlias(*(yymsp[0].minor.yy399), true);
- delete yymsp[0].minor.yy399;
+ yygotominor.yy200 = new ParserStubAlias(*(yymsp[0].minor.yy319), true);
+ delete yymsp[0].minor.yy319;
}
break;
- case 163: /* as ::= ids */
- case 164: /* as ::= AS ID_ALIAS */ yytestcase(yyruleno==164);
- case 165: /* as ::= ID_ALIAS */ yytestcase(yyruleno==165);
+ case 171: /* as ::= ids */
+ case 172: /* as ::= AS ID_ALIAS */ yytestcase(yyruleno==172);
+ case 173: /* as ::= ID_ALIAS */ yytestcase(yyruleno==173);
{
- yygotominor.yy200 = new ParserStubAlias(*(yymsp[0].minor.yy399), false);
- delete yymsp[0].minor.yy399;
+ yygotominor.yy200 = new ParserStubAlias(*(yymsp[0].minor.yy319), false);
+ delete yymsp[0].minor.yy319;
}
break;
- case 166: /* as ::= */
+ case 174: /* as ::= */
{yygotominor.yy200 = nullptr;}
break;
- case 167: /* from ::= */
-{yygotominor.yy511 = nullptr;}
+ case 175: /* from ::= */
+{yygotominor.yy31 = nullptr;}
break;
- case 168: /* from ::= FROM joinsrc */
-{yygotominor.yy511 = yymsp[0].minor.yy511;}
+ case 176: /* from ::= FROM joinsrc */
+{yygotominor.yy31 = yymsp[0].minor.yy31;}
break;
- case 169: /* joinsrc ::= singlesrc seltablist */
+ case 177: /* joinsrc ::= singlesrc seltablist */
{
- yygotominor.yy511 = new SqliteSelect::Core::JoinSource(
- yymsp[-1].minor.yy201,
- *(yymsp[0].minor.yy131)
+ yygotominor.yy31 = new SqliteSelect::Core::JoinSource(
+ yymsp[-1].minor.yy441,
+ *(yymsp[0].minor.yy451)
);
- delete yymsp[0].minor.yy131;
- objectForTokens = yygotominor.yy511;
+ delete yymsp[0].minor.yy451;
+ objectForTokens = yygotominor.yy31;
}
break;
- case 170: /* joinsrc ::= */
+ case 178: /* joinsrc ::= */
{
parserContext->minorErrorBeforeNextToken("Syntax error");
- yygotominor.yy511 = new SqliteSelect::Core::JoinSource();
- objectForTokens = yygotominor.yy511;
+ yygotominor.yy31 = new SqliteSelect::Core::JoinSource();
+ objectForTokens = yygotominor.yy31;
}
break;
- case 171: /* seltablist ::= seltablist joinop singlesrc joinconstr_opt */
+ case 179: /* seltablist ::= seltablist joinop singlesrc joinconstr_opt */
{
SqliteSelect::Core::JoinSourceOther* src =
- new SqliteSelect::Core::JoinSourceOther(yymsp[-2].minor.yy301, yymsp[-1].minor.yy201, yymsp[0].minor.yy295);
+ new SqliteSelect::Core::JoinSourceOther(yymsp[-2].minor.yy221, yymsp[-1].minor.yy441, yymsp[0].minor.yy295);
- yymsp[-3].minor.yy131->append(src);
- yygotominor.yy131 = yymsp[-3].minor.yy131;
+ yymsp[-3].minor.yy451->append(src);
+ yygotominor.yy451 = yymsp[-3].minor.yy451;
objectForTokens = src;
DONT_INHERIT_TOKENS("seltablist");
}
break;
- case 172: /* seltablist ::= */
+ case 180: /* seltablist ::= */
{
- yygotominor.yy131 = new ParserOtherSourceList();
+ yygotominor.yy451 = new ParserOtherSourceList();
}
break;
- case 173: /* singlesrc ::= nm dbnm as indexed_opt */
+ case 181: /* singlesrc ::= nm dbnm as indexed_opt */
{
- yygotominor.yy201 = new SqliteSelect::Core::SingleSource(
- *(yymsp[-3].minor.yy399),
- *(yymsp[-2].minor.yy399),
+ yygotominor.yy441 = new SqliteSelect::Core::SingleSource(
+ *(yymsp[-3].minor.yy319),
+ *(yymsp[-2].minor.yy319),
yymsp[-1].minor.yy200 ? yymsp[-1].minor.yy200->asKw : false,
- yymsp[-1].minor.yy200 ? yymsp[-1].minor.yy200->name : QString::null,
- yymsp[0].minor.yy192 ? yymsp[0].minor.yy192->notIndexedKw : false,
- yymsp[0].minor.yy192 ? yymsp[0].minor.yy192->indexedBy : QString::null
+ yymsp[-1].minor.yy200 ? yymsp[-1].minor.yy200->name : QString(),
+ yymsp[0].minor.yy592 ? yymsp[0].minor.yy592->notIndexedKw : false,
+ yymsp[0].minor.yy592 ? yymsp[0].minor.yy592->indexedBy : QString()
);
- delete yymsp[-3].minor.yy399;
- delete yymsp[-2].minor.yy399;
+ delete yymsp[-3].minor.yy319;
+ delete yymsp[-2].minor.yy319;
delete yymsp[-1].minor.yy200;
- if (yymsp[0].minor.yy192)
- delete yymsp[0].minor.yy192;
- objectForTokens = yygotominor.yy201;
+ if (yymsp[0].minor.yy592)
+ delete yymsp[0].minor.yy592;
+ objectForTokens = yygotominor.yy441;
}
break;
- case 174: /* singlesrc ::= LP select RP as */
+ case 182: /* singlesrc ::= LP select RP as */
{
- yygotominor.yy201 = new SqliteSelect::Core::SingleSource(
- yymsp[-2].minor.yy473,
+ yygotominor.yy441 = new SqliteSelect::Core::SingleSource(
+ yymsp[-2].minor.yy313,
yymsp[0].minor.yy200 ? yymsp[0].minor.yy200->asKw : false,
- yymsp[0].minor.yy200 ? yymsp[0].minor.yy200->name : QString::null
+ yymsp[0].minor.yy200 ? yymsp[0].minor.yy200->name : QString()
);
delete yymsp[0].minor.yy200;
- objectForTokens = yygotominor.yy201;
+ objectForTokens = yygotominor.yy441;
}
break;
- case 175: /* singlesrc ::= LP joinsrc RP as */
+ case 183: /* singlesrc ::= LP joinsrc RP as */
{
- yygotominor.yy201 = new SqliteSelect::Core::SingleSource(
- yymsp[-2].minor.yy511,
+ yygotominor.yy441 = new SqliteSelect::Core::SingleSource(
+ yymsp[-2].minor.yy31,
yymsp[0].minor.yy200 ? yymsp[0].minor.yy200->asKw : false,
- yymsp[0].minor.yy200 ? yymsp[0].minor.yy200->name : QString::null
+ yymsp[0].minor.yy200 ? yymsp[0].minor.yy200->name : QString()
);
delete yymsp[0].minor.yy200;
- objectForTokens = yygotominor.yy201;
+ objectForTokens = yygotominor.yy441;
}
break;
- case 176: /* singlesrc ::= nm dbnm LP exprlist RP as */
+ case 184: /* singlesrc ::= nm dbnm LP exprlist RP as */
{
- yygotominor.yy201 = new SqliteSelect::Core::SingleSource(
- *(yymsp[-5].minor.yy399),
- *(yymsp[-4].minor.yy399),
+ yygotominor.yy441 = new SqliteSelect::Core::SingleSource(
+ *(yymsp[-5].minor.yy319),
+ *(yymsp[-4].minor.yy319),
yymsp[0].minor.yy200 ? yymsp[0].minor.yy200->asKw : false,
- yymsp[0].minor.yy200 ? yymsp[0].minor.yy200->name : QString::null,
- *(yymsp[-2].minor.yy551)
+ yymsp[0].minor.yy200 ? yymsp[0].minor.yy200->name : QString(),
+ *(yymsp[-2].minor.yy71)
);
- delete yymsp[-5].minor.yy399;
- delete yymsp[-4].minor.yy399;
+ delete yymsp[-5].minor.yy319;
+ delete yymsp[-4].minor.yy319;
delete yymsp[0].minor.yy200;
- if (yymsp[-2].minor.yy551)
- delete yymsp[-2].minor.yy551;
+ if (yymsp[-2].minor.yy71)
+ delete yymsp[-2].minor.yy71;
- objectForTokens = yygotominor.yy201;
+ objectForTokens = yygotominor.yy441;
}
break;
- case 177: /* singlesrc ::= */
+ case 185: /* singlesrc ::= */
{
parserContext->minorErrorBeforeNextToken("Syntax error");
- yygotominor.yy201 = new SqliteSelect::Core::SingleSource();
- objectForTokens = yygotominor.yy201;
+ yygotominor.yy441 = new SqliteSelect::Core::SingleSource();
+ objectForTokens = yygotominor.yy441;
}
break;
- case 178: /* singlesrc ::= nm DOT */
+ case 186: /* singlesrc ::= nm DOT */
{
parserContext->minorErrorBeforeNextToken("Syntax error");
- yygotominor.yy201 = new SqliteSelect::Core::SingleSource();
- yygotominor.yy201->database = *(yymsp[-1].minor.yy399);
- delete yymsp[-1].minor.yy399;
- objectForTokens = yygotominor.yy201;
+ yygotominor.yy441 = new SqliteSelect::Core::SingleSource();
+ yygotominor.yy441->database = *(yymsp[-1].minor.yy319);
+ delete yymsp[-1].minor.yy319;
+ objectForTokens = yygotominor.yy441;
}
break;
- case 183: /* joinconstr_opt ::= ON expr */
+ case 191: /* joinconstr_opt ::= ON expr */
{
- yygotominor.yy295 = new SqliteSelect::Core::JoinConstraint(yymsp[0].minor.yy352);
+ yygotominor.yy295 = new SqliteSelect::Core::JoinConstraint(yymsp[0].minor.yy512);
objectForTokens = yygotominor.yy295;
}
break;
- case 184: /* joinconstr_opt ::= USING LP idlist RP */
+ case 192: /* joinconstr_opt ::= USING LP idlist RP */
{
- yygotominor.yy295 = new SqliteSelect::Core::JoinConstraint(*(yymsp[-1].minor.yy95));
- delete yymsp[-1].minor.yy95;
+ yygotominor.yy295 = new SqliteSelect::Core::JoinConstraint(*(yymsp[-1].minor.yy575));
+ delete yymsp[-1].minor.yy575;
objectForTokens = yygotominor.yy295;
}
break;
- case 185: /* joinconstr_opt ::= */
+ case 193: /* joinconstr_opt ::= */
{yygotominor.yy295 = nullptr;}
break;
- case 188: /* fullname ::= nm dbnm */
+ case 196: /* fullname ::= nm dbnm */
{
- yygotominor.yy360 = new ParserFullName();
- yygotominor.yy360->name1 = *(yymsp[-1].minor.yy399);
- yygotominor.yy360->name2 = *(yymsp[0].minor.yy399);
- delete yymsp[-1].minor.yy399;
- delete yymsp[0].minor.yy399;
+ yygotominor.yy440 = new ParserFullName();
+ yygotominor.yy440->name1 = *(yymsp[-1].minor.yy319);
+ yygotominor.yy440->name2 = *(yymsp[0].minor.yy319);
+ delete yymsp[-1].minor.yy319;
+ delete yymsp[0].minor.yy319;
}
break;
- case 189: /* joinop ::= COMMA */
+ case 197: /* joinop ::= COMMA */
{
- yygotominor.yy301 = new SqliteSelect::Core::JoinOp(true);
- objectForTokens = yygotominor.yy301;
+ yygotominor.yy221 = new SqliteSelect::Core::JoinOp(true);
+ objectForTokens = yygotominor.yy221;
}
break;
- case 190: /* joinop ::= JOIN */
+ case 198: /* joinop ::= JOIN */
{
- yygotominor.yy301 = new SqliteSelect::Core::JoinOp(false);
- objectForTokens = yygotominor.yy301;
+ yygotominor.yy221 = new SqliteSelect::Core::JoinOp(false);
+ objectForTokens = yygotominor.yy221;
}
break;
- case 191: /* joinop ::= JOIN_KW JOIN */
+ case 199: /* joinop ::= JOIN_KW JOIN */
{
- yygotominor.yy301 = new SqliteSelect::Core::JoinOp(yymsp[-1].minor.yy0->value);
- objectForTokens = yygotominor.yy301;
+ yygotominor.yy221 = new SqliteSelect::Core::JoinOp(yymsp[-1].minor.yy0->value);
+ objectForTokens = yygotominor.yy221;
}
break;
- case 192: /* joinop ::= JOIN_KW nm JOIN */
+ case 200: /* joinop ::= JOIN_KW nm JOIN */
{
- yygotominor.yy301 = new SqliteSelect::Core::JoinOp(yymsp[-2].minor.yy0->value, *(yymsp[-1].minor.yy399));
- delete yymsp[-1].minor.yy399;
- objectForTokens = yygotominor.yy301;
+ yygotominor.yy221 = new SqliteSelect::Core::JoinOp(yymsp[-2].minor.yy0->value, *(yymsp[-1].minor.yy319));
+ delete yymsp[-1].minor.yy319;
+ objectForTokens = yygotominor.yy221;
}
break;
- case 193: /* joinop ::= JOIN_KW nm nm JOIN */
- case 194: /* joinop ::= ID_JOIN_OPTS */ yytestcase(yyruleno==194);
+ case 201: /* joinop ::= JOIN_KW nm nm JOIN */
+ case 202: /* joinop ::= ID_JOIN_OPTS */ yytestcase(yyruleno==202);
{
- yygotominor.yy301 = new SqliteSelect::Core::JoinOp(yymsp[-3].minor.yy0->value, *(yymsp[-2].minor.yy399), *(yymsp[-1].minor.yy399));
- delete yymsp[-2].minor.yy399;
- delete yymsp[-2].minor.yy399;
- objectForTokens = yygotominor.yy301;
+ yygotominor.yy221 = new SqliteSelect::Core::JoinOp(yymsp[-3].minor.yy0->value, *(yymsp[-2].minor.yy319), *(yymsp[-1].minor.yy319));
+ delete yymsp[-2].minor.yy319;
+ objectForTokens = yygotominor.yy221;
}
break;
- case 195: /* indexed_opt ::= */
-{yygotominor.yy192 = nullptr;}
+ case 203: /* indexed_opt ::= */
+{yygotominor.yy592 = nullptr;}
break;
- case 196: /* indexed_opt ::= INDEXED BY nm */
+ case 204: /* indexed_opt ::= INDEXED BY nm */
{
- yygotominor.yy192 = new ParserIndexedBy(*(yymsp[0].minor.yy399));
- delete yymsp[0].minor.yy399;
+ yygotominor.yy592 = new ParserIndexedBy(*(yymsp[0].minor.yy319));
+ delete yymsp[0].minor.yy319;
}
break;
- case 197: /* indexed_opt ::= NOT INDEXED */
- case 198: /* indexed_opt ::= INDEXED BY ID_IDX */ yytestcase(yyruleno==198);
-{yygotominor.yy192 = new ParserIndexedBy(true);}
+ case 205: /* indexed_opt ::= NOT INDEXED */
+ case 206: /* indexed_opt ::= INDEXED BY ID_IDX */ yytestcase(yyruleno==206);
+{yygotominor.yy592 = new ParserIndexedBy(true);}
break;
- case 199: /* orderby_opt ::= */
-{yygotominor.yy163 = new ParserOrderByList();}
+ case 207: /* orderby_opt ::= */
+{yygotominor.yy403 = new ParserOrderByList();}
break;
- case 200: /* orderby_opt ::= ORDER BY sortlist */
-{yygotominor.yy163 = yymsp[0].minor.yy163;}
+ case 208: /* orderby_opt ::= ORDER BY sortlist */
+{yygotominor.yy403 = yymsp[0].minor.yy403;}
break;
- case 201: /* sortlist ::= sortlist COMMA expr sortorder */
+ case 209: /* sortlist ::= sortlist COMMA expr sortorder nulls */
{
- SqliteOrderBy* obj = new SqliteOrderBy(yymsp[-1].minor.yy352, *(yymsp[0].minor.yy309));
- yymsp[-3].minor.yy163->append(obj);
- yygotominor.yy163 = yymsp[-3].minor.yy163;
- delete yymsp[0].minor.yy309;
+ SqliteOrderBy* obj = new SqliteOrderBy(yymsp[-2].minor.yy512, *(yymsp[-1].minor.yy549), *(yymsp[0].minor.yy579));
+ yymsp[-4].minor.yy403->append(obj);
+ yygotominor.yy403 = yymsp[-4].minor.yy403;
+ delete yymsp[-1].minor.yy549;
+ delete yymsp[0].minor.yy579;
objectForTokens = obj;
DONT_INHERIT_TOKENS("sortlist");
}
break;
- case 202: /* sortlist ::= expr sortorder */
+ case 210: /* sortlist ::= expr sortorder nulls */
{
- SqliteOrderBy* obj = new SqliteOrderBy(yymsp[-1].minor.yy352, *(yymsp[0].minor.yy309));
- yygotominor.yy163 = new ParserOrderByList();
- yygotominor.yy163->append(obj);
- delete yymsp[0].minor.yy309;
+ SqliteOrderBy* obj = new SqliteOrderBy(yymsp[-2].minor.yy512, *(yymsp[-1].minor.yy549), *(yymsp[0].minor.yy579));
+ yygotominor.yy403 = new ParserOrderByList();
+ yygotominor.yy403->append(obj);
+ delete yymsp[-1].minor.yy549;
+ delete yymsp[0].minor.yy579;
objectForTokens = obj;
}
break;
- case 203: /* sortorder ::= ASC */
-{yygotominor.yy309 = new SqliteSortOrder(SqliteSortOrder::ASC);}
+ case 211: /* sortorder ::= ASC */
+{yygotominor.yy549 = new SqliteSortOrder(SqliteSortOrder::ASC);}
break;
- case 204: /* sortorder ::= DESC */
-{yygotominor.yy309 = new SqliteSortOrder(SqliteSortOrder::DESC);}
+ case 212: /* sortorder ::= DESC */
+{yygotominor.yy549 = new SqliteSortOrder(SqliteSortOrder::DESC);}
break;
- case 205: /* sortorder ::= */
-{yygotominor.yy309 = new SqliteSortOrder(SqliteSortOrder::null);}
+ case 213: /* sortorder ::= */
+{yygotominor.yy549 = new SqliteSortOrder(SqliteSortOrder::null);}
break;
- case 206: /* groupby_opt ::= */
- case 320: /* exprlist ::= */ yytestcase(yyruleno==320);
-{yygotominor.yy551 = new ParserExprList();}
+ case 214: /* nulls ::= NULLS FIRST */
+{yygotominor.yy579 = new SqliteNulls(SqliteNulls::FIRST);}
break;
- case 207: /* groupby_opt ::= GROUP BY nexprlist */
- case 319: /* exprlist ::= nexprlist */ yytestcase(yyruleno==319);
-{yygotominor.yy551 = yymsp[0].minor.yy551;}
+ case 215: /* nulls ::= NULLS LAST */
+{yygotominor.yy579 = new SqliteNulls(SqliteNulls::LAST);}
break;
- case 208: /* groupby_opt ::= GROUP BY */
+ case 216: /* nulls ::= */
+{yygotominor.yy579 = new SqliteNulls(SqliteNulls::null);}
+ break;
+ case 217: /* groupby_opt ::= */
+ case 326: /* exprlist ::= */ yytestcase(yyruleno==326);
+{yygotominor.yy71 = new ParserExprList();}
+ break;
+ case 218: /* groupby_opt ::= GROUP BY nexprlist */
+ case 325: /* exprlist ::= nexprlist */ yytestcase(yyruleno==325);
+{yygotominor.yy71 = yymsp[0].minor.yy71;}
+ break;
+ case 219: /* groupby_opt ::= GROUP BY */
{
parserContext->minorErrorBeforeNextToken("Syntax error");
- yygotominor.yy551 = new ParserExprList();
+ yygotominor.yy71 = new ParserExprList();
}
break;
- case 209: /* having_opt ::= */
- case 221: /* where_opt ::= */ yytestcase(yyruleno==221);
- case 316: /* case_else ::= */ yytestcase(yyruleno==316);
- case 318: /* case_operand ::= */ yytestcase(yyruleno==318);
- case 376: /* when_clause ::= */ yytestcase(yyruleno==376);
- case 391: /* key_opt ::= */ yytestcase(yyruleno==391);
-{yygotominor.yy352 = nullptr;}
+ case 220: /* having_opt ::= */
+ case 232: /* where_opt ::= */ yytestcase(yyruleno==232);
+ case 322: /* case_else ::= */ yytestcase(yyruleno==322);
+ case 324: /* case_operand ::= */ yytestcase(yyruleno==324);
+ case 350: /* vinto ::= */ yytestcase(yyruleno==350);
+ case 384: /* when_clause ::= */ yytestcase(yyruleno==384);
+ case 399: /* key_opt ::= */ yytestcase(yyruleno==399);
+{yygotominor.yy512 = nullptr;}
break;
- case 210: /* having_opt ::= HAVING expr */
- case 222: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==222);
- case 309: /* expr ::= exprx */ yytestcase(yyruleno==309);
- case 315: /* case_else ::= ELSE expr */ yytestcase(yyruleno==315);
- case 317: /* case_operand ::= exprx */ yytestcase(yyruleno==317);
- case 377: /* when_clause ::= WHEN expr */ yytestcase(yyruleno==377);
- case 392: /* key_opt ::= KEY expr */ yytestcase(yyruleno==392);
-{yygotominor.yy352 = yymsp[0].minor.yy352;}
+ case 221: /* having_opt ::= HAVING expr */
+ case 233: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==233);
+ case 315: /* expr ::= exprx */ yytestcase(yyruleno==315);
+ case 321: /* case_else ::= ELSE expr */ yytestcase(yyruleno==321);
+ case 323: /* case_operand ::= exprx */ yytestcase(yyruleno==323);
+ case 349: /* vinto ::= INTO expr */ yytestcase(yyruleno==349);
+ case 385: /* when_clause ::= WHEN expr */ yytestcase(yyruleno==385);
+ case 400: /* key_opt ::= KEY expr */ yytestcase(yyruleno==400);
+{yygotominor.yy512 = yymsp[0].minor.yy512;}
break;
- case 211: /* limit_opt ::= */
-{yygotominor.yy484 = nullptr;}
+ case 222: /* limit_opt ::= */
+{yygotominor.yy4 = nullptr;}
break;
- case 212: /* limit_opt ::= LIMIT expr */
+ case 223: /* limit_opt ::= LIMIT expr */
{
- yygotominor.yy484 = new SqliteLimit(yymsp[0].minor.yy352);
- objectForTokens = yygotominor.yy484;
+ yygotominor.yy4 = new SqliteLimit(yymsp[0].minor.yy512);
+ objectForTokens = yygotominor.yy4;
}
break;
- case 213: /* limit_opt ::= LIMIT expr OFFSET expr */
+ case 224: /* limit_opt ::= LIMIT expr OFFSET expr */
{
- yygotominor.yy484 = new SqliteLimit(yymsp[-2].minor.yy352, yymsp[0].minor.yy352, true);
- objectForTokens = yygotominor.yy484;
+ yygotominor.yy4 = new SqliteLimit(yymsp[-2].minor.yy512, yymsp[0].minor.yy512, true);
+ objectForTokens = yygotominor.yy4;
}
break;
- case 214: /* limit_opt ::= LIMIT expr COMMA expr */
+ case 225: /* limit_opt ::= LIMIT expr COMMA expr */
{
- yygotominor.yy484 = new SqliteLimit(yymsp[-2].minor.yy352, yymsp[0].minor.yy352, false);
- objectForTokens = yygotominor.yy484;
+ yygotominor.yy4 = new SqliteLimit(yymsp[-2].minor.yy512, yymsp[0].minor.yy512, false);
+ objectForTokens = yygotominor.yy4;
}
break;
- case 216: /* delete_stmt ::= with DELETE FROM fullname indexed_opt where_opt */
+ case 227: /* delete_stmt ::= with DELETE FROM fullname indexed_opt where_opt */
{
- if (yymsp[-1].minor.yy192)
+ if (yymsp[-1].minor.yy592)
{
- if (!yymsp[-1].minor.yy192->indexedBy.isNull())
+ if (!yymsp[-1].minor.yy592->indexedBy.isNull())
{
- yygotominor.yy283 = new SqliteDelete(
- yymsp[-2].minor.yy360->name1,
- yymsp[-2].minor.yy360->name2,
- yymsp[-1].minor.yy192->indexedBy,
- yymsp[0].minor.yy352,
- yymsp[-5].minor.yy321
+ yygotominor.yy363 = new SqliteDelete(
+ yymsp[-2].minor.yy440->name1,
+ yymsp[-2].minor.yy440->name2,
+ yymsp[-1].minor.yy592->indexedBy,
+ yymsp[0].minor.yy512,
+ yymsp[-5].minor.yy1
);
}
else
{
- yygotominor.yy283 = new SqliteDelete(
- yymsp[-2].minor.yy360->name1,
- yymsp[-2].minor.yy360->name2,
- yymsp[-1].minor.yy192->notIndexedKw,
- yymsp[0].minor.yy352,
- yymsp[-5].minor.yy321
+ yygotominor.yy363 = new SqliteDelete(
+ yymsp[-2].minor.yy440->name1,
+ yymsp[-2].minor.yy440->name2,
+ yymsp[-1].minor.yy592->notIndexedKw,
+ yymsp[0].minor.yy512,
+ yymsp[-5].minor.yy1
);
}
- delete yymsp[-1].minor.yy192;
+ delete yymsp[-1].minor.yy592;
}
else
{
- yygotominor.yy283 = new SqliteDelete(
- yymsp[-2].minor.yy360->name1,
- yymsp[-2].minor.yy360->name2,
+ yygotominor.yy363 = new SqliteDelete(
+ yymsp[-2].minor.yy440->name1,
+ yymsp[-2].minor.yy440->name2,
false,
- yymsp[0].minor.yy352,
- yymsp[-5].minor.yy321
+ yymsp[0].minor.yy512,
+ yymsp[-5].minor.yy1
);
}
- delete yymsp[-2].minor.yy360;
+ delete yymsp[-2].minor.yy440;
// since it's used in trigger:
- objectForTokens = yygotominor.yy283;
+ objectForTokens = yygotominor.yy363;
}
break;
- case 217: /* delete_stmt ::= with DELETE FROM */
+ case 228: /* delete_stmt ::= with DELETE FROM */
{
parserContext->minorErrorBeforeNextToken("Syntax error");
SqliteDelete* q = new SqliteDelete();
- q->with = yymsp[-2].minor.yy321;
- yygotominor.yy283 = q;
- objectForTokens = yygotominor.yy283;
+ q->with = yymsp[-2].minor.yy1;
+ yygotominor.yy363 = q;
+ objectForTokens = yygotominor.yy363;
}
break;
- case 218: /* delete_stmt ::= with DELETE FROM nm DOT */
+ case 229: /* delete_stmt ::= with DELETE FROM nm DOT */
{
parserContext->minorErrorBeforeNextToken("Syntax error");
SqliteDelete* q = new SqliteDelete();
- q->with = yymsp[-4].minor.yy321;
- q->database = *(yymsp[-1].minor.yy399);
- yygotominor.yy283 = q;
- objectForTokens = yygotominor.yy283;
- delete yymsp[-1].minor.yy399;
+ q->with = yymsp[-4].minor.yy1;
+ q->database = *(yymsp[-1].minor.yy319);
+ yygotominor.yy363 = q;
+ objectForTokens = yygotominor.yy363;
+ delete yymsp[-1].minor.yy319;
}
break;
- case 219: /* delete_stmt ::= with DELETE FROM nm DOT ID_TAB */
- case 228: /* update_stmt ::= with UPDATE orconf nm DOT ID_TAB */ yytestcase(yyruleno==228);
-{ yy_destructor(yypParser,221,&yymsp[-5].minor);
- yy_destructor(yypParser,179,&yymsp[-2].minor);
+ case 230: /* delete_stmt ::= with DELETE FROM nm DOT ID_TAB */
+ case 239: /* update_stmt ::= with UPDATE orconf nm DOT ID_TAB */ yytestcase(yyruleno==239);
+{ yy_destructor(yypParser,244,&yymsp[-5].minor);
+ yy_destructor(yypParser,199,&yymsp[-2].minor);
}
break;
- case 220: /* delete_stmt ::= with DELETE FROM ID_DB|ID_TAB */
- case 229: /* update_stmt ::= with UPDATE orconf ID_DB|ID_TAB */ yytestcase(yyruleno==229);
-{ yy_destructor(yypParser,221,&yymsp[-3].minor);
+ case 231: /* delete_stmt ::= with DELETE FROM ID_DB|ID_TAB */
+ case 240: /* update_stmt ::= with UPDATE orconf ID_DB|ID_TAB */ yytestcase(yyruleno==240);
+{ yy_destructor(yypParser,244,&yymsp[-3].minor);
}
break;
- case 223: /* where_opt ::= WHERE */
+ case 234: /* where_opt ::= WHERE */
{
parserContext->minorErrorBeforeNextToken("Syntax error");
- yygotominor.yy352 = new SqliteExpr();
+ yygotominor.yy512 = new SqliteExpr();
}
break;
- case 225: /* update_stmt ::= with UPDATE orconf fullname indexed_opt SET setlist where_opt */
+ case 236: /* update_stmt ::= with UPDATE orconf fullname indexed_opt SET setlist from where_opt */
{
- yygotominor.yy283 = new SqliteUpdate(
- *(yymsp[-5].minor.yy338),
- yymsp[-4].minor.yy360->name1,
- yymsp[-4].minor.yy360->name2,
- yymsp[-3].minor.yy192 ? yymsp[-3].minor.yy192->notIndexedKw : false,
- yymsp[-3].minor.yy192 ? yymsp[-3].minor.yy192->indexedBy : QString::null,
- *(yymsp[-1].minor.yy521),
- yymsp[0].minor.yy352,
- yymsp[-7].minor.yy321
+ yygotominor.yy363 = new SqliteUpdate(
+ *(yymsp[-6].minor.yy418),
+ yymsp[-5].minor.yy440->name1,
+ yymsp[-5].minor.yy440->name2,
+ yymsp[-4].minor.yy592 ? yymsp[-4].minor.yy592->notIndexedKw : false,
+ yymsp[-4].minor.yy592 ? yymsp[-4].minor.yy592->indexedBy : QString(),
+ *(yymsp[-2].minor.yy201),
+ yymsp[-1].minor.yy31,
+ yymsp[0].minor.yy512,
+ yymsp[-8].minor.yy1
);
- delete yymsp[-5].minor.yy338;
- delete yymsp[-4].minor.yy360;
- delete yymsp[-1].minor.yy521;
- if (yymsp[-3].minor.yy192)
- delete yymsp[-3].minor.yy192;
+ delete yymsp[-6].minor.yy418;
+ delete yymsp[-5].minor.yy440;
+ delete yymsp[-2].minor.yy201;
+ if (yymsp[-4].minor.yy592)
+ delete yymsp[-4].minor.yy592;
// since it's used in trigger:
- objectForTokens = yygotominor.yy283;
+ objectForTokens = yygotominor.yy363;
}
break;
- case 226: /* update_stmt ::= with UPDATE orconf */
+ case 237: /* update_stmt ::= with UPDATE orconf */
{
parserContext->minorErrorBeforeNextToken("Syntax error");
SqliteUpdate* q = new SqliteUpdate();
- q->with = yymsp[-2].minor.yy321;
- yygotominor.yy283 = q;
- objectForTokens = yygotominor.yy283;
- delete yymsp[0].minor.yy338;
+ q->with = yymsp[-2].minor.yy1;
+ yygotominor.yy363 = q;
+ objectForTokens = yygotominor.yy363;
+ delete yymsp[0].minor.yy418;
}
break;
- case 227: /* update_stmt ::= with UPDATE orconf nm DOT */
+ case 238: /* update_stmt ::= with UPDATE orconf nm DOT */
{
parserContext->minorErrorBeforeNextToken("Syntax error");
SqliteUpdate* q = new SqliteUpdate();
- q->with = yymsp[-4].minor.yy321;
- q->database = *(yymsp[-1].minor.yy399);
- yygotominor.yy283 = q;
- objectForTokens = yygotominor.yy283;
- delete yymsp[-2].minor.yy338;
- delete yymsp[-1].minor.yy399;
+ q->with = yymsp[-4].minor.yy1;
+ q->database = *(yymsp[-1].minor.yy319);
+ yygotominor.yy363 = q;
+ objectForTokens = yygotominor.yy363;
+ delete yymsp[-2].minor.yy418;
+ delete yymsp[-1].minor.yy319;
}
break;
- case 230: /* setlist ::= setlist COMMA nm EQ expr */
+ case 241: /* setlist ::= setlist COMMA nm EQ expr */
{
- yymsp[-4].minor.yy521->append(ParserSetValue(*(yymsp[-2].minor.yy399), yymsp[0].minor.yy352));
- yygotominor.yy521 = yymsp[-4].minor.yy521;
- delete yymsp[-2].minor.yy399;
+ yymsp[-4].minor.yy201->append(ParserSetValue(*(yymsp[-2].minor.yy319), yymsp[0].minor.yy512));
+ yygotominor.yy201 = yymsp[-4].minor.yy201;
+ delete yymsp[-2].minor.yy319;
}
break;
- case 231: /* setlist ::= setlist COMMA LP idlist RP EQ expr */
+ case 242: /* setlist ::= setlist COMMA LP idlist RP EQ expr */
{
- yymsp[-6].minor.yy521->append(ParserSetValue(*(yymsp[-3].minor.yy95), yymsp[0].minor.yy352));
- yygotominor.yy521 = yymsp[-6].minor.yy521;
- delete yymsp[-3].minor.yy95;
+ yymsp[-6].minor.yy201->append(ParserSetValue(*(yymsp[-3].minor.yy575), yymsp[0].minor.yy512));
+ yygotominor.yy201 = yymsp[-6].minor.yy201;
+ delete yymsp[-3].minor.yy575;
}
break;
- case 232: /* setlist ::= nm EQ expr */
+ case 243: /* setlist ::= nm EQ expr */
{
- yygotominor.yy521 = new ParserSetValueList();
- yygotominor.yy521->append(ParserSetValue(*(yymsp[-2].minor.yy399), yymsp[0].minor.yy352));
- delete yymsp[-2].minor.yy399;
+ yygotominor.yy201 = new ParserSetValueList();
+ yygotominor.yy201->append(ParserSetValue(*(yymsp[-2].minor.yy319), yymsp[0].minor.yy512));
+ delete yymsp[-2].minor.yy319;
}
break;
- case 233: /* setlist ::= LP idlist RP EQ expr */
+ case 244: /* setlist ::= LP idlist RP EQ expr */
{
- yygotominor.yy521 = new ParserSetValueList();
- yygotominor.yy521->append(ParserSetValue(*(yymsp[-3].minor.yy95), yymsp[0].minor.yy352));
- delete yymsp[-3].minor.yy95;
+ yygotominor.yy201 = new ParserSetValueList();
+ yygotominor.yy201->append(ParserSetValue(*(yymsp[-3].minor.yy575), yymsp[0].minor.yy512));
+ delete yymsp[-3].minor.yy575;
}
break;
- case 234: /* setlist ::= */
+ case 245: /* setlist ::= */
{
parserContext->minorErrorBeforeNextToken("Syntax error");
- yygotominor.yy521 = new ParserSetValueList();
+ yygotominor.yy201 = new ParserSetValueList();
}
break;
- case 235: /* setlist ::= setlist COMMA */
+ case 246: /* setlist ::= setlist COMMA */
{
parserContext->minorErrorBeforeNextToken("Syntax error");
- yygotominor.yy521 = yymsp[-1].minor.yy521;
+ yygotominor.yy201 = yymsp[-1].minor.yy201;
}
break;
- case 236: /* setlist ::= setlist COMMA ID_COL */
- case 237: /* setlist ::= ID_COL */ yytestcase(yyruleno==237);
-{ yy_destructor(yypParser,249,&yymsp[-2].minor);
+ case 247: /* setlist ::= setlist COMMA ID_COL */
+ case 248: /* setlist ::= ID_COL */ yytestcase(yyruleno==248);
+{ yy_destructor(yypParser,274,&yymsp[-2].minor);
}
break;
- case 238: /* idlist_opt ::= */
-{yygotominor.yy95 = new QStringList();}
+ case 249: /* idlist_opt ::= */
+{yygotominor.yy575 = new QStringList();}
break;
- case 239: /* idlist_opt ::= LP idlist RP */
-{yygotominor.yy95 = yymsp[-1].minor.yy95;}
+ case 250: /* idlist_opt ::= LP idlist RP */
+{yygotominor.yy575 = yymsp[-1].minor.yy575;}
break;
- case 240: /* idlist ::= idlist COMMA nm */
+ case 251: /* idlist ::= idlist COMMA nm */
{
- yygotominor.yy95 = yymsp[-2].minor.yy95;
- *(yygotominor.yy95) << *(yymsp[0].minor.yy399);
- delete yymsp[0].minor.yy399;
+ yygotominor.yy575 = yymsp[-2].minor.yy575;
+ *(yygotominor.yy575) << *(yymsp[0].minor.yy319);
+ delete yymsp[0].minor.yy319;
}
break;
- case 241: /* idlist ::= nm */
+ case 252: /* idlist ::= nm */
{
- yygotominor.yy95 = new QStringList();
- *(yygotominor.yy95) << *(yymsp[0].minor.yy399);
- delete yymsp[0].minor.yy399;
+ yygotominor.yy575 = new QStringList();
+ *(yygotominor.yy575) << *(yymsp[0].minor.yy319);
+ delete yymsp[0].minor.yy319;
}
break;
- case 242: /* idlist ::= */
+ case 253: /* idlist ::= */
{
parserContext->minorErrorBeforeNextToken("Syntax error");
- yygotominor.yy95 = new QStringList();
+ yygotominor.yy575 = new QStringList();
}
break;
- case 243: /* idlist ::= idlist COMMA ID_COL */
- case 244: /* idlist ::= ID_COL */ yytestcase(yyruleno==244);
-{ yy_destructor(yypParser,245,&yymsp[-2].minor);
+ case 254: /* idlist ::= idlist COMMA ID_COL */
+ case 255: /* idlist ::= ID_COL */ yytestcase(yyruleno==255);
+{ yy_destructor(yypParser,269,&yymsp[-2].minor);
}
break;
- case 246: /* insert_stmt ::= with insert_cmd INTO fullname idlist_opt select upsert */
-{
- yygotominor.yy283 = new SqliteInsert(
- yymsp[-5].minor.yy105->replace,
- yymsp[-5].minor.yy105->orConflict,
- yymsp[-3].minor.yy360->name1,
- yymsp[-3].minor.yy360->name2,
- *(yymsp[-2].minor.yy95),
- yymsp[-1].minor.yy473,
- yymsp[-6].minor.yy321,
- yymsp[0].minor.yy560
+ case 257: /* insert_stmt ::= with insert_cmd INTO fullname idlist_opt select upsert */
+{
+ yygotominor.yy363 = new SqliteInsert(
+ yymsp[-5].minor.yy504->replace,
+ yymsp[-5].minor.yy504->orConflict,
+ yymsp[-3].minor.yy440->name1,
+ yymsp[-3].minor.yy440->name2,
+ *(yymsp[-2].minor.yy575),
+ yymsp[-1].minor.yy313,
+ yymsp[-6].minor.yy1,
+ yymsp[0].minor.yy400
);
- delete yymsp[-3].minor.yy360;
- delete yymsp[-5].minor.yy105;
- delete yymsp[-2].minor.yy95;
+ delete yymsp[-3].minor.yy440;
+ delete yymsp[-5].minor.yy504;
+ delete yymsp[-2].minor.yy575;
// since it's used in trigger:
- objectForTokens = yygotominor.yy283;
+ objectForTokens = yygotominor.yy363;
}
break;
- case 247: /* insert_stmt ::= with insert_cmd INTO fullname idlist_opt DEFAULT VALUES */
+ case 258: /* insert_stmt ::= with insert_cmd INTO fullname idlist_opt DEFAULT VALUES */
{
- yygotominor.yy283 = new SqliteInsert(
- yymsp[-5].minor.yy105->replace,
- yymsp[-5].minor.yy105->orConflict,
- yymsp[-3].minor.yy360->name1,
- yymsp[-3].minor.yy360->name2,
- *(yymsp[-2].minor.yy95),
- yymsp[-6].minor.yy321
+ yygotominor.yy363 = new SqliteInsert(
+ yymsp[-5].minor.yy504->replace,
+ yymsp[-5].minor.yy504->orConflict,
+ yymsp[-3].minor.yy440->name1,
+ yymsp[-3].minor.yy440->name2,
+ *(yymsp[-2].minor.yy575),
+ yymsp[-6].minor.yy1
);
- delete yymsp[-3].minor.yy360;
- delete yymsp[-5].minor.yy105;
- delete yymsp[-2].minor.yy95;
+ delete yymsp[-3].minor.yy440;
+ delete yymsp[-5].minor.yy504;
+ delete yymsp[-2].minor.yy575;
// since it's used in trigger:
- objectForTokens = yygotominor.yy283;
+ objectForTokens = yygotominor.yy363;
}
break;
- case 248: /* insert_stmt ::= with insert_cmd INTO */
+ case 259: /* insert_stmt ::= with insert_cmd INTO */
{
parserContext->minorErrorBeforeNextToken("Syntax error");
SqliteInsert* q = new SqliteInsert();
- q->replaceKw = yymsp[-1].minor.yy105->replace;
- q->onConflict = yymsp[-1].minor.yy105->orConflict;
- q->with = yymsp[-2].minor.yy321;
- yygotominor.yy283 = q;
- objectForTokens = yygotominor.yy283;
- delete yymsp[-1].minor.yy105;
+ q->replaceKw = yymsp[-1].minor.yy504->replace;
+ q->onConflict = yymsp[-1].minor.yy504->orConflict;
+ q->with = yymsp[-2].minor.yy1;
+ yygotominor.yy363 = q;
+ objectForTokens = yygotominor.yy363;
+ delete yymsp[-1].minor.yy504;
}
break;
- case 249: /* insert_stmt ::= with insert_cmd INTO nm DOT */
+ case 260: /* insert_stmt ::= with insert_cmd INTO nm DOT */
{
parserContext->minorErrorBeforeNextToken("Syntax error");
SqliteInsert* q = new SqliteInsert();
- q->replaceKw = yymsp[-3].minor.yy105->replace;
- q->onConflict = yymsp[-3].minor.yy105->orConflict;
- q->with = yymsp[-4].minor.yy321;
- q->database = *(yymsp[-1].minor.yy399);
- yygotominor.yy283 = q;
- objectForTokens = yygotominor.yy283;
- delete yymsp[-3].minor.yy105;
- delete yymsp[-1].minor.yy399;
- }
- break;
- case 250: /* insert_stmt ::= with insert_cmd INTO ID_DB|ID_TAB */
-{ yy_destructor(yypParser,221,&yymsp[-3].minor);
- yy_destructor(yypParser,252,&yymsp[-2].minor);
+ q->replaceKw = yymsp[-3].minor.yy504->replace;
+ q->onConflict = yymsp[-3].minor.yy504->orConflict;
+ q->with = yymsp[-4].minor.yy1;
+ q->database = *(yymsp[-1].minor.yy319);
+ yygotominor.yy363 = q;
+ objectForTokens = yygotominor.yy363;
+ delete yymsp[-3].minor.yy504;
+ delete yymsp[-1].minor.yy319;
+ }
+ break;
+ case 261: /* insert_stmt ::= with insert_cmd INTO ID_DB|ID_TAB */
+{ yy_destructor(yypParser,244,&yymsp[-3].minor);
+ yy_destructor(yypParser,277,&yymsp[-2].minor);
}
break;
- case 251: /* insert_stmt ::= with insert_cmd INTO nm DOT ID_TAB */
-{ yy_destructor(yypParser,221,&yymsp[-5].minor);
- yy_destructor(yypParser,252,&yymsp[-4].minor);
- yy_destructor(yypParser,179,&yymsp[-2].minor);
+ case 262: /* insert_stmt ::= with insert_cmd INTO nm DOT ID_TAB */
+{ yy_destructor(yypParser,244,&yymsp[-5].minor);
+ yy_destructor(yypParser,277,&yymsp[-4].minor);
+ yy_destructor(yypParser,199,&yymsp[-2].minor);
}
break;
- case 252: /* insert_cmd ::= INSERT orconf */
-{
- yygotominor.yy105 = new ParserStubInsertOrReplace(false, *(yymsp[0].minor.yy338));
- delete yymsp[0].minor.yy338;
- }
- break;
- case 253: /* insert_cmd ::= REPLACE */
-{yygotominor.yy105 = new ParserStubInsertOrReplace(true);}
- break;
- case 254: /* upsert ::= */
+ case 263: /* insert_cmd ::= INSERT orconf */
{
- yygotominor.yy560 = nullptr;
+ yygotominor.yy504 = new ParserStubInsertOrReplace(false, *(yymsp[0].minor.yy418));
+ delete yymsp[0].minor.yy418;
}
break;
- case 255: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt */
-{
- yygotominor.yy560 = new SqliteUpsert(*(yymsp[-7].minor.yy163), yymsp[-5].minor.yy352, *(yymsp[-1].minor.yy521), yymsp[0].minor.yy352);
- delete yymsp[-7].minor.yy163;
- delete yymsp[-1].minor.yy521;
- objectForTokens = yygotominor.yy560;
- }
+ case 264: /* insert_cmd ::= REPLACE */
+{yygotominor.yy504 = new ParserStubInsertOrReplace(true);}
break;
- case 256: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING */
+ case 265: /* upsert ::= */
{
- yygotominor.yy560 = new SqliteUpsert(*(yymsp[-4].minor.yy163), yymsp[-2].minor.yy352);
- delete yymsp[-4].minor.yy163;
- objectForTokens = yygotominor.yy560;
+ yygotominor.yy400 = nullptr;
}
break;
- case 257: /* upsert ::= ON CONFLICT DO NOTHING */
+ case 266: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt */
{
- yygotominor.yy560 = new SqliteUpsert();
- objectForTokens = yygotominor.yy560;
+ yygotominor.yy400 = new SqliteUpsert(*(yymsp[-7].minor.yy403), yymsp[-5].minor.yy512, *(yymsp[-1].minor.yy201), yymsp[0].minor.yy512);
+ delete yymsp[-7].minor.yy403;
+ delete yymsp[-1].minor.yy201;
+ objectForTokens = yygotominor.yy400;
}
break;
- case 258: /* exprx ::= nm DOT */
+ case 267: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING */
{
- yygotominor.yy352 = new SqliteExpr();
- yygotominor.yy352->initId(*(yymsp[-1].minor.yy399), QString::null, QString::null);
- delete yymsp[-1].minor.yy399;
- objectForTokens = yygotominor.yy352;
- parserContext->minorErrorBeforeNextToken("Syntax error <exprx: nm.>");
+ yygotominor.yy400 = new SqliteUpsert(*(yymsp[-4].minor.yy403), yymsp[-2].minor.yy512);
+ delete yymsp[-4].minor.yy403;
+ objectForTokens = yygotominor.yy400;
}
break;
- case 259: /* exprx ::= nm DOT nm DOT */
+ case 268: /* upsert ::= ON CONFLICT DO NOTHING */
{
- yygotominor.yy352 = new SqliteExpr();
- yygotominor.yy352->initId(*(yymsp[-3].minor.yy399), *(yymsp[-1].minor.yy399), QString::null);
- delete yymsp[-3].minor.yy399;
- delete yymsp[-1].minor.yy399;
- objectForTokens = yygotominor.yy352;
- parserContext->minorErrorBeforeNextToken("Syntax error <exprx: nm.nm.>");
+ yygotominor.yy400 = new SqliteUpsert();
+ objectForTokens = yygotominor.yy400;
}
break;
- case 260: /* exprx ::= expr not_opt BETWEEN expr AND */
-{
- yygotominor.yy352 = new SqliteExpr();
- delete yymsp[-3].minor.yy451;
- delete yymsp[-4].minor.yy352;
- delete yymsp[-1].minor.yy352;
- objectForTokens = yygotominor.yy352;
- parserContext->minorErrorBeforeNextToken("Syntax error <exprx: expr not_opt BETWEEN expr AND>");
- }
- break;
- case 261: /* exprx ::= CASE case_operand case_exprlist case_else */
-{
- yygotominor.yy352 = new SqliteExpr();
- delete yymsp[-1].minor.yy551;
- delete yymsp[-2].minor.yy352;
- delete yymsp[0].minor.yy352;
- objectForTokens = yygotominor.yy352;
- parserContext->minorErrorBeforeNextToken("Syntax error <exprx: CASE operand exprlist else>");
- }
- break;
- case 262: /* exprx ::= expr not_opt IN LP exprlist */
-{
- yygotominor.yy352 = new SqliteExpr();
- delete yymsp[-3].minor.yy451;
- delete yymsp[0].minor.yy551;
- delete yymsp[-4].minor.yy352;
- objectForTokens = yygotominor.yy352;
- parserContext->minorErrorBeforeNextToken("Syntax error <exprx: expr not_opt IN LP exprlist>");
- }
- break;
- case 263: /* exprx ::= expr not_opt IN ID_DB */
-{ yy_destructor(yypParser,201,&yymsp[-3].minor);
+ case 269: /* exprx ::= expr not_opt IN ID_DB */
+{ yy_destructor(yypParser,222,&yymsp[-3].minor);
}
break;
- case 264: /* exprx ::= expr not_opt IN nm DOT ID_TAB */
- case 265: /* exprx ::= ID_DB|ID_TAB|ID_COL|ID_FN */ yytestcase(yyruleno==265);
-{ yy_destructor(yypParser,201,&yymsp[-5].minor);
- yy_destructor(yypParser,179,&yymsp[-2].minor);
+ case 270: /* exprx ::= expr not_opt IN nm DOT ID_TAB */
+ case 271: /* exprx ::= ID_DB|ID_TAB|ID_COL|ID_FN */ yytestcase(yyruleno==271);
+{ yy_destructor(yypParser,222,&yymsp[-5].minor);
+ yy_destructor(yypParser,199,&yymsp[-2].minor);
}
break;
- case 267: /* exprx ::= nm DOT nm DOT ID_COL */
-{ yy_destructor(yypParser,179,&yymsp[-4].minor);
- yy_destructor(yypParser,179,&yymsp[-2].minor);
+ case 272: /* exprx ::= tnm DOT ID_TAB|ID_COL */
+{ yy_destructor(yypParser,230,&yymsp[-2].minor);
}
break;
- case 268: /* exprx ::= expr COLLATE ID_COLLATE */
- case 269: /* exprx ::= RAISE LP raisetype COMMA ID_ERR_MSG RP */ yytestcase(yyruleno==269);
-{ yy_destructor(yypParser,201,&yymsp[-2].minor);
+ case 273: /* exprx ::= tnm DOT nm DOT ID_COL */
+{ yy_destructor(yypParser,230,&yymsp[-4].minor);
+ yy_destructor(yypParser,199,&yymsp[-2].minor);
}
break;
- case 270: /* exprx ::= term */
-{
- yygotominor.yy352 = new SqliteExpr();
- yygotominor.yy352->initLiteral(*(yymsp[0].minor.yy469));
- delete yymsp[0].minor.yy469;
- objectForTokens = yygotominor.yy352;
- }
- break;
- case 271: /* exprx ::= CTIME_KW */
-{
- yygotominor.yy352 = new SqliteExpr();
- yygotominor.yy352->initCTime(yymsp[0].minor.yy0->value);
- objectForTokens = yygotominor.yy352;
- }
+ case 274: /* exprx ::= expr COLLATE ID_COLLATE */
+ case 275: /* exprx ::= RAISE LP raisetype COMMA ID_ERR_MSG RP */ yytestcase(yyruleno==275);
+{ yy_destructor(yypParser,222,&yymsp[-2].minor);
+}
break;
- case 272: /* exprx ::= LP nexprlist RP */
+ case 276: /* exprx ::= CTIME_KW */
{
- yygotominor.yy352 = new SqliteExpr();
- yygotominor.yy352->initRowValue(*(yymsp[-1].minor.yy551));
- delete yymsp[-1].minor.yy551;
- objectForTokens = yygotominor.yy352;
+ yygotominor.yy512 = new SqliteExpr();
+ yygotominor.yy512->initCTime(yymsp[0].minor.yy0->value);
+ objectForTokens = yygotominor.yy512;
}
break;
- case 273: /* exprx ::= id */
+ case 277: /* exprx ::= LP nexprlist RP */
{
- yygotominor.yy352 = new SqliteExpr();
- yygotominor.yy352->initId(*(yymsp[0].minor.yy399));
- delete yymsp[0].minor.yy399;
- objectForTokens = yygotominor.yy352;
+ yygotominor.yy512 = new SqliteExpr();
+ yygotominor.yy512->initRowValue(*(yymsp[-1].minor.yy71));
+ delete yymsp[-1].minor.yy71;
+ objectForTokens = yygotominor.yy512;
}
break;
- case 274: /* exprx ::= JOIN_KW */
+ case 278: /* exprx ::= tnm */
{
- yygotominor.yy352 = new SqliteExpr();
- yygotominor.yy352->initId(yymsp[0].minor.yy0->value);
- objectForTokens = yygotominor.yy352;
+ yygotominor.yy512 = new SqliteExpr();
+ if (yymsp[0].minor.yy590->isLiteral())
+ yygotominor.yy512->initLiteral(yymsp[0].minor.yy590->toLiteral());
+ else
+ yygotominor.yy512->initId(yymsp[0].minor.yy590->toName());
+ //parserContext->errorBeforeLastToken("Syntax error <expected literal value>");
+
+ delete yymsp[0].minor.yy590;
+ objectForTokens = yygotominor.yy512;
}
break;
- case 275: /* exprx ::= nm DOT nm */
+ case 279: /* exprx ::= tnm DOT nm */
{
- yygotominor.yy352 = new SqliteExpr();
- yygotominor.yy352->initId(*(yymsp[-2].minor.yy399), *(yymsp[0].minor.yy399));
- delete yymsp[-2].minor.yy399;
- delete yymsp[0].minor.yy399;
- objectForTokens = yygotominor.yy352;
+ yygotominor.yy512 = new SqliteExpr();
+ if (yymsp[-2].minor.yy590->isName())
+ yygotominor.yy512->initId(yymsp[-2].minor.yy590->toName(), *(yymsp[0].minor.yy319));
+ else
+ parserContext->errorAtToken("Syntax error <expected name>", -3);
+
+ delete yymsp[-2].minor.yy590;
+ delete yymsp[0].minor.yy319;
+ objectForTokens = yygotominor.yy512;
}
break;
- case 276: /* exprx ::= nm DOT nm DOT nm */
+ case 280: /* exprx ::= tnm DOT nm DOT nm */
{
- yygotominor.yy352 = new SqliteExpr();
- yygotominor.yy352->initId(*(yymsp[-4].minor.yy399), *(yymsp[-2].minor.yy399), *(yymsp[0].minor.yy399));
- delete yymsp[-4].minor.yy399;
- delete yymsp[-2].minor.yy399;
- delete yymsp[0].minor.yy399;
- objectForTokens = yygotominor.yy352;
+ yygotominor.yy512 = new SqliteExpr();
+ if (yymsp[-4].minor.yy590->isName())
+ yygotominor.yy512->initId(yymsp[-4].minor.yy590->toName(), *(yymsp[-2].minor.yy319), *(yymsp[0].minor.yy319));
+ else
+ parserContext->errorAtToken("Syntax error <expected name>", -5);
+
+ delete yymsp[-4].minor.yy590;
+ delete yymsp[-2].minor.yy319;
+ delete yymsp[0].minor.yy319;
+ objectForTokens = yygotominor.yy512;
}
break;
- case 277: /* exprx ::= VARIABLE */
+ case 281: /* exprx ::= VARIABLE */
{
- yygotominor.yy352 = new SqliteExpr();
- yygotominor.yy352->initBindParam(yymsp[0].minor.yy0->value);
- objectForTokens = yygotominor.yy352;
+ yygotominor.yy512 = new SqliteExpr();
+ yygotominor.yy512->initBindParam(yymsp[0].minor.yy0->value);
+ objectForTokens = yygotominor.yy512;
}
break;
- case 278: /* exprx ::= expr COLLATE ids */
+ case 282: /* exprx ::= expr COLLATE ids */
{
- yygotominor.yy352 = new SqliteExpr();
- yygotominor.yy352->initCollate(yymsp[-2].minor.yy352, *(yymsp[0].minor.yy399));
- delete yymsp[0].minor.yy399;
- objectForTokens = yygotominor.yy352;
+ yygotominor.yy512 = new SqliteExpr();
+ yygotominor.yy512->initCollate(yymsp[-2].minor.yy512, *(yymsp[0].minor.yy319));
+ delete yymsp[0].minor.yy319;
+ objectForTokens = yygotominor.yy512;
}
break;
- case 279: /* exprx ::= CAST LP expr AS typetoken RP */
+ case 283: /* exprx ::= CAST LP expr AS typetoken RP */
{
- yygotominor.yy352 = new SqliteExpr();
- yygotominor.yy352->initCast(yymsp[-3].minor.yy352, yymsp[-1].minor.yy537);
- objectForTokens = yygotominor.yy352;
+ yygotominor.yy512 = new SqliteExpr();
+ yygotominor.yy512->initCast(yymsp[-3].minor.yy512, yymsp[-1].minor.yy57);
+ objectForTokens = yygotominor.yy512;
}
break;
- case 280: /* exprx ::= ID LP distinct exprlist RP */
+ case 284: /* exprx ::= ID LP distinct exprlist RP */
{
- yygotominor.yy352 = new SqliteExpr();
- yygotominor.yy352->initFunction(yymsp[-4].minor.yy0->value, *(yymsp[-2].minor.yy146), *(yymsp[-1].minor.yy551));
- delete yymsp[-2].minor.yy146;
- delete yymsp[-1].minor.yy551;
- objectForTokens = yygotominor.yy352;
+ yygotominor.yy512 = new SqliteExpr();
+ yygotominor.yy512->initFunction(yymsp[-4].minor.yy0->value, *(yymsp[-2].minor.yy386), *(yymsp[-1].minor.yy71));
+ delete yymsp[-2].minor.yy386;
+ delete yymsp[-1].minor.yy71;
+ objectForTokens = yygotominor.yy512;
}
break;
- case 281: /* exprx ::= ID LP STAR RP */
+ case 285: /* exprx ::= ID LP STAR RP */
{
- yygotominor.yy352 = new SqliteExpr();
- yygotominor.yy352->initFunction(yymsp[-3].minor.yy0->value, true);
- objectForTokens = yygotominor.yy352;
+ yygotominor.yy512 = new SqliteExpr();
+ yygotominor.yy512->initFunction(yymsp[-3].minor.yy0->value, true);
+ objectForTokens = yygotominor.yy512;
}
break;
- case 282: /* exprx ::= expr AND expr */
- case 283: /* exprx ::= expr OR expr */ yytestcase(yyruleno==283);
- case 284: /* exprx ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==284);
- case 285: /* exprx ::= expr EQ|NE expr */ yytestcase(yyruleno==285);
- case 286: /* exprx ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==286);
- case 287: /* exprx ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==287);
- case 288: /* exprx ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==288);
- case 289: /* exprx ::= expr CONCAT expr */ yytestcase(yyruleno==289);
+ case 286: /* exprx ::= expr AND expr */
+ case 287: /* exprx ::= expr OR expr */ yytestcase(yyruleno==287);
+ case 288: /* exprx ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==288);
+ case 289: /* exprx ::= expr EQ|NE expr */ yytestcase(yyruleno==289);
+ case 290: /* exprx ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==290);
+ case 291: /* exprx ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==291);
+ case 292: /* exprx ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==292);
+ case 293: /* exprx ::= expr CONCAT expr */ yytestcase(yyruleno==293);
{
- yygotominor.yy352 = new SqliteExpr();
- yygotominor.yy352->initBinOp(yymsp[-2].minor.yy352, yymsp[-1].minor.yy0->value, yymsp[0].minor.yy352);
- objectForTokens = yygotominor.yy352;
+ yygotominor.yy512 = new SqliteExpr();
+ yygotominor.yy512->initBinOp(yymsp[-2].minor.yy512, yymsp[-1].minor.yy0->value, yymsp[0].minor.yy512);
+ objectForTokens = yygotominor.yy512;
}
break;
- case 290: /* exprx ::= expr not_opt likeop expr */
+ case 294: /* exprx ::= expr not_opt likeop expr */
{
- yygotominor.yy352 = new SqliteExpr();
- yygotominor.yy352->initLike(yymsp[-3].minor.yy352, *(yymsp[-2].minor.yy451), *(yymsp[-1].minor.yy520), yymsp[0].minor.yy352);
- delete yymsp[-2].minor.yy451;
- delete yymsp[-1].minor.yy520;
- objectForTokens = yygotominor.yy352;
+ yygotominor.yy512 = new SqliteExpr();
+ yygotominor.yy512->initLike(yymsp[-3].minor.yy512, *(yymsp[-2].minor.yy611), *(yymsp[-1].minor.yy40), yymsp[0].minor.yy512);
+ delete yymsp[-2].minor.yy611;
+ delete yymsp[-1].minor.yy40;
+ objectForTokens = yygotominor.yy512;
}
break;
- case 291: /* exprx ::= expr not_opt likeop expr ESCAPE expr */
+ case 295: /* exprx ::= expr not_opt likeop expr ESCAPE expr */
{
- yygotominor.yy352 = new SqliteExpr();
- yygotominor.yy352->initLike(yymsp[-5].minor.yy352, *(yymsp[-4].minor.yy451), *(yymsp[-3].minor.yy520), yymsp[-2].minor.yy352, yymsp[0].minor.yy352);
- delete yymsp[-4].minor.yy451;
- delete yymsp[-3].minor.yy520;
- objectForTokens = yygotominor.yy352;
+ yygotominor.yy512 = new SqliteExpr();
+ yygotominor.yy512->initLike(yymsp[-5].minor.yy512, *(yymsp[-4].minor.yy611), *(yymsp[-3].minor.yy40), yymsp[-2].minor.yy512, yymsp[0].minor.yy512);
+ delete yymsp[-4].minor.yy611;
+ delete yymsp[-3].minor.yy40;
+ objectForTokens = yygotominor.yy512;
}
break;
- case 292: /* exprx ::= expr ISNULL|NOTNULL */
+ case 296: /* exprx ::= expr ISNULL|NOTNULL */
{
- yygotominor.yy352 = new SqliteExpr();
- yygotominor.yy352->initNull(yymsp[-1].minor.yy352, yymsp[0].minor.yy0->value);
- objectForTokens = yygotominor.yy352;
+ yygotominor.yy512 = new SqliteExpr();
+ yygotominor.yy512->initNull(yymsp[-1].minor.yy512, yymsp[0].minor.yy0->value);
+ objectForTokens = yygotominor.yy512;
}
break;
- case 293: /* exprx ::= expr NOT NULL */
+ case 297: /* exprx ::= expr NOT NULL */
{
- yygotominor.yy352 = new SqliteExpr();
- yygotominor.yy352->initNull(yymsp[-2].minor.yy352, "NOT NULL");
- objectForTokens = yygotominor.yy352;
+ yygotominor.yy512 = new SqliteExpr();
+ yygotominor.yy512->initNull(yymsp[-2].minor.yy512, "NOT NULL");
+ objectForTokens = yygotominor.yy512;
}
break;
- case 294: /* exprx ::= expr IS not_opt expr */
+ case 298: /* exprx ::= expr IS not_opt expr */
{
- yygotominor.yy352 = new SqliteExpr();
- yygotominor.yy352->initIs(yymsp[-3].minor.yy352, *(yymsp[-1].minor.yy451), yymsp[0].minor.yy352);
- delete yymsp[-1].minor.yy451;
- objectForTokens = yygotominor.yy352;
+ yygotominor.yy512 = new SqliteExpr();
+ yygotominor.yy512->initIs(yymsp[-3].minor.yy512, *(yymsp[-1].minor.yy611), yymsp[0].minor.yy512);
+ delete yymsp[-1].minor.yy611;
+ objectForTokens = yygotominor.yy512;
}
break;
- case 295: /* exprx ::= NOT expr */
+ case 299: /* exprx ::= NOT expr */
{
- yygotominor.yy352 = new SqliteExpr();
- yygotominor.yy352->initUnaryOp(yymsp[0].minor.yy352, yymsp[-1].minor.yy0->value);
+ yygotominor.yy512 = new SqliteExpr();
+ yygotominor.yy512->initUnaryOp(yymsp[0].minor.yy512, yymsp[-1].minor.yy0->value);
}
break;
- case 296: /* exprx ::= BITNOT expr */
- case 298: /* exprx ::= PLUS expr */ yytestcase(yyruleno==298);
+ case 300: /* exprx ::= BITNOT expr */
+ case 302: /* exprx ::= PLUS expr */ yytestcase(yyruleno==302);
{
- yygotominor.yy352 = new SqliteExpr();
- yygotominor.yy352->initUnaryOp(yymsp[0].minor.yy352, yymsp[-1].minor.yy0->value);
- objectForTokens = yygotominor.yy352;
+ yygotominor.yy512 = new SqliteExpr();
+ yygotominor.yy512->initUnaryOp(yymsp[0].minor.yy512, yymsp[-1].minor.yy0->value);
+ objectForTokens = yygotominor.yy512;
}
break;
- case 297: /* exprx ::= MINUS expr */
+ case 301: /* exprx ::= MINUS expr */
{
- yygotominor.yy352 = new SqliteExpr();
- if (yymsp[0].minor.yy352->mode == SqliteExpr::Mode::LITERAL_VALUE &&
+ yygotominor.yy512 = new SqliteExpr();
+ if (yymsp[0].minor.yy512->mode == SqliteExpr::Mode::LITERAL_VALUE &&
parserContext->isCandidateForMaxNegativeNumber() &&
- yymsp[0].minor.yy352->literalValue == static_cast<qint64>(0L))
+ yymsp[0].minor.yy512->literalValue == static_cast<qint64>(0L))
{
- yygotominor.yy352->initLiteral(std::numeric_limits<qint64>::min());
- delete yymsp[0].minor.yy352;
+ yygotominor.yy512->initLiteral(std::numeric_limits<qint64>::min());
+ delete yymsp[0].minor.yy512;
}
else
{
- yygotominor.yy352->initUnaryOp(yymsp[0].minor.yy352, yymsp[-1].minor.yy0->value);
+ yygotominor.yy512->initUnaryOp(yymsp[0].minor.yy512, yymsp[-1].minor.yy0->value);
}
- objectForTokens = yygotominor.yy352;
+ objectForTokens = yygotominor.yy512;
}
break;
- case 299: /* exprx ::= expr not_opt BETWEEN expr AND expr */
+ case 303: /* exprx ::= expr not_opt BETWEEN expr AND expr */
{
- yygotominor.yy352 = new SqliteExpr();
- yygotominor.yy352->initBetween(yymsp[-5].minor.yy352, *(yymsp[-4].minor.yy451), yymsp[-2].minor.yy352, yymsp[0].minor.yy352);
- delete yymsp[-4].minor.yy451;
- objectForTokens = yygotominor.yy352;
+ yygotominor.yy512 = new SqliteExpr();
+ yygotominor.yy512->initBetween(yymsp[-5].minor.yy512, *(yymsp[-4].minor.yy611), yymsp[-2].minor.yy512, yymsp[0].minor.yy512);
+ delete yymsp[-4].minor.yy611;
+ objectForTokens = yygotominor.yy512;
}
break;
- case 300: /* exprx ::= expr not_opt IN LP exprlist RP */
+ case 304: /* exprx ::= expr not_opt IN LP exprlist RP */
{
- yygotominor.yy352 = new SqliteExpr();
- yygotominor.yy352->initIn(yymsp[-5].minor.yy352, *(yymsp[-4].minor.yy451), *(yymsp[-1].minor.yy551));
- delete yymsp[-4].minor.yy451;
- delete yymsp[-1].minor.yy551;
- objectForTokens = yygotominor.yy352;
+ yygotominor.yy512 = new SqliteExpr();
+ yygotominor.yy512->initIn(yymsp[-5].minor.yy512, *(yymsp[-4].minor.yy611), *(yymsp[-1].minor.yy71));
+ delete yymsp[-4].minor.yy611;
+ delete yymsp[-1].minor.yy71;
+ objectForTokens = yygotominor.yy512;
}
break;
- case 301: /* exprx ::= LP select RP */
+ case 305: /* exprx ::= LP select RP */
{
- yygotominor.yy352 = new SqliteExpr();
- yygotominor.yy352->initSubSelect(yymsp[-1].minor.yy473);
- objectForTokens = yygotominor.yy352;
+ yygotominor.yy512 = new SqliteExpr();
+ yygotominor.yy512->initSubSelect(yymsp[-1].minor.yy313);
+ objectForTokens = yygotominor.yy512;
}
break;
- case 302: /* exprx ::= expr not_opt IN LP select RP */
+ case 306: /* exprx ::= expr not_opt IN LP select RP */
{
- yygotominor.yy352 = new SqliteExpr();
- yygotominor.yy352->initIn(yymsp[-5].minor.yy352, *(yymsp[-4].minor.yy451), yymsp[-1].minor.yy473);
- delete yymsp[-4].minor.yy451;
- objectForTokens = yygotominor.yy352;
+ yygotominor.yy512 = new SqliteExpr();
+ yygotominor.yy512->initIn(yymsp[-5].minor.yy512, *(yymsp[-4].minor.yy611), yymsp[-1].minor.yy313);
+ delete yymsp[-4].minor.yy611;
+ objectForTokens = yygotominor.yy512;
}
break;
- case 303: /* exprx ::= expr not_opt IN nm dbnm */
+ case 307: /* exprx ::= expr not_opt IN nm dbnm */
{
- yygotominor.yy352 = new SqliteExpr();
- yygotominor.yy352->initIn(yymsp[-4].minor.yy352, *(yymsp[-3].minor.yy451), *(yymsp[-1].minor.yy399), *(yymsp[0].minor.yy399));
- delete yymsp[-3].minor.yy451;
- delete yymsp[-1].minor.yy399;
- objectForTokens = yygotominor.yy352;
+ yygotominor.yy512 = new SqliteExpr();
+ yygotominor.yy512->initIn(yymsp[-4].minor.yy512, *(yymsp[-3].minor.yy611), *(yymsp[-1].minor.yy319), *(yymsp[0].minor.yy319));
+ delete yymsp[-3].minor.yy611;
+ delete yymsp[-1].minor.yy319;
+ objectForTokens = yygotominor.yy512;
}
break;
- case 304: /* exprx ::= EXISTS LP select RP */
+ case 308: /* exprx ::= EXISTS LP select RP */
{
- yygotominor.yy352 = new SqliteExpr();
- yygotominor.yy352->initExists(yymsp[-1].minor.yy473);
- objectForTokens = yygotominor.yy352;
+ yygotominor.yy512 = new SqliteExpr();
+ yygotominor.yy512->initExists(yymsp[-1].minor.yy313);
+ objectForTokens = yygotominor.yy512;
}
break;
- case 305: /* exprx ::= CASE case_operand case_exprlist case_else END */
+ case 309: /* exprx ::= CASE case_operand case_exprlist case_else END */
{
- yygotominor.yy352 = new SqliteExpr();
- yygotominor.yy352->initCase(yymsp[-3].minor.yy352, *(yymsp[-2].minor.yy551), yymsp[-1].minor.yy352);
- delete yymsp[-2].minor.yy551;
- objectForTokens = yygotominor.yy352;
+ yygotominor.yy512 = new SqliteExpr();
+ yygotominor.yy512->initCase(yymsp[-3].minor.yy512, *(yymsp[-2].minor.yy71), yymsp[-1].minor.yy512);
+ delete yymsp[-2].minor.yy71;
+ objectForTokens = yygotominor.yy512;
}
break;
- case 306: /* exprx ::= RAISE LP IGNORE RP */
+ case 310: /* exprx ::= RAISE LP IGNORE RP */
{
- yygotominor.yy352 = new SqliteExpr();
- yygotominor.yy352->initRaise(yymsp[-1].minor.yy0->value);
- objectForTokens = yygotominor.yy352;
+ yygotominor.yy512 = new SqliteExpr();
+ yygotominor.yy512->initRaise(yymsp[-1].minor.yy0->value);
+ objectForTokens = yygotominor.yy512;
}
break;
- case 307: /* exprx ::= RAISE LP raisetype COMMA nm RP */
+ case 311: /* exprx ::= RAISE LP raisetype COMMA nm RP */
{
- yygotominor.yy352 = new SqliteExpr();
- yygotominor.yy352->initRaise(yymsp[-3].minor.yy0->value, *(yymsp[-1].minor.yy399));
- delete yymsp[-1].minor.yy399;
- objectForTokens = yygotominor.yy352;
+ yygotominor.yy512 = new SqliteExpr();
+ yygotominor.yy512->initRaise(yymsp[-3].minor.yy0->value, *(yymsp[-1].minor.yy319));
+ delete yymsp[-1].minor.yy319;
+ objectForTokens = yygotominor.yy512;
}
break;
- case 308: /* expr ::= */
+ case 312: /* exprx ::= ID LP distinct exprlist RP filter_over */
{
- yygotominor.yy352 = new SqliteExpr();
- objectForTokens = yygotominor.yy352;
+ yygotominor.yy512 = new SqliteExpr();
+ yygotominor.yy512->initWindowFunction(yymsp[-5].minor.yy0->value, *(yymsp[-3].minor.yy386), *(yymsp[-2].minor.yy71), yymsp[0].minor.yy247);
+ delete yymsp[-3].minor.yy386;
+ delete yymsp[-2].minor.yy71;
+ objectForTokens = yygotominor.yy512;
+ }
+ break;
+ case 313: /* exprx ::= ID LP STAR RP filter_over */
+{
+ yygotominor.yy512 = new SqliteExpr();
+ yygotominor.yy512->initWindowFunction(yymsp[-4].minor.yy0->value, yymsp[0].minor.yy247);
+ objectForTokens = yygotominor.yy512;
+ }
+ break;
+ case 314: /* expr ::= */
+{
+ yygotominor.yy512 = new SqliteExpr();
+ objectForTokens = yygotominor.yy512;
parserContext->minorErrorAfterLastToken("Syntax error <expr>");
}
break;
- case 312: /* likeop ::= LIKE_KW|MATCH */
-{yygotominor.yy520 = new SqliteExpr::LikeOp(SqliteExpr::likeOp(yymsp[0].minor.yy0->value));}
+ case 318: /* likeop ::= LIKE_KW|MATCH */
+{yygotominor.yy40 = new SqliteExpr::LikeOp(SqliteExpr::likeOp(yymsp[0].minor.yy0->value));}
break;
- case 313: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
+ case 319: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
{
- yymsp[-4].minor.yy551->append(yymsp[-2].minor.yy352);
- yymsp[-4].minor.yy551->append(yymsp[0].minor.yy352);
- yygotominor.yy551 = yymsp[-4].minor.yy551;
+ yymsp[-4].minor.yy71->append(yymsp[-2].minor.yy512);
+ yymsp[-4].minor.yy71->append(yymsp[0].minor.yy512);
+ yygotominor.yy71 = yymsp[-4].minor.yy71;
}
break;
- case 314: /* case_exprlist ::= WHEN expr THEN expr */
+ case 320: /* case_exprlist ::= WHEN expr THEN expr */
{
- yygotominor.yy551 = new ParserExprList();
- yygotominor.yy551->append(yymsp[-2].minor.yy352);
- yygotominor.yy551->append(yymsp[0].minor.yy352);
+ yygotominor.yy71 = new ParserExprList();
+ yygotominor.yy71->append(yymsp[-2].minor.yy512);
+ yygotominor.yy71->append(yymsp[0].minor.yy512);
}
break;
- case 321: /* nexprlist ::= nexprlist COMMA expr */
+ case 327: /* nexprlist ::= nexprlist COMMA expr */
{
- yymsp[-2].minor.yy551->append(yymsp[0].minor.yy352);
- yygotominor.yy551 = yymsp[-2].minor.yy551;
+ yymsp[-2].minor.yy71->append(yymsp[0].minor.yy512);
+ yygotominor.yy71 = yymsp[-2].minor.yy71;
DONT_INHERIT_TOKENS("nexprlist");
}
break;
- case 322: /* nexprlist ::= exprx */
+ case 328: /* nexprlist ::= exprx */
{
- yygotominor.yy551 = new ParserExprList();
- yygotominor.yy551->append(yymsp[0].minor.yy352);
+ yygotominor.yy71 = new ParserExprList();
+ yygotominor.yy71->append(yymsp[0].minor.yy512);
}
break;
- case 323: /* cmd ::= CREATE uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
+ case 329: /* cmd ::= CREATE uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
{
- yygotominor.yy283 = new SqliteCreateIndex(
- *(yymsp[-10].minor.yy451),
- *(yymsp[-8].minor.yy451),
- *(yymsp[-7].minor.yy399),
- *(yymsp[-6].minor.yy399),
- *(yymsp[-4].minor.yy399),
- *(yymsp[-2].minor.yy163),
- yymsp[0].minor.yy352
+ yygotominor.yy363 = new SqliteCreateIndex(
+ *(yymsp[-10].minor.yy611),
+ *(yymsp[-8].minor.yy611),
+ *(yymsp[-7].minor.yy319),
+ *(yymsp[-6].minor.yy319),
+ *(yymsp[-4].minor.yy319),
+ *(yymsp[-2].minor.yy403),
+ yymsp[0].minor.yy512
);
- delete yymsp[-8].minor.yy451;
- delete yymsp[-10].minor.yy451;
- delete yymsp[-7].minor.yy399;
- delete yymsp[-6].minor.yy399;
- delete yymsp[-4].minor.yy399;
- delete yymsp[-2].minor.yy163;
- objectForTokens = yygotominor.yy283;
+ delete yymsp[-8].minor.yy611;
+ delete yymsp[-10].minor.yy611;
+ delete yymsp[-7].minor.yy319;
+ delete yymsp[-6].minor.yy319;
+ delete yymsp[-4].minor.yy319;
+ delete yymsp[-2].minor.yy403;
+ objectForTokens = yygotominor.yy363;
}
break;
- case 324: /* cmd ::= CREATE uniqueflag INDEX ifnotexists nm dbnm ON ID_TAB */
-{ yy_destructor(yypParser,179,&yymsp[-3].minor);
+ case 330: /* cmd ::= CREATE uniqueflag INDEX ifnotexists nm dbnm ON ID_TAB */
+{ yy_destructor(yypParser,199,&yymsp[-3].minor);
}
break;
- case 329: /* idxlist_opt ::= */
+ case 335: /* idxlist_opt ::= */
{yygotominor.yy223 = new ParserIndexedColumnList();}
break;
- case 330: /* idxlist_opt ::= LP idxlist RP */
+ case 336: /* idxlist_opt ::= LP idxlist RP */
{yygotominor.yy223 = yymsp[-1].minor.yy223;}
break;
- case 331: /* idxlist ::= idxlist COMMA idxlist_single */
+ case 337: /* idxlist ::= idxlist COMMA idxlist_single */
{
- yymsp[-2].minor.yy223->append(yymsp[0].minor.yy108);
+ yymsp[-2].minor.yy223->append(yymsp[0].minor.yy268);
yygotominor.yy223 = yymsp[-2].minor.yy223;
DONT_INHERIT_TOKENS("idxlist");
}
break;
- case 332: /* idxlist ::= idxlist_single */
+ case 338: /* idxlist ::= idxlist_single */
{
yygotominor.yy223 = new ParserIndexedColumnList();
- yygotominor.yy223->append(yymsp[0].minor.yy108);
+ yygotominor.yy223->append(yymsp[0].minor.yy268);
}
break;
- case 333: /* idxlist_single ::= nm collate sortorder */
- case 334: /* idxlist_single ::= ID_COL */ yytestcase(yyruleno==334);
+ case 339: /* idxlist_single ::= nm collate sortorder */
+ case 340: /* idxlist_single ::= ID_COL */ yytestcase(yyruleno==340);
{
SqliteIndexedColumn* obj =
new SqliteIndexedColumn(
- *(yymsp[-2].minor.yy399),
- *(yymsp[-1].minor.yy399),
- *(yymsp[0].minor.yy309)
+ *(yymsp[-2].minor.yy319),
+ *(yymsp[-1].minor.yy319),
+ *(yymsp[0].minor.yy549)
);
- yygotominor.yy108 = obj;
- delete yymsp[0].minor.yy309;
- delete yymsp[-2].minor.yy399;
- delete yymsp[-1].minor.yy399;
- objectForTokens = yygotominor.yy108;
+ yygotominor.yy268 = obj;
+ delete yymsp[0].minor.yy549;
+ delete yymsp[-2].minor.yy319;
+ delete yymsp[-1].minor.yy319;
+ objectForTokens = yygotominor.yy268;
}
break;
- case 338: /* cmd ::= DROP INDEX ifexists fullname */
+ case 344: /* cmd ::= DROP INDEX ifexists fullname */
{
- yygotominor.yy283 = new SqliteDropIndex(*(yymsp[-1].minor.yy451), yymsp[0].minor.yy360->name1, yymsp[0].minor.yy360->name2);
- delete yymsp[-1].minor.yy451;
- delete yymsp[0].minor.yy360;
- objectForTokens = yygotominor.yy283;
+ yygotominor.yy363 = new SqliteDropIndex(*(yymsp[-1].minor.yy611), yymsp[0].minor.yy440->name1, yymsp[0].minor.yy440->name2);
+ delete yymsp[-1].minor.yy611;
+ delete yymsp[0].minor.yy440;
+ objectForTokens = yygotominor.yy363;
}
break;
- case 341: /* cmd ::= VACUUM */
+ case 347: /* cmd ::= VACUUM vinto */
{
- yygotominor.yy283 = new SqliteVacuum();
- objectForTokens = yygotominor.yy283;
+ yygotominor.yy363 = new SqliteVacuum(yymsp[0].minor.yy512);
+ objectForTokens = yygotominor.yy363;
}
break;
- case 342: /* cmd ::= VACUUM nm */
+ case 348: /* cmd ::= VACUUM nm vinto */
{
- yygotominor.yy283 = new SqliteVacuum(*(yymsp[0].minor.yy399));
- delete yymsp[0].minor.yy399;
- objectForTokens = yygotominor.yy283;
+ yygotominor.yy363 = new SqliteVacuum(*(yymsp[-1].minor.yy319), yymsp[0].minor.yy512);
+ delete yymsp[-1].minor.yy319;
+ objectForTokens = yygotominor.yy363;
}
break;
- case 343: /* cmd ::= PRAGMA nm dbnm */
+ case 351: /* cmd ::= PRAGMA nm dbnm */
{
- yygotominor.yy283 = new SqlitePragma(*(yymsp[-1].minor.yy399), *(yymsp[0].minor.yy399));
- delete yymsp[-1].minor.yy399;
- delete yymsp[0].minor.yy399;
- objectForTokens = yygotominor.yy283;
+ yygotominor.yy363 = new SqlitePragma(*(yymsp[-1].minor.yy319), *(yymsp[0].minor.yy319));
+ delete yymsp[-1].minor.yy319;
+ delete yymsp[0].minor.yy319;
+ objectForTokens = yygotominor.yy363;
}
break;
- case 344: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
- case 346: /* cmd ::= PRAGMA nm dbnm EQ minus_num */ yytestcase(yyruleno==346);
+ case 352: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
+ case 354: /* cmd ::= PRAGMA nm dbnm EQ minus_num */ yytestcase(yyruleno==354);
{
- yygotominor.yy283 = new SqlitePragma(*(yymsp[-3].minor.yy399), *(yymsp[-2].minor.yy399), *(yymsp[0].minor.yy469), true);
- delete yymsp[-3].minor.yy399;
- delete yymsp[-2].minor.yy399;
- delete yymsp[0].minor.yy469;
- objectForTokens = yygotominor.yy283;
+ yygotominor.yy363 = new SqlitePragma(*(yymsp[-3].minor.yy319), *(yymsp[-2].minor.yy319), *(yymsp[0].minor.yy229), true);
+ delete yymsp[-3].minor.yy319;
+ delete yymsp[-2].minor.yy319;
+ delete yymsp[0].minor.yy229;
+ objectForTokens = yygotominor.yy363;
}
break;
- case 345: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
- case 347: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */ yytestcase(yyruleno==347);
+ case 353: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
+ case 355: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */ yytestcase(yyruleno==355);
{
- yygotominor.yy283 = new SqlitePragma(*(yymsp[-4].minor.yy399), *(yymsp[-3].minor.yy399), *(yymsp[-1].minor.yy469), false);
- delete yymsp[-4].minor.yy399;
- delete yymsp[-3].minor.yy399;
- delete yymsp[-1].minor.yy469;
- objectForTokens = yygotominor.yy283;
+ yygotominor.yy363 = new SqlitePragma(*(yymsp[-4].minor.yy319), *(yymsp[-3].minor.yy319), *(yymsp[-1].minor.yy229), false);
+ delete yymsp[-4].minor.yy319;
+ delete yymsp[-3].minor.yy319;
+ delete yymsp[-1].minor.yy229;
+ objectForTokens = yygotominor.yy363;
}
break;
- case 351: /* nmnum ::= nm */
+ case 359: /* nmnum ::= nm */
{
- yygotominor.yy469 = new QVariant(*(yymsp[0].minor.yy399));
- delete yymsp[0].minor.yy399;
+ yygotominor.yy229 = new QVariant(*(yymsp[0].minor.yy319));
+ delete yymsp[0].minor.yy319;
}
break;
- case 357: /* minus_num ::= MINUS number */
+ case 360: /* nmnum ::= ON */
+ case 361: /* nmnum ::= DELETE */ yytestcase(yyruleno==361);
+ case 362: /* nmnum ::= DEFAULT */ yytestcase(yyruleno==362);
+{yygotominor.yy229 = new QVariant(yymsp[0].minor.yy0->value);}
+ break;
+ case 365: /* minus_num ::= MINUS number */
{
- if (yymsp[0].minor.yy469->type() == QVariant::Double)
- *(yymsp[0].minor.yy469) = -(yymsp[0].minor.yy469->toDouble());
- else if (yymsp[0].minor.yy469->type() == QVariant::LongLong)
+ if (yymsp[0].minor.yy229->type() == QVariant::Double)
+ *(yymsp[0].minor.yy229) = -(yymsp[0].minor.yy229->toDouble());
+ else if (yymsp[0].minor.yy229->type() == QVariant::LongLong)
{
if (parserContext->isCandidateForMaxNegativeNumber())
- *(yymsp[0].minor.yy469) = std::numeric_limits<qint64>::min();
+ *(yymsp[0].minor.yy229) = std::numeric_limits<qint64>::min();
else
- *(yymsp[0].minor.yy469) = -(yymsp[0].minor.yy469->toLongLong());
+ *(yymsp[0].minor.yy229) = -(yymsp[0].minor.yy229->toLongLong());
}
else
Q_ASSERT_X(true, "producing minus number", "QVariant is neither of Double or LongLong.");
- yygotominor.yy469 = yymsp[0].minor.yy469;
- }
- break;
- case 360: /* cmd ::= CREATE temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON nm foreach_clause when_clause BEGIN trigger_cmd_list END */
-{
- yygotominor.yy283 = new SqliteCreateTrigger(
- *(yymsp[-13].minor.yy146),
- *(yymsp[-11].minor.yy451),
- *(yymsp[-10].minor.yy399),
- *(yymsp[-9].minor.yy399),
- *(yymsp[-5].minor.yy399),
- *(yymsp[-8].minor.yy132),
- yymsp[-7].minor.yy552,
- *(yymsp[-4].minor.yy3),
- yymsp[-3].minor.yy352,
- *(yymsp[-1].minor.yy430),
+ yygotominor.yy229 = yymsp[0].minor.yy229;
+ }
+ break;
+ case 368: /* cmd ::= CREATE temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON nm foreach_clause when_clause BEGIN trigger_cmd_list END */
+{
+ yygotominor.yy363 = new SqliteCreateTrigger(
+ *(yymsp[-13].minor.yy386),
+ *(yymsp[-11].minor.yy611),
+ *(yymsp[-10].minor.yy319),
+ *(yymsp[-9].minor.yy319),
+ *(yymsp[-5].minor.yy319),
+ *(yymsp[-8].minor.yy532),
+ yymsp[-7].minor.yy151,
+ *(yymsp[-4].minor.yy83),
+ yymsp[-3].minor.yy512,
+ *(yymsp[-1].minor.yy110),
3
);
- delete yymsp[-11].minor.yy451;
- delete yymsp[-13].minor.yy146;
- delete yymsp[-8].minor.yy132;
- delete yymsp[-4].minor.yy3;
- delete yymsp[-10].minor.yy399;
- delete yymsp[-5].minor.yy399;
- delete yymsp[-9].minor.yy399;
- delete yymsp[-1].minor.yy430;
- objectForTokens = yygotominor.yy283;
+ delete yymsp[-11].minor.yy611;
+ delete yymsp[-13].minor.yy386;
+ delete yymsp[-8].minor.yy532;
+ delete yymsp[-4].minor.yy83;
+ delete yymsp[-10].minor.yy319;
+ delete yymsp[-5].minor.yy319;
+ delete yymsp[-9].minor.yy319;
+ delete yymsp[-1].minor.yy110;
+ objectForTokens = yygotominor.yy363;
}
break;
- case 361: /* cmd ::= CREATE temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON nm foreach_clause when_clause */
+ case 369: /* cmd ::= CREATE temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON nm foreach_clause when_clause */
{
QList<SqliteQuery *> CL;
- yygotominor.yy283 = new SqliteCreateTrigger(
- *(yymsp[-10].minor.yy146),
- *(yymsp[-8].minor.yy451),
- *(yymsp[-7].minor.yy399),
- *(yymsp[-6].minor.yy399),
- *(yymsp[-2].minor.yy399),
- *(yymsp[-5].minor.yy132),
- yymsp[-4].minor.yy552,
- *(yymsp[-1].minor.yy3),
- yymsp[0].minor.yy352,
+ yygotominor.yy363 = new SqliteCreateTrigger(
+ *(yymsp[-10].minor.yy386),
+ *(yymsp[-8].minor.yy611),
+ *(yymsp[-7].minor.yy319),
+ *(yymsp[-6].minor.yy319),
+ *(yymsp[-2].minor.yy319),
+ *(yymsp[-5].minor.yy532),
+ yymsp[-4].minor.yy151,
+ *(yymsp[-1].minor.yy83),
+ yymsp[0].minor.yy512,
CL,
3
);
- delete yymsp[-8].minor.yy451;
- delete yymsp[-10].minor.yy146;
- delete yymsp[-5].minor.yy132;
- delete yymsp[-1].minor.yy3;
- delete yymsp[-7].minor.yy399;
- delete yymsp[-2].minor.yy399;
- delete yymsp[-6].minor.yy399;
- objectForTokens = yygotominor.yy283;
+ delete yymsp[-8].minor.yy611;
+ delete yymsp[-10].minor.yy386;
+ delete yymsp[-5].minor.yy532;
+ delete yymsp[-1].minor.yy83;
+ delete yymsp[-7].minor.yy319;
+ delete yymsp[-2].minor.yy319;
+ delete yymsp[-6].minor.yy319;
+ objectForTokens = yygotominor.yy363;
parserContext->minorErrorAfterLastToken("Syntax error");
}
break;
- case 362: /* cmd ::= CREATE temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON nm foreach_clause when_clause BEGIN trigger_cmd_list */
-{
- yygotominor.yy283 = new SqliteCreateTrigger(
- *(yymsp[-12].minor.yy146),
- *(yymsp[-10].minor.yy451),
- *(yymsp[-9].minor.yy399),
- *(yymsp[-8].minor.yy399),
- *(yymsp[-4].minor.yy399),
- *(yymsp[-7].minor.yy132),
- yymsp[-6].minor.yy552,
- *(yymsp[-3].minor.yy3),
- yymsp[-2].minor.yy352,
- *(yymsp[0].minor.yy430),
- 3
+ case 370: /* cmd ::= CREATE temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON nm foreach_clause when_clause BEGIN trigger_cmd_list */
+{
+ yygotominor.yy363 = new SqliteCreateTrigger(
+ *(yymsp[-12].minor.yy386),
+ *(yymsp[-10].minor.yy611),
+ *(yymsp[-9].minor.yy319),
+ *(yymsp[-8].minor.yy319),
+ *(yymsp[-4].minor.yy319),
+ *(yymsp[-7].minor.yy532),
+ yymsp[-6].minor.yy151,
+ *(yymsp[-3].minor.yy83),
+ yymsp[-2].minor.yy512,
+ *(yymsp[0].minor.yy110),
+ 3
);
- delete yymsp[-10].minor.yy451;
- delete yymsp[-12].minor.yy146;
- delete yymsp[-7].minor.yy132;
- delete yymsp[-3].minor.yy3;
- delete yymsp[-9].minor.yy399;
- delete yymsp[-4].minor.yy399;
- delete yymsp[-8].minor.yy399;
- delete yymsp[0].minor.yy430;
- objectForTokens = yygotominor.yy283;
+ delete yymsp[-10].minor.yy611;
+ delete yymsp[-12].minor.yy386;
+ delete yymsp[-7].minor.yy532;
+ delete yymsp[-3].minor.yy83;
+ delete yymsp[-9].minor.yy319;
+ delete yymsp[-4].minor.yy319;
+ delete yymsp[-8].minor.yy319;
+ delete yymsp[0].minor.yy110;
+ objectForTokens = yygotominor.yy363;
parserContext->minorErrorAfterLastToken("Syntax error");
}
break;
- case 363: /* cmd ::= CREATE temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON ID_TAB */
-{ yy_destructor(yypParser,181,&yymsp[-8].minor);
- yy_destructor(yypParser,179,&yymsp[-5].minor);
- yy_destructor(yypParser,265,&yymsp[-3].minor);
- yy_destructor(yypParser,266,&yymsp[-2].minor);
+ case 371: /* cmd ::= CREATE temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON ID_TAB */
+{ yy_destructor(yypParser,201,&yymsp[-8].minor);
+ yy_destructor(yypParser,199,&yymsp[-5].minor);
+ yy_destructor(yypParser,292,&yymsp[-3].minor);
+ yy_destructor(yypParser,293,&yymsp[-2].minor);
}
break;
- case 366: /* trigger_time ::= BEFORE */
-{yygotominor.yy132 = new SqliteCreateTrigger::Time(SqliteCreateTrigger::Time::BEFORE);}
+ case 374: /* trigger_time ::= BEFORE */
+{yygotominor.yy532 = new SqliteCreateTrigger::Time(SqliteCreateTrigger::Time::BEFORE);}
break;
- case 367: /* trigger_time ::= AFTER */
-{yygotominor.yy132 = new SqliteCreateTrigger::Time(SqliteCreateTrigger::Time::AFTER);}
+ case 375: /* trigger_time ::= AFTER */
+{yygotominor.yy532 = new SqliteCreateTrigger::Time(SqliteCreateTrigger::Time::AFTER);}
break;
- case 368: /* trigger_time ::= INSTEAD OF */
-{yygotominor.yy132 = new SqliteCreateTrigger::Time(SqliteCreateTrigger::Time::INSTEAD_OF);}
+ case 376: /* trigger_time ::= INSTEAD OF */
+{yygotominor.yy532 = new SqliteCreateTrigger::Time(SqliteCreateTrigger::Time::INSTEAD_OF);}
break;
- case 369: /* trigger_time ::= */
-{yygotominor.yy132 = new SqliteCreateTrigger::Time(SqliteCreateTrigger::Time::null);}
+ case 377: /* trigger_time ::= */
+{yygotominor.yy532 = new SqliteCreateTrigger::Time(SqliteCreateTrigger::Time::null);}
break;
- case 370: /* trigger_event ::= DELETE */
+ case 378: /* trigger_event ::= DELETE */
{
- yygotominor.yy552 = new SqliteCreateTrigger::Event(SqliteCreateTrigger::Event::DELETE);
- objectForTokens = yygotominor.yy552;
+ yygotominor.yy151 = new SqliteCreateTrigger::Event(SqliteCreateTrigger::Event::DELETE);
+ objectForTokens = yygotominor.yy151;
}
break;
- case 371: /* trigger_event ::= INSERT */
+ case 379: /* trigger_event ::= INSERT */
{
- yygotominor.yy552 = new SqliteCreateTrigger::Event(SqliteCreateTrigger::Event::INSERT);
- objectForTokens = yygotominor.yy552;
+ yygotominor.yy151 = new SqliteCreateTrigger::Event(SqliteCreateTrigger::Event::INSERT);
+ objectForTokens = yygotominor.yy151;
}
break;
- case 372: /* trigger_event ::= UPDATE */
+ case 380: /* trigger_event ::= UPDATE */
{
- yygotominor.yy552 = new SqliteCreateTrigger::Event(SqliteCreateTrigger::Event::UPDATE);
- objectForTokens = yygotominor.yy552;
+ yygotominor.yy151 = new SqliteCreateTrigger::Event(SqliteCreateTrigger::Event::UPDATE);
+ objectForTokens = yygotominor.yy151;
}
break;
- case 373: /* trigger_event ::= UPDATE OF idlist */
+ case 381: /* trigger_event ::= UPDATE OF idlist */
{
- yygotominor.yy552 = new SqliteCreateTrigger::Event(*(yymsp[0].minor.yy95));
- delete yymsp[0].minor.yy95;
- objectForTokens = yygotominor.yy552;
+ yygotominor.yy151 = new SqliteCreateTrigger::Event(*(yymsp[0].minor.yy575));
+ delete yymsp[0].minor.yy575;
+ objectForTokens = yygotominor.yy151;
}
break;
- case 374: /* foreach_clause ::= */
-{yygotominor.yy3 = new SqliteCreateTrigger::Scope(SqliteCreateTrigger::Scope::null);}
+ case 382: /* foreach_clause ::= */
+{yygotominor.yy83 = new SqliteCreateTrigger::Scope(SqliteCreateTrigger::Scope::null);}
break;
- case 375: /* foreach_clause ::= FOR EACH ROW */
-{yygotominor.yy3 = new SqliteCreateTrigger::Scope(SqliteCreateTrigger::Scope::FOR_EACH_ROW);}
+ case 383: /* foreach_clause ::= FOR EACH ROW */
+{yygotominor.yy83 = new SqliteCreateTrigger::Scope(SqliteCreateTrigger::Scope::FOR_EACH_ROW);}
break;
- case 378: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
+ case 386: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
{
- yymsp[-2].minor.yy430->append(yymsp[-1].minor.yy283);
- yygotominor.yy430 = yymsp[-2].minor.yy430;
+ yymsp[-2].minor.yy110->append(yymsp[-1].minor.yy363);
+ yygotominor.yy110 = yymsp[-2].minor.yy110;
DONT_INHERIT_TOKENS("trigger_cmd_list");
}
break;
- case 379: /* trigger_cmd_list ::= trigger_cmd SEMI */
+ case 387: /* trigger_cmd_list ::= trigger_cmd SEMI */
{
- yygotominor.yy430 = new ParserQueryList();
- yygotominor.yy430->append(yymsp[-1].minor.yy283);
+ yygotominor.yy110 = new ParserQueryList();
+ yygotominor.yy110->append(yymsp[-1].minor.yy363);
}
break;
- case 380: /* trigger_cmd_list ::= SEMI */
+ case 388: /* trigger_cmd_list ::= SEMI */
{
- yygotominor.yy430 = new ParserQueryList();
+ yygotominor.yy110 = new ParserQueryList();
parserContext->minorErrorAfterLastToken("Syntax error");
}
break;
- case 385: /* raisetype ::= ROLLBACK|ABORT|FAIL */
+ case 393: /* raisetype ::= ROLLBACK|ABORT|FAIL */
{yygotominor.yy0 = yymsp[0].minor.yy0;}
break;
- case 386: /* cmd ::= DROP TRIGGER ifexists fullname */
+ case 394: /* cmd ::= DROP TRIGGER ifexists fullname */
{
- yygotominor.yy283 = new SqliteDropTrigger(*(yymsp[-1].minor.yy451), yymsp[0].minor.yy360->name1, yymsp[0].minor.yy360->name2);
- delete yymsp[-1].minor.yy451;
- delete yymsp[0].minor.yy360;
- objectForTokens = yygotominor.yy283;
+ yygotominor.yy363 = new SqliteDropTrigger(*(yymsp[-1].minor.yy611), yymsp[0].minor.yy440->name1, yymsp[0].minor.yy440->name2);
+ delete yymsp[-1].minor.yy611;
+ delete yymsp[0].minor.yy440;
+ objectForTokens = yygotominor.yy363;
}
break;
- case 389: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
+ case 397: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
{
- yygotominor.yy283 = new SqliteAttach(*(yymsp[-4].minor.yy451), yymsp[-3].minor.yy352, yymsp[-1].minor.yy352, yymsp[0].minor.yy352);
- delete yymsp[-4].minor.yy451;
- objectForTokens = yygotominor.yy283;
+ yygotominor.yy363 = new SqliteAttach(*(yymsp[-4].minor.yy611), yymsp[-3].minor.yy512, yymsp[-1].minor.yy512, yymsp[0].minor.yy512);
+ delete yymsp[-4].minor.yy611;
+ objectForTokens = yygotominor.yy363;
}
break;
- case 390: /* cmd ::= DETACH database_kw_opt expr */
+ case 398: /* cmd ::= DETACH database_kw_opt expr */
{
- yygotominor.yy283 = new SqliteDetach(*(yymsp[-1].minor.yy451), yymsp[0].minor.yy352);
- delete yymsp[-1].minor.yy451;
- objectForTokens = yygotominor.yy283;
+ yygotominor.yy363 = new SqliteDetach(*(yymsp[-1].minor.yy611), yymsp[0].minor.yy512);
+ delete yymsp[-1].minor.yy611;
+ objectForTokens = yygotominor.yy363;
}
break;
- case 395: /* cmd ::= REINDEX */
-{yygotominor.yy283 = new SqliteReindex();}
+ case 403: /* cmd ::= REINDEX */
+{yygotominor.yy363 = new SqliteReindex();}
break;
- case 396: /* cmd ::= REINDEX nm dbnm */
- case 397: /* cmd ::= REINDEX ID_COLLATE */ yytestcase(yyruleno==397);
+ case 404: /* cmd ::= REINDEX nm dbnm */
+ case 405: /* cmd ::= REINDEX ID_COLLATE */ yytestcase(yyruleno==405);
{
- yygotominor.yy283 = new SqliteReindex(*(yymsp[-1].minor.yy399), *(yymsp[0].minor.yy399));
- delete yymsp[-1].minor.yy399;
- delete yymsp[0].minor.yy399;
- objectForTokens = yygotominor.yy283;
+ yygotominor.yy363 = new SqliteReindex(*(yymsp[-1].minor.yy319), *(yymsp[0].minor.yy319));
+ delete yymsp[-1].minor.yy319;
+ delete yymsp[0].minor.yy319;
+ objectForTokens = yygotominor.yy363;
}
break;
- case 400: /* cmd ::= ANALYZE */
+ case 408: /* cmd ::= ANALYZE */
{
- yygotominor.yy283 = new SqliteAnalyze();
- objectForTokens = yygotominor.yy283;
+ yygotominor.yy363 = new SqliteAnalyze();
+ objectForTokens = yygotominor.yy363;
}
break;
- case 401: /* cmd ::= ANALYZE nm dbnm */
+ case 409: /* cmd ::= ANALYZE nm dbnm */
{
- yygotominor.yy283 = new SqliteAnalyze(*(yymsp[-1].minor.yy399), *(yymsp[0].minor.yy399));
- delete yymsp[-1].minor.yy399;
- delete yymsp[0].minor.yy399;
- objectForTokens = yygotominor.yy283;
+ yygotominor.yy363 = new SqliteAnalyze(*(yymsp[-1].minor.yy319), *(yymsp[0].minor.yy319));
+ delete yymsp[-1].minor.yy319;
+ delete yymsp[0].minor.yy319;
+ objectForTokens = yygotominor.yy363;
}
break;
- case 404: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
+ case 412: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
{
- yygotominor.yy283 = new SqliteAlterTable(
- yymsp[-3].minor.yy360->name1,
- yymsp[-3].minor.yy360->name2,
- *(yymsp[0].minor.yy399)
+ yygotominor.yy363 = new SqliteAlterTable(
+ yymsp[-3].minor.yy440->name1,
+ yymsp[-3].minor.yy440->name2,
+ *(yymsp[0].minor.yy319)
);
- delete yymsp[0].minor.yy399;
- delete yymsp[-3].minor.yy360;
- objectForTokens = yygotominor.yy283;
+ delete yymsp[0].minor.yy319;
+ delete yymsp[-3].minor.yy440;
+ objectForTokens = yygotominor.yy363;
}
break;
- case 405: /* cmd ::= ALTER TABLE fullname ADD kwcolumn_opt column */
+ case 413: /* cmd ::= ALTER TABLE fullname ADD kwcolumn_opt column */
{
- yygotominor.yy283 = new SqliteAlterTable(
- yymsp[-3].minor.yy360->name1,
- yymsp[-3].minor.yy360->name2,
- *(yymsp[-1].minor.yy451),
- yymsp[0].minor.yy227
+ yygotominor.yy363 = new SqliteAlterTable(
+ yymsp[-3].minor.yy440->name1,
+ yymsp[-3].minor.yy440->name2,
+ *(yymsp[-1].minor.yy611),
+ yymsp[0].minor.yy147
);
- delete yymsp[-1].minor.yy451;
- delete yymsp[-3].minor.yy360;
- objectForTokens = yygotominor.yy283;
+ delete yymsp[-1].minor.yy611;
+ delete yymsp[-3].minor.yy440;
+ objectForTokens = yygotominor.yy363;
}
break;
- case 406: /* cmd ::= ALTER TABLE fullname RENAME TO ID_TAB_NEW */
-{ yy_destructor(yypParser,183,&yymsp[-3].minor);
+ case 414: /* cmd ::= ALTER TABLE fullname RENAME TO ID_TAB_NEW */
+{ yy_destructor(yypParser,203,&yymsp[-3].minor);
}
break;
- case 412: /* create_vtab ::= CREATE VIRTUAL TABLE ifnotexists nm dbnm USING nm */
+ case 420: /* create_vtab ::= CREATE VIRTUAL TABLE ifnotexists nm dbnm USING nm */
{
- yygotominor.yy283 = new SqliteCreateVirtualTable(
- *(yymsp[-4].minor.yy451),
- *(yymsp[-3].minor.yy399),
- *(yymsp[-2].minor.yy399),
- *(yymsp[0].minor.yy399)
+ yygotominor.yy363 = new SqliteCreateVirtualTable(
+ *(yymsp[-4].minor.yy611),
+ *(yymsp[-3].minor.yy319),
+ *(yymsp[-2].minor.yy319),
+ *(yymsp[0].minor.yy319)
);
- delete yymsp[-4].minor.yy451;
- delete yymsp[-3].minor.yy399;
- delete yymsp[-2].minor.yy399;
- delete yymsp[0].minor.yy399;
- objectForTokens = yygotominor.yy283;
+ delete yymsp[-4].minor.yy611;
+ delete yymsp[-3].minor.yy319;
+ delete yymsp[-2].minor.yy319;
+ delete yymsp[0].minor.yy319;
+ objectForTokens = yygotominor.yy363;
}
break;
- case 413: /* create_vtab ::= CREATE VIRTUAL TABLE ifnotexists nm dbnm USING nm LP vtabarglist RP */
+ case 421: /* create_vtab ::= CREATE VIRTUAL TABLE ifnotexists nm dbnm USING nm LP vtabarglist RP */
{
- yygotominor.yy283 = new SqliteCreateVirtualTable(
- *(yymsp[-7].minor.yy451),
- *(yymsp[-6].minor.yy399),
- *(yymsp[-5].minor.yy399),
- *(yymsp[-3].minor.yy399),
- *(yymsp[-1].minor.yy95)
+ yygotominor.yy363 = new SqliteCreateVirtualTable(
+ *(yymsp[-7].minor.yy611),
+ *(yymsp[-6].minor.yy319),
+ *(yymsp[-5].minor.yy319),
+ *(yymsp[-3].minor.yy319),
+ *(yymsp[-1].minor.yy575)
);
- delete yymsp[-6].minor.yy399;
- delete yymsp[-5].minor.yy399;
- delete yymsp[-3].minor.yy399;
- delete yymsp[-7].minor.yy451;
- delete yymsp[-1].minor.yy95;
- objectForTokens = yygotominor.yy283;
+ delete yymsp[-6].minor.yy319;
+ delete yymsp[-5].minor.yy319;
+ delete yymsp[-3].minor.yy319;
+ delete yymsp[-7].minor.yy611;
+ delete yymsp[-1].minor.yy575;
+ objectForTokens = yygotominor.yy363;
}
break;
- case 416: /* vtabarglist ::= vtabarg */
+ case 424: /* vtabarglist ::= vtabarg */
{
- yygotominor.yy95 = new QStringList();
- yygotominor.yy95->append((yymsp[0].minor.yy399)->mid(1)); // mid(1) to skip the first whitespace added in vtabarg
- delete yymsp[0].minor.yy399;
+ yygotominor.yy575 = new QStringList();
+ yygotominor.yy575->append((yymsp[0].minor.yy319)->mid(1)); // mid(1) to skip the first whitespace added in vtabarg
+ delete yymsp[0].minor.yy319;
}
break;
- case 417: /* vtabarglist ::= vtabarglist COMMA vtabarg */
+ case 425: /* vtabarglist ::= vtabarglist COMMA vtabarg */
{
- yymsp[-2].minor.yy95->append((yymsp[0].minor.yy399)->mid(1)); // mid(1) to skip the first whitespace added in vtabarg
- yygotominor.yy95 = yymsp[-2].minor.yy95;
- delete yymsp[0].minor.yy399;
+ yymsp[-2].minor.yy575->append((yymsp[0].minor.yy319)->mid(1)); // mid(1) to skip the first whitespace added in vtabarg
+ yygotominor.yy575 = yymsp[-2].minor.yy575;
+ delete yymsp[0].minor.yy319;
DONT_INHERIT_TOKENS("vtabarglist");
}
break;
- case 419: /* vtabarg ::= vtabarg vtabargtoken */
+ case 427: /* vtabarg ::= vtabarg vtabargtoken */
{
- yymsp[-1].minor.yy399->append(" "+ *(yymsp[0].minor.yy399));
- yygotominor.yy399 = yymsp[-1].minor.yy399;
- delete yymsp[0].minor.yy399;
+ yymsp[-1].minor.yy319->append(" "+ *(yymsp[0].minor.yy319));
+ yygotominor.yy319 = yymsp[-1].minor.yy319;
+ delete yymsp[0].minor.yy319;
}
break;
- case 420: /* vtabargtoken ::= ANY */
+ case 428: /* vtabargtoken ::= ANY */
{
- yygotominor.yy399 = new QString(yymsp[0].minor.yy0->value);
+ yygotominor.yy319 = new QString(yymsp[0].minor.yy0->value);
}
break;
- case 421: /* vtabargtoken ::= LP anylist RP */
+ case 429: /* vtabargtoken ::= LP anylist RP */
{
- yygotominor.yy399 = new QString("(");
- yygotominor.yy399->append(*(yymsp[-1].minor.yy399));
- yygotominor.yy399->append(")");
- delete yymsp[-1].minor.yy399;
+ yygotominor.yy319 = new QString("(");
+ yygotominor.yy319->append(*(yymsp[-1].minor.yy319));
+ yygotominor.yy319->append(")");
+ delete yymsp[-1].minor.yy319;
}
break;
- case 423: /* anylist ::= anylist LP anylist RP */
+ case 431: /* anylist ::= anylist LP anylist RP */
{
- yygotominor.yy399 = yymsp[-3].minor.yy399;
- yygotominor.yy399->append("(");
- yygotominor.yy399->append(*(yymsp[-1].minor.yy399));
- yygotominor.yy399->append(")");
- delete yymsp[-1].minor.yy399;
+ yygotominor.yy319 = yymsp[-3].minor.yy319;
+ yygotominor.yy319->append("(");
+ yygotominor.yy319->append(*(yymsp[-1].minor.yy319));
+ yygotominor.yy319->append(")");
+ delete yymsp[-1].minor.yy319;
DONT_INHERIT_TOKENS("anylist");
}
break;
- case 424: /* anylist ::= anylist ANY */
+ case 432: /* anylist ::= anylist ANY */
{
- yygotominor.yy399 = yymsp[-1].minor.yy399;
- yygotominor.yy399->append(yymsp[0].minor.yy0->value);
+ yygotominor.yy319 = yymsp[-1].minor.yy319;
+ yygotominor.yy319->append(yymsp[0].minor.yy0->value);
DONT_INHERIT_TOKENS("anylist");
}
break;
- case 425: /* with ::= */
-{yygotominor.yy321 = nullptr;}
+ case 433: /* with ::= */
+{yygotominor.yy1 = nullptr;}
break;
- case 426: /* with ::= WITH wqlist */
+ case 434: /* with ::= WITH wqlist */
{
- yygotominor.yy321 = yymsp[0].minor.yy321;
- objectForTokens = yygotominor.yy321;
+ yygotominor.yy1 = new SqliteWith();
+ yygotominor.yy1->cteList = *(yymsp[0].minor.yy593);
+ delete yymsp[0].minor.yy593;
+ objectForTokens = yygotominor.yy1;
}
break;
- case 427: /* with ::= WITH RECURSIVE wqlist */
+ case 435: /* with ::= WITH RECURSIVE wqlist */
{
- yygotominor.yy321 = yymsp[0].minor.yy321;
- yygotominor.yy321->recursive = true;
- objectForTokens = yygotominor.yy321;
+ yygotominor.yy1 = new SqliteWith();
+ yygotominor.yy1->cteList = *(yymsp[0].minor.yy593);
+ yygotominor.yy1->recursive = true;
+ delete yymsp[0].minor.yy593;
+ objectForTokens = yygotominor.yy1;
}
break;
- case 428: /* wqlist ::= nm idxlist_opt AS LP select RP */
+ case 436: /* wqlist ::= wqcte */
{
- yygotominor.yy321 = SqliteWith::append(*(yymsp[-5].minor.yy399), *(yymsp[-4].minor.yy223), yymsp[-1].minor.yy473);
- delete yymsp[-5].minor.yy399;
- delete yymsp[-4].minor.yy223;
+ yygotominor.yy593 = new ParserCteList();
+ yygotominor.yy593->append(yymsp[0].minor.yy446);
}
break;
- case 429: /* wqlist ::= wqlist COMMA nm idxlist_opt AS LP select RP */
+ case 437: /* wqlist ::= wqlist COMMA wqcte */
{
- yygotominor.yy321 = SqliteWith::append(yymsp[-7].minor.yy321, *(yymsp[-5].minor.yy399), *(yymsp[-4].minor.yy223), yymsp[-1].minor.yy473);
- delete yymsp[-5].minor.yy399;
- delete yymsp[-4].minor.yy223;
+ yygotominor.yy593 = yymsp[-2].minor.yy593;
+ yygotominor.yy593->append(yymsp[0].minor.yy446);
DONT_INHERIT_TOKENS("wqlist");
}
break;
- case 430: /* wqlist ::= ID_TAB_NEW */
+ case 438: /* wqlist ::= ID_TAB_NEW */
{
parserContext->minorErrorBeforeNextToken("Syntax error");
- yygotominor.yy321 = new SqliteWith();
}
break;
+ case 439: /* wqcte ::= nm idxlist_opt AS LP select RP */
+{
+ yygotominor.yy446 = new SqliteWith::CommonTableExpression(*(yymsp[-5].minor.yy319), *(yymsp[-4].minor.yy223), yymsp[-1].minor.yy313);
+ delete yymsp[-5].minor.yy319;
+ delete yymsp[-4].minor.yy223;
+ objectForTokens = yygotominor.yy446;
+ }
+ break;
+ case 440: /* windowdefn_list ::= windowdefn */
+{
+ yygotominor.yy299 = new ParserWindowDefList();
+ yygotominor.yy299->append(yymsp[0].minor.yy266);
+ }
+ break;
+ case 441: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */
+{
+ yymsp[-2].minor.yy299->append(yymsp[0].minor.yy266);
+ yygotominor.yy299 = yymsp[-2].minor.yy299;
+ DONT_INHERIT_TOKENS("windowdefn_list");
+ }
+ break;
+ case 442: /* windowdefn ::= nm AS LP window RP */
+{
+ yygotominor.yy266 = new SqliteWindowDefinition(*(yymsp[-4].minor.yy319), yymsp[-1].minor.yy334);
+ delete yymsp[-4].minor.yy319;
+ objectForTokens = yygotominor.yy266;
+ }
+ break;
+ case 443: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */
+{
+ yygotominor.yy334 = new SqliteWindowDefinition::Window();
+ yygotominor.yy334->initPartitionBy(QString(), *(yymsp[-2].minor.yy71), *(yymsp[-1].minor.yy403), yymsp[0].minor.yy41);
+ delete yymsp[-2].minor.yy71;
+ delete yymsp[-1].minor.yy403;
+ objectForTokens = yygotominor.yy334;
+ }
+ break;
+ case 444: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
+{
+ yygotominor.yy334 = new SqliteWindowDefinition::Window();
+ yygotominor.yy334->initPartitionBy(*(yymsp[-5].minor.yy319), *(yymsp[-2].minor.yy71), *(yymsp[-1].minor.yy403), yymsp[0].minor.yy41);
+ delete yymsp[-2].minor.yy71;
+ delete yymsp[-5].minor.yy319;
+ delete yymsp[-1].minor.yy403;
+ objectForTokens = yygotominor.yy334;
+ }
+ break;
+ case 445: /* window ::= ORDER BY sortlist frame_opt */
+{
+ yygotominor.yy334 = new SqliteWindowDefinition::Window();
+ yygotominor.yy334->initOrderBy(QString(), *(yymsp[-1].minor.yy403), yymsp[0].minor.yy41);
+ delete yymsp[-1].minor.yy403;
+ objectForTokens = yygotominor.yy334;
+ }
+ break;
+ case 446: /* window ::= nm ORDER BY sortlist frame_opt */
+{
+ yygotominor.yy334 = new SqliteWindowDefinition::Window();
+ yygotominor.yy334->initOrderBy(*(yymsp[-4].minor.yy319), *(yymsp[-1].minor.yy403), yymsp[0].minor.yy41);
+ delete yymsp[-1].minor.yy403;
+ delete yymsp[-4].minor.yy319;
+ objectForTokens = yygotominor.yy334;
+ }
+ break;
+ case 447: /* window ::= frame_opt */
+{
+ yygotominor.yy334 = new SqliteWindowDefinition::Window();
+ yygotominor.yy334->init(QString(), yymsp[0].minor.yy41);
+ objectForTokens = yygotominor.yy334;
+ }
+ break;
+ case 448: /* window ::= nm frame_opt */
+{
+ yygotominor.yy334 = new SqliteWindowDefinition::Window();
+ yygotominor.yy334->init(QString(), yymsp[0].minor.yy41);
+ delete yymsp[-1].minor.yy319;
+ objectForTokens = yygotominor.yy334;
+ }
+ break;
+ case 449: /* frame_opt ::= */
+{yygotominor.yy41 = nullptr;}
+ break;
+ case 450: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
+{
+ yygotominor.yy41 = new SqliteWindowDefinition::Window::Frame(*(yymsp[-2].minor.yy419), yymsp[-1].minor.yy442, nullptr, *(yymsp[0].minor.yy63));
+ delete yymsp[-2].minor.yy419;
+ delete yymsp[0].minor.yy63;
+ objectForTokens = yygotominor.yy41;
+ }
+ break;
+ case 451: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
+{
+ yygotominor.yy41 = new SqliteWindowDefinition::Window::Frame(*(yymsp[-5].minor.yy419), yymsp[-3].minor.yy442, yymsp[-1].minor.yy442, *(yymsp[0].minor.yy63));
+ delete yymsp[-5].minor.yy419;
+ delete yymsp[0].minor.yy63;
+ objectForTokens = yygotominor.yy41;
+ }
+ break;
+ case 452: /* range_or_rows ::= RANGE|ROWS|GROUPS */
+{
+ yygotominor.yy419 = new SqliteWindowDefinition::Window::Frame::RangeOrRows(
+ SqliteWindowDefinition::Window::Frame::toRangeOrRows(yymsp[0].minor.yy0->value)
+ );
+ }
+ break;
+ case 453: /* frame_bound_s ::= frame_bound */
+ case 455: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==455);
+{
+ yygotominor.yy442 = yymsp[0].minor.yy442;
+ objectForTokens = yygotominor.yy442;
+ }
+ break;
+ case 454: /* frame_bound_s ::= UNBOUNDED PRECEDING */
+ case 456: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==456);
+ case 458: /* frame_bound ::= CURRENT ROW */ yytestcase(yyruleno==458);
+{
+ yygotominor.yy442 = new SqliteWindowDefinition::Window::Frame::Bound(nullptr, yymsp[-1].minor.yy0->value + " " + yymsp[0].minor.yy0->value);
+ objectForTokens = yygotominor.yy442;
+ }
+ break;
+ case 457: /* frame_bound ::= expr PRECEDING|FOLLOWING */
+{
+ yygotominor.yy442 = new SqliteWindowDefinition::Window::Frame::Bound(yymsp[-1].minor.yy512, yymsp[0].minor.yy0->value);
+ objectForTokens = yygotominor.yy442;
+ }
+ break;
+ case 459: /* frame_exclude_opt ::= */
+{
+ yygotominor.yy63 = new SqliteWindowDefinition::Window::Frame::Exclude(
+ SqliteWindowDefinition::Window::Frame::Exclude::null
+ );
+ }
+ break;
+ case 460: /* frame_exclude_opt ::= EXCLUDE frame_exclude */
+{
+ yygotominor.yy63 = yymsp[0].minor.yy63;
+ }
+ break;
+ case 461: /* frame_exclude ::= NO OTHERS */
+{
+ yygotominor.yy63 = new SqliteWindowDefinition::Window::Frame::Exclude(
+ SqliteWindowDefinition::Window::Frame::Exclude::NO_OTHERS
+ );
+ }
+ break;
+ case 462: /* frame_exclude ::= CURRENT ROW */
+{
+ yygotominor.yy63 = new SqliteWindowDefinition::Window::Frame::Exclude(
+ SqliteWindowDefinition::Window::Frame::Exclude::CURRENT_ROW
+ );
+ }
+ break;
+ case 463: /* frame_exclude ::= GROUP */
+{
+ yygotominor.yy63 = new SqliteWindowDefinition::Window::Frame::Exclude(
+ SqliteWindowDefinition::Window::Frame::Exclude::GROUP
+ );
+ }
+ break;
+ case 464: /* frame_exclude ::= TIES */
+{
+ yygotominor.yy63 = new SqliteWindowDefinition::Window::Frame::Exclude(
+ SqliteWindowDefinition::Window::Frame::Exclude::TIES
+ );
+ }
+ break;
+ case 465: /* window_clause ::= WINDOW windowdefn_list */
+{
+ yygotominor.yy299 = yymsp[0].minor.yy299;
+ }
+ break;
+ case 466: /* filter_over ::= filter_clause over_clause */
+{
+ yygotominor.yy247 = new SqliteFilterOver(yymsp[-1].minor.yy397, yymsp[0].minor.yy248);
+ objectForTokens = yygotominor.yy247;
+ }
+ break;
+ case 467: /* filter_over ::= over_clause */
+{
+ yygotominor.yy247 = new SqliteFilterOver(nullptr, yymsp[0].minor.yy248);
+ objectForTokens = yygotominor.yy247;
+ }
+ break;
+ case 468: /* filter_over ::= filter_clause */
+{
+ yygotominor.yy247 = new SqliteFilterOver(yymsp[0].minor.yy397, nullptr);
+ objectForTokens = yygotominor.yy247;
+ }
+ break;
+ case 469: /* over_clause ::= OVER LP window RP */
+{
+ yygotominor.yy248 = new SqliteFilterOver::Over(yymsp[-1].minor.yy334);
+ objectForTokens = yygotominor.yy248;
+ }
+ break;
+ case 470: /* over_clause ::= OVER nm */
+{
+ yygotominor.yy248 = new SqliteFilterOver::Over(*(yymsp[0].minor.yy319));
+ delete yymsp[0].minor.yy319;
+ objectForTokens = yygotominor.yy248;
+ }
+ break;
+ case 471: /* filter_clause ::= FILTER LP WHERE expr RP */
+{
+ yygotominor.yy397 = new SqliteFilterOver::Filter(yymsp[-1].minor.yy512);
+ objectForTokens = yygotominor.yy397;
+ }
+ break;
default:
/* (0) input ::= cmdlist */ yytestcase(yyruleno==0);
break;
@@ -5390,4 +5988,4 @@ void sqlite3_parse(
}
}while( yymajor!=YYNOCODE && yypParser->yyidx>=0 );
return;
-}
+} \ No newline at end of file
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/sqlite3_parse.h b/SQLiteStudio3/coreSQLiteStudio/parser/sqlite3_parse.h
index 050ebd3..200b09c 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/sqlite3_parse.h
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/sqlite3_parse.h
@@ -5,165 +5,185 @@
#define TK3_ABORT 5
#define TK3_ACTION 6
#define TK3_AFTER 7
-#define TK3_ANALYZE 8
-#define TK3_ASC 9
-#define TK3_ATTACH 10
-#define TK3_BEFORE 11
-#define TK3_BEGIN 12
-#define TK3_BY 13
-#define TK3_CASCADE 14
-#define TK3_CAST 15
-#define TK3_COLUMNKW 16
-#define TK3_CONFLICT 17
-#define TK3_DATABASE 18
-#define TK3_DEFERRED 19
-#define TK3_DESC 20
-#define TK3_DETACH 21
-#define TK3_EACH 22
-#define TK3_END 23
-#define TK3_EXCLUSIVE 24
-#define TK3_EXPLAIN 25
-#define TK3_FAIL 26
-#define TK3_FOR 27
-#define TK3_IGNORE 28
-#define TK3_IMMEDIATE 29
-#define TK3_INDEXED 30
-#define TK3_INITIALLY 31
-#define TK3_INSTEAD 32
-#define TK3_LIKE_KW 33
-#define TK3_MATCH 34
-#define TK3_NO 35
-#define TK3_PLAN 36
-#define TK3_QUERY 37
-#define TK3_KEY 38
-#define TK3_OF 39
-#define TK3_OFFSET 40
-#define TK3_PRAGMA 41
-#define TK3_RAISE 42
-#define TK3_RECURSIVE 43
-#define TK3_RELEASE 44
-#define TK3_REPLACE 45
-#define TK3_RESTRICT 46
-#define TK3_ROW 47
-#define TK3_ROLLBACK 48
-#define TK3_SAVEPOINT 49
-#define TK3_TEMP 50
-#define TK3_TRIGGER 51
-#define TK3_VACUUM 52
-#define TK3_VIEW 53
-#define TK3_VIRTUAL 54
-#define TK3_WITH 55
-#define TK3_WITHOUT 56
-#define TK3_REINDEX 57
-#define TK3_RENAME 58
-#define TK3_CTIME_KW 59
-#define TK3_IF 60
-#define TK3_ANY 61
-#define TK3_OR 62
-#define TK3_AND 63
-#define TK3_NOT 64
-#define TK3_IS 65
-#define TK3_BETWEEN 66
-#define TK3_IN 67
-#define TK3_ISNULL 68
-#define TK3_NOTNULL 69
-#define TK3_NE 70
-#define TK3_EQ 71
-#define TK3_GT 72
-#define TK3_LE 73
-#define TK3_LT 74
-#define TK3_GE 75
-#define TK3_ESCAPE 76
-#define TK3_BITAND 77
-#define TK3_BITOR 78
-#define TK3_LSHIFT 79
-#define TK3_RSHIFT 80
-#define TK3_PLUS 81
-#define TK3_MINUS 82
-#define TK3_STAR 83
-#define TK3_SLASH 84
-#define TK3_REM 85
-#define TK3_CONCAT 86
-#define TK3_COLLATE 87
-#define TK3_BITNOT 88
-#define TK3_SEMI 89
-#define TK3_TRANSACTION 90
-#define TK3_ID_TRANS 91
-#define TK3_COMMIT 92
-#define TK3_TO 93
-#define TK3_CREATE 94
-#define TK3_TABLE 95
-#define TK3_LP 96
-#define TK3_RP 97
-#define TK3_AS 98
-#define TK3_DOT 99
-#define TK3_ID_TAB_NEW 100
-#define TK3_ID_DB 101
-#define TK3_CTX_ROWID_KW 102
-#define TK3_EXISTS 103
-#define TK3_COMMA 104
-#define TK3_ID_COL_NEW 105
-#define TK3_STRING 106
-#define TK3_JOIN_KW 107
-#define TK3_ID_COL_TYPE 108
-#define TK3_CONSTRAINT 109
-#define TK3_DEFAULT 110
-#define TK3_NULL 111
-#define TK3_PRIMARY 112
-#define TK3_UNIQUE 113
-#define TK3_CHECK 114
-#define TK3_REFERENCES 115
-#define TK3_ID_CONSTR 116
-#define TK3_ID_COLLATE 117
-#define TK3_ID_TAB 118
-#define TK3_INTEGER 119
-#define TK3_FLOAT 120
-#define TK3_BLOB 121
-#define TK3_AUTOINCR 122
-#define TK3_ON 123
-#define TK3_INSERT 124
-#define TK3_DELETE 125
-#define TK3_UPDATE 126
-#define TK3_ID_FK_MATCH 127
-#define TK3_SET 128
-#define TK3_DEFERRABLE 129
-#define TK3_FOREIGN 130
-#define TK3_DROP 131
-#define TK3_ID_VIEW_NEW 132
-#define TK3_ID_VIEW 133
-#define TK3_SELECT 134
-#define TK3_VALUES 135
-#define TK3_UNION 136
-#define TK3_ALL 137
-#define TK3_EXCEPT 138
-#define TK3_INTERSECT 139
-#define TK3_DISTINCT 140
-#define TK3_ID_ALIAS 141
-#define TK3_FROM 142
-#define TK3_USING 143
-#define TK3_JOIN 144
-#define TK3_ID_JOIN_OPTS 145
-#define TK3_ID_IDX 146
-#define TK3_ORDER 147
-#define TK3_GROUP 148
-#define TK3_HAVING 149
-#define TK3_LIMIT 150
-#define TK3_WHERE 151
-#define TK3_ID_COL 152
-#define TK3_INTO 153
-#define TK3_DO 154
-#define TK3_NOTHING 155
-#define TK3_CASE 156
-#define TK3_ID_FN 157
-#define TK3_ID_ERR_MSG 158
-#define TK3_VARIABLE 159
-#define TK3_WHEN 160
-#define TK3_THEN 161
-#define TK3_ELSE 162
-#define TK3_INDEX 163
-#define TK3_ID_IDX_NEW 164
-#define TK3_ID_PRAGMA 165
-#define TK3_ID_TRIG_NEW 166
-#define TK3_ID_TRIG 167
-#define TK3_ALTER 168
-#define TK3_ADD 169
+#define TK3_ALWAYS 8
+#define TK3_ANALYZE 9
+#define TK3_ASC 10
+#define TK3_ATTACH 11
+#define TK3_BEFORE 12
+#define TK3_BEGIN 13
+#define TK3_BY 14
+#define TK3_CASCADE 15
+#define TK3_CAST 16
+#define TK3_COLUMNKW 17
+#define TK3_CONFLICT 18
+#define TK3_CURRENT 19
+#define TK3_DATABASE 20
+#define TK3_DEFERRED 21
+#define TK3_DESC 22
+#define TK3_DETACH 23
+#define TK3_DO 24
+#define TK3_EACH 25
+#define TK3_END 26
+#define TK3_EXCLUDE 27
+#define TK3_EXCLUSIVE 28
+#define TK3_EXPLAIN 29
+#define TK3_FAIL 30
+#define TK3_FIRST 31
+#define TK3_FOLLOWING 32
+#define TK3_FOR 33
+#define TK3_GENERATED 34
+#define TK3_GROUPS 35
+#define TK3_IGNORE 36
+#define TK3_IMMEDIATE 37
+#define TK3_INDEXED 38
+#define TK3_INITIALLY 39
+#define TK3_INSTEAD 40
+#define TK3_LAST 41
+#define TK3_LIKE_KW 42
+#define TK3_MATCH 43
+#define TK3_NO 44
+#define TK3_NULLS 45
+#define TK3_OTHERS 46
+#define TK3_PLAN 47
+#define TK3_QUERY 48
+#define TK3_KEY 49
+#define TK3_OF 50
+#define TK3_OFFSET 51
+#define TK3_PARTITION 52
+#define TK3_PRAGMA 53
+#define TK3_PRECEDING 54
+#define TK3_RAISE 55
+#define TK3_RANGE 56
+#define TK3_RECURSIVE 57
+#define TK3_RELEASE 58
+#define TK3_REPLACE 59
+#define TK3_RESTRICT 60
+#define TK3_ROW 61
+#define TK3_ROWS 62
+#define TK3_ROLLBACK 63
+#define TK3_SAVEPOINT 64
+#define TK3_TEMP 65
+#define TK3_TIES 66
+#define TK3_TRIGGER 67
+#define TK3_UNBOUNDED 68
+#define TK3_VACUUM 69
+#define TK3_VIEW 70
+#define TK3_VIRTUAL 71
+#define TK3_WITH 72
+#define TK3_WITHOUT 73
+#define TK3_REINDEX 74
+#define TK3_RENAME 75
+#define TK3_CTIME_KW 76
+#define TK3_IF 77
+#define TK3_ANY 78
+#define TK3_OR 79
+#define TK3_AND 80
+#define TK3_NOT 81
+#define TK3_IS 82
+#define TK3_BETWEEN 83
+#define TK3_IN 84
+#define TK3_ISNULL 85
+#define TK3_NOTNULL 86
+#define TK3_NE 87
+#define TK3_EQ 88
+#define TK3_GT 89
+#define TK3_LE 90
+#define TK3_LT 91
+#define TK3_GE 92
+#define TK3_ESCAPE 93
+#define TK3_BITAND 94
+#define TK3_BITOR 95
+#define TK3_LSHIFT 96
+#define TK3_RSHIFT 97
+#define TK3_PLUS 98
+#define TK3_MINUS 99
+#define TK3_STAR 100
+#define TK3_SLASH 101
+#define TK3_REM 102
+#define TK3_CONCAT 103
+#define TK3_COLLATE 104
+#define TK3_BITNOT 105
+#define TK3_SEMI 106
+#define TK3_TRANSACTION 107
+#define TK3_ID_TRANS 108
+#define TK3_COMMIT 109
+#define TK3_TO 110
+#define TK3_CREATE 111
+#define TK3_TABLE 112
+#define TK3_LP 113
+#define TK3_RP 114
+#define TK3_AS 115
+#define TK3_DOT 116
+#define TK3_ID_TAB_NEW 117
+#define TK3_ID_DB 118
+#define TK3_CTX_ROWID_KW 119
+#define TK3_EXISTS 120
+#define TK3_COMMA 121
+#define TK3_ID_COL_NEW 122
+#define TK3_STRING 123
+#define TK3_JOIN_KW 124
+#define TK3_ID_COL_TYPE 125
+#define TK3_RIGHT_ASSOC 126
+#define TK3_CONSTRAINT 127
+#define TK3_DEFAULT 128
+#define TK3_NULL 129
+#define TK3_PRIMARY 130
+#define TK3_UNIQUE 131
+#define TK3_CHECK 132
+#define TK3_REFERENCES 133
+#define TK3_ID_CONSTR 134
+#define TK3_ID_COLLATE 135
+#define TK3_ID_TAB 136
+#define TK3_INTEGER 137
+#define TK3_FLOAT 138
+#define TK3_BLOB 139
+#define TK3_AUTOINCR 140
+#define TK3_ON 141
+#define TK3_INSERT 142
+#define TK3_DELETE 143
+#define TK3_UPDATE 144
+#define TK3_ID_FK_MATCH 145
+#define TK3_SET 146
+#define TK3_DEFERRABLE 147
+#define TK3_FOREIGN 148
+#define TK3_DROP 149
+#define TK3_ID_VIEW_NEW 150
+#define TK3_ID_VIEW 151
+#define TK3_SELECT 152
+#define TK3_VALUES 153
+#define TK3_UNION 154
+#define TK3_ALL 155
+#define TK3_EXCEPT 156
+#define TK3_INTERSECT 157
+#define TK3_DISTINCT 158
+#define TK3_ID_ALIAS 159
+#define TK3_FROM 160
+#define TK3_USING 161
+#define TK3_JOIN 162
+#define TK3_ID_JOIN_OPTS 163
+#define TK3_ID_IDX 164
+#define TK3_ORDER 165
+#define TK3_GROUP 166
+#define TK3_HAVING 167
+#define TK3_LIMIT 168
+#define TK3_WHERE 169
+#define TK3_ID_COL 170
+#define TK3_INTO 171
+#define TK3_NOTHING 172
+#define TK3_ID_FN 173
+#define TK3_ID_ERR_MSG 174
+#define TK3_VARIABLE 175
+#define TK3_CASE 176
+#define TK3_WHEN 177
+#define TK3_THEN 178
+#define TK3_ELSE 179
+#define TK3_INDEX 180
+#define TK3_ID_IDX_NEW 181
+#define TK3_ID_PRAGMA 182
+#define TK3_ID_TRIG_NEW 183
+#define TK3_ID_TRIG 184
+#define TK3_ALTER 185
+#define TK3_ADD 186
+#define TK3_WINDOW 187
+#define TK3_OVER 188
+#define TK3_FILTER 189
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/sqlite3_parse.y b/SQLiteStudio3/coreSQLiteStudio/parser/sqlite3_parse.y
index 7e29506..1510c49 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/sqlite3_parse.y
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/sqlite3_parse.y
@@ -12,7 +12,6 @@
}
%stack_overflow {
- UNUSED_PARAMETER(yypMinor);
parserContext->error(QObject::tr("Parser stack overflow"));
}
@@ -21,6 +20,8 @@
#include "parsercontext.h"
#include "parser_helper_stubs.h"
#include "common/utils_sql.h"
+#include "common/global.h"
+#include "common/unused.h"
#include "parser/ast/sqlitealtertable.h"
#include "parser/ast/sqliteanalyze.h"
#include "parser/ast/sqliteattach.h"
@@ -56,6 +57,9 @@
#include "parser/ast/sqliteforeignkey.h"
#include "parser/ast/sqlitewith.h"
#include "parser/ast/sqliteupsert.h"
+#include "parser/ast/sqlitewindowdefinition.h"
+#include "parser/ast/sqlitefilterover.h"
+#include "parser/ast/sqlitenulls.h"
#include <QObject>
#include <QDebug>
#include <limits.h>
@@ -78,15 +82,15 @@
// are allowed for fallback if compound selects are disabled,
// which is not this case.
%fallback ID
- ABORT ACTION AFTER ANALYZE ASC ATTACH BEFORE BEGIN BY CASCADE CAST COLUMNKW
- CONFLICT DATABASE DEFERRED DESC DETACH EACH END EXCLUSIVE EXPLAIN FAIL FOR
- IGNORE IMMEDIATE INDEXED INITIALLY INSTEAD LIKE_KW MATCH NO PLAN
- QUERY KEY OF OFFSET PRAGMA RAISE RECURSIVE RELEASE REPLACE RESTRICT ROW ROLLBACK
- SAVEPOINT TEMP TRIGGER VACUUM VIEW VIRTUAL WITH WITHOUT
+ ABORT ACTION AFTER ALWAYS ANALYZE ASC ATTACH BEFORE BEGIN BY CASCADE CAST COLUMNKW
+ CONFLICT CURRENT DATABASE DEFERRED DESC DETACH DO EACH END EXCLUDE EXCLUSIVE EXPLAIN FAIL FIRST FOLLOWING FOR
+ GENERATED GROUPS IGNORE IMMEDIATE INDEXED INITIALLY INSTEAD LAST LIKE_KW MATCH NO NULLS OTHERS PLAN
+ QUERY KEY OF OFFSET PARTITION PRAGMA PRECEDING RAISE RANGE RECURSIVE RELEASE REPLACE RESTRICT ROW ROWS ROLLBACK
+ SAVEPOINT TEMP TIES TRIGGER UNBOUNDED VACUUM VIEW VIRTUAL WITH WITHOUT
REINDEX RENAME CTIME_KW IF
.
%wildcard ANY.
-
+
// Define operator precedence early so that this is the first occurance
// of the operator tokens in the grammer. Keeping the operators together
// causes them to be assigned integer values that are close together,
@@ -112,7 +116,7 @@
// Input is a single SQL command
%type cmd {SqliteQuery*}
-%destructor cmd {delete $$;}
+%destructor cmd {parser_safe_delete($$);}
input ::= cmdlist.
@@ -120,7 +124,7 @@ cmdlist ::= cmdlist ecmd(C). {parserContext->addQuery(C); DONT_IN
cmdlist ::= ecmd(C). {parserContext->addQuery(C);}
%type ecmd {SqliteQuery*}
-%destructor ecmd {delete $$;}
+%destructor ecmd {parser_safe_delete($$);}
ecmd(X) ::= SEMI. {X = new SqliteEmptyQuery();}
ecmd(X) ::= explain(E) cmdx(C) SEMI. {
X = C;
@@ -131,13 +135,13 @@ ecmd(X) ::= explain(E) cmdx(C) SEMI. {
}
%type explain {ParserStubExplain*}
-%destructor explain {delete $$;}
+%destructor explain {parser_safe_delete($$);}
explain(X) ::= . {X = new ParserStubExplain(false, false);}
explain(X) ::= EXPLAIN. {X = new ParserStubExplain(true, false);}
explain(X) ::= EXPLAIN QUERY PLAN. {X = new ParserStubExplain(true, true);}
%type cmdx {SqliteQuery*}
-%destructor cmdx {delete $$;}
+%destructor cmdx {parser_safe_delete($$);}
cmdx(X) ::= cmd(C). {X = C;}
///////////////////// Begin and end transaction. ////////////////////////////
@@ -155,7 +159,7 @@ cmd(X) ::= BEGIN transtype(TT)
}
%type trans_opt {ParserStubTransDetails*}
-%destructor trans_opt {delete $$;}
+%destructor trans_opt {parser_safe_delete($$);}
trans_opt(X) ::= . {X = new ParserStubTransDetails();}
trans_opt(X) ::= TRANSACTION. {
X = new ParserStubTransDetails();
@@ -170,7 +174,7 @@ trans_opt(X) ::= TRANSACTION nm(N). {
trans_opt ::= TRANSACTION ID_TRANS. {}
%type transtype {ParserStubTransDetails*}
-%destructor transtype {delete $$;}
+%destructor transtype {parser_safe_delete($$);}
transtype(X) ::= . {X = new ParserStubTransDetails();}
transtype(X) ::= DEFERRED. {
X = new ParserStubTransDetails();
@@ -212,7 +216,7 @@ cmd(X) ::= ROLLBACK trans_opt(T). {
}
%type savepoint_opt {bool*}
-%destructor savepoint_opt {delete $$;}
+%destructor savepoint_opt {parser_safe_delete($$);}
savepoint_opt(X) ::= SAVEPOINT. {X = new bool(true);}
savepoint_opt(X) ::= . {X = new bool(false);}
@@ -287,7 +291,7 @@ cmd ::= CREATE temp TABLE ifnotexists
ID_DB|ID_TAB_NEW. {}
%type table_options {QString*}
-%destructor table_options {delete $$;}
+%destructor table_options {parser_safe_delete($$);}
table_options(X) ::= . {X = new QString();}
table_options(X) ::= WITHOUT nm(N). {
if (N->toLower() != "rowid")
@@ -298,17 +302,17 @@ table_options(X) ::= WITHOUT nm(N). {
table_options ::= WITHOUT CTX_ROWID_KW. {}
%type ifnotexists {bool*}
-%destructor ifnotexists {delete $$;}
+%destructor ifnotexists {parser_safe_delete($$);}
ifnotexists(X) ::= . {X = new bool(false);}
ifnotexists(X) ::= IF NOT EXISTS. {X = new bool(true);}
%type temp {int*}
-%destructor temp {delete $$;}
+%destructor temp {parser_safe_delete($$);}
temp(X) ::= TEMP(T). {X = new int( (T->value.length() > 4) ? 2 : 1 );}
temp(X) ::= . {X = new int(0);}
%type columnlist {ParserCreateTableColumnList*}
-%destructor columnlist {delete $$;}
+%destructor columnlist {parser_safe_delete($$);}
columnlist(X) ::= columnlist(L)
COMMA column(C). {
L->append(C);
@@ -326,7 +330,7 @@ columnlist(X) ::= column(C). {
// NOT NULL and so forth.
%type column {SqliteCreateTable::Column*}
-%destructor column {delete $$;}
+%destructor column {parser_safe_delete($$);}
column(X) ::= columnid(C) type(T)
carglist(L). {
X = new SqliteCreateTable::Column(*(C), T, *(L));
@@ -336,7 +340,7 @@ column(X) ::= columnid(C) type(T)
}
%type columnid {QString*}
-%destructor columnid {delete $$;}
+%destructor columnid {parser_safe_delete($$);}
columnid(X) ::= nm(N). {X = N;}
columnid ::= ID_COL_NEW. {}
@@ -344,16 +348,24 @@ columnid ::= ID_COL_NEW. {}
// An IDENTIFIER can be a generic identifier, or one of several
// keywords. Any non-standard keyword can also be an identifier.
%type id {QString*}
-%destructor id {delete $$;}
-id(X) ::= ID(T). {
+%destructor id {parser_safe_delete($$);}
+id(X) ::= ID(T). {
X = new QString(
stripObjName(
- T->value,
- parserContext->dialect
+ T->value
)
);
}
+%type id_opt {QString*}
+%destructor id_opt {parser_safe_delete($$);}
+id_opt(X) ::= id(T). {
+ X = T;
+ }
+id_opt(X) ::= . {
+ X = new QString();
+ }
+
// Why would INDEXED be defined individually like this? I don't know.
// It was like this in the original SQLite grammar, but it doesn't
// make any sense, since we have a fallback mechanism for such things.
@@ -363,12 +375,12 @@ id(X) ::= ID(T). {
// And "ids" is an identifer-or-string.
%type ids {QString*}
-%destructor ids {delete $$;}
+%destructor ids {parser_safe_delete($$);}
ids(X) ::= ID|STRING(T). {X = new QString(T->value);}
// The name of a column or table can be any of the following:
%type nm {QString*}
-%destructor nm {delete $$;}
+%destructor nm {parser_safe_delete($$);}
nm(X) ::= id(N). {X = N;}
nm(X) ::= STRING(N). {X = new QString(stripString(N->value));}
nm(X) ::= JOIN_KW(N). {X = new QString(N->value);}
@@ -377,12 +389,12 @@ nm(X) ::= JOIN_KW(N). {X = new QString(N->value);}
// as can be found after the column name in a CREATE TABLE statement.
// Multiple tokens are concatenated to form the value of the typetoken.
%type type {SqliteColumnType*}
-%destructor type {delete $$;}
+%destructor type {parser_safe_delete($$);}
type(X) ::= . {X = nullptr;}
type(X) ::= typetoken(T). {X = T;}
%type typetoken {SqliteColumnType*}
-%destructor typetoken {delete $$;}
+%destructor typetoken {parser_safe_delete($$);}
typetoken(X) ::= typename(N). {
X = new SqliteColumnType(*(N));
delete N;
@@ -405,7 +417,7 @@ typetoken(X) ::= typename(N) LP signed(P)
}
%type typename {QString*}
-%destructor typename {delete $$;}
+%destructor typename {parser_safe_delete($$);}
typename(X) ::= ids(I). {X = I;}
typename(X) ::= typename(T) ids(I). {
T->append(" " + *(I));
@@ -415,23 +427,24 @@ typename(X) ::= typename(T) ids(I). {
typename ::= ID_COL_TYPE. {}
%type signed {QVariant*}
-%destructor signed {delete $$;}
+%destructor signed {parser_safe_delete($$);}
signed(X) ::= plus_num(N). {X = N;}
signed(X) ::= minus_num(N). {X = N;}
// "carglist" is a list of additional constraints that come after the
// column name and column type in a CREATE TABLE statement.
%type carglist {ParserCreateTableColumnConstraintList*}
-%destructor carglist {delete $$;}
-carglist(X) ::= carglist(L) ccons(C). {
+%destructor carglist {parser_safe_delete($$);}
+carglist(X) ::= carglist(L) ccons(C).
+ [RIGHT_ASSOC] {
L->append(C);
X = L;
DONT_INHERIT_TOKENS("carglist");
}
-carglist(X) ::= . {X = new ParserCreateTableColumnConstraintList();}
+carglist(X) ::= . [RIGHT_ASSOC] {X = new ParserCreateTableColumnConstraintList();}
%type ccons {SqliteCreateTable::Column::Constraint*}
-%destructor ccons {delete $$;}
+%destructor ccons {parser_safe_delete($$);}
ccons(X) ::= CONSTRAINT nm(N). {
X = new SqliteCreateTable::Column::Constraint();
X->initDefNameOnly(*(N));
@@ -528,6 +541,17 @@ ccons(X) ::= COLLATE ids(I). {
delete I;
objectForTokens = X;
}
+ccons(X) ::= gen_always(A) AS
+ LP expr(E) RP id_opt(T). {
+ if (!T->isNull() && T->toLower() != "stored" && T->toLower() != "virtual")
+ parserContext->errorAtToken(QString("Invalid generated column type: %1").arg(*(T)));
+
+ X = new SqliteCreateTable::Column::Constraint();
+ X->initGeneratedAs(E, *(A), *(T));
+ delete A;
+ delete T;
+ objectForTokens = X;
+ }
ccons ::= CONSTRAINT ID_CONSTR. {}
ccons ::= COLLATE ID_COLLATE. {}
@@ -540,15 +564,33 @@ ccons(X) ::= CHECK LP RP. {
}
%type term {QVariant*}
-%destructor term {delete $$;}
+%destructor term {parser_safe_delete($$);}
term(X) ::= NULL. {X = new QVariant();}
term(X) ::= INTEGER(N). {X = parserContext->handleNumberToken(N->value);}
term(X) ::= FLOAT(N). {X = new QVariant(QVariant(N->value).toDouble());}
-term(X) ::= STRING|BLOB(S). {X = new QVariant(S->value);}
+term(X) ::= STRING|BLOB(S). {X = new QVariant(stripString(S->value));}
+
+// Term Literal or Name. String falls under Term, but can be falled back to Name if necessary in the context.
+// On the other hand - if name is ID, it cannot be falled back to Term, as ID is never a Literal value.
+%type tnm {ParserTermOrLiteral*}
+%destructor tnm {parser_safe_delete($$);}
+tnm(X) ::= term(T). {
+ X = new ParserTermOrLiteral(*(T));
+ delete T;
+ }
+tnm(X) ::= nm(N). {
+ X = new ParserTermOrLiteral(*(N));
+ delete N;
+ }
+
+%type gen_always {bool*}
+%destructor gen_always {parser_safe_delete($$);}
+gen_always(X) ::= GENERATED ALWAYS. {X = new bool(true);}
+gen_always(X) ::= . {X = new bool(false);}
// The optional AUTOINCREMENT keyword
%type autoinc {bool*}
-%destructor autoinc {delete $$;}
+%destructor autoinc {parser_safe_delete($$);}
autoinc(X) ::= . {X = new bool(false);}
autoinc(X) ::= AUTOINCR. {X = new bool(true);}
@@ -557,7 +599,7 @@ autoinc(X) ::= AUTOINCR. {X = new bool(true);}
// or immediate and which determine what action to take if a ref-integ
// check fails.
%type refargs {ParserFkConditionList*}
-%destructor refargs {delete $$;}
+%destructor refargs {parser_safe_delete($$);}
refargs(X) ::= . {X = new ParserFkConditionList();}
refargs(X) ::= refargs(L) refarg(A). {
L->append(A);
@@ -566,7 +608,7 @@ refargs(X) ::= refargs(L) refarg(A). {
}
%type refarg {SqliteForeignKey::Condition*}
-%destructor refarg {delete $$;}
+%destructor refarg {parser_safe_delete($$);}
refarg(X) ::= MATCH nm(N). {
X = new SqliteForeignKey::Condition(*(N));
delete N;
@@ -577,7 +619,7 @@ refarg(X) ::= ON UPDATE refact(R). {X = new SqliteForeignKey::Condition
refarg ::= MATCH ID_FK_MATCH. {}
%type refact {SqliteForeignKey::Condition::Reaction*}
-%destructor refact {delete $$;}
+%destructor refact {parser_safe_delete($$);}
refact(X) ::= SET NULL. {X = new SqliteForeignKey::Condition::Reaction(SqliteForeignKey::Condition::SET_NULL);}
refact(X) ::= SET DEFAULT. {X = new SqliteForeignKey::Condition::Reaction(SqliteForeignKey::Condition::SET_DEFAULT);}
refact(X) ::= CASCADE. {X = new SqliteForeignKey::Condition::Reaction(SqliteForeignKey::Condition::CASCADE);}
@@ -585,7 +627,7 @@ refact(X) ::= RESTRICT. {X = new SqliteForeignKey::Condition
refact(X) ::= NO ACTION. {X = new SqliteForeignKey::Condition::Reaction(SqliteForeignKey::Condition::NO_ACTION);}
%type defer_subclause {ParserDeferSubClause*}
-%destructor defer_subclause {delete $$;}
+%destructor defer_subclause {parser_safe_delete($$);}
defer_subclause(X) ::= NOT DEFERRABLE
init_deferred_pred_opt(I). {
X = new ParserDeferSubClause(SqliteDeferrable::NOT_DEFERRABLE, *(I));
@@ -598,7 +640,7 @@ defer_subclause(X) ::= DEFERRABLE
}
%type init_deferred_pred_opt {SqliteInitially*}
-%destructor init_deferred_pred_opt {delete $$;}
+%destructor init_deferred_pred_opt {parser_safe_delete($$);}
init_deferred_pred_opt(X) ::= . {X = new SqliteInitially(SqliteInitially::null);}
init_deferred_pred_opt(X) ::= INITIALLY
DEFERRED. {X = new SqliteInitially(SqliteInitially::DEFERRED);}
@@ -606,12 +648,12 @@ init_deferred_pred_opt(X) ::= INITIALLY
IMMEDIATE. {X = new SqliteInitially(SqliteInitially::IMMEDIATE);}
%type conslist_opt {ParserCreateTableConstraintList*}
-%destructor conslist_opt {delete $$;}
+%destructor conslist_opt {parser_safe_delete($$);}
conslist_opt(X) ::= . {X = new ParserCreateTableConstraintList();}
conslist_opt(X) ::= COMMA conslist(L). {X = L;}
%type conslist {ParserCreateTableConstraintList*}
-%destructor conslist {delete $$;}
+%destructor conslist {parser_safe_delete($$);}
conslist(X) ::= conslist(L) tconscomma(CM)
tcons(C). {
C->afterComma = *(CM);
@@ -626,12 +668,12 @@ conslist(X) ::= tcons(C). {
}
%type tconscomma {bool*}
-%destructor tconscomma {delete $$;}
+%destructor tconscomma {parser_safe_delete($$);}
tconscomma(X) ::= COMMA. {X = new bool(true);}
tconscomma(X) ::= . {X = new bool(false);}
%type tcons {SqliteCreateTable::Constraint*}
-%destructor tcons {delete $$;}
+%destructor tcons {parser_safe_delete($$);}
tcons(X) ::= CONSTRAINT nm(N). {
X = new SqliteCreateTable::Constraint();
X->initNameOnly(*(N));
@@ -691,7 +733,7 @@ tcons(X) ::= CHECK LP RP onconf. {
}
%type defer_subclause_opt {ParserDeferSubClause*}
-%destructor defer_subclause_opt {delete $$;}
+%destructor defer_subclause_opt {parser_safe_delete($$);}
defer_subclause_opt(X) ::= . {X = new ParserDeferSubClause(SqliteDeferrable::null, SqliteInitially::null);}
defer_subclause_opt(X) ::=
defer_subclause(D). {X = D;}
@@ -700,17 +742,17 @@ defer_subclause_opt(X) ::=
// default behavior when there is a constraint conflict.
%type onconf {SqliteConflictAlgo*}
-%destructor onconf {delete $$;}
+%destructor onconf {parser_safe_delete($$);}
onconf(X) ::= . {X = new SqliteConflictAlgo(SqliteConflictAlgo::null);}
onconf(X) ::= ON CONFLICT resolvetype(R). {X = R;}
%type orconf {SqliteConflictAlgo*}
-%destructor orconf {delete $$;}
+%destructor orconf {parser_safe_delete($$);}
orconf(X) ::= . {X = new SqliteConflictAlgo(SqliteConflictAlgo::null);}
orconf(X) ::= OR resolvetype(R). {X = R;}
%type resolvetype {SqliteConflictAlgo*}
-%destructor resolvetype {delete $$;}
+%destructor resolvetype {parser_safe_delete($$);}
resolvetype(X) ::= raisetype(V). {X = new SqliteConflictAlgo(sqliteConflictAlgo(V->value));}
resolvetype(X) ::= IGNORE(V). {X = new SqliteConflictAlgo(sqliteConflictAlgo(V->value));}
resolvetype(X) ::= REPLACE(V). {X = new SqliteConflictAlgo(sqliteConflictAlgo(V->value));}
@@ -730,7 +772,7 @@ cmd ::= DROP TABLE ifexists nm DOT
cmd ::= DROP TABLE ifexists ID_DB|ID_TAB. {}
%type ifexists {bool*}
-%destructor ifexists {delete $$;}
+%destructor ifexists {parser_safe_delete($$);}
ifexists(X) ::= IF EXISTS. {X = new bool(true);}
ifexists(X) ::= . {X = new bool(false);}
@@ -771,7 +813,7 @@ cmd(X) ::= select_stmt(S). {
}
%type select_stmt {SqliteQuery*}
-%destructor select_stmt {delete $$;}
+%destructor select_stmt {parser_safe_delete($$);}
select_stmt(X) ::= select(S). {
X = S;
// since it's used in trigger:
@@ -779,7 +821,7 @@ select_stmt(X) ::= select(S). {
}
%type select {SqliteSelect*}
-%destructor select {delete $$;}
+%destructor select {parser_safe_delete($$);}
select(X) ::= with(W) selectnowith(S). {
X = S;
S->setWith(W);
@@ -787,7 +829,7 @@ select(X) ::= with(W) selectnowith(S). {
}
%type selectnowith {SqliteSelect*}
-%destructor selectnowith {delete $$;}
+%destructor selectnowith {parser_safe_delete($$);}
selectnowith(X) ::= oneselect(S). {
X = SqliteSelect::append(S);
objectForTokens = X;
@@ -812,7 +854,7 @@ selectnowith(X) ::= selectnowith(S1)
objectForTokens = X;
}
%type oneselect {SqliteSelect::Core*}
-%destructor oneselect {delete $$;}
+%destructor oneselect {parser_safe_delete($$);}
oneselect(X) ::= SELECT distinct(D)
selcollist(L) from(F)
where_opt(W) groupby_opt(G)
@@ -834,9 +876,34 @@ oneselect(X) ::= SELECT distinct(D)
delete O;
objectForTokens = X;
}
+oneselect(X) ::= SELECT distinct(D)
+ selcollist(L) from(F)
+ where_opt(W) groupby_opt(G)
+ having_opt(H)
+ window_clause(WF)
+ orderby_opt(O)
+ limit_opt(LI). {
+ X = new SqliteSelect::Core(
+ *(D),
+ *(L),
+ F,
+ W,
+ *(G),
+ H,
+ *(WF),
+ *(O),
+ LI
+ );
+ delete L;
+ delete D;
+ delete G;
+ delete O;
+ delete WF;
+ objectForTokens = X;
+ }
%type values {ParserExprNestedList*}
-%destructor values {delete $$;}
+%destructor values {parser_safe_delete($$);}
values(X) ::= VALUES LP nexprlist(E) RP. {
X = new ParserExprNestedList();
X->append(*(E));
@@ -851,31 +918,31 @@ values(X) ::= values(L) COMMA LP
}
%type multiselect_op {SqliteSelect::CompoundOperator*}
-%destructor multiselect_op {delete $$;}
+%destructor multiselect_op {parser_safe_delete($$);}
multiselect_op(X) ::= UNION. {X = new SqliteSelect::CompoundOperator(SqliteSelect::CompoundOperator::UNION);}
multiselect_op(X) ::= UNION ALL. {X = new SqliteSelect::CompoundOperator(SqliteSelect::CompoundOperator::UNION_ALL);}
multiselect_op(X) ::= EXCEPT. {X = new SqliteSelect::CompoundOperator(SqliteSelect::CompoundOperator::EXCEPT);}
multiselect_op(X) ::= INTERSECT. {X = new SqliteSelect::CompoundOperator(SqliteSelect::CompoundOperator::INTERSECT);}
%type distinct {int*}
-%destructor distinct {delete $$;}
+%destructor distinct {parser_safe_delete($$);}
distinct(X) ::= DISTINCT. {X = new int(1);}
distinct(X) ::= ALL. {X = new int(2);}
distinct(X) ::= . {X = new int(0);}
%type sclp {ParserResultColumnList*}
-%destructor sclp {delete $$;}
+%destructor sclp {parser_safe_delete($$);}
sclp(X) ::= selcollist(L) COMMA. {X = L;}
sclp(X) ::= . {X = new ParserResultColumnList();}
%type selcollist {ParserResultColumnList*}
-%destructor selcollist {delete $$;}
+%destructor selcollist {parser_safe_delete($$);}
selcollist(X) ::= sclp(L) expr(E) as(N). {
SqliteSelect::Core::ResultColumn* obj =
new SqliteSelect::Core::ResultColumn(
E,
N ? N->asKw : false,
- N ? N->name : QString::null
+ N ? N->name : QString()
);
L->append(obj);
@@ -893,12 +960,16 @@ selcollist(X) ::= sclp(L) STAR. {
objectForTokens = obj;
DONT_INHERIT_TOKENS("sclp");
}
-selcollist(X) ::= sclp(L) nm(N) DOT STAR. {
+selcollist(X) ::= sclp(L) tnm(N) DOT STAR. {
SqliteSelect::Core::ResultColumn* obj =
new SqliteSelect::Core::ResultColumn(
true,
- *(N)
+ N->toName()
);
+
+ if (!N->isName())
+ parserContext->errorAtToken("Syntax error <expected name, not literal value>", -3);
+
L->append(obj);
X = L;
delete N;
@@ -915,7 +986,7 @@ selcollist ::= sclp ID_TAB DOT STAR. {}
// define the result set, or one of the tables in the FROM clause.
%type as {ParserStubAlias*}
-%destructor as {delete $$;}
+%destructor as {parser_safe_delete($$);}
as(X) ::= AS nm(N). {
X = new ParserStubAlias(*(N), true);
delete N;
@@ -931,12 +1002,12 @@ as(X) ::= . {X = nullptr;}
// A complete FROM clause.
%type from {SqliteSelect::Core::JoinSource*}
-%destructor from {delete $$;}
+%destructor from {parser_safe_delete($$);}
from(X) ::= . {X = nullptr;}
from(X) ::= FROM joinsrc(L). {X = L;}
%type joinsrc {SqliteSelect::Core::JoinSource*}
-%destructor joinsrc {delete $$;}
+%destructor joinsrc {parser_safe_delete($$);}
joinsrc(X) ::= singlesrc(S) seltablist(L). {
X = new SqliteSelect::Core::JoinSource(
S,
@@ -952,7 +1023,7 @@ joinsrc(X) ::= . {
}
%type seltablist {ParserOtherSourceList*}
-%destructor seltablist {delete $$;}
+%destructor seltablist {parser_safe_delete($$);}
seltablist(X) ::= seltablist(L) joinop(O)
singlesrc(S)
joinconstr_opt(C). {
@@ -969,16 +1040,16 @@ seltablist(X) ::= . {
}
%type singlesrc {SqliteSelect::Core::SingleSource*}
-%destructor singlesrc {delete $$;}
+%destructor singlesrc {parser_safe_delete($$);}
singlesrc(X) ::= nm(N1) dbnm(N2) as(A)
indexed_opt(I). {
X = new SqliteSelect::Core::SingleSource(
*(N1),
*(N2),
A ? A->asKw : false,
- A ? A->name : QString::null,
+ A ? A->name : QString(),
I ? I->notIndexedKw : false,
- I ? I->indexedBy : QString::null
+ I ? I->indexedBy : QString()
);
delete N1;
delete N2;
@@ -991,7 +1062,7 @@ singlesrc(X) ::= LP select(S) RP as(A). {
X = new SqliteSelect::Core::SingleSource(
S,
A ? A->asKw : false,
- A ? A->name : QString::null
+ A ? A->name : QString()
);
delete A;
objectForTokens = X;
@@ -1000,7 +1071,7 @@ singlesrc(X) ::= LP joinsrc(J) RP as(A). {
X = new SqliteSelect::Core::SingleSource(
J,
A ? A->asKw : false,
- A ? A->name : QString::null
+ A ? A->name : QString()
);
delete A;
objectForTokens = X;
@@ -1011,7 +1082,7 @@ singlesrc(X) ::= nm(N1) dbnm(N2)
*(N1),
*(N2),
A ? A->asKw : false,
- A ? A->name : QString::null,
+ A ? A->name : QString(),
*(E)
);
delete N1;
@@ -1041,7 +1112,7 @@ singlesrc ::= nm DOT ID_VIEW. {}
singlesrc ::= ID_DB|ID_VIEW. {}
%type joinconstr_opt {SqliteSelect::Core::JoinConstraint*}
-%destructor joinconstr_opt {delete $$;}
+%destructor joinconstr_opt {parser_safe_delete($$);}
joinconstr_opt(X) ::= ON expr(E). {
X = new SqliteSelect::Core::JoinConstraint(E);
objectForTokens = X;
@@ -1055,12 +1126,12 @@ joinconstr_opt(X) ::= USING LP
joinconstr_opt(X) ::= . {X = nullptr;}
%type dbnm {QString*}
-%destructor dbnm {delete $$;}
+%destructor dbnm {parser_safe_delete($$);}
dbnm(X) ::= . {X = new QString();}
dbnm(X) ::= DOT nm(N). {X = N;}
%type fullname {ParserFullName*}
-%destructor fullname {delete $$;}
+%destructor fullname {parser_safe_delete($$);}
fullname(X) ::= nm(N1) dbnm(N2). {
X = new ParserFullName();
X->name1 = *(N1);
@@ -1070,7 +1141,7 @@ fullname(X) ::= nm(N1) dbnm(N2). {
}
%type joinop {SqliteSelect::Core::JoinOp*}
-%destructor joinop {delete $$;}
+%destructor joinop {parser_safe_delete($$);}
joinop(X) ::= COMMA. {
X = new SqliteSelect::Core::JoinOp(true);
objectForTokens = X;
@@ -1092,7 +1163,6 @@ joinop(X) ::= JOIN_KW(K) nm(N1) nm(N2)
JOIN. {
X = new SqliteSelect::Core::JoinOp(K->value, *(N1), *(N2));
delete N1;
- delete N1;
objectForTokens = X;
}
@@ -1108,7 +1178,7 @@ joinop ::= ID_JOIN_OPTS. {}
// normally illegal. The sqlite3SrcListIndexedBy() function
// recognizes and interprets this as a special case.
%type indexed_opt {ParserIndexedBy*}
-%destructor indexed_opt {delete $$;}
+%destructor indexed_opt {parser_safe_delete($$);}
indexed_opt(X) ::= . {X = nullptr;}
indexed_opt(X) ::= INDEXED BY nm(N). {
X = new ParserIndexedBy(*(N));
@@ -1119,38 +1189,47 @@ indexed_opt(X) ::= NOT INDEXED. {X = new ParserIndexedBy(true);}
indexed_opt ::= INDEXED BY ID_IDX. {}
%type orderby_opt {ParserOrderByList*}
-%destructor orderby_opt {delete $$;}
+%destructor orderby_opt {parser_safe_delete($$);}
orderby_opt(X) ::= . {X = new ParserOrderByList();}
orderby_opt(X) ::= ORDER BY sortlist(L). {X = L;}
// SQLite3 documentation says it's allowed for "COLLATE name" and expr itself handles this.
%type sortlist {ParserOrderByList*}
-%destructor sortlist {delete $$;}
+%destructor sortlist {parser_safe_delete($$);}
sortlist(X) ::= sortlist(L) COMMA expr(E)
- sortorder(O). {
- SqliteOrderBy* obj = new SqliteOrderBy(E, *(O));
+ sortorder(O) nulls(N). {
+ SqliteOrderBy* obj = new SqliteOrderBy(E, *(O), *(N));
L->append(obj);
X = L;
delete O;
+ delete N;
objectForTokens = obj;
DONT_INHERIT_TOKENS("sortlist");
}
-sortlist(X) ::= expr(E) sortorder(O). {
- SqliteOrderBy* obj = new SqliteOrderBy(E, *(O));
+sortlist(X) ::= expr(E) sortorder(O)
+ nulls(N). {
+ SqliteOrderBy* obj = new SqliteOrderBy(E, *(O), *(N));
X = new ParserOrderByList();
X->append(obj);
delete O;
+ delete N;
objectForTokens = obj;
}
%type sortorder {SqliteSortOrder*}
-%destructor sortorder {delete $$;}
+%destructor sortorder {parser_safe_delete($$);}
sortorder(X) ::= ASC. {X = new SqliteSortOrder(SqliteSortOrder::ASC);}
sortorder(X) ::= DESC. {X = new SqliteSortOrder(SqliteSortOrder::DESC);}
sortorder(X) ::= . {X = new SqliteSortOrder(SqliteSortOrder::null);}
+%type nulls {SqliteNulls*}
+%destructor nulls {parser_safe_delete($$);}
+nulls(X) ::= NULLS FIRST. {X = new SqliteNulls(SqliteNulls::FIRST);}
+nulls(X) ::= NULLS LAST. {X = new SqliteNulls(SqliteNulls::LAST);}
+nulls(X) ::= . {X = new SqliteNulls(SqliteNulls::null);}
+
%type groupby_opt {ParserExprList*}
-%destructor groupby_opt {delete $$;}
+%destructor groupby_opt {parser_safe_delete($$);}
groupby_opt(X) ::= . {X = new ParserExprList();}
groupby_opt(X) ::= GROUP BY nexprlist(L). {X = L;}
groupby_opt(X) ::= GROUP BY. {
@@ -1159,12 +1238,12 @@ groupby_opt(X) ::= GROUP BY. {
}
%type having_opt {SqliteExpr*}
-%destructor having_opt {delete $$;}
+%destructor having_opt {parser_safe_delete($$);}
having_opt(X) ::= . {X = nullptr;}
having_opt(X) ::= HAVING expr(E). {X = E;}
%type limit_opt {SqliteLimit*}
-%destructor limit_opt {delete $$;}
+%destructor limit_opt {parser_safe_delete($$);}
limit_opt(X) ::= . {X = nullptr;}
limit_opt(X) ::= LIMIT expr(E). {
X = new SqliteLimit(E);
@@ -1194,7 +1273,7 @@ cmd(X) ::= delete_stmt(S). {
}
%type delete_stmt {SqliteQuery*}
-%destructor delete_stmt {delete $$;}
+%destructor delete_stmt {parser_safe_delete($$);}
delete_stmt(X) ::= with(WI) DELETE FROM
fullname(N)
indexed_opt(I)
@@ -1262,7 +1341,7 @@ delete_stmt ::= with DELETE FROM
ID_DB|ID_TAB. {}
%type where_opt {SqliteExpr*}
-%destructor where_opt {delete $$;}
+%destructor where_opt {parser_safe_delete($$);}
where_opt(X) ::= . {X = nullptr;}
where_opt(X) ::= WHERE expr(E). {X = E;}
where_opt(X) ::= WHERE. {
@@ -1272,27 +1351,25 @@ where_opt(X) ::= WHERE. {
////////////////////////// The UPDATE command ////////////////////////////////
-//%ifdef SQLITE_ENABLE_UPDATE_DELETE_LIMIT
-///cmd ::= UPDATE orconf fullname indexed_opt SET setlist where_opt orderby_opt(O) limit_opt.
-//%endif
-//%ifndef SQLITE_ENABLE_UPDATE_DELETE_LIMIT
cmd(X) ::= update_stmt(S). {
X = S;
objectForTokens = X;
}
%type update_stmt {SqliteQuery*}
-%destructor update_stmt {delete $$;}
+%destructor update_stmt {parser_safe_delete($$);}
update_stmt(X) ::= with(WI) UPDATE orconf(C)
fullname(N) indexed_opt(I) SET
- setlist(L) where_opt(W). {
+ setlist(L) from(F)
+ where_opt(W). {
X = new SqliteUpdate(
*(C),
N->name1,
N->name2,
I ? I->notIndexedKw : false,
- I ? I->indexedBy : QString::null,
+ I ? I->indexedBy : QString(),
*(L),
+ F,
W,
WI
);
@@ -1304,7 +1381,6 @@ update_stmt(X) ::= with(WI) UPDATE orconf(C)
// since it's used in trigger:
objectForTokens = X;
}
-//%endif
update_stmt(X) ::= with(WI) UPDATE
orconf(C). {
@@ -1332,7 +1408,7 @@ update_stmt ::= with UPDATE orconf
ID_DB|ID_TAB. {}
%type setlist {ParserSetValueList*}
-%destructor setlist {delete $$;}
+%destructor setlist {parser_safe_delete($$);}
setlist(X) ::= setlist(L) COMMA nm(N) EQ
expr(E). {
L->append(ParserSetValue(*(N), E));
@@ -1368,12 +1444,12 @@ setlist ::= setlist COMMA ID_COL. {}
setlist ::= ID_COL. {}
%type idlist_opt {QStringList*}
-%destructor idlist_opt {delete $$;}
+%destructor idlist_opt {parser_safe_delete($$);}
idlist_opt(X) ::= . {X = new QStringList();}
idlist_opt(X) ::= LP idlist(L) RP. {X = L;}
%type idlist {QStringList*}
-%destructor idlist {delete $$;}
+%destructor idlist {parser_safe_delete($$);}
idlist(X) ::= idlist(L) COMMA nm(N). {
X = L;
*(X) << *(N);
@@ -1400,7 +1476,7 @@ cmd(X) ::= insert_stmt(S). {
}
%type insert_stmt {SqliteQuery*}
-%destructor insert_stmt {delete $$;}
+%destructor insert_stmt {parser_safe_delete($$);}
insert_stmt(X) ::= with(W) insert_cmd(C)
INTO fullname(N)
@@ -1471,7 +1547,7 @@ insert_stmt ::= with insert_cmd INTO
nm DOT ID_TAB. {}
%type insert_cmd {ParserStubInsertOrReplace*}
-%destructor insert_cmd {delete $$;}
+%destructor insert_cmd {parser_safe_delete($$);}
insert_cmd(X) ::= INSERT orconf(C). {
X = new ParserStubInsertOrReplace(false, *(C));
delete C;
@@ -1480,7 +1556,7 @@ insert_cmd(X) ::= REPLACE. {X = new ParserStubInsertOrReplace(t
%type upsert {SqliteUpsert*}
-%destructor upsert {delete $$;}
+%destructor upsert {parser_safe_delete($$);}
upsert(X) ::= . {
X = nullptr;
@@ -1509,77 +1585,19 @@ upsert(X) ::= ON CONFLICT DO NOTHING. {
/////////////////////////// Expression Processing /////////////////////////////
%type exprx {SqliteExpr*}
-%destructor exprx {delete $$;}
+%destructor exprx {parser_safe_delete($$);}
-exprx(X) ::= nm(N1) DOT. {
- X = new SqliteExpr();
- X->initId(*(N1), QString::null, QString::null);
- delete N1;
- objectForTokens = X;
- parserContext->minorErrorBeforeNextToken("Syntax error <exprx: nm.>");
- }
-exprx(X) ::= nm(N1) DOT nm(N2) DOT. {
- X = new SqliteExpr();
- X->initId(*(N1), *(N2), QString::null);
- delete N1;
- delete N2;
- objectForTokens = X;
- parserContext->minorErrorBeforeNextToken("Syntax error <exprx: nm.nm.>");
- }
-exprx(X) ::= expr(E1) not_opt(N) BETWEEN
- expr(E2) AND. {
- X = new SqliteExpr();
- delete N;
- delete E1;
- delete E2;
- objectForTokens = X;
- parserContext->minorErrorBeforeNextToken("Syntax error <exprx: expr not_opt BETWEEN expr AND>");
- }
-exprx(X) ::= CASE case_operand(O)
- case_exprlist(L)
- case_else(E). {
- X = new SqliteExpr();
- delete L;
- delete O;
- delete E;
- objectForTokens = X;
- parserContext->minorErrorBeforeNextToken("Syntax error <exprx: CASE operand exprlist else>");
- }
-exprx(X) ::= expr(E) not_opt(N) IN LP
- exprlist(L). [IN] {
- X = new SqliteExpr();
- delete N;
- delete L;
- delete E;
- objectForTokens = X;
- parserContext->minorErrorBeforeNextToken("Syntax error <exprx: expr not_opt IN LP exprlist>");
- }
-/*
-This introduces premature reduce for LP-expr and causes bug #2755
-exprx(X) ::= LP expr(E). {
- X = new SqliteExpr();
- X->initSubExpr(E);
- objectForTokens = X;
- parserContext->minorErrorBeforeNextToken("Syntax error <exprx: LP expr>");
- }
-*/
exprx ::= expr not_opt IN ID_DB. [IN] {}
exprx ::= expr not_opt IN nm DOT
ID_TAB. [IN] {}
exprx ::= ID_DB|ID_TAB|ID_COL|ID_FN. {}
-exprx ::= nm DOT ID_TAB|ID_COL. {}
-exprx ::= nm DOT nm DOT ID_COL. {}
+exprx ::= tnm DOT ID_TAB|ID_COL. {}
+exprx ::= tnm DOT nm DOT ID_COL. {}
exprx ::= expr COLLATE ID_COLLATE. {}
exprx ::= RAISE LP raisetype COMMA
ID_ERR_MSG RP. {}
-exprx(X) ::= term(T). {
- X = new SqliteExpr();
- X->initLiteral(*(T));
- delete T;
- objectForTokens = X;
- }
exprx(X) ::= CTIME_KW(K). {
X = new SqliteExpr();
X->initCTime(K->value);
@@ -1591,34 +1609,35 @@ exprx(X) ::= LP nexprlist(L) RP. {
delete L;
objectForTokens = X;
}
-/*
-exprx(X) ::= LP expr(E) RP. {
- X = new SqliteExpr();
- X->initSubExpr(E);
- objectForTokens = X;
- }
-*/
-exprx(X) ::= id(N). {
+exprx(X) ::= tnm(N1). {
X = new SqliteExpr();
- X->initId(*(N));
- delete N;
- objectForTokens = X;
- }
-exprx(X) ::= JOIN_KW(N). {
- X = new SqliteExpr();
- X->initId(N->value);
+ if (N1->isLiteral())
+ X->initLiteral(N1->toLiteral());
+ else
+ X->initId(N1->toName());
+ //parserContext->errorBeforeLastToken("Syntax error <expected literal value>");
+
+ delete N1;
objectForTokens = X;
}
-exprx(X) ::= nm(N1) DOT nm(N2). {
+exprx(X) ::= tnm(N1) DOT nm(N2). {
X = new SqliteExpr();
- X->initId(*(N1), *(N2));
+ if (N1->isName())
+ X->initId(N1->toName(), *(N2));
+ else
+ parserContext->errorAtToken("Syntax error <expected name>", -3);
+
delete N1;
delete N2;
objectForTokens = X;
}
-exprx(X) ::= nm(N1) DOT nm(N2) DOT nm(N3). {
+exprx(X) ::= tnm(N1) DOT nm(N2) DOT nm(N3). {
X = new SqliteExpr();
- X->initId(*(N1), *(N2), *(N3));
+ if (N1->isName())
+ X->initId(N1->toName(), *(N2), *(N3));
+ else
+ parserContext->errorAtToken("Syntax error <expected name>", -5);
+
delete N1;
delete N2;
delete N3;
@@ -1824,9 +1843,23 @@ exprx(X) ::= RAISE LP raisetype(R) COMMA
delete N;
objectForTokens = X;
}
+exprx(X) ::= ID(I) LP distinct(D)
+ exprlist(E) RP filter_over(F). {
+ X = new SqliteExpr();
+ X->initWindowFunction(I->value, *(D), *(E), F);
+ delete D;
+ delete E;
+ objectForTokens = X;
+ }
+exprx(X) ::= ID(I) LP STAR RP
+ filter_over(F). {
+ X = new SqliteExpr();
+ X->initWindowFunction(I->value, F);
+ objectForTokens = X;
+ }
%type expr {SqliteExpr*}
-%destructor expr {delete $$;}
+%destructor expr {parser_safe_delete($$);}
expr(X) ::= . {
X = new SqliteExpr();
objectForTokens = X;
@@ -1835,16 +1868,16 @@ expr(X) ::= . {
expr(X) ::= exprx(E). {X = E;}
%type not_opt {bool*}
-%destructor not_opt {delete $$;}
+%destructor not_opt {parser_safe_delete($$);}
not_opt(X) ::= . {X = new bool(false);}
not_opt(X) ::= NOT. {X = new bool(true);}
%type likeop {SqliteExpr::LikeOp*}
-%destructor likeop {delete $$;}
+%destructor likeop {parser_safe_delete($$);}
likeop(X) ::= LIKE_KW|MATCH(T). {X = new SqliteExpr::LikeOp(SqliteExpr::likeOp(T->value));}
%type case_exprlist {ParserExprList*}
-%destructor case_exprlist {delete $$;}
+%destructor case_exprlist {parser_safe_delete($$);}
case_exprlist(X) ::= case_exprlist(L) WHEN
expr(E1) THEN expr(E2). {
L->append(E1);
@@ -1859,22 +1892,22 @@ case_exprlist(X) ::= WHEN expr(E1) THEN
}
%type case_else {SqliteExpr*}
-%destructor case_else {delete $$;}
+%destructor case_else {parser_safe_delete($$);}
case_else(X) ::= ELSE expr(E). {X = E;}
case_else(X) ::= . {X = nullptr;}
%type case_operand {SqliteExpr*}
-%destructor case_operand {delete $$;}
+%destructor case_operand {parser_safe_delete($$);}
case_operand(X) ::= exprx(E). {X = E;}
case_operand(X) ::= . {X = nullptr;}
%type exprlist {ParserExprList*}
-%destructor exprlist {delete $$;}
+%destructor exprlist {parser_safe_delete($$);}
exprlist(X) ::= nexprlist(L). {X = L;}
exprlist(X) ::= . {X = new ParserExprList();}
%type nexprlist {ParserExprList*}
-%destructor nexprlist {delete $$;}
+%destructor nexprlist {parser_safe_delete($$);}
nexprlist(X) ::= nexprlist(L) COMMA
expr(E). {
L->append(E);
@@ -1919,17 +1952,17 @@ cmd ::= CREATE uniqueflag INDEX ifnotexists
%type uniqueflag {bool*}
-%destructor uniqueflag {delete $$;}
+%destructor uniqueflag {parser_safe_delete($$);}
uniqueflag(X) ::= UNIQUE. {X = new bool(true);}
uniqueflag(X) ::= . {X = new bool(false);}
%type idxlist_opt {ParserIndexedColumnList*}
-%destructor idxlist_opt {delete $$;}
+%destructor idxlist_opt {parser_safe_delete($$);}
idxlist_opt(X) ::= . {X = new ParserIndexedColumnList();}
idxlist_opt(X) ::= LP idxlist(I) RP. {X = I;}
%type idxlist {ParserIndexedColumnList*}
-%destructor idxlist {delete $$;}
+%destructor idxlist {parser_safe_delete($$);}
idxlist(X) ::= idxlist(L) COMMA
idxlist_single(S). {
L->append(S);
@@ -1942,7 +1975,7 @@ idxlist(X) ::= idxlist_single(S). {
}
%type idxlist_single {SqliteIndexedColumn*}
-%destructor idxlist_single {delete $$;}
+%destructor idxlist_single {parser_safe_delete($$);}
idxlist_single(X) ::= nm(N) collate(C)
sortorder(S). {
SqliteIndexedColumn* obj =
@@ -1961,7 +1994,7 @@ idxlist_single(X) ::= nm(N) collate(C)
idxlist_single ::= ID_COL. {}
%type collate {QString*}
-%destructor collate {delete $$;}
+%destructor collate {parser_safe_delete($$);}
collate(X) ::= . {X = new QString();}
collate(X) ::= COLLATE ids(I). {X = I;}
collate ::= COLLATE ID_COLLATE. {}
@@ -1982,16 +2015,22 @@ cmd ::= DROP INDEX ifexists ID_DB|ID_IDX. {}
///////////////////////////// The VACUUM command /////////////////////////////
-cmd(X) ::= VACUUM. {
- X = new SqliteVacuum();
+cmd(X) ::= VACUUM vinto(I). {
+ X = new SqliteVacuum(I);
objectForTokens = X;
}
-cmd(X) ::= VACUUM nm(N). {
- X = new SqliteVacuum(*(N));
+cmd(X) ::= VACUUM nm(N) vinto(I). {
+ X = new SqliteVacuum(*(N), I);
delete N;
objectForTokens = X;
}
+
+%type vinto {SqliteExpr*}
+%destructor vinto {parser_safe_delete($$);}
+vinto(X) ::= INTO expr(E). {X = E;}
+vinto(X) ::= . {X = nullptr;}
+
///////////////////////////// The PRAGMA command /////////////////////////////
cmd(X) ::= PRAGMA nm(N1) dbnm(N2). {
@@ -2037,7 +2076,7 @@ cmd ::= PRAGMA nm DOT ID_PRAGMA. {}
cmd ::= PRAGMA ID_DB|ID_PRAGMA. {}
%type nmnum {QVariant*}
-%destructor nmnum {delete $$;}
+%destructor nmnum {parser_safe_delete($$);}
nmnum(X) ::= plus_num(N). {X = N;}
nmnum(X) ::= nm(N). {
X = new QVariant(*(N));
@@ -2048,12 +2087,12 @@ nmnum(X) ::= DELETE(T). {X = new QVariant(T->value);}
nmnum(X) ::= DEFAULT(T). {X = new QVariant(T->value);}
%type plus_num {QVariant*}
-%destructor plus_num {delete $$;}
+%destructor plus_num {parser_safe_delete($$);}
plus_num(X) ::= PLUS number(N). {X = N;}
plus_num(X) ::= number(N). {X = N;}
%type minus_num {QVariant*}
-%destructor minus_num {delete $$;}
+%destructor minus_num {parser_safe_delete($$);}
minus_num(X) ::= MINUS number(N). {
if (N->type() == QVariant::Double)
*(N) = -(N->toDouble());
@@ -2071,7 +2110,7 @@ minus_num(X) ::= MINUS number(N). {
}
%type number {QVariant*}
-%destructor number {delete $$;}
+%destructor number {parser_safe_delete($$);}
number(X) ::= INTEGER(N). {X = parserContext->handleNumberToken(N->value);}
number(X) ::= FLOAT(N). {X = new QVariant(QVariant(N->value).toDouble());}
@@ -2150,17 +2189,17 @@ cmd(X) ::= CREATE temp(T) TRIGGER
when_clause(WC) BEGIN
trigger_cmd_list(CL). {
X = new SqliteCreateTrigger(
- *(T),
- *(IE),
- *(N1),
- *(N2),
- *(N),
- *(TT),
- EV,
- *(FC),
- WC,
- *(CL),
- 3
+ *(T),
+ *(IE),
+ *(N1),
+ *(N2),
+ *(N),
+ *(TT),
+ EV,
+ *(FC),
+ WC,
+ *(CL),
+ 3
);
delete IE;
delete T;
@@ -2183,14 +2222,14 @@ cmd ::= CREATE temp TRIGGER ifnotexists
ID_DB|ID_TRIG_NEW. {}
%type trigger_time {SqliteCreateTrigger::Time*}
-%destructor trigger_time {delete $$;}
+%destructor trigger_time {parser_safe_delete($$);}
trigger_time(X) ::= BEFORE. {X = new SqliteCreateTrigger::Time(SqliteCreateTrigger::Time::BEFORE);}
trigger_time(X) ::= AFTER. {X = new SqliteCreateTrigger::Time(SqliteCreateTrigger::Time::AFTER);}
trigger_time(X) ::= INSTEAD OF. {X = new SqliteCreateTrigger::Time(SqliteCreateTrigger::Time::INSTEAD_OF);}
trigger_time(X) ::= . {X = new SqliteCreateTrigger::Time(SqliteCreateTrigger::Time::null);}
%type trigger_event {SqliteCreateTrigger::Event*}
-%destructor trigger_event {delete $$;}
+%destructor trigger_event {parser_safe_delete($$);}
trigger_event(X) ::= DELETE. {
X = new SqliteCreateTrigger::Event(SqliteCreateTrigger::Event::DELETE);
objectForTokens = X;
@@ -2211,17 +2250,17 @@ trigger_event(X) ::= UPDATE OF
}
%type foreach_clause {SqliteCreateTrigger::Scope*}
-%destructor foreach_clause {delete $$;}
+%destructor foreach_clause {parser_safe_delete($$);}
foreach_clause(X) ::= . {X = new SqliteCreateTrigger::Scope(SqliteCreateTrigger::Scope::null);}
foreach_clause(X) ::= FOR EACH ROW. {X = new SqliteCreateTrigger::Scope(SqliteCreateTrigger::Scope::FOR_EACH_ROW);}
%type when_clause {SqliteExpr*}
-%destructor when_clause {if ($$) delete $$;}
+%destructor when_clause {parser_safe_delete($$);}
when_clause(X) ::= . {X = nullptr;}
when_clause(X) ::= WHEN expr(E). {X = E;}
%type trigger_cmd_list {ParserQueryList*}
-%destructor trigger_cmd_list {delete $$;}
+%destructor trigger_cmd_list {parser_safe_delete($$);}
trigger_cmd_list(X) ::= trigger_cmd_list(L)
trigger_cmd(C) SEMI. {
L->append(C);
@@ -2239,7 +2278,7 @@ trigger_cmd_list(X) ::= SEMI. {
}
%type trigger_cmd {SqliteQuery*}
-%destructor trigger_cmd {delete $$;}
+%destructor trigger_cmd {parser_safe_delete($$);}
trigger_cmd(X) ::= update_stmt(S). {X = S;}
trigger_cmd(X) ::= insert_stmt(S). {X = S;}
trigger_cmd(X) ::= delete_stmt(S). {X = S;}
@@ -2278,12 +2317,12 @@ cmd(X) ::= DETACH database_kw_opt(D)
}
%type key_opt {SqliteExpr*}
-%destructor key_opt {if ($$) delete $$;}
+%destructor key_opt {parser_safe_delete($$);}
key_opt(X) ::= . {X = nullptr;}
key_opt(X) ::= KEY expr(E). {X = E;}
%type database_kw_opt {bool*}
-%destructor database_kw_opt {delete $$;}
+%destructor database_kw_opt {parser_safe_delete($$);}
database_kw_opt(X) ::= DATABASE. {X = new bool(true);}
database_kw_opt(X) ::= . {X = new bool(false);}
@@ -2346,7 +2385,7 @@ cmd ::= ALTER TABLE nm DOT ID_TAB. {}
cmd ::= ALTER TABLE ID_DB|ID_TAB. {}
%type kwcolumn_opt {bool*}
-%destructor kwcolumn_opt {delete $$;}
+%destructor kwcolumn_opt {parser_safe_delete($$);}
kwcolumn_opt(X) ::= . {X = new bool(true);}
kwcolumn_opt(X) ::= COLUMNKW. {X = new bool(false);}
@@ -2354,7 +2393,7 @@ kwcolumn_opt(X) ::= COLUMNKW. {X = new bool(false);}
cmd(X) ::= create_vtab(C). {X = C;}
%type create_vtab {SqliteQuery*}
-%destructor create_vtab {delete $$;}
+%destructor create_vtab {parser_safe_delete($$);}
create_vtab(X) ::= CREATE VIRTUAL TABLE
ifnotexists(E) nm(N1)
dbnm(N2) USING nm(N3). {
@@ -2397,7 +2436,7 @@ create_vtab ::= CREATE VIRTUAL TABLE
ID_DB|ID_TAB_NEW. {}
%type vtabarglist {QStringList*}
-%destructor vtabarglist {delete $$;}
+%destructor vtabarglist {parser_safe_delete($$);}
vtabarglist(X) ::= vtabarg(A). {
X = new QStringList();
X->append((A)->mid(1)); // mid(1) to skip the first whitespace added in vtabarg
@@ -2412,7 +2451,7 @@ vtabarglist(X) ::= vtabarglist(L) COMMA
}
%type vtabarg {QString*}
-%destructor vtabarg {delete $$;}
+%destructor vtabarg {parser_safe_delete($$);}
vtabarg(X) ::= . {X = new QString();}
vtabarg(X) ::= vtabarg(A) vtabargtoken(T). {
A->append(" "+ *(T));
@@ -2421,7 +2460,7 @@ vtabarg(X) ::= vtabarg(A) vtabargtoken(T). {
}
%type vtabargtoken {QString*}
-%destructor vtabargtoken {delete $$;}
+%destructor vtabargtoken {parser_safe_delete($$);}
vtabargtoken(X) ::= ANY(A). {
X = new QString(A->value);
}
@@ -2433,7 +2472,7 @@ vtabargtoken(X) ::= LP anylist(L) RP. {
}
%type anylist {QString*}
-%destructor anylist {delete $$;}
+%destructor anylist {parser_safe_delete($$);}
anylist(X) ::= . {X = new QString();}
anylist(X) ::= anylist(L1) LP anylist(L2)
RP. {
@@ -2452,36 +2491,277 @@ anylist(X) ::= anylist(L) ANY(A). {
//////////////////////// COMMON TABLE EXPRESSIONS ////////////////////////////
%type with {SqliteWith*}
-%type wqlist {SqliteWith*}
-%destructor with {delete $$;}
-%destructor wqlist {delete $$;}
+%destructor with {parser_safe_delete($$);}
with(X) ::= . {X = nullptr;}
with(X) ::= WITH wqlist(W). {
- X = W;
+ X = new SqliteWith();
+ X->cteList = *(W);
+ delete W;
objectForTokens = X;
}
with(X) ::= WITH RECURSIVE wqlist(W). {
- X = W;
+ X = new SqliteWith();
+ X->cteList = *(W);
X->recursive = true;
+ delete W;
objectForTokens = X;
}
-wqlist(X) ::= nm(N) idxlist_opt(IL) AS
- LP select(S) RP. {
- X = SqliteWith::append(*(N), *(IL), S);
- delete N;
- delete IL;
+%type wqlist {ParserCteList*}
+%destructor wqlist {parser_safe_delete($$);}
+
+wqlist(X) ::= wqcte(C). {
+ X = new ParserCteList();
+ X->append(C);
}
-wqlist(X) ::= wqlist(WL) COMMA nm(N)
- idxlist_opt(IL) AS
- LP select(S) RP. {
- X = SqliteWith::append(WL, *(N), *(IL), S);
- delete N;
- delete IL;
+wqlist(X) ::= wqlist(W) COMMA wqcte(C). {
+ X = W;
+ X->append(C);
DONT_INHERIT_TOKENS("wqlist");
}
-wqlist(X) ::= ID_TAB_NEW. {
+wqlist ::= ID_TAB_NEW. {
parserContext->minorErrorBeforeNextToken("Syntax error");
- X = new SqliteWith();
}
+
+%type wqcte {SqliteWith::CommonTableExpression*}
+%destructor wqcte {parser_safe_delete($$);}
+
+wqcte(X) ::= nm(N) idxlist_opt(IL) AS
+ LP select(S) RP. {
+ X = new SqliteWith::CommonTableExpression(*(N), *(IL), S);
+ delete N;
+ delete IL;
+ objectForTokens = X;
+ }
+
+//////////////////////// WINDOW FUNCTION EXPRESSIONS /////////////////////////
+// These must be at the end of this file. Specifically, the rules that
+// introduce tokens WINDOW, OVER and FILTER must appear last. This causes
+// the integer values assigned to these tokens to be larger than all other
+// tokens that may be output by the tokenizer except TK_SPACE and TK_ILLEGAL.
+//
+%type windowdefn_list {ParserWindowDefList*}
+%destructor windowdefn_list {parser_safe_delete($$);}
+
+windowdefn_list(X) ::= windowdefn(W). {
+ X = new ParserWindowDefList();
+ X->append(W);
+ }
+windowdefn_list(X) ::= windowdefn_list(L)
+ COMMA windowdefn(W). {
+ L->append(W);
+ X = L;
+ DONT_INHERIT_TOKENS("windowdefn_list");
+ }
+
+%type windowdefn {SqliteWindowDefinition*}
+%destructor windowdefn {parser_safe_delete($$);}
+
+windowdefn(X) ::= nm(N) AS LP window(W) RP. {
+ X = new SqliteWindowDefinition(*(N), W);
+ delete N;
+ objectForTokens = X;
+ }
+
+%type window {SqliteWindowDefinition::Window*}
+%destructor window {parser_safe_delete($$);}
+
+window(X) ::= PARTITION BY nexprlist(L)
+ orderby_opt(O) frame_opt(F). {
+ X = new SqliteWindowDefinition::Window();
+ X->initPartitionBy(QString(), *(L), *(O), F);
+ delete L;
+ delete O;
+ objectForTokens = X;
+ }
+window(X) ::= nm(N) PARTITION BY
+ nexprlist(L) orderby_opt(O)
+ frame_opt(F). {
+ X = new SqliteWindowDefinition::Window();
+ X->initPartitionBy(*(N), *(L), *(O), F);
+ delete L;
+ delete N;
+ delete O;
+ objectForTokens = X;
+ }
+window(X) ::= ORDER BY sortlist(S)
+ frame_opt(F). {
+ X = new SqliteWindowDefinition::Window();
+ X->initOrderBy(QString(), *(S), F);
+ delete S;
+ objectForTokens = X;
+ }
+window(X) ::= nm(N) ORDER BY sortlist(S)
+ frame_opt(F). {
+ X = new SqliteWindowDefinition::Window();
+ X->initOrderBy(*(N), *(S), F);
+ delete S;
+ delete N;
+ objectForTokens = X;
+ }
+window(X) ::= frame_opt(F). {
+ X = new SqliteWindowDefinition::Window();
+ X->init(QString(), F);
+ objectForTokens = X;
+ }
+window(X) ::= nm(N) frame_opt(F). {
+ X = new SqliteWindowDefinition::Window();
+ X->init(QString(), F);
+ delete N;
+ objectForTokens = X;
+ }
+
+%type frame_opt {SqliteWindowDefinition::Window::Frame*}
+%destructor frame_opt {parser_safe_delete($$);}
+
+frame_opt(X) ::= . {X = nullptr;}
+frame_opt(X) ::= range_or_rows(R)
+ frame_bound_s(B)
+ frame_exclude_opt(E). {
+ X = new SqliteWindowDefinition::Window::Frame(*(R), B, nullptr, *(E));
+ delete R;
+ delete E;
+ objectForTokens = X;
+ }
+frame_opt(X) ::= range_or_rows(R) BETWEEN
+ frame_bound_s(BS) AND
+ frame_bound_e(BE)
+ frame_exclude_opt(E). {
+ X = new SqliteWindowDefinition::Window::Frame(*(R), BS, BE, *(E));
+ delete R;
+ delete E;
+ objectForTokens = X;
+ }
+
+%type range_or_rows {SqliteWindowDefinition::Window::Frame::RangeOrRows*}
+%destructor range_or_rows {parser_safe_delete($$);}
+
+range_or_rows(X) ::= RANGE|ROWS|GROUPS(R). {
+ X = new SqliteWindowDefinition::Window::Frame::RangeOrRows(
+ SqliteWindowDefinition::Window::Frame::toRangeOrRows(R->value)
+ );
+ }
+
+%type frame_bound_s {SqliteWindowDefinition::Window::Frame::Bound*}
+%destructor frame_bound_s {parser_safe_delete($$);}
+
+frame_bound_s(X) ::= frame_bound(F). {
+ X = F;
+ objectForTokens = X;
+ }
+frame_bound_s(X) ::= UNBOUNDED(U)
+ PRECEDING(P). {
+ X = new SqliteWindowDefinition::Window::Frame::Bound(nullptr, U->value + " " + P->value);
+ objectForTokens = X;
+ }
+
+%type frame_bound_e {SqliteWindowDefinition::Window::Frame::Bound*}
+%destructor frame_bound_e {parser_safe_delete($$);}
+
+frame_bound_e(X) ::= frame_bound(F). {
+ X = F;
+ objectForTokens = X;
+ }
+frame_bound_e(X) ::= UNBOUNDED(U)
+ FOLLOWING(F). {
+ X = new SqliteWindowDefinition::Window::Frame::Bound(nullptr, U->value + " " + F->value);
+ objectForTokens = X;
+ }
+
+%type frame_bound {SqliteWindowDefinition::Window::Frame::Bound*}
+%destructor frame_bound {parser_safe_delete($$);}
+
+frame_bound(X) ::= expr(E)
+ PRECEDING|FOLLOWING(P). {
+ X = new SqliteWindowDefinition::Window::Frame::Bound(E, P->value);
+ objectForTokens = X;
+ }
+frame_bound(X) ::= CURRENT(C) ROW(R). {
+ X = new SqliteWindowDefinition::Window::Frame::Bound(nullptr, C->value + " " + R->value);
+ objectForTokens = X;
+ }
+
+%type frame_exclude_opt {SqliteWindowDefinition::Window::Frame::Exclude*}
+%destructor frame_bound {parser_safe_delete($$);}
+
+frame_exclude_opt(X) ::= . {
+ X = new SqliteWindowDefinition::Window::Frame::Exclude(
+ SqliteWindowDefinition::Window::Frame::Exclude::null
+ );
+ }
+frame_exclude_opt(X) ::= EXCLUDE
+ frame_exclude(F). {
+ X = F;
+ }
+
+%type frame_exclude {SqliteWindowDefinition::Window::Frame::Exclude*}
+%destructor frame_bound {parser_safe_delete($$);}
+
+frame_exclude(X) ::= NO OTHERS. {
+ X = new SqliteWindowDefinition::Window::Frame::Exclude(
+ SqliteWindowDefinition::Window::Frame::Exclude::NO_OTHERS
+ );
+ }
+frame_exclude(X) ::= CURRENT ROW. {
+ X = new SqliteWindowDefinition::Window::Frame::Exclude(
+ SqliteWindowDefinition::Window::Frame::Exclude::CURRENT_ROW
+ );
+ }
+frame_exclude(X) ::= GROUP. {
+ X = new SqliteWindowDefinition::Window::Frame::Exclude(
+ SqliteWindowDefinition::Window::Frame::Exclude::GROUP
+ );
+ }
+frame_exclude(X) ::= TIES. {
+ X = new SqliteWindowDefinition::Window::Frame::Exclude(
+ SqliteWindowDefinition::Window::Frame::Exclude::TIES
+ );
+ }
+
+%type window_clause {ParserWindowDefList*}
+%destructor window_clause {parser_safe_delete($$);}
+
+window_clause(X) ::= WINDOW
+ windowdefn_list(L). {
+ X = L;
+ }
+
+%type filter_over {SqliteFilterOver*}
+%destructor filter_over {parser_safe_delete($$);}
+
+filter_over(X) ::= filter_clause(F)
+ over_clause(O). {
+ X = new SqliteFilterOver(F, O);
+ objectForTokens = X;
+ }
+filter_over(X) ::= over_clause(O). {
+ X = new SqliteFilterOver(nullptr, O);
+ objectForTokens = X;
+ }
+filter_over(X) ::= filter_clause(F). {
+ X = new SqliteFilterOver(F, nullptr);
+ objectForTokens = X;
+ }
+
+%type over_clause {SqliteFilterOver::Over*}
+%destructor over_clause {parser_safe_delete($$);}
+
+over_clause(X) ::= OVER LP window(W) RP. {
+ X = new SqliteFilterOver::Over(W);
+ objectForTokens = X;
+ }
+over_clause(X) ::= OVER nm(N). {
+ X = new SqliteFilterOver::Over(*(N));
+ delete N;
+ objectForTokens = X;
+ }
+
+%type filter_clause {SqliteFilterOver::Filter*}
+%destructor filter_clause {parser_safe_delete($$);}
+
+filter_clause(X) ::= FILTER LP WHERE
+ expr(E) RP. {
+ X = new SqliteFilterOver::Filter(E);
+ objectForTokens = X;
+ }
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/statementtokenbuilder.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/statementtokenbuilder.cpp
index 07d1976..faf8c8e 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/statementtokenbuilder.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/statementtokenbuilder.cpp
@@ -10,40 +10,22 @@ StatementTokenBuilder& StatementTokenBuilder::withKeyword(const QString& value)
StatementTokenBuilder& StatementTokenBuilder::withOther(const QString& value)
{
- return with(Token::OTHER, value);
+ return withOther(value, true);
}
-StatementTokenBuilder& StatementTokenBuilder::withOther(const QString& value, Dialect dialect)
+StatementTokenBuilder& StatementTokenBuilder::withOther(const QString& value, bool wrapIfNeeded)
{
- return withOther(wrapObjIfNeeded(value, dialect));
+ return with(Token::OTHER, wrapIfNeeded ? wrapObjIfNeeded(value) : value);
}
-StatementTokenBuilder&StatementTokenBuilder::withStringPossiblyOther(const QString& value, Dialect dialect)
+StatementTokenBuilder&StatementTokenBuilder::withStringPossiblyOther(const QString& value)
{
if (value.contains("\""))
- return withOther(wrapObjIfNeeded(value, dialect));
+ return withOther(wrapObjIfNeeded(value));
else
return withOther(wrapObjName(value, NameWrapper::DOUBLE_QUOTE));
}
-StatementTokenBuilder& StatementTokenBuilder::withOtherList(const QList<QString>& value, Dialect dialect, const QString& separator)
-{
- bool first = true;
- for (const QString& str : value)
- {
- if (!first)
- {
- if (!separator.isEmpty())
- withOperator(separator);
-
- withSpace();
- }
- withOther(str, dialect);
- first = false;
- }
- return *this;
-}
-
StatementTokenBuilder& StatementTokenBuilder::withOtherList(const QList<QString>& value, const QString& separator)
{
bool first = true;
@@ -157,6 +139,12 @@ StatementTokenBuilder& StatementTokenBuilder::withLiteralValue(const QVariant& v
if (value.isNull())
return *this;
+ if (value.userType() == QVariant::String)
+ {
+ withString(value.toString());
+ return *this;
+ }
+
bool ok;
if (value.userType() == QVariant::Double)
{
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/statementtokenbuilder.h b/SQLiteStudio3/coreSQLiteStudio/parser/statementtokenbuilder.h
index 9ccfaa3..c5ec197 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/statementtokenbuilder.h
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/statementtokenbuilder.h
@@ -4,7 +4,6 @@
#include "token.h"
#include "ast/sqliteconflictalgo.h"
#include "ast/sqlitesortorder.h"
-#include "dialect.h"
class SqliteStatement;
@@ -33,10 +32,10 @@ class SqliteStatement;
* if (ifNotExists)
* builder.withKeyword("IF").withSpace().withKeyword("NOT").withSpace().withKeyword("EXISTS").withSpace();
*
- * if (dialect == Dialect::Sqlite3 && !database.isNull())
- * builder.withOther(database, dialect).withOperator(".");
+ * if (!database.isNull())
+ * builder.withOther(database).withOperator(".");
*
- * builder.withOther(view, dialect).withSpace().withKeyword("AS").withStatement(select);
+ * builder.withOther(view).withSpace().withKeyword("AS").withStatement(select);
*
* return builder.build();
* }
@@ -66,31 +65,29 @@ class StatementTokenBuilder
/**
* @brief Adds "other" token (some object name, or other word).
* @param value Value for the token.
- * @param dialect Dialect used for wrapping the value.
+ * @param wrapIfNeeded Defined whether the value should be wrapped if identified to require wrapping (i.e. is a keyword, or multiword).
* @return Reference to the builder for the further building.
*
- * The \p value is wrapped with the proper wrapper using wrapObjIfNeeded().
- *
- * @overload
+ * This is used for table names, etc. The \p value is quoted just as passed.
+ * You may want to pass wrapIfNeeded=false if you know that this may be equal to keyword,
+ * that is allowed as ID too (Lemon's fallback to ID).
*/
- StatementTokenBuilder& withOther(const QString& value, Dialect dialect);
+ StatementTokenBuilder& withOther(const QString& value, bool wrapIfNeeded);
/**
* @brief Adds string using double-quote wrapping.
* @param value Value for the token.
- * @param dialect Dialect used for wrapping the value if double-quote could not be used.
* @return Reference to the builder for the further building.
*
* The \p value is wrapped with double quote, but if it's not possible then the proper wrapper is used by wrapObjIfNeeded().
*
* @overload
*/
- StatementTokenBuilder& withStringPossiblyOther(const QString& value, Dialect dialect);
+ StatementTokenBuilder& withStringPossiblyOther(const QString& value);
/**
* @brief Adds list of "other" tokens.
* @param value List of values for tokens.
- * @param dialect Dialect used for wrapping values.
* @param separator Optional value for separator tokens.
* @return Reference to the builder for the further building.
*
@@ -98,18 +95,6 @@ class StatementTokenBuilder
* token between all produced tokens using the \p separator value. To skip separator tokens pass
* an empty string as the separator value.
*/
- StatementTokenBuilder& withOtherList(const QList<QString>& value, Dialect dialect, const QString& separator = ",");
-
- /**
- * @brief Adds list of "other" tokens.
- * @param value List of values for tokens.
- * @param separator Optional value for separator tokens.
- * @return Reference to the builder for the further building.
- *
- * Works just like the other withOtherList() method, except it doesn't wrap values with wrapObjIfNeeded().
- *
- * @overload
- */
StatementTokenBuilder& withOtherList(const QList<QString>& value, const QString& separator = ",");
/**
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/token.cpp b/SQLiteStudio3/coreSQLiteStudio/parser/token.cpp
index cd7e4b0..41980b4 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/token.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/token.cpp
@@ -4,7 +4,7 @@
#include <QStringList>
Token::Token()
- : lemonType(0), type(INVALID), value(QString::null), start(-1), end(-1)
+ : lemonType(0), type(INVALID), value(QString()), start(-1), end(-1)
{
}
@@ -160,6 +160,28 @@ bool Token::isSeparating() const
return false;
}
+bool Token::isMeaningful() const
+{
+ switch (type)
+ {
+ case Token::BIND_PARAM:
+ case Token::PAR_LEFT:
+ case Token::PAR_RIGHT:
+ case Token::BLOB:
+ case Token::FLOAT:
+ case Token::INTEGER:
+ case Token::INVALID:
+ case Token::KEYWORD:
+ case Token::OTHER:
+ case Token::STRING:
+ case Token::OPERATOR:
+ return true;
+ default:
+ break;
+ }
+ return false;
+}
+
bool Token::isDbObjectType() const
{
return ((type & TOKEN_TYPE_MASK_DB_OBJECT) == TOKEN_TYPE_MASK_DB_OBJECT);
diff --git a/SQLiteStudio3/coreSQLiteStudio/parser/token.h b/SQLiteStudio3/coreSQLiteStudio/parser/token.h
index 85c46c1..1088d9e 100644
--- a/SQLiteStudio3/coreSQLiteStudio/parser/token.h
+++ b/SQLiteStudio3/coreSQLiteStudio/parser/token.h
@@ -113,7 +113,7 @@ struct API_EXPORT Token
/**
* @brief Creates fully defined token.
- * @param lemonType Lemon token ID to use (see sqlite2_parser.h and sqlite3_parser.h).
+ * @param lemonType Lemon token ID to use (see sqlite3_parser.h).
* @param type Token type.
* @param value Value of the token.
* @param start Start position of the token (index of the first character in the query).
@@ -199,6 +199,12 @@ struct API_EXPORT Token
bool isSeparating() const;
/**
+ * @brief Tests whether the token represents meaningful type.
+ * @return true if token is meaningful, like a word, object, string, number, etc. Not comment, not whitespace, not context marker.
+ */
+ bool isMeaningful() const;
+
+ /**
* @brief Tests whether this token is representing any kind of database object name.
* @return true if the token is the name an object, or false otherwise.
*
diff --git a/SQLiteStudio3/coreSQLiteStudio/plugins/dbplugin.h b/SQLiteStudio3/coreSQLiteStudio/plugins/dbplugin.h
index 2f2e62e..7eef517 100644
--- a/SQLiteStudio3/coreSQLiteStudio/plugins/dbplugin.h
+++ b/SQLiteStudio3/coreSQLiteStudio/plugins/dbplugin.h
@@ -30,7 +30,7 @@ class API_EXPORT DbPlugin : virtual public Plugin
* @return Type label.
*
* The label is used for presenting to the user what kind of database this is. It's used on GUI
- * to display database type in databases dialog. It's usually either "SQLite3" or "SQLite2",
+ * to display database type in databases dialog. It's usually "SQLite3",
* but it may be something else, like for example encrypted database might provide "Encrypted SQLite3",
* or something similar.
*/
diff --git a/SQLiteStudio3/coreSQLiteStudio/plugins/dbpluginsqlite3.cpp b/SQLiteStudio3/coreSQLiteStudio/plugins/dbpluginsqlite3.cpp
index 7228752..4a19489 100644
--- a/SQLiteStudio3/coreSQLiteStudio/plugins/dbpluginsqlite3.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/plugins/dbpluginsqlite3.cpp
@@ -45,3 +45,8 @@ bool DbPluginSqlite3::checkIfDbServedByPlugin(Db* db) const
{
return (db && dynamic_cast<DbSqlite3*>(db));
}
+
+bool DbPluginSqlite3::usesPath() const
+{
+ return true;
+}
diff --git a/SQLiteStudio3/coreSQLiteStudio/plugins/dbpluginsqlite3.h b/SQLiteStudio3/coreSQLiteStudio/plugins/dbpluginsqlite3.h
index ee522d7..79b762a 100644
--- a/SQLiteStudio3/coreSQLiteStudio/plugins/dbpluginsqlite3.h
+++ b/SQLiteStudio3/coreSQLiteStudio/plugins/dbpluginsqlite3.h
@@ -19,6 +19,7 @@ class DbPluginSqlite3 : public BuiltInPlugin, public DbPlugin
QList<DbPluginOption> getOptionsList() const;
QString generateDbName(const QVariant& baseValue);
bool checkIfDbServedByPlugin(Db* db) const;
+ bool usesPath() const;
};
#endif // DBPLUGINSQLITE3_H
diff --git a/SQLiteStudio3/coreSQLiteStudio/plugins/exportplugin.h b/SQLiteStudio3/coreSQLiteStudio/plugins/exportplugin.h
index 8c269e2..30cce28 100644
--- a/SQLiteStudio3/coreSQLiteStudio/plugins/exportplugin.h
+++ b/SQLiteStudio3/coreSQLiteStudio/plugins/exportplugin.h
@@ -87,7 +87,7 @@ class ExportPlugin : virtual public Plugin
*
* If exporting with this plugin is not configurable (i.e. getConfig() returns null),
* then this method is not even called, so it can return anything, just to satisfy method
- * return type. In that case good idea is to always return QString::null.
+ * return type. In that case good idea is to always return QString().
*
* @see FormManager
*/
@@ -137,7 +137,7 @@ class ExportPlugin : virtual public Plugin
*
* See details http://qt-project.org/doc/qt-5/qmimedata.html#setData
*
- * If the plugin exports just a string, then this method can return QString::null and SqliteStudio will assume
+ * If the plugin exports just a string, then this method can return QString() and SqliteStudio will assume
* that the data is of "text/plain" type.
*/
virtual QString getMimeType() const = 0;
diff --git a/SQLiteStudio3/coreSQLiteStudio/plugins/genericexportplugin.cpp b/SQLiteStudio3/coreSQLiteStudio/plugins/genericexportplugin.cpp
index d191ae4..163e0ae 100644
--- a/SQLiteStudio3/coreSQLiteStudio/plugins/genericexportplugin.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/plugins/genericexportplugin.cpp
@@ -47,12 +47,12 @@ CfgMain* GenericExportPlugin::getConfig()
QString GenericExportPlugin::getConfigFormName(ExportManager::ExportMode mode) const
{
UNUSED(mode);
- return QString::null;
+ return QString();
}
QString GenericExportPlugin::getMimeType() const
{
- return QString::null;
+ return QString();
}
QString GenericExportPlugin::getDefaultEncoding() const
diff --git a/SQLiteStudio3/coreSQLiteStudio/plugins/importplugin.h b/SQLiteStudio3/coreSQLiteStudio/plugins/importplugin.h
index ff520cd..3b7181e 100644
--- a/SQLiteStudio3/coreSQLiteStudio/plugins/importplugin.h
+++ b/SQLiteStudio3/coreSQLiteStudio/plugins/importplugin.h
@@ -37,7 +37,7 @@ class ImportPlugin : virtual public Plugin
* @brief Provides file name filter for file dialog.
* @return Filter compliant with QFileDialog documentation.
*
- * If your plugin does not return ImportManager::FILE_NAME, this method can simply return QString::null.
+ * If your plugin does not return ImportManager::FILE_NAME, this method can simply return QString().
* If your plugin does use input file name, then this method can (but don't have to) return file name filter
* to match expected files when user browses for the input file.
*
@@ -102,7 +102,7 @@ class ImportPlugin : virtual public Plugin
*
* If importing with this plugin is not configurable (i.e. getConfig() returns null),
* then this method is not even called, so it can return anything, just to satisfy method
- * return type. In that case good idea is to always return QString::null.
+ * return type. In that case good idea is to always return QString().
*
* @see FormManager
*/
diff --git a/SQLiteStudio3/coreSQLiteStudio/plugins/populatedictionary.cpp b/SQLiteStudio3/coreSQLiteStudio/plugins/populatedictionary.cpp
index fd654ad..aa1f9b1 100644
--- a/SQLiteStudio3/coreSQLiteStudio/plugins/populatedictionary.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/plugins/populatedictionary.cpp
@@ -5,6 +5,7 @@
#include <QFileInfo>
#include <QFile>
#include <QTextStream>
+#include <QRandomGenerator>
PopulateDictionary::PopulateDictionary()
{
@@ -45,7 +46,7 @@ bool PopulateDictionaryEngine::beforePopulating(Db* db, const QString& table)
dictionaryPos = 0;
dictionarySize = dictionary.size();
if (cfg.PopulateDictionary.Random.get())
- qsrand(QDateTime::currentDateTime().toTime_t());
+ QRandomGenerator::system()->seed(QDateTime::currentDateTime().toTime_t());
return true;
}
@@ -55,7 +56,7 @@ QVariant PopulateDictionaryEngine::nextValue(bool& nextValueError)
UNUSED(nextValueError);
if (cfg.PopulateDictionary.Random.get())
{
- int r = qrand() % dictionarySize;
+ int r = QRandomGenerator::system()->generate() % dictionarySize;
return dictionary[r];
}
else
diff --git a/SQLiteStudio3/coreSQLiteStudio/plugins/populateplugin.h b/SQLiteStudio3/coreSQLiteStudio/plugins/populateplugin.h
index 1a1db43..962f65a 100644
--- a/SQLiteStudio3/coreSQLiteStudio/plugins/populateplugin.h
+++ b/SQLiteStudio3/coreSQLiteStudio/plugins/populateplugin.h
@@ -35,7 +35,7 @@ class API_EXPORT PopulateEngine
*
* If populating with this plugin is not configurable (i.e. getConfig() returns null),
* then this method is not even called, so it can return anything, just to satisfy method
- * return type. In that case good idea is to always return QString::null.
+ * return type. In that case good idea is to always return QString().
*
* @see FormManager
*/
diff --git a/SQLiteStudio3/coreSQLiteStudio/plugins/populaterandom.cpp b/SQLiteStudio3/coreSQLiteStudio/plugins/populaterandom.cpp
index 3258bbc..149e92b 100644
--- a/SQLiteStudio3/coreSQLiteStudio/plugins/populaterandom.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/plugins/populaterandom.cpp
@@ -2,6 +2,7 @@
#include "services/populatemanager.h"
#include "common/unused.h"
#include <QDateTime>
+#include <QRandomGenerator>
PopulateRandom::PopulateRandom()
{
@@ -21,7 +22,7 @@ bool PopulateRandomEngine::beforePopulating(Db* db, const QString& table)
{
UNUSED(db);
UNUSED(table);
- qsrand(QDateTime::currentDateTime().toTime_t());
+ QRandomGenerator::system()->seed(QDateTime::currentDateTime().toTime_t());
range = cfg.PopulateRandom.MaxValue.get() - cfg.PopulateRandom.MinValue.get() + 1;
return (range > 0);
}
@@ -29,7 +30,7 @@ bool PopulateRandomEngine::beforePopulating(Db* db, const QString& table)
QVariant PopulateRandomEngine::nextValue(bool& nextValueError)
{
UNUSED(nextValueError);
- QString randValue = QString::number((qrand() % range) + cfg.PopulateRandom.MinValue.get());
+ QString randValue = QString::number((QRandomGenerator::system()->generate() % range) + cfg.PopulateRandom.MinValue.get());
return (cfg.PopulateRandom.Prefix.get() + randValue + cfg.PopulateRandom.Suffix.get());
}
diff --git a/SQLiteStudio3/coreSQLiteStudio/plugins/populaterandomtext.cpp b/SQLiteStudio3/coreSQLiteStudio/plugins/populaterandomtext.cpp
index d9f148a..e2f8733 100644
--- a/SQLiteStudio3/coreSQLiteStudio/plugins/populaterandomtext.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/plugins/populaterandomtext.cpp
@@ -3,6 +3,8 @@
#include "common/unused.h"
#include "services/populatemanager.h"
+#include <QRandomGenerator>
+
PopulateRandomText::PopulateRandomText()
{
}
@@ -21,7 +23,7 @@ bool PopulateRandomTextEngine::beforePopulating(Db* db, const QString& table)
{
UNUSED(db);
UNUSED(table);
- qsrand(QDateTime::currentDateTime().toTime_t());
+ QRandomGenerator::system()->seed(QDateTime::currentDateTime().toTime_t());
range = cfg.PopulateRandomText.MaxLength.get() - cfg.PopulateRandomText.MinLength.get() + 1;
chars = "";
@@ -53,7 +55,7 @@ bool PopulateRandomTextEngine::beforePopulating(Db* db, const QString& table)
QVariant PopulateRandomTextEngine::nextValue(bool& nextValueError)
{
UNUSED(nextValueError);
- int lgt = (qrand() % range) + cfg.PopulateRandomText.MinLength.get();
+ int lgt = (QRandomGenerator::system()->generate() % range) + cfg.PopulateRandomText.MinLength.get();
return randStr(lgt, chars);
}
diff --git a/SQLiteStudio3/coreSQLiteStudio/plugins/scriptingqt.cpp b/SQLiteStudio3/coreSQLiteStudio/plugins/scriptingqt.cpp
index 79824dc..f88fa85 100644
--- a/SQLiteStudio3/coreSQLiteStudio/plugins/scriptingqt.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/plugins/scriptingqt.cpp
@@ -202,7 +202,7 @@ QString ScriptingQt::getErrorMessage(ScriptingPlugin::Context* context) const
{
ContextQt* ctx = getContext(context);
if (!ctx)
- return QString::null;
+ return QString();
return ctx->error;
}
diff --git a/SQLiteStudio3/coreSQLiteStudio/plugins/sqlformatterplugin.cpp b/SQLiteStudio3/coreSQLiteStudio/plugins/sqlformatterplugin.cpp
index 350c024..3c560ed 100644
--- a/SQLiteStudio3/coreSQLiteStudio/plugins/sqlformatterplugin.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/plugins/sqlformatterplugin.cpp
@@ -1,15 +1,13 @@
#include "sqlformatterplugin.h"
#include "parser/parser.h"
#include "db/db.h"
+#include "common/unused.h"
#include <QDebug>
QString SqlFormatterPlugin::format(const QString& code, Db* contextDb)
{
- Dialect dialect = Dialect::Sqlite3;
- if (contextDb && contextDb->isValid())
- contextDb->getDialect();
-
- Parser parser(dialect);
+ UNUSED(contextDb);
+ Parser parser;
if (!parser.parse(code))
{
qWarning() << "Could not parse SQL in order to format it. The SQL was:" << code;
diff --git a/SQLiteStudio3/coreSQLiteStudio/populateworker.cpp b/SQLiteStudio3/coreSQLiteStudio/populateworker.cpp
index e1c207a..08acd19 100644
--- a/SQLiteStudio3/coreSQLiteStudio/populateworker.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/populateworker.cpp
@@ -25,14 +25,13 @@ void PopulateWorker::run()
return;
}
- Dialect dialect = db->getDialect();
- QString wrappedTable = wrapObjIfNeeded(table, dialect);
+ QString wrappedTable = wrapObjIfNeeded(table);
QStringList cols;
QStringList argList;
for (const QString& column : columns)
{
- cols << wrapObjIfNeeded(column, dialect);
+ cols << wrapObjIfNeeded(column);
argList << "?";
}
diff --git a/SQLiteStudio3/coreSQLiteStudio/querygenerator.cpp b/SQLiteStudio3/coreSQLiteStudio/querygenerator.cpp
index 75b0e89..3f01350 100644
--- a/SQLiteStudio3/coreSQLiteStudio/querygenerator.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/querygenerator.cpp
@@ -2,6 +2,7 @@
#include "common/global.h"
#include "common/utils_sql.h"
#include "db/db.h"
+#include "common/unused.h"
QueryGenerator::QueryGenerator()
{
@@ -30,8 +31,7 @@ QString QueryGenerator::generateInsertToTable(Db* db, const QString& database, c
static_qstring(tpl, "INSERT INTO %1 (%2) VALUES %3");
static_qstring(rowTpl, "(%1)");
- Dialect dialect = db->getDialect();
- QString target = toFullObjectName(database, table, dialect);
+ QString target = toFullObjectName(database, table);
// Get all table's columns
SchemaResolver resolver(db);
@@ -41,7 +41,7 @@ QString QueryGenerator::generateInsertToTable(Db* db, const QString& database, c
if (values.isEmpty())
{
QStringList valueList = wrapStrings(tableCols);
- QStringList wrappedCols = wrapObjNamesIfNeeded(tableCols, dialect);
+ QStringList wrappedCols = wrapObjNamesIfNeeded(tableCols);
return tpl.arg(target, wrappedCols.join(", "), rowTpl.arg(valueList.join(", ")));
}
@@ -50,11 +50,11 @@ QString QueryGenerator::generateInsertToTable(Db* db, const QString& database, c
sortWithReferenceList(valueCols, tableCols);
// Group values into rows
- QStringList valueSets = toValueSets(valueCols, values, dialect);
+ QStringList valueSets = toValueSets(valueCols, values);
QString valueStr = rowTpl.arg(valueSets.join("), ("));
// Wrap given column names
- QStringList wrappedCols = wrapObjNamesIfNeeded(valueCols, dialect);
+ QStringList wrappedCols = wrapObjNamesIfNeeded(valueCols);
return tpl.arg(target, wrappedCols.join(", "), valueStr);
}
@@ -70,8 +70,7 @@ QString QueryGenerator::generateUpdateOfTable(Db* db, const QString& database, c
static_qstring(tplWithWhere, "UPDATE %1 SET %2 WHERE %3");
static_qstring(updateColTpl, "%1 = %2");
- Dialect dialect = db->getDialect();
- QString target = toFullObjectName(database, table, dialect);
+ QString target = toFullObjectName(database, table);
// Get all columns of the table
SchemaResolver resolver(db);
@@ -80,7 +79,7 @@ QString QueryGenerator::generateUpdateOfTable(Db* db, const QString& database, c
// Create list of "column = 'column'"
QStringList commonUpdateCols;
for (const QString& col : tableCols)
- commonUpdateCols << updateColTpl.arg(wrapObjIfNeeded(col, dialect), wrapString(col));
+ commonUpdateCols << updateColTpl.arg(wrapObjIfNeeded(col), wrapString(col));
// Put it to comma spearated string
QString commonColumnStr = commonUpdateCols.join(", ");
@@ -97,7 +96,7 @@ QString QueryGenerator::generateUpdateOfTable(Db* db, const QString& database, c
sortWithReferenceList(valueCols, tableCols);
// Conditions for WHERE clause
- QString conditionStr = valuesToConditionStr(values, dialect);
+ QString conditionStr = valuesToConditionStr(values);
return tpl.arg(target, commonColumnStr, conditionStr);
}
@@ -113,8 +112,7 @@ QString QueryGenerator::generateDeleteFromTable(Db* db, const QString& database,
static_qstring(tplWithWhere, "DELETE FROM %1 WHERE %2");
static_qstring(conditionColTpl, "%1 = %2");
- Dialect dialect = db->getDialect();
- QString target = toFullObjectName(database, table, dialect);
+ QString target = toFullObjectName(database, table);
// Get all columns of the table
SchemaResolver resolver(db);
@@ -126,7 +124,7 @@ QString QueryGenerator::generateDeleteFromTable(Db* db, const QString& database,
// Create list of "column = 'column'"
QStringList conditionCols;
for (const QString& col : tableCols)
- conditionCols << conditionColTpl.arg(wrapObjIfNeeded(col, dialect), wrapString(col));
+ conditionCols << conditionColTpl.arg(wrapObjIfNeeded(col), wrapString(col));
// Put it to comma spearated string
QString conditionStr = conditionCols.join(" AND ");
@@ -139,7 +137,7 @@ QString QueryGenerator::generateDeleteFromTable(Db* db, const QString& database,
sortWithReferenceList(valueCols, tableCols);
// Conditions for WHERE clause
- QString conditionStr = valuesToConditionStr(values, dialect);
+ QString conditionStr = valuesToConditionStr(values);
return tpl.arg(target, conditionStr);
}
@@ -160,8 +158,6 @@ QString QueryGenerator::generateSelectFromSelect(Db* db, const QString& initialS
{
static_qstring(tpl, "SELECT %1 FROM (%2)%3");
- Dialect dialect = db->getDialect();
-
// Resolve all columns of the select
SelectResolver resolver(db, initialSelect, dbNameToAttach);
QList<SelectResolver::Column> columns = resolver.resolveColumnsFromFirstCore();
@@ -169,24 +165,24 @@ QString QueryGenerator::generateSelectFromSelect(Db* db, const QString& initialS
// Generate result columns
QStringList resCols;
for (const SelectResolver::Column& col : columns)
- resCols << toResultColumnString(col, dialect);
+ resCols << toResultColumnString(col);
// Generate conditions for WHERE clause
- QString conditionStr = valuesToConditionStr(values, dialect);
+ QString conditionStr = valuesToConditionStr(values);
return tpl.arg(resCols.join(", "), initialSelect, conditionStr);
}
QString QueryGenerator::generateSelectFromTableOrView(Db* db, const QString& database, const QString& tableOrView, const QStringList& columns, const StrHash<QVariantList> values)
{
+ UNUSED(db);
static_qstring(tpl, "SELECT %1 FROM %2%3");
- Dialect dialect = db->getDialect();
-
- QString target = toFullObjectName(database, tableOrView, dialect);
- QString conditionStr = valuesToConditionStr(values, dialect);
+ QStringList wrappedCols = wrapObjNamesIfNeeded(columns);
+ QString target = toFullObjectName(database, tableOrView);
+ QString conditionStr = valuesToConditionStr(values);
- return tpl.arg(columns.join(", "), target, conditionStr);
+ return tpl.arg(wrappedCols.join(", "), target, conditionStr);
}
QString QueryGenerator::getAlias(const QString& name, QSet<QString>& usedAliases)
@@ -208,8 +204,9 @@ QString QueryGenerator::getAlias(const QString& name, QSet<QString>& usedAliases
return alias;
}
-QStringList QueryGenerator::valuesToConditionList(const StrHash<QVariantList>& values, Dialect dialect)
+QStringList QueryGenerator::valuesToConditionList(const StrHash<QVariantList>& values)
{
+ static_qstring(conditionTpl0, "%1 IS NULL");
static_qstring(conditionTpl1, "%1 = %2");
static_qstring(conditionTpl2, "%1 IN (%2)");
@@ -217,21 +214,26 @@ QStringList QueryGenerator::valuesToConditionList(const StrHash<QVariantList>& v
QStringList conditionValues;
for (const QString& col : values.keys())
{
- conditionValues = valueListToSqlList(values[col], dialect);
+ conditionValues = valueListToSqlList(values[col]);
conditionValues.removeDuplicates();
if (conditionValues.size() == 1)
- conditions << conditionTpl1.arg(wrapObjIfNeeded(col, dialect), conditionValues.first());
+ {
+ if (conditionValues.first() == "NULL")
+ conditions << conditionTpl0.arg(wrapObjIfNeeded(col));
+ else
+ conditions << conditionTpl1.arg(wrapObjIfNeeded(col), conditionValues.first());
+ }
else
- conditions << conditionTpl2.arg(wrapObjIfNeeded(col, dialect), conditionValues.join(", "));
+ conditions << conditionTpl2.arg(wrapObjIfNeeded(col), conditionValues.join(", "));
}
return conditions;
}
-QString QueryGenerator::valuesToConditionStr(const StrHash<QVariantList>& values, Dialect dialect)
+QString QueryGenerator::valuesToConditionStr(const StrHash<QVariantList>& values)
{
static_qstring(condTpl, " WHERE %1");
- QStringList conditions = valuesToConditionList(values, dialect);
+ QStringList conditions = valuesToConditionList(values);
QString conditionStr = "";
if (conditions.size() > 0)
conditionStr = condTpl.arg(conditions.join(" AND "));
@@ -239,26 +241,26 @@ QString QueryGenerator::valuesToConditionStr(const StrHash<QVariantList>& values
return conditionStr;
}
-QString QueryGenerator::toResultColumnString(const SelectResolver::Column& column, Dialect dialect)
+QString QueryGenerator::toResultColumnString(const SelectResolver::Column& column)
{
- return wrapObjIfNeeded(column.displayName, dialect);
+ return wrapObjIfNeeded(column.displayName);
}
-QString QueryGenerator::toFullObjectName(const QString& database, const QString& object, Dialect dialect)
+QString QueryGenerator::toFullObjectName(const QString& database, const QString& object)
{
static_qstring(tpl, "%1%2");
QString dbName = "";
if (!database.isEmpty() && dbName.toLower() != "main")
- dbName = wrapObjIfNeeded(database, dialect);
+ dbName = wrapObjIfNeeded(database);
if (!dbName.isEmpty())
dbName.append(".");
- return tpl.arg(dbName, wrapObjIfNeeded(object, dialect));
+ return tpl.arg(dbName, wrapObjIfNeeded(object));
}
-QStringList QueryGenerator::toValueSets(const QStringList& columns, const StrHash<QVariantList> values, Dialect dialect)
+QStringList QueryGenerator::toValueSets(const QStringList& columns, const StrHash<QVariantList> values)
{
QStringList rows;
QVariantList rowValues;
@@ -270,7 +272,7 @@ QStringList QueryGenerator::toValueSets(const QStringList& columns, const StrHas
for (const QString& col : columns)
rowValues << values[col][i];
- valueList = valueListToSqlList(rowValues, dialect);
+ valueList = valueListToSqlList(rowValues);
rows << valueList.join(", ");
}
diff --git a/SQLiteStudio3/coreSQLiteStudio/querygenerator.h b/SQLiteStudio3/coreSQLiteStudio/querygenerator.h
index 3f7df9c..1de8440 100644
--- a/SQLiteStudio3/coreSQLiteStudio/querygenerator.h
+++ b/SQLiteStudio3/coreSQLiteStudio/querygenerator.h
@@ -2,7 +2,6 @@
#define QUERYGENERATOR_H
#include "common/column.h"
-#include "dialect.h"
#include "common/bistrhash.h"
#include "schemaresolver.h"
#include "common/strhash.h"
@@ -65,11 +64,11 @@ class API_EXPORT QueryGenerator
private:
QString generateSelectFromTableOrView(Db* db, const QString& database, const QString& tableOrView, const QStringList& columns, const StrHash<QVariantList> values = StrHash<QVariantList>());
QString getAlias(const QString& name, QSet<QString>& usedAliases);
- QStringList valuesToConditionList(const StrHash<QVariantList>& values, Dialect dialect);
- QString valuesToConditionStr(const StrHash<QVariantList>& values, Dialect dialect);
- QString toResultColumnString(const SelectResolver::Column& column, Dialect dialect);
- QString toFullObjectName(const QString& database, const QString& object, Dialect dialect);
- QStringList toValueSets(const QStringList& columns, const StrHash<QVariantList> values, Dialect dialect);
+ QStringList valuesToConditionList(const StrHash<QVariantList>& values);
+ QString valuesToConditionStr(const StrHash<QVariantList>& values);
+ QString toResultColumnString(const SelectResolver::Column& column);
+ QString toFullObjectName(const QString& database, const QString& object);
+ QStringList toValueSets(const QStringList& columns, const StrHash<QVariantList> values);
};
#endif // QUERYGENERATOR_H
diff --git a/SQLiteStudio3/coreSQLiteStudio/returncode.cpp b/SQLiteStudio3/coreSQLiteStudio/returncode.cpp
index 80edbe4..6cb1084 100644
--- a/SQLiteStudio3/coreSQLiteStudio/returncode.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/returncode.cpp
@@ -37,7 +37,7 @@ QString ReturnCode::message()
if (errorMessages.size() > 0)
return errorMessages.at(0);
else
- return QString::null;
+ return QString();
}
void ReturnCode::setCode(quint16 code)
diff --git a/SQLiteStudio3/coreSQLiteStudio/rsa/BigInt.cpp b/SQLiteStudio3/coreSQLiteStudio/rsa/BigInt.cpp
index 0579add..3fbe83c 100644
--- a/SQLiteStudio3/coreSQLiteStudio/rsa/BigInt.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/rsa/BigInt.cpp
@@ -568,17 +568,18 @@ digitCount(rightNumber.digitCount), positive(rightNumber.positive)
//make sure we have just enough space
if (length <= digitCount + 2 || length > (digitCount << 2))
length = (unsigned long int) (digitCount * BigInt::FACTOR + 1);
- try
- {
- digits = new unsigned char[length];
- }
- catch (...)
- {
- delete[] digits;
- throw "Error BIGINT08: BigInt creation error (out of memory?).";
- }
- std::copy(rightNumber.digits, rightNumber.digits + digitCount, digits);
+ try
+ {
+ digits = new unsigned char[length];
+ }
+ catch (...)
+ {
+ delete[] digits;
+ throw "Error BIGINT08: BigInt creation error (out of memory?).";
+ }
+
+ std::copy(rightNumber.digits, rightNumber.digits + digitCount, digits);
}
BigInt::operator std::string() const
@@ -627,12 +628,13 @@ BigInt &BigInt::operator =(const BigInt &rightNumber)
std::ostream &operator <<(std::ostream &cout, const BigInt &number)
{
- if (!number.positive)
- cout << '-';
+ if (!number.positive)
+ cout << '-';
+
for (int i = number.digitCount - 1; i >= 0; i--)
cout << (int(number.digits[i]));
- return cout;
+ return cout;
}
std::istream &operator >>(std::istream &cin, BigInt &number)
diff --git a/SQLiteStudio3/coreSQLiteStudio/schemaresolver.cpp b/SQLiteStudio3/coreSQLiteStudio/schemaresolver.cpp
index 62a685c..4d65461 100644
--- a/SQLiteStudio3/coreSQLiteStudio/schemaresolver.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/schemaresolver.cpp
@@ -16,11 +16,12 @@ const char* sqliteTempMasterDdl =
"CREATE TABLE sqlite_temp_master (type text, name text, tbl_name text, rootpage integer, sql text)";
ExpiringCache<SchemaResolver::ObjectCacheKey,QVariant> SchemaResolver::cache;
+ExpiringCache<QString, QString> SchemaResolver::autoIndexDdlCache;
SchemaResolver::SchemaResolver(Db *db)
: db(db)
{
- parser = new Parser(db->getDialect());
+ parser = new Parser();
}
SchemaResolver::~SchemaResolver()
@@ -39,9 +40,26 @@ QStringList SchemaResolver::getTables(const QString &database)
QStringList SchemaResolver::getIndexes(const QString &database)
{
- QStringList indexes = getObjects(database, "index");
- if (ignoreSystemObjects)
- filterSystemIndexes(indexes);
+ static_qstring(idxForTableTpl, "SELECT name FROM %1.pragma_index_list(%2)");
+
+ QStringList tables = getTables(database);
+ QStringList queryParts;
+ for (const QString& table : tables)
+ queryParts << idxForTableTpl.arg(wrapObjName(database), wrapString(table));
+
+ QString query = queryParts.join(" UNION ");
+ SqlQueryPtr results = db->exec(query, dbFlags);
+
+ QStringList indexes;
+ QString value;
+ for (SqlResultsRowPtr row : results->getAll())
+ {
+ value = row->value(0).toString();
+ if (isFilteredOut(value, "index"))
+ continue;
+
+ indexes << value;
+ }
return indexes;
}
@@ -58,8 +76,17 @@ QStringList SchemaResolver::getViews(const QString &database)
StrHash<QStringList> SchemaResolver::getGroupedIndexes(const QString &database)
{
- QStringList allIndexes = getIndexes(database);
- return getGroupedObjects(database, allIndexes, SqliteQueryType::CreateIndex);
+ StrHash<QString> indexesWithTables = getIndexesWithTables(database);
+
+ StrHash<QStringList> groupedIndexes;
+ auto it = indexesWithTables.iterator();
+ while (it.hasNext())
+ {
+ auto entry = it.next();
+ groupedIndexes[entry.value()] << entry.key();
+ }
+
+ return groupedIndexes;
}
StrHash<QStringList> SchemaResolver::getGroupedTriggers(const QString &database)
@@ -68,10 +95,10 @@ StrHash<QStringList> SchemaResolver::getGroupedTriggers(const QString &database)
return getGroupedObjects(database, allTriggers, SqliteQueryType::CreateTrigger);
}
-StrHash< QStringList> SchemaResolver::getGroupedObjects(const QString &database, const QStringList &inputList, SqliteQueryType type)
+StrHash<QStringList> SchemaResolver::getGroupedObjects(const QString &database, const QStringList &inputList, SqliteQueryType type)
{
QString strType = sqliteQueryTypeToString(type);
- StrHash< QStringList> groupedTriggers;
+ StrHash<QStringList> groupedObjects;
SqliteQueryPtr parsedQuery;
SqliteTableRelatedDdlPtr tableRelatedDdl;
@@ -93,10 +120,10 @@ StrHash< QStringList> SchemaResolver::getGroupedObjects(const QString &database,
continue;
}
- groupedTriggers[tableRelatedDdl->getTargetTable()] << object;
+ groupedObjects[tableRelatedDdl->getTargetTable()] << object;
}
- return groupedTriggers;
+ return groupedObjects;
}
bool SchemaResolver::isFilteredOut(const QString& value, const QString& type)
@@ -106,7 +133,7 @@ bool SchemaResolver::isFilteredOut(const QString& value, const QString& type)
if (type == "table" && isSystemTable(value))
return true;
- if (type == "index" && isSystemIndex(value, db->getDialect()))
+ if (type == "index" && isSystemIndex(value))
return true;
}
@@ -245,13 +272,12 @@ QList<SelectResolver::Column> SchemaResolver::getViewColumnObjects(const QString
SqliteCreateTablePtr SchemaResolver::virtualTableAsRegularTable(const QString &database, const QString &table)
{
- Dialect dialect = db->getDialect();
- QString strippedName = stripObjName(table, dialect);
- QString dbName = getPrefixDb(database, dialect);
+ QString strippedName = stripObjName(table);
+ QString dbName = getPrefixDb(database);
// Create temp table to see columns.
QString newTable = db->getUniqueNewObjectName(strippedName);
- QString origTable = wrapObjIfNeeded(strippedName, dialect);
+ QString origTable = wrapObjIfNeeded(strippedName);
SqlQueryPtr tempTableRes = db->exec(QString("CREATE TEMP TABLE %1 AS SELECT * FROM %2.%3 LIMIT 0;").arg(newTable, dbName, origTable), dbFlags);
if (tempTableRes->isError())
qWarning() << "Could not create temp table to identify virtual table columns of virtual table " << origTable << ". Error details:" << tempTableRes->getErrorText();
@@ -278,18 +304,19 @@ QString SchemaResolver::getObjectDdl(const QString& name, ObjectType type)
QString SchemaResolver::getObjectDdl(const QString &database, const QString &name, ObjectType type)
{
if (name.isNull())
- return QString::null;
+ return QString();
+
+ // Prepare db prefix.
+ QString dbName = getPrefixDb(database);
- Dialect dialect = db->getDialect();
// In case of sqlite_master or sqlite_temp_master we have static definitions
- QString lowerName = stripObjName(name, dialect).toLower();
+ QString lowerName = stripObjName(name).toLower();
if (lowerName == "sqlite_master")
return getSqliteMasterDdl(false);
else if (lowerName == "sqlite_temp_master")
return getSqliteMasterDdl(true);
-
- // Prepare db prefix.
- QString dbName = getPrefixDb(database, dialect);
+ else if (lowerName.startsWith("sqlite_autoindex_"))
+ return getSqliteAutoIndexDdl(dbName, stripObjName(name));
// Standalone or temp table?
QString targetTable = "sqlite_master";
@@ -346,7 +373,7 @@ QString SchemaResolver::getObjectDdlWithDifficultName(const QString &dbName, con
if (queryResults->isError())
{
qDebug() << "Could not get object's DDL:" << dbName << "." << lowerName << ", details:" << queryResults->getErrorText();
- return QString::null;
+ return QString();
}
// The DDL string
@@ -387,7 +414,7 @@ QString SchemaResolver::getObjectDdlWithSimpleName(const QString &dbName, const
if (queryResults->isError())
{
qDebug() << "Could not get object's DDL:" << dbName << "." << lowerName << ", details:" << queryResults->getErrorText();
- return QString::null;
+ return QString();
}
// The DDL string
@@ -395,9 +422,38 @@ QString SchemaResolver::getObjectDdlWithSimpleName(const QString &dbName, const
return results.toString();
}
+StrHash<QString> SchemaResolver::getIndexesWithTables(const QString& database)
+{
+ static_qstring(idxForTableTpl, "SELECT %2 as tbl_name, name FROM %1.pragma_index_list(%2)");
+
+ QStringList tables = getTables(database);
+ QString dbName = getPrefixDb(database);
+ QStringList queryParts;
+ for (const QString& table : tables)
+ queryParts << idxForTableTpl.arg(wrapObjName(dbName), wrapString(table));
+
+ QString query = queryParts.join(" UNION ");
+ SqlQueryPtr results = db->exec(query, dbFlags);
+
+ StrHash<QString> indexes;
+ QString tabName;
+ QString idxName;
+ for (SqlResultsRowPtr row : results->getAll())
+ {
+ tabName = row->value("tbl_name").toString();
+ idxName = row->value("name").toString();
+ if (isFilteredOut(idxName, "index"))
+ continue;
+
+ indexes[idxName] = tabName;
+ }
+
+ return indexes;
+}
+
QStringList SchemaResolver::getColumnsFromDdlUsingPragma(const QString& ddl)
{
- Parser parser(db->getDialect());
+ Parser parser;
if (!parser.parse(ddl) || parser.getQueries().isEmpty())
{
qWarning() << "Could not parse DDL for determinating columns using PRAGMA. The DDL was:\n" << ddl;
@@ -418,7 +474,7 @@ QStringList SchemaResolver::getColumnsFromDdlUsingPragma(const QString& ddl)
QStringList SchemaResolver::getColumnsUsingPragma(const QString& tableOrView)
{
static_qstring(query, "PRAGMA table_info(%1)");
- SqlQueryPtr results = db->exec(query.arg(wrapObjIfNeeded(tableOrView, db->getDialect())));
+ SqlQueryPtr results = db->exec(query.arg(wrapObjIfNeeded(tableOrView)));
if (results->isError())
{
qWarning() << "Could not get column list using PRAGMA for table or view:" << tableOrView << ", error was:" << results->getErrorText();
@@ -453,7 +509,7 @@ QStringList SchemaResolver::getColumnsUsingPragma(SqliteCreateTable* createTable
QStringList columns = getColumnsUsingPragma(name);
static_qstring(dropSql, "DROP TABLE %1");
- db->exec(dropSql.arg(wrapObjIfNeeded(name, db->getDialect())));
+ db->exec(dropSql.arg(wrapObjIfNeeded(name)));
return columns;
}
@@ -479,7 +535,7 @@ QStringList SchemaResolver::getColumnsUsingPragma(SqliteCreateView* createView)
QStringList columns = getColumnsUsingPragma(name);
static_qstring(dropSql, "DROP VIEW %1");
- db->exec(dropSql.arg(wrapObjIfNeeded(name, db->getDialect())));
+ db->exec(dropSql.arg(wrapObjIfNeeded(name)));
return columns;
}
@@ -507,7 +563,7 @@ StrHash< SqliteQueryPtr> SchemaResolver::getAllParsedObjects()
StrHash< SqliteQueryPtr> SchemaResolver::getAllParsedObjects(const QString& database)
{
- return getAllParsedObjectsForType<SqliteQuery>(database, QString::null);
+ return getAllParsedObjectsForType<SqliteQuery>(database, QString());
}
StrHash< SqliteCreateTablePtr> SchemaResolver::getAllParsedTables()
@@ -550,6 +606,81 @@ StrHash< SqliteCreateViewPtr> SchemaResolver::getAllParsedViews(const QString& d
return getAllParsedObjectsForType<SqliteCreateView>(database, "view");
}
+QString SchemaResolver::getSqliteAutoIndexDdl(const QString& database, const QString& index)
+{
+ // First, let's try to use cached value
+ static_qstring(cacheKeyTpl, "%1.%2");
+ QString cacheKey = cacheKeyTpl.arg(database, index).toLower();
+ QString* cachedDdlPtr = autoIndexDdlCache[cacheKey];
+ if (cachedDdlPtr)
+ return *(cachedDdlPtr);
+
+ // Not in cache. We need to find out indexed table.
+ // Let's try to find it in sqlite_master.
+ // If it's there, we will at least know it's referenced table.
+ static_qstring(masterQuery, "SELECT tbl_name FROM %1.sqlite_master WHERE type = 'index' AND name = ?");
+
+ QString table;
+ QString dbName = getPrefixDb(database);
+ QVariant masterRes = db->exec(masterQuery.arg(dbName), {index}, dbFlags)->getSingleCell();
+ if (masterRes.isNull())
+ {
+ // Not lucky. We need to find out the table.
+ StrHash<QString> indexesWithTables = getIndexesWithTables(database);
+ auto it = indexesWithTables.iterator();
+ while (it.hasNext())
+ {
+ auto entry = it.next();
+ if (entry.key().toLower() == index.toLower())
+ {
+ table = entry.value();
+ break;
+ }
+ }
+ }
+ else
+ table = masterRes.toString();
+
+ if (table.isNull())
+ {
+ qCritical() << "Could not determin table associated with index" << database << "." << index;
+ return QString();
+ }
+
+ // Check the unique flag of the index
+ static_qstring(idxUniqueQueryTpl, "SELECT unique FROM %1.pragma_index_list(%2) WHERE name = ?");
+ SqlQueryPtr uniqRes = db->exec(idxUniqueQueryTpl.arg(dbName, wrapString(table)), {index}, dbFlags);
+ bool unique = uniqRes->getSingleCell().toInt() > 0;
+
+ // Now let's find out columns
+ static_qstring(idxColQueryTpl, "SELECT name, coll, desc FROM %1.pragma_index_xinfo(%2) WHERE key = 1");
+ static_qstring(idxColTpl, "%1 COLLATE %2");
+
+ QStringList columns;
+ SqlQueryPtr colRes = db->exec(idxColQueryTpl.arg(dbName, wrapString(index)), dbFlags);
+ while (colRes->hasNext())
+ {
+ SqlResultsRowPtr row = colRes->next();
+ QString column = idxColTpl.arg(wrapObjIfNeeded(row->value("name").toString()), row->value("coll").toString());
+ if (row->value("desc").toInt() > 0)
+ column += " DESC";
+
+ columns << column;
+ }
+
+ // Finally, let's build it up & cache
+ static_qstring(ddlTpl, "CREATE %1INDEX %2 ON %3 (%4)");
+ QString ddl = ddlTpl.arg(
+ unique ? "UNIQUE " : "",
+ wrapObjIfNeeded(index),
+ wrapObjIfNeeded(table),
+ columns.join(", ")
+ );
+
+ autoIndexDdlCache.insert(cacheKey, new QString(ddl));
+ return ddl;
+}
+
SqliteQueryPtr SchemaResolver::getParsedDdl(const QString& ddl)
{
if (!parser->parse(ddl))
@@ -558,6 +689,8 @@ SqliteQueryPtr SchemaResolver::getParsedDdl(const QString& ddl)
for (ParserError* err : parser->getErrors())
qDebug() << err->getMessage();
+ qDebug() << "The DDL is:" << ddl;
+
return SqliteQueryPtr();
}
@@ -575,7 +708,7 @@ SqliteQueryPtr SchemaResolver::getParsedDdl(const QString& ddl)
QStringList SchemaResolver::getObjects(const QString &type)
{
- return getObjects(QString::null, type);
+ return getObjects(QString(), type);
}
QStringList SchemaResolver::getObjects(const QString &database, const QString &type)
@@ -586,7 +719,7 @@ QStringList SchemaResolver::getObjects(const QString &database, const QString &t
return cache.object(key, true)->toStringList();
QStringList resList;
- QString dbName = getPrefixDb(database, db->getDialect());
+ QString dbName = getPrefixDb(database);
SqlQueryPtr results = db->exec(QString("SELECT name FROM %1.sqlite_master WHERE type = ?;").arg(dbName), {type}, dbFlags);
@@ -606,7 +739,7 @@ QStringList SchemaResolver::getObjects(const QString &database, const QString &t
QStringList SchemaResolver::getAllObjects()
{
- return getAllObjects(QString::null);
+ return getAllObjects(QString());
}
QStringList SchemaResolver::getAllObjects(const QString& database)
@@ -617,7 +750,7 @@ QStringList SchemaResolver::getAllObjects(const QString& database)
return cache.object(key, true)->toStringList();
QStringList resList;
- QString dbName = getPrefixDb(database, db->getDialect());
+ QString dbName = getPrefixDb(database);
SqlQueryPtr results = db->exec(QString("SELECT name, type FROM %1.sqlite_master;").arg(dbName), dbFlags);
@@ -661,10 +794,6 @@ QStringList SchemaResolver::getFkReferencingTables(const QString& table)
QStringList SchemaResolver::getFkReferencingTables(const QString& database, const QString& table)
{
- Dialect dialect = db->getDialect();
- if (dialect == Dialect::Sqlite2)
- return QStringList();
-
// Get all tables
StrHash<SqliteCreateTablePtr> parsedTables = getAllParsedTables(database);
@@ -719,11 +848,23 @@ QStringList SchemaResolver::getFkReferencingTables(const QString& table, const Q
QStringList SchemaResolver::getIndexesForTable(const QString& database, const QString& table)
{
- QStringList names;
- for (SqliteCreateIndexPtr idx : getParsedIndexesForTable(database, table))
- names << idx->index;
+ static_qstring(idxForTableTpl, "SELECT name FROM %1.pragma_index_list(%2)");
- return names;
+ QString query = idxForTableTpl.arg(wrapObjName(database), wrapString(table));
+ SqlQueryPtr results = db->exec(query, dbFlags);
+
+ QStringList indexes;
+ QString value;
+ for (SqlResultsRowPtr row : results->getAll())
+ {
+ value = row->value(0).toString();
+ if (isFilteredOut(value, "index"))
+ continue;
+
+ indexes << value;
+ }
+
+ return indexes;
}
QStringList SchemaResolver::getIndexesForTable(const QString& table)
@@ -793,7 +934,7 @@ StrHash<SchemaResolver::ObjectDetails> SchemaResolver::getAllObjectDetails(const
}
else
{
- SqlQueryPtr results = db->exec(QString("SELECT name, type, sql FROM %1.sqlite_master").arg(getPrefixDb(database, db->getDialect())), dbFlags);
+ SqlQueryPtr results = db->exec(QString("SELECT name, type, sql FROM %1.sqlite_master").arg(getPrefixDb(database)), dbFlags);
if (results->isError())
{
qCritical() << "Error while getting all object details in SchemaResolver:" << results->getErrorCode();
@@ -832,9 +973,6 @@ QList<SqliteCreateIndexPtr> SchemaResolver::getParsedIndexesForTable(const QStri
SqliteCreateIndexPtr createIndex;
for (const QString& index : indexes)
{
- if (index.startsWith("sqlite_", Qt::CaseInsensitive))
- continue;
-
query = getParsedObject(database, index, INDEX);
if (!query)
continue;
@@ -989,11 +1127,10 @@ QList<SqliteCreateViewPtr> SchemaResolver::getParsedViewsForTable(const QString&
void SchemaResolver::filterSystemIndexes(QStringList& indexes)
{
- Dialect dialect = db->getDialect();
QMutableListIterator<QString> it(indexes);
while (it.hasNext())
{
- if (isSystemIndex(it.next(), dialect))
+ if (isSystemIndex(it.next()))
it.remove();
}
}
@@ -1075,9 +1212,6 @@ QString SchemaResolver::getSqliteMasterDdl(bool temp)
QStringList SchemaResolver::getCollations()
{
QStringList list;
- if (db->getDialect() != Dialect::Sqlite3)
- return list;
-
SqlQueryPtr results = db->exec("PRAGMA collation_list", dbFlags);
if (results->isError())
{
diff --git a/SQLiteStudio3/coreSQLiteStudio/schemaresolver.h b/SQLiteStudio3/coreSQLiteStudio/schemaresolver.h
index fb19cee..e7bf2c8 100644
--- a/SQLiteStudio3/coreSQLiteStudio/schemaresolver.h
+++ b/SQLiteStudio3/coreSQLiteStudio/schemaresolver.h
@@ -60,19 +60,19 @@ class API_EXPORT SchemaResolver
explicit SchemaResolver(Db* db);
virtual ~SchemaResolver();
- QStringList getTables(const QString& database = QString::null);
- QStringList getIndexes(const QString& database = QString::null);
- QStringList getTriggers(const QString& database = QString::null);
- QStringList getViews(const QString& database = QString::null);
- StrHash<QStringList> getGroupedIndexes(const QString& database = QString::null);
- StrHash<QStringList> getGroupedTriggers(const QString& database = QString::null);
+ QStringList getTables(const QString& database = QString());
+ QStringList getIndexes(const QString& database = QString());
+ QStringList getTriggers(const QString& database = QString());
+ QStringList getViews(const QString& database = QString());
+ StrHash<QStringList> getGroupedIndexes(const QString& database = QString());
+ StrHash<QStringList> getGroupedTriggers(const QString& database = QString());
QSet<QString> getDatabases();
QStringList getObjects(const QString& type);
QStringList getObjects(const QString& database, const QString& type);
QStringList getAllObjects();
QStringList getAllObjects(const QString& database);
QString getUniqueName(const QString& database, const QString& namePrefix, const QStringList& forbiddenNames = QStringList());
- QString getUniqueName(const QString& namePrefix = QString::null, const QStringList& forbiddenNames = QStringList());
+ QString getUniqueName(const QString& namePrefix = QString(), const QStringList& forbiddenNames = QStringList());
QStringList getFkReferencingTables(const QString& table);
QStringList getFkReferencingTables(const QString& database, const QString& table);
@@ -131,7 +131,7 @@ class API_EXPORT SchemaResolver
QList<DataType> getTableColumnDataTypes(const QString& table, int expectedNumberOfTypes = -1);
QList<DataType> getTableColumnDataTypes(const QString& database, const QString& table, int expectedNumberOfTypes = -1);
- StrHash<QStringList> getAllTableColumns(const QString& database = QString::null);
+ StrHash<QStringList> getAllTableColumns(const QString& database = QString());
QStringList getViewColumns(const QString& view);
QStringList getViewColumns(const QString& database, const QString& view);
@@ -175,6 +175,7 @@ class API_EXPORT SchemaResolver
StrHash<SqliteCreateViewPtr> getAllParsedViews();
StrHash<SqliteCreateViewPtr> getAllParsedViews(const QString& database);
+ QString getSqliteAutoIndexDdl(const QString& database, const QString& index);
static QString getSqliteMasterDdl(bool temp = false);
static QStringList getFkReferencingTables(const QString& table, const QList<SqliteCreateTablePtr>& allParsedTables);
@@ -202,6 +203,7 @@ class API_EXPORT SchemaResolver
QList<SqliteCreateTriggerPtr> getParsedTriggersForTableOrView(const QString& database, const QString& tableOrView, bool includeContentReferences, bool table);
QString getObjectDdlWithDifficultName(const QString& dbName, const QString& lowerName, QString targetTable, ObjectType type);
QString getObjectDdlWithSimpleName(const QString& dbName, const QString& lowerName, QString targetTable, ObjectType type);
+ StrHash<QString> getIndexesWithTables(const QString& database = QString());
template <class T>
StrHash<QSharedPointer<T>> getAllParsedObjectsForType(const QString& database, const QString& type);
@@ -212,6 +214,7 @@ class API_EXPORT SchemaResolver
Db::Flags dbFlags;
static ExpiringCache<ObjectCacheKey,QVariant> cache;
+ static ExpiringCache<QString, QString> autoIndexDdlCache;
};
int qHash(const SchemaResolver::ObjectCacheKey& key);
@@ -222,7 +225,7 @@ StrHash<QSharedPointer<T>> SchemaResolver::getAllParsedObjectsForType(const QStr
{
StrHash< QSharedPointer<T>> parsedObjects;
- QString dbName = getPrefixDb(database, db->getDialect());
+ QString dbName = getPrefixDb(database);
SqlQueryPtr results;
diff --git a/SQLiteStudio3/coreSQLiteStudio/selectresolver.cpp b/SQLiteStudio3/coreSQLiteStudio/selectresolver.cpp
index 64da5b2..3db029d 100644
--- a/SQLiteStudio3/coreSQLiteStudio/selectresolver.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/selectresolver.cpp
@@ -168,9 +168,6 @@ QList<SelectResolver::Column> SelectResolver::resolveCore(SqliteSelect::Core* se
if (select && select->coreSelects.size() > 1)
markCompoundColumns();
- if (select && select->with)
- markCteColumns();
-
return currentCoreResults;
}
@@ -180,10 +177,6 @@ QList<SelectResolver::Column> SelectResolver::resolveAvailableCoreColumns(Sqlite
if (selectCore->from)
columns = resolveJoinSource(selectCore->from);
- SqliteSelect* select = dynamic_cast<SqliteSelect*>(selectCore->parentStatement());
- if (select && select->with)
- markCteColumns(&columns);
-
return columns;
}
@@ -244,11 +237,6 @@ void SelectResolver::markCompoundColumns()
markCurrentColumnsWithFlag(FROM_COMPOUND_SELECT);
}
-void SelectResolver::markCteColumns(QList<Column>* columnList)
-{
- markCurrentColumnsWithFlag(FROM_CTE_SELECT, columnList);
-}
-
void SelectResolver::markGroupedColumns()
{
markCurrentColumnsWithFlag(FROM_GROUPED_SELECT);
@@ -361,16 +349,16 @@ void SelectResolver::resolveStar(SqliteSelect::Core::ResultColumn *resCol)
void SelectResolver::resolveExpr(SqliteSelect::Core::ResultColumn *resCol)
{
- SelectResolver::Column column;
- column.alias = resCol->alias;
- column.originalColumn = resCol;
- column.column = getResColTokensWithoutAlias(resCol).detokenize().trimmed();
- column.displayName = !resCol->alias.isNull() ? column.alias : column.column;
-
SqliteExpr* expr = resCol->expr;
if (expr->mode != SqliteExpr::Mode::ID)
{
// Not a simple column, but some expression
+ SelectResolver::Column column;
+ column.alias = resCol->alias;
+ column.originalColumn = resCol;
+ column.column = getResColTokensWithoutAlias(resCol).detokenize().trimmed();
+ column.displayName = !resCol->alias.isNull() ? column.alias : column.column;
+
column.type = Column::OTHER;
currentCoreResults << column;
@@ -580,6 +568,9 @@ QList<SelectResolver::Column> SelectResolver::resolveSingleSource(SqliteSelect::
if (isView(joinSrc->database, joinSrc->table))
return resolveView(joinSrc->database, joinSrc->table, joinSrc->alias);
+ if (joinSrc->database.isNull() && cteList.contains(joinSrc->table))
+ return resolveCteColumns(joinSrc);
+
QList<Column> columnSources;
QStringList columns = getTableColumns(joinSrc->database, joinSrc->table, joinSrc->alias);
Column column;
@@ -599,6 +590,47 @@ QList<SelectResolver::Column> SelectResolver::resolveSingleSource(SqliteSelect::
return columnSources;
}
+QList<SelectResolver::Column> SelectResolver::resolveCteColumns(SqliteSelect::Core::SingleSource* joinSrc)
+{
+ SqliteWith::CommonTableExpression* cte = cteList[joinSrc->table];
+
+ Column column;
+ column.type = Column::COLUMN;
+ column.flags |= FROM_CTE_SELECT;
+ column.tableAlias = cte->table;
+
+ QList<Column> columnSources;
+
+ static_qstring(cteSelectTpl, "WITH %1 SELECT * FROM %2");
+ QString selectQuery = cte->detokenize();
+ QString query = cteSelectTpl.arg(selectQuery, cte->table);
+ QList<AliasedColumn> queryColumns = db->columnsForQuery(query);
+ if (queryColumns.isEmpty())
+ {
+ qWarning() << "Could not detect query columns. Probably due to db error:" << db->getErrorText();
+ return columnSources;
+ }
+
+ for (const AliasedColumn& queryColumn : queryColumns)
+ {
+ if (!queryColumn.getDatabase().isNull())
+ column.database = resolveDatabase(queryColumn.getDatabase());
+ else
+ column.database = queryColumn.getDatabase();
+
+ column.table = queryColumn.getTable();
+
+ // From CTE perspective, however the column is received as "result column name" from SQLite API
+ // is what we report back to user of the CTE as available column. No matter if it's actual alias,
+ // or simply name of a column.
+ column.column = queryColumn.getAlias();
+ column.displayName = queryColumn.getAlias();
+ columnSources << column;
+ }
+
+ return columnSources;
+}
+
QList<SelectResolver::Column> SelectResolver::resolveTableFunctionColumns(SqliteSelect::Core::SingleSource *joinSrc)
{
static_qstring(columnSqlTpl, "SELECT * FROM %1 LIMIT 0");
@@ -708,14 +740,6 @@ QStringList SelectResolver::getTableColumns(const QString &database, const QStri
{
return tableColumnsCache.value(dbTable);
}
- else if (database.isNull() && cteList.contains(table))
- {
- QStringList columns;
- for (SqliteIndexedColumn* idxCol : cteList[table]->indexedColumns)
- columns << idxCol->name;
-
- return columns;
- }
else
{
QStringList columns = schemaResolver->getTableColumns(database, table);
@@ -760,7 +784,7 @@ bool SelectResolver::parseOriginalQuery()
if (originalQueryParsed)
return true;
- Parser parser(db->getDialect());
+ Parser parser;
if (!parser.parse(query) || parser.getQueries().isEmpty())
{
qWarning() << "Could not parse query in SelectResolver:" << query;
diff --git a/SQLiteStudio3/coreSQLiteStudio/selectresolver.h b/SQLiteStudio3/coreSQLiteStudio/selectresolver.h
index 92924ea..cb93d65 100644
--- a/SQLiteStudio3/coreSQLiteStudio/selectresolver.h
+++ b/SQLiteStudio3/coreSQLiteStudio/selectresolver.h
@@ -3,7 +3,6 @@
#include "parser/ast/sqliteselect.h"
#include "common/bistrhash.h"
-#include "dialect.h"
#include "expectedtoken.h"
#include "parser/ast/sqlitewith.h"
#include <QString>
@@ -41,6 +40,12 @@ class SchemaResolver;
* Result column like "table.*" will produce one or more column
* objects from this class.
*
+ * In case of CTE (Common Table Expression, aka WITH statement)
+ * the columns resolved from CTE will by of type COLUMN
+ * and will have FROM_CTE flag set. Such columns will have
+ * displayName and tableAlias populated, while database, table
+ * and column attributes may or may not be populated.
+ *
* There's one unsupported case: When the select has a subselect
* in "FROM" clause and that subselect is actually a multi-core
* select (with UNIONs), then columns produced from such source
@@ -204,6 +209,7 @@ class API_EXPORT SelectResolver
QList<Column> resolveJoinSource(SqliteSelect::Core::JoinSource* joinSrc);
QList<Column> resolveSingleSource(SqliteSelect::Core::SingleSource* joinSrc);
+ QList<Column> resolveCteColumns(SqliteSelect::Core::SingleSource* joinSrc);
QList<Column> resolveTableFunctionColumns(SqliteSelect::Core::SingleSource* joinSrc);
QList<Column> resolveSingleSourceSubSelect(SqliteSelect::Core::SingleSource* joinSrc);
QList<Column> resolveOtherSource(SqliteSelect::Core::JoinSourceOther *otherSrc);
@@ -217,7 +223,6 @@ class API_EXPORT SelectResolver
void markDistinctColumns();
void markCompoundColumns();
- void markCteColumns(QList<Column>* columnList = nullptr);
void markGroupedColumns();
void fixColumnNames();
void markCurrentColumnsWithFlag(Flag flag, QList<Column>* columnList = nullptr);
diff --git a/SQLiteStudio3/coreSQLiteStudio/services/codeformatter.cpp b/SQLiteStudio3/coreSQLiteStudio/services/codeformatter.cpp
index e02508f..e17032b 100644
--- a/SQLiteStudio3/coreSQLiteStudio/services/codeformatter.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/services/codeformatter.cpp
@@ -2,6 +2,7 @@
#include "parser/parser.h"
#include "plugins/codeformatterplugin.h"
#include "services/pluginmanager.h"
+#include "common/compatibility.h"
#include <QDebug>
void CodeFormatter::setFormatter(const QString& lang, CodeFormatterPlugin *formatterPlugin)
@@ -44,7 +45,7 @@ void CodeFormatter::updateCurrent()
QHash<QString,QVariant> config = CFG_CORE.General.ActiveCodeFormatter.get();
QString name;
QStringList names = availableFormatters.keys();
- qSort(names);
+ sSort(names);
for (const QString& lang : names)
{
name = config[lang].toString();
diff --git a/SQLiteStudio3/coreSQLiteStudio/services/config.cpp b/SQLiteStudio3/coreSQLiteStudio/services/config.cpp
index 60a80d5..c03847a 100644
--- a/SQLiteStudio3/coreSQLiteStudio/services/config.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/services/config.cpp
@@ -4,6 +4,7 @@ CFG_DEFINE(Core)
static const QString DB_FILE_NAME = QStringLiteral("settings3");
static QString MASTER_CONFIG_FILE = QString();
+Config::AskUserForConfigDirFunc Config::askUserForConfigDirFunc;
Config::~Config()
{
@@ -18,3 +19,8 @@ QString Config::getMasterConfigFile()
{
return MASTER_CONFIG_FILE;
}
+
+void Config::setAskUserForConfigDirFunc(const AskUserForConfigDirFunc& value)
+{
+ askUserForConfigDirFunc = value;
+}
diff --git a/SQLiteStudio3/coreSQLiteStudio/services/config.h b/SQLiteStudio3/coreSQLiteStudio/services/config.h
index 202120a..9d1e567 100644
--- a/SQLiteStudio3/coreSQLiteStudio/services/config.h
+++ b/SQLiteStudio3/coreSQLiteStudio/services/config.h
@@ -14,7 +14,7 @@
#include <QSharedPointer>
#include <QDateTime>
-const int SQLITESTUDIO_CONFIG_VERSION = 2;
+const int SQLITESTUDIO_CONFIG_VERSION = 3;
CFG_CATEGORIES(Core,
CFG_CATEGORY(General,
@@ -74,6 +74,7 @@ class API_EXPORT Config : public QObject
QList<DbGroupPtr> childs;
int order;
bool open = false;
+ bool dbExpanded = false;
};
struct SqlHistoryEntry
@@ -107,13 +108,17 @@ class API_EXPORT Config : public QObject
typedef QSharedPointer<ReportHistoryEntry> ReportHistoryEntryPtr;
+ typedef std::function<QString()> AskUserForConfigDirFunc;
+
static void setMasterConfigFile(const QString& path);
static QString getMasterConfigFile();
+ static void setAskUserForConfigDirFunc(const AskUserForConfigDirFunc& value);
virtual void init() = 0;
virtual void cleanUp() = 0;
virtual const QString& getConfigDir() const = 0;
virtual QString getConfigFilePath() const = 0;
+ virtual bool isInMemory() const = 0;
virtual void beginMassSave() = 0;
virtual void commitMassSave() = 0;
@@ -191,6 +196,10 @@ class API_EXPORT Config : public QObject
public slots:
virtual void refreshSqlHistory() = 0;
virtual void refreshDdlHistory() = 0;
+
+ protected:
+ static AskUserForConfigDirFunc askUserForConfigDirFunc;
+
};
#define CFG SQLITESTUDIO->getConfig()
diff --git a/SQLiteStudio3/coreSQLiteStudio/services/extralicensemanager.cpp b/SQLiteStudio3/coreSQLiteStudio/services/extralicensemanager.cpp
index 2bdc712..9710673 100644
--- a/SQLiteStudio3/coreSQLiteStudio/services/extralicensemanager.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/services/extralicensemanager.cpp
@@ -55,7 +55,7 @@ bool ExtraLicenseManager::isViolatedLicense(const QString& title)
QString ExtraLicenseManager::getViolationMessage(const QString& title)
{
if (!licenses.contains(title))
- return QString::null;
+ return QString();
return licenses[title]->violationMessage;
}
@@ -109,7 +109,7 @@ QString ExtraLicenseManager::readLicenseFile(const QString& path) const
if (!file.open(QIODevice::ReadOnly))
{
qCritical() << "Error opening" << file.fileName();
- return QString::null;
+ return QString();
}
QString contents = QString::fromLatin1(file.readAll());
file.close();
diff --git a/SQLiteStudio3/coreSQLiteStudio/services/functionmanager.cpp b/SQLiteStudio3/coreSQLiteStudio/services/functionmanager.cpp
index 10db318..f45e803 100644
--- a/SQLiteStudio3/coreSQLiteStudio/services/functionmanager.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/services/functionmanager.cpp
@@ -24,7 +24,7 @@ QString FunctionManager::FunctionBase::typeString(Type type)
case ScriptFunction::AGGREGATE:
return "AGGREGATE";
}
- return QString::null;
+ return QString();
}
FunctionManager::ScriptFunction::Type FunctionManager::FunctionBase::typeString(const QString& type)
diff --git a/SQLiteStudio3/coreSQLiteStudio/services/impl/configimpl.cpp b/SQLiteStudio3/coreSQLiteStudio/services/impl/configimpl.cpp
index 860e828..570395a 100644
--- a/SQLiteStudio3/coreSQLiteStudio/services/impl/configimpl.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/services/impl/configimpl.cpp
@@ -15,10 +15,15 @@
#include <QDateTime>
#include <QSysInfo>
#include <QCoreApplication>
+#include <QStandardPaths>
+#include <QSettings>
#include <QtConcurrent/QtConcurrentRun>
+#include <QtWidgets/QFileDialog>
static_qstring(DB_FILE_NAME, "settings3");
+static_qstring(CONFIG_DIR_SETTING, "SQLiteStudioConfigDir");
qint64 ConfigImpl::sqlHistoryId = -1;
+QString ConfigImpl::memoryDbName = QStringLiteral(":memory:");
ConfigImpl::~ConfigImpl()
{
@@ -43,7 +48,7 @@ void ConfigImpl::cleanUp()
if (db->isOpen())
db->close();
- safe_delete(db);
+ safe_delete(db)
}
const QString &ConfigImpl::getConfigDir() const
@@ -59,6 +64,11 @@ QString ConfigImpl::getConfigFilePath() const
return db->getPath();
}
+bool ConfigImpl::isInMemory() const
+{
+ return db->getPath() == memoryDbName;
+}
+
void ConfigImpl::beginMassSave()
{
if (isMassSaving())
@@ -243,8 +253,8 @@ void ConfigImpl::storeGroup(const ConfigImpl::DbGroupPtr &group, qint64 parentId
if (parentId > -1)
parent = parentId;
- SqlQueryPtr results = db->exec("INSERT INTO groups (name, [order], parent, open, dbname) VALUES (?, ?, ?, ?, ?)",
- {group->name, group->order, parent, group->open, group->referencedDbName});
+ SqlQueryPtr results = db->exec("INSERT INTO groups (name, [order], parent, open, dbname, db_expanded) VALUES (?, ?, ?, ?, ?, ?)",
+ {group->name, group->order, parent, group->open, group->referencedDbName, group->dbExpanded});
qint64 newParentId = results->getRegularInsertRowId();
for (const DbGroupPtr& childGroup : group->childs)
@@ -261,7 +271,7 @@ QList<ConfigImpl::DbGroupPtr> ConfigImpl::getGroups()
ConfigImpl::DbGroupPtr ConfigImpl::getDbGroup(const QString& dbName)
{
- SqlQueryPtr results = db->exec("SELECT id, name, [order], open, dbname FROM groups WHERE dbname = ? LIMIT 1", {dbName});
+ SqlQueryPtr results = db->exec("SELECT id, name, [order], open, dbname, db_expanded FROM groups WHERE dbname = ? LIMIT 1", {dbName});
DbGroupPtr group = DbGroupPtr::create();
group->referencedDbName = dbName;
@@ -274,6 +284,7 @@ ConfigImpl::DbGroupPtr ConfigImpl::getDbGroup(const QString& dbName)
group->name = row->value("name").toString();
group->order = row->value("order").toInt();
group->open = row->value("open").toBool();
+ group->dbExpanded = row->value("db_expanded").toBool();
return group;
}
@@ -553,9 +564,9 @@ void ConfigImpl::readGroupRecursively(ConfigImpl::DbGroupPtr group)
{
SqlQueryPtr results;
if (group->id < 0)
- results = db->exec("SELECT id, name, [order], open, dbname FROM groups WHERE parent IS NULL ORDER BY [order]");
+ results = db->exec("SELECT id, name, [order], open, dbname, db_expanded FROM groups WHERE parent IS NULL ORDER BY [order]");
else
- results = db->exec("SELECT id, name, [order], open, dbname FROM groups WHERE parent = ? ORDER BY [order]", {group->id});
+ results = db->exec("SELECT id, name, [order], open, dbname, db_expanded FROM groups WHERE parent = ? ORDER BY [order]", {group->id});
DbGroupPtr childGroup;
SqlResultsRowPtr row;
@@ -568,6 +579,7 @@ void ConfigImpl::readGroupRecursively(ConfigImpl::DbGroupPtr group)
childGroup->order = row->value("order").toInt();
childGroup->open = row->value("open").toBool();
childGroup->referencedDbName = row->value("dbname").toString();
+ childGroup->dbExpanded = row->value("db_expanded").toBool();
group->childs += childGroup;
}
@@ -592,6 +604,11 @@ void ConfigImpl::rollback()
QString ConfigImpl::getConfigPath()
{
+ return QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + "/" + DB_FILE_NAME;
+}
+
+QString ConfigImpl::getLegacyConfigPath()
+{
#ifdef Q_OS_WIN
if (QSysInfo::windowsVersion() & QSysInfo::WV_NT_based)
return SQLITESTUDIO->getEnv("APPDATA")+"/sqlitestudio";
@@ -669,7 +686,7 @@ void ConfigImpl::initTables()
if (!tables.contains("groups"))
db->exec("CREATE TABLE groups (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, parent INTEGER REFERENCES groups(id), "
"[order] INTEGER, open INTEGER DEFAULT 0, dbname TEXT UNIQUE REFERENCES dblist(name) ON UPDATE CASCADE ON DELETE CASCADE, "
- "UNIQUE(name, parent))");
+ "db_expanded INTEGER DEFAULT 0, UNIQUE(name, parent))");
if (!tables.contains("ddl_history"))
db->exec("CREATE TABLE ddl_history (id INTEGER PRIMARY KEY AUTOINCREMENT, dbname TEXT, file TEXT, timestamp INTEGER, "
@@ -712,43 +729,29 @@ void ConfigImpl::initTables()
void ConfigImpl::initDbFile()
{
- // Determinate global config location and portable one
- QString globalPath = getConfigPath();
- QString portablePath = getPortableConfigPath();
-
QList<QPair<QString,bool>> paths;
- if (!globalPath.isNull() && !portablePath.isNull())
- {
- if (QFileInfo(portablePath).exists())
- {
- paths << QPair<QString,bool>(portablePath+"/"+DB_FILE_NAME, false);
- paths << QPair<QString,bool>(globalPath+"/"+DB_FILE_NAME, true);
- }
- else
- {
- paths << QPair<QString,bool>(globalPath+"/"+DB_FILE_NAME, true);
- paths << QPair<QString,bool>(portablePath+"/"+DB_FILE_NAME, false);
- }
- }
- else if (!globalPath.isNull())
+
+ // Do we have path selected by user? (because app was unable to find writable location before)
+ QSettings sett;
+ QString customPath = sett.value(CONFIG_DIR_SETTING).toString();
+ if (!customPath.isEmpty())
{
- paths << QPair<QString,bool>(globalPath+"/"+DB_FILE_NAME, true);
- }
- else if (!portablePath.isNull())
- {
- paths << QPair<QString,bool>(portablePath+"/"+DB_FILE_NAME, false);
+ paths << QPair<QString,bool>(customPath + "/" + DB_FILE_NAME, false);
+ qDebug() << "Using custom configuration directory. The location is stored in" << sett.fileName();
}
+ else
+ paths.append(getStdDbPaths());
// A fallback to in-memory db
- paths << QPair<QString,bool>(":memory:", false);
+ paths << QPair<QString,bool>(memoryDbName, false);
// Go through all candidates and pick one
QDir dir;
for (const QPair<QString,bool>& path : paths)
{
dir = QDir(path.first);
- if (path.first != ":memory:")
- dir.cdUp();
+ if (path.first != memoryDbName)
+ dir = QFileInfo(path.first).dir();
if (tryInitDbFile(path))
{
@@ -757,8 +760,25 @@ void ConfigImpl::initDbFile()
}
}
+ // Failed to use any of predefined directories. Let's ask the user.
+ while (configDir == memoryDbName)
+ {
+ QString path = askUserForConfigDirFunc();
+ if (path.isNull())
+ break;
+
+ dir = QDir(path);
+ if (tryInitDbFile(QPair<QString,bool>(path + "/" + DB_FILE_NAME, false)))
+ {
+ configDir = dir.absolutePath();
+ QSettings sett;
+ sett.setValue(CONFIG_DIR_SETTING, configDir);
+ qDebug() << "Using custom configuration directory. The location is stored in" << sett.fileName();
+ }
+ }
+
// We ended up with in-memory one? That's not good.
- if (configDir == ":memory:")
+ if (configDir == memoryDbName)
{
paths.removeLast();
QStringList pathStrings;
@@ -766,13 +786,38 @@ void ConfigImpl::initDbFile()
pathStrings << path.first;
notifyError(QObject::tr("Could not initialize configuration file. Any configuration changes and queries history will be lost after application restart."
- " Tried to initialize the file at following localizations: %1.").arg(pathStrings.join(", ")));
+ " Unable to create a file at following locations: %1.").arg(pathStrings.join(", ")));
}
qDebug() << "Using configuration directory:" << configDir;
db->exec("PRAGMA foreign_keys = 1;");
}
+QList<QPair<QString,bool>> ConfigImpl::getStdDbPaths()
+{
+ QList<QPair<QString,bool>> paths;
+
+ // Portable dir location has always precedense - comes first
+ QString portablePath = getPortableConfigPath();
+ if (!portablePath.isNull())
+ paths << QPair<QString,bool>(portablePath+"/"+DB_FILE_NAME, false);
+
+ // Determinate global config location
+ QString globalPath = getConfigPath();
+ paths << QPair<QString,bool>(globalPath, true);
+
+ // If needed, migrate configuration from legacy location (pre-3.3) to new location (3.3 and later)
+ QString legacyGlobalPath = getLegacyConfigPath();
+ if (!legacyGlobalPath.isNull())
+ {
+ paths << QPair<QString,bool>(legacyGlobalPath+"/"+DB_FILE_NAME, true);
+ if (!QFile::exists(globalPath))
+ tryToMigrateOldGlobalPath(legacyGlobalPath, globalPath);
+ }
+
+ return paths;
+}
+
bool ConfigImpl::tryInitDbFile(const QPair<QString, bool> &dbPath)
{
// Create global config directory if not existing
@@ -1118,6 +1163,12 @@ void ConfigImpl::updateConfigDb()
// 1->2
db->exec("UPDATE settings SET [key] = 'DataUncommittedError' WHERE [key] = 'DataUncommitedError'");
db->exec("UPDATE settings SET [key] = 'DataUncommitted' WHERE [key] = 'DataUncommited'");
+ __attribute__((__fallthrough__));
+ }
+ case 2:
+ {
+ // 2->3
+ db->exec("ALTER TABLE groups ADD db_expanded INTEGER DEFAULT 0");
}
// Add cases here for next versions,
// without a "break" instruction,
@@ -1129,6 +1180,30 @@ void ConfigImpl::updateConfigDb()
db->commit();
}
+bool ConfigImpl::tryToMigrateOldGlobalPath(const QString& oldPath, const QString& newPath)
+{
+ if (!QFileInfo::exists(oldPath))
+ return false;
+
+ qDebug() << "Attempting to migrate legacy config location" << oldPath << "to new location" << newPath;
+ QDir dir = QFileInfo(newPath).dir();
+ if (!dir.exists())
+ QDir::root().mkpath(dir.absolutePath());
+
+ if (QFile::copy(oldPath, dir.absoluteFilePath(DB_FILE_NAME)))
+ {
+ qDebug() << "Migration successful. Renaming old location file so it has '.old' suffix.";
+ if (QFile::rename(oldPath, oldPath+".old"))
+ qDebug() << "Renaming successful.";
+ else
+ qDebug() << "Renaming did not work, but it's okay. It will just remain with original name there.";
+ }
+ else
+ qDebug() << "Migration (copying) failed.";
+
+ return true;
+}
+
void ConfigImpl::refreshSqlHistory()
{
if (sqlHistoryModel)
diff --git a/SQLiteStudio3/coreSQLiteStudio/services/impl/configimpl.h b/SQLiteStudio3/coreSQLiteStudio/services/impl/configimpl.h
index 561aab4..710fbb3 100644
--- a/SQLiteStudio3/coreSQLiteStudio/services/impl/configimpl.h
+++ b/SQLiteStudio3/coreSQLiteStudio/services/impl/configimpl.h
@@ -22,6 +22,7 @@ class API_EXPORT ConfigImpl : public Config
void cleanUp();
const QString& getConfigDir() const;
QString getConfigFilePath() const;
+ bool isInMemory() const;
void beginMassSave();
void commitMassSave();
@@ -104,6 +105,7 @@ class API_EXPORT ConfigImpl : public Config
QString getPortableConfigPath();
void initTables();
void initDbFile();
+ QList<QPair<QString, bool> > getStdDbPaths();
bool tryInitDbFile(const QPair<QString, bool>& dbPath);
QVariant deserializeValue(const QVariant& value) const;
@@ -131,9 +133,12 @@ class API_EXPORT ConfigImpl : public Config
void mergeMasterConfig();
void updateConfigDb();
+ bool tryToMigrateOldGlobalPath(const QString& oldPath, const QString& newPath);
+ QString getLegacyConfigPath();
static Config* instance;
static qint64 sqlHistoryId;
+ static QString memoryDbName;
Db* db = nullptr;
QString configDir;
diff --git a/SQLiteStudio3/coreSQLiteStudio/services/impl/dbmanagerimpl.cpp b/SQLiteStudio3/coreSQLiteStudio/services/impl/dbmanagerimpl.cpp
index 217c2b7..9086257 100644
--- a/SQLiteStudio3/coreSQLiteStudio/services/impl/dbmanagerimpl.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/services/impl/dbmanagerimpl.cpp
@@ -284,7 +284,7 @@ QString DbManagerImpl::quickAddDb(const QString& path, const QHash<QString, QVar
QString newName = DbManager::generateDbName(path);
newName = generateUniqueName(newName, DBLIST->getDbNames());
if (!DBLIST->addDb(newName, path, options, false))
- return QString::null;
+ return QString();
return newName;
}
diff --git a/SQLiteStudio3/coreSQLiteStudio/services/impl/pluginmanagerimpl.cpp b/SQLiteStudio3/coreSQLiteStudio/services/impl/pluginmanagerimpl.cpp
index c67156c..324f549 100644
--- a/SQLiteStudio3/coreSQLiteStudio/services/impl/pluginmanagerimpl.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/services/impl/pluginmanagerimpl.cpp
@@ -87,7 +87,7 @@ QStringList PluginManagerImpl::getPluginDirs() const
QString PluginManagerImpl::getFilePath(Plugin* plugin) const
{
if (!pluginContainer.contains(plugin->getName()))
- return QString::null;
+ return QString();
return pluginContainer[plugin->getName()]->filePath;
}
@@ -339,7 +339,13 @@ bool PluginManagerImpl::initPlugin(Plugin* plugin)
bool PluginManagerImpl::shouldAutoLoad(const QString& pluginName)
{
- QStringList loadedPlugins = CFG_CORE.General.LoadedPlugins.get().split(",", QString::SkipEmptyParts);
+ QStringList loadedPlugins = CFG_CORE.General.LoadedPlugins.get().split(",",
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
+ Qt::SkipEmptyParts
+#else
+ QString::SkipEmptyParts
+#endif
+ );
QStringList pair;
for (const QString& loadedPlugin : loadedPlugins)
{
@@ -385,7 +391,7 @@ PluginType* PluginManagerImpl::getPluginType(const QString& pluginName) const
QString PluginManagerImpl::getAuthor(const QString& pluginName) const
{
if (!pluginContainer.contains(pluginName))
- return QString::null;
+ return QString();
return pluginContainer[pluginName]->author;
}
@@ -393,7 +399,7 @@ QString PluginManagerImpl::getAuthor(const QString& pluginName) const
QString PluginManagerImpl::getTitle(const QString& pluginName) const
{
if (!pluginContainer.contains(pluginName))
- return QString::null;
+ return QString();
return pluginContainer[pluginName]->title;
}
@@ -401,7 +407,7 @@ QString PluginManagerImpl::getTitle(const QString& pluginName) const
QString PluginManagerImpl::getPrintableVersion(const QString& pluginName) const
{
if (!pluginContainer.contains(pluginName))
- return QString::null;
+ return QString();
return pluginContainer[pluginName]->printableVersion;
}
@@ -417,7 +423,7 @@ int PluginManagerImpl::getVersion(const QString& pluginName) const
QString PluginManagerImpl::getDescription(const QString& pluginName) const
{
if (!pluginContainer.contains(pluginName))
- return QString::null;
+ return QString();
return pluginContainer[pluginName]->description;
}
diff --git a/SQLiteStudio3/coreSQLiteStudio/services/importmanager.cpp b/SQLiteStudio3/coreSQLiteStudio/services/importmanager.cpp
index b9aa947..a06a743 100644
--- a/SQLiteStudio3/coreSQLiteStudio/services/importmanager.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/services/importmanager.cpp
@@ -67,7 +67,7 @@ void ImportManager::importToTable(Db* db, const QString& table, bool async)
importInProgress = true;
ImportWorker* worker = new ImportWorker(plugin, &importConfig, db, table);
- connect(worker, SIGNAL(finished(bool)), this, SLOT(finalizeImport(bool)));
+ connect(worker, SIGNAL(finished(bool, int)), this, SLOT(finalizeImport(bool, int)));
connect(worker, SIGNAL(createdTable(Db*,QString)), this, SLOT(handleTableCreated(Db*,QString)));
connect(this, SIGNAL(orderWorkerToInterrupt()), worker, SLOT(interrupt()));
@@ -87,13 +87,13 @@ bool ImportManager::isAnyPluginAvailable()
return PLUGINS->getLoadedPlugins<ImportPlugin>().size() > 0;
}
-void ImportManager::finalizeImport(bool result)
+void ImportManager::finalizeImport(bool result, int rowCount)
{
importInProgress = false;
emit importFinished();
if (result)
{
- notifyInfo(tr("Imported data to the table '%1' successfully.").arg(table));
+ notifyInfo(tr("Imported data to the table '%1' successfully. Number of imported rows: %2").arg(table, QString::number(rowCount)));
emit importSuccessful();
}
else
diff --git a/SQLiteStudio3/coreSQLiteStudio/services/importmanager.h b/SQLiteStudio3/coreSQLiteStudio/services/importmanager.h
index 5c6a73e..9e9b160 100644
--- a/SQLiteStudio3/coreSQLiteStudio/services/importmanager.h
+++ b/SQLiteStudio3/coreSQLiteStudio/services/importmanager.h
@@ -70,7 +70,7 @@ class API_EXPORT ImportManager : public PluginServiceBase
void interrupt();
private slots:
- void finalizeImport(bool result);
+ void finalizeImport(bool result, int rowCount);
void handleTableCreated(Db* db, const QString& table);
signals:
diff --git a/SQLiteStudio3/coreSQLiteStudio/services/pluginmanager.h b/SQLiteStudio3/coreSQLiteStudio/services/pluginmanager.h
index f771c2c..65aa8fa 100644
--- a/SQLiteStudio3/coreSQLiteStudio/services/pluginmanager.h
+++ b/SQLiteStudio3/coreSQLiteStudio/services/pluginmanager.h
@@ -344,7 +344,7 @@ class API_EXPORT PluginManager : public QObject
* the other one, if the first one is already loaded - and vice versa.
*
* Declaring conflicts for a plugin can be useful for example if somebody wants to proivde an alternative
- * implementation of SQLite2 database plugin, etc. In that case SQLiteStudio won't get confused in
+ * implementation of SQLCipher database plugin, etc. In that case SQLiteStudio won't get confused in
* deciding which plugin to use for supporting such databases.
*/
virtual QStringList getConflicts(const QString& pluginName) const = 0;
diff --git a/SQLiteStudio3/coreSQLiteStudio/services/updatemanager.cpp b/SQLiteStudio3/coreSQLiteStudio/services/updatemanager.cpp
index 87df73b..867ef58 100644
--- a/SQLiteStudio3/coreSQLiteStudio/services/updatemanager.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/services/updatemanager.cpp
@@ -7,29 +7,18 @@
#include <QRegularExpression>
#include <QCoreApplication>
#include <QFileInfo>
+#include <QNetworkRequest>
+#include <QNetworkAccessManager>
+#include <QNetworkReply>
+#include <QJsonDocument>
+#include <QJsonObject>
#include <QtConcurrent/QtConcurrentRun>
UpdateManager::UpdateManager(QObject *parent) :
QObject(parent)
{
- qRegisterMetaType<QList<UpdateManager::UpdateEntry>>();
-
- connect(this, SIGNAL(updatingError(QString)), NOTIFY_MANAGER, SLOT(error(QString)));
-
- QString updateBinary =
-#if defined(Q_OS_WIN)
- "UpdateSQLiteStudio.exe";
-#elif defined(Q_OS_LINUX)
- "UpdateSQLiteStudio";
-#elif defined(Q_OS_OSX)
- "../../UpdateSQLiteStudio.app/Contents/MacOS/UpdateSQLiteStudio";
-#else
- "";
-#endif
-
- if (!updateBinary.isEmpty()) {
- updateBinaryAbsolutePath = QFileInfo(QCoreApplication::applicationDirPath() + "/" + updateBinary).absoluteFilePath();
- }
+ connect(this, SIGNAL(updatingError(QString)), this, SLOT(handleUpdatingError(QString)));
+ netManager = new QNetworkAccessManager(this);
}
UpdateManager::~UpdateManager()
@@ -42,54 +31,14 @@ void UpdateManager::checkForUpdates()
if (!CFG_CORE.General.CheckUpdatesOnStartup.get())
return;
- if (updateBinaryAbsolutePath.isEmpty()) {
- qDebug() << "Updater binary not defined. Skipping updates checking.";
- return;
- }
-
- if (!QFileInfo(updateBinaryAbsolutePath).exists()) {
- QString errorDetails = tr("Updates installer executable is missing.");
- emit updatingError(tr("Unable to check for updates (%1)").arg(errorDetails.trimmed()));
- qWarning() << "Error while checking for updates: " << errorDetails;
- return;
- }
-
- QtConcurrent::run(this, &UpdateManager::checkForUpdatesAsync);
-}
-
-void UpdateManager::checkForUpdatesAsync()
-{
- QProcess proc;
- proc.start(updateBinaryAbsolutePath, {"--checkupdates"});
- if (!waitForProcess(proc))
+ static_qstring(url, "https://sqlitestudio.pl/rest/updates");
+ QNetworkRequest request(url);
+ QNetworkReply* response = netManager->get(request);
+ connect(response, &QNetworkReply::finished, [this, response]()
{
- QString errorDetails = QString::fromLocal8Bit(proc.readAllStandardError());
-
- if (errorDetails.toLower().contains("no updates")) {
- emit noUpdatesAvailable();
- return;
- }
-
- if (errorDetails.isEmpty())
- errorDetails = tr("details are unknown");
-
- emit updatingError(tr("Unable to check for updates (%1)").arg(errorDetails.trimmed()));
- qWarning() << "Error while checking for updates: " << errorDetails;
- return;
- }
-
- processCheckResults(proc.readAllStandardOutput());
-}
-
-void UpdateManager::update()
-{
- bool success = QProcess::startDetached(updateBinaryAbsolutePath, {"--updater"});
- if (!success)
- {
- emit updatingError(tr("Unable to run updater application (%1). Please report this.").arg(updateBinaryAbsolutePath));
- return;
- }
- qApp->exit(0);
+ response->deleteLater();
+ handleUpdatesResponse(response);
+ });
}
bool UpdateManager::isPlatformEligibleForUpdate() const
@@ -97,56 +46,50 @@ bool UpdateManager::isPlatformEligibleForUpdate() const
return getDistributionType() != DistributionType::OS_MANAGED;
}
-bool UpdateManager::waitForProcess(QProcess& proc)
+void UpdateManager::handleUpdatesResponse(QNetworkReply* response)
{
- if (!proc.waitForFinished(-1))
+ if (response->error() != QNetworkReply::NoError)
{
- qDebug() << "Update QProcess timed out.";
- return false;
+ emit updatingError(response->errorString());
+ return;
}
- if (proc.exitStatus() == QProcess::CrashExit)
- {
- qDebug() << "Update QProcess finished by crashing.";
- return false;
- }
+ QJsonParseError parsingError;
+ QJsonDocument json = QJsonDocument::fromJson(response->readAll(), &parsingError);
- if (proc.exitCode() != 0)
+ if (parsingError.error != QJsonParseError::NoError)
{
- qDebug() << "Update QProcess finished with code:" << proc.exitCode();
- return false;
+ emit updatingError(parsingError.errorString());
+ return;
}
- return true;
-}
+ QString version = json["version"].toString();
+ QStringList versionParts = version.split(".");
+ QString alignedVersion = versionParts[0] + versionParts[1].rightJustified(2, '0') + versionParts[2].rightJustified(2, '0');
+ int versionNumber = alignedVersion.toInt();
-void UpdateManager::processCheckResults(const QByteArray &results)
-{
- if (results.trimmed().isEmpty()) {
+ if (SQLITESTUDIO->getVersion() >= versionNumber)
+ {
emit noUpdatesAvailable();
return;
}
- QRegularExpression re(R"(\<update\s+([^\>]+)\>)");
- QRegularExpression versionRe(R"(version\=\"([\d\.]+)\")");
- QRegularExpression nameRe(R"(name\=\"([^\"]+)\")");
+#if defined(Q_OS_WIN)
+ QString url = json["win"].toString();
+#elif defined(Q_OS_LINUX)
+ QString url = json["lin"].toString();
+#elif defined(Q_OS_OSX)
+ QString url = json["mac"].toString();
+#else
+ QString url = jsonQString();
+#endif
- QRegularExpressionMatchIterator reIter = re.globalMatch(results);
- QString updateNode;
- UpdateEntry theUpdate;
- QList<UpdateEntry> updates;
- while (reIter.hasNext())
- {
- updateNode = reIter.next().captured(1);
- theUpdate.version = versionRe.match(updateNode).captured(1);
- theUpdate.compontent = nameRe.match(updateNode).captured(1);
- updates << theUpdate;
- }
+ emit updateAvailable(version, url);
+}
- if (updates.isEmpty())
- emit noUpdatesAvailable();
- else
- emit updatesAvailable(updates);
+void UpdateManager::handleUpdatingError(const QString& errorMessage)
+{
+ NOTIFY_MANAGER->warn(tr("Could not check for updates (%1).").arg(errorMessage));
}
#endif // PORTABLE_CONFIG
diff --git a/SQLiteStudio3/coreSQLiteStudio/services/updatemanager.h b/SQLiteStudio3/coreSQLiteStudio/services/updatemanager.h
index 50f4b6b..d7f59ca 100644
--- a/SQLiteStudio3/coreSQLiteStudio/services/updatemanager.h
+++ b/SQLiteStudio3/coreSQLiteStudio/services/updatemanager.h
@@ -9,8 +9,8 @@
#include <functional>
#include <QProcess>
-class QNetworkAccessManager;
class QNetworkReply;
+class QNetworkAccessManager;
class QTemporaryDir;
class QFile;
@@ -18,34 +18,27 @@ class API_EXPORT UpdateManager : public QObject
{
Q_OBJECT
public:
- struct UpdateEntry
- {
- QString compontent;
- QString version;
- };
-
explicit UpdateManager(QObject *parent = 0);
~UpdateManager();
void checkForUpdates();
- void update();
bool isPlatformEligibleForUpdate() const;
private:
QString updateBinaryAbsolutePath;
+ QNetworkAccessManager *netManager = nullptr;
- void checkForUpdatesAsync();
- bool waitForProcess(QProcess& proc);
- void processCheckResults(const QByteArray& results);
+ void handleUpdatesResponse(QNetworkReply* response);
+
+ private slots:
+ void handleUpdatingError(const QString& errorMessage);
signals:
- void updatesAvailable(const QList<UpdateManager::UpdateEntry>& updates);
+ void updateAvailable(const QString& version, const QString& url);
void noUpdatesAvailable();
void updatingError(const QString& errorMessage);
};
-Q_DECLARE_METATYPE(QList<UpdateManager::UpdateEntry>)
-
#define UPDATES SQLITESTUDIO->getUpdateManager()
#endif // PORTABLE_CONFIG
diff --git a/SQLiteStudio3/coreSQLiteStudio/sqlitestudio.cpp b/SQLiteStudio3/coreSQLiteStudio/sqlitestudio.cpp
index 136ba03..c38f528 100644
--- a/SQLiteStudio3/coreSQLiteStudio/sqlitestudio.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/sqlitestudio.cpp
@@ -40,7 +40,7 @@
DEFINE_SINGLETON(SQLiteStudio)
-static const int sqlitestudioVersion = 30201;
+static const int sqlitestudioVersion = 30303;
SQLiteStudio::SQLiteStudio()
{
@@ -126,9 +126,9 @@ QString SQLiteStudio::getHomePage() const
return url;
}
-QString SQLiteStudio::getForumPage() const
+QString SQLiteStudio::getGitHubReleases() const
{
- static_qstring(url, "https://forum.sqlitestudio.pl");
+ static_qstring(url, "https://github.com/pawelsalawa/sqlitestudio/releases");
return url;
}
@@ -150,6 +150,12 @@ QString SQLiteStudio::getIssuesPage() const
return url;
}
+QString SQLiteStudio::getDonatePage() const
+{
+ static_qstring(url, "https://sqlitestudio.pl/donate/");
+ return url;
+}
+
QString SQLiteStudio::getNewIssuePage() const
{
static_qstring(url, "https://github.com/pawelsalawa/sqlitestudio/issues/new");
diff --git a/SQLiteStudio3/coreSQLiteStudio/sqlitestudio.h b/SQLiteStudio3/coreSQLiteStudio/sqlitestudio.h
index 5cd3118..0b07717 100644
--- a/SQLiteStudio3/coreSQLiteStudio/sqlitestudio.h
+++ b/SQLiteStudio3/coreSQLiteStudio/sqlitestudio.h
@@ -34,7 +34,7 @@ class SqliteExtensionManager;
/**
* @mainpage
- * SQLiteStudio is SQLite 2 and 3 manager for Windows, MacOS X and Linux.
+ * SQLiteStudio is SQLite 3 manager for Windows, MacOS X and Linux.
*
* Global variables and macros:
* <ul>
@@ -136,10 +136,11 @@ class API_EXPORT SQLiteStudio : public QObject
void setCodeFormatter(CodeFormatter* codeFormatter);
QString getHomePage() const;
- QString getForumPage() const;
+ QString getGitHubReleases() const;
QString getUserManualPage() const;
QString getSqliteDocsPage() const;
QString getIssuesPage() const;
+ QString getDonatePage() const;
QString getNewIssuePage() const;
#ifdef PORTABLE_CONFIG
diff --git a/SQLiteStudio3/coreSQLiteStudio/tablemodifier.cpp b/SQLiteStudio3/coreSQLiteStudio/tablemodifier.cpp
index 3558ec1..59d978c 100644
--- a/SQLiteStudio3/coreSQLiteStudio/tablemodifier.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/tablemodifier.cpp
@@ -36,8 +36,7 @@ void TableModifier::alterTable(SqliteCreateTablePtr newCreateTable)
existingColumns = newCreateTable->getColumnNames();
newName = newCreateTable->table;
- if (db->getDialect() == Dialect::Sqlite3)
- sqls << "PRAGMA foreign_keys = 0;";
+ sqls << "PRAGMA foreign_keys = 0;";
handleFkConstrains(newCreateTable.data(), createTable->table, newName);
@@ -53,14 +52,13 @@ void TableModifier::alterTable(SqliteCreateTablePtr newCreateTable)
// If temp table was created, it means that table name hasn't changed. In that case we need to cleanup temp table (drop it).
// Otherwise, the table name has changed, therefor there still remains the old table which we copied data from - we need to drop it here.
- sqls << QString("DROP TABLE %1;").arg(wrapObjIfNeeded(tempTableName.isNull() ? originalTable : tempTableName, dialect));
+ sqls << QString("DROP TABLE %1;").arg(wrapObjIfNeeded(tempTableName.isNull() ? originalTable : tempTableName));
handleIndexes();
handleTriggers();
handleViews();
- if (db->getDialect() == Dialect::Sqlite3)
- sqls << "PRAGMA foreign_keys = 1;";
+ sqls << "PRAGMA foreign_keys = 1;";
}
void TableModifier::renameTo(const QString& newName)
@@ -70,8 +68,8 @@ void TableModifier::renameTo(const QString& newName)
// Using ALTER TABLE RENAME TO is not a good solution here, because it automatically renames all occurrences in REFERENCES,
// which we don't want, because we rename a lot to temporary tables and drop them.
- sqls << QString("CREATE TABLE %1 AS SELECT * FROM %2;").arg(wrapObjIfNeeded(newName, dialect), wrapObjIfNeeded(table, dialect))
- << QString("DROP TABLE %1;").arg(wrapObjIfNeeded(table, dialect));
+ sqls << QString("CREATE TABLE %1 AS SELECT * FROM %2;").arg(wrapObjIfNeeded(newName), wrapObjIfNeeded(table))
+ << QString("DROP TABLE %1;").arg(wrapObjIfNeeded(table));
table = newName;
createTable->table = newName;
@@ -87,11 +85,17 @@ QString TableModifier::renameToTemp()
void TableModifier::copyDataTo(const QString& targetTable)
{
SchemaResolver resolver(db);
+ resolver.setIgnoreSystemObjects(true);
QStringList targetColumns = resolver.getTableColumns(targetTable);
QStringList colsToCopy;
for (SqliteCreateTable::Column* column : createTable->columns)
+ {
+ if (column->hasConstraint(SqliteCreateTable::Column::Constraint::GENERATED))
+ continue;
+
if (targetColumns.contains(column->name, Qt::CaseInsensitive))
- colsToCopy << wrapObjIfNeeded(column->name, dialect);
+ colsToCopy << wrapObjIfNeeded(column->name);
+ }
copyDataTo(targetTable, colsToCopy, colsToCopy);
}
@@ -101,7 +105,7 @@ void TableModifier::handleFks()
tablesHandledForFk << originalTable;
SchemaResolver resolver(db);
-
+ resolver.setIgnoreSystemObjects(true);
QStringList fkTables = resolver.getFkReferencingTables(originalTable);
for (const QString& fkTable : fkTables)
@@ -159,7 +163,7 @@ void TableModifier::handleFks(const QString& oldName, const QString& theNewName)
handleFks();
- sqls << QString("DROP TABLE %1;").arg(wrapObjIfNeeded(tempName, dialect));
+ sqls << QString("DROP TABLE %1;").arg(wrapObjIfNeeded(tempName));
simpleHandleIndexes();
simpleHandleTriggers();
@@ -405,11 +409,14 @@ void TableModifier::copyDataTo(SqliteCreateTablePtr newCreateTable)
QStringList dstCols;
for (SqliteCreateTable::Column* column : newCreateTable->columns)
{
+ if (column->hasConstraint(SqliteCreateTable::Column::Constraint::GENERATED))
+ continue;
+
if (!existingColumns.contains(column->originalName))
continue; // not copying columns that didn't exist before
- srcCols << wrapObjIfNeeded(column->originalName, dialect);
- dstCols << wrapObjIfNeeded(column->name, dialect);
+ srcCols << wrapObjIfNeeded(column->originalName);
+ dstCols << wrapObjIfNeeded(column->name);
}
copyDataTo(newCreateTable->table, srcCols, dstCols);
@@ -418,6 +425,7 @@ void TableModifier::copyDataTo(SqliteCreateTablePtr newCreateTable)
void TableModifier::handleIndexes()
{
SchemaResolver resolver(db);
+ resolver.setIgnoreSystemObjects(true);
QList<SqliteCreateIndexPtr> parsedIndexesForTable = resolver.getParsedIndexesForTable(originalTable);
for (SqliteCreateIndexPtr index : parsedIndexesForTable)
handleIndex(index);
@@ -444,6 +452,7 @@ void TableModifier::handleIndex(SqliteCreateIndexPtr index)
void TableModifier::handleTriggers()
{
SchemaResolver resolver(db);
+ resolver.setIgnoreSystemObjects(true);
QList<SqliteCreateTriggerPtr> parsedTriggersForTable = resolver.getParsedTriggersForTable(originalTable, true);
for (SqliteCreateTriggerPtr trig : parsedTriggersForTable)
handleTrigger(trig);
@@ -473,7 +482,7 @@ void TableModifier::handleTrigger(SqliteCreateTriggerPtr trigger)
{
// The trigger was already modified by handling of some referencing table.
QString oldDdl = triggerNameToDdlMap[trigger->trigger];
- Parser parser(dialect);
+ Parser parser;
trigger = parser.parse<SqliteCreateTrigger>(oldDdl);
if (!trigger)
{
@@ -506,7 +515,7 @@ void TableModifier::handleTrigger(SqliteCreateTriggerPtr trigger)
if (!forThisTable)
{
// If this is for other table, than trigger might be still existing, cause altering this table will not delete trigger.
- sqls << QString("DROP TRIGGER IF EXISTS %1").arg(wrapObjIfNeeded(trigger->trigger, dialect));
+ sqls << QString("DROP TRIGGER IF EXISTS %1").arg(wrapObjIfNeeded(trigger->trigger));
}
sqls << newQueryString;
@@ -533,6 +542,7 @@ void TableModifier::handleTriggerQueries(SqliteCreateTriggerPtr trigger)
void TableModifier::handleViews()
{
SchemaResolver resolver(db);
+ resolver.setIgnoreSystemObjects(true);
QList<SqliteCreateViewPtr> parsedViewsForTable = resolver.getParsedViewsForTable(originalTable);
for (SqliteCreateViewPtr view : parsedViewsForTable)
handleView(view);
@@ -561,7 +571,7 @@ void TableModifier::handleView(SqliteCreateViewPtr view)
view->select->setParent(view.data());
view->rebuildTokens();
- sqls << QString("DROP VIEW %1;").arg(wrapObjIfNeeded(view->view, dialect));
+ sqls << QString("DROP VIEW %1;").arg(wrapObjIfNeeded(view->view));
sqls << view->detokenize();
simpleHandleTriggers(view->view);
@@ -894,6 +904,7 @@ bool TableModifier::handleExpr(SqliteExpr* expr)
void TableModifier::simpleHandleIndexes()
{
SchemaResolver resolver(db);
+ resolver.setIgnoreSystemObjects(true);
QList<SqliteCreateIndexPtr> parsedIndexesForTable = resolver.getParsedIndexesForTable(originalTable);
for (SqliteCreateIndexPtr index : parsedIndexesForTable)
sqls << index->detokenize();
@@ -902,6 +913,7 @@ void TableModifier::simpleHandleIndexes()
void TableModifier::simpleHandleTriggers(const QString& view)
{
SchemaResolver resolver(db);
+ resolver.setIgnoreSystemObjects(true);
QList<SqliteCreateTriggerPtr> parsedTriggers ;
if (!view.isNull())
parsedTriggers = resolver.getParsedTriggersForView(view);
@@ -914,7 +926,7 @@ void TableModifier::simpleHandleTriggers(const QString& view)
SqliteQueryPtr TableModifier::parseQuery(const QString& ddl)
{
- Parser parser(dialect);
+ Parser parser;
if (!parser.parse(ddl) || parser.getQueries().size() == 0)
return SqliteQueryPtr();
@@ -923,8 +935,8 @@ SqliteQueryPtr TableModifier::parseQuery(const QString& ddl)
void TableModifier::copyDataTo(const QString& targetTable, const QStringList& srcCols, const QStringList& dstCols)
{
- sqls << QString("INSERT INTO %1 (%2) SELECT %3 FROM %4;").arg(wrapObjIfNeeded(targetTable, dialect), dstCols.join(", "), srcCols.join(", "),
- wrapObjIfNeeded(table, dialect));
+ sqls << QString("INSERT INTO %1 (%2) SELECT %3 FROM %4;").arg(wrapObjIfNeeded(targetTable), dstCols.join(", "), srcCols.join(", "),
+ wrapObjIfNeeded(table));
}
QStringList TableModifier::generateSqls() const
@@ -949,7 +961,6 @@ QStringList TableModifier::getWarnings() const
void TableModifier::init()
{
- dialect = db->getDialect();
originalTable = table;
parseDdl();
}
@@ -957,6 +968,7 @@ void TableModifier::init()
void TableModifier::parseDdl()
{
SchemaResolver resolver(db);
+ resolver.setIgnoreSystemObjects(true);
QString ddl = resolver.getObjectDdl(database, table, SchemaResolver::TABLE);
if (ddl.isNull())
{
@@ -964,7 +976,7 @@ void TableModifier::parseDdl()
return;
}
- Parser parser(dialect);
+ Parser parser;
if (!parser.parse(ddl))
{
qCritical() << "Could not parse table's' ddl in the TableModifier. The ddl is:" << ddl;
@@ -991,6 +1003,7 @@ void TableModifier::parseDdl()
QString TableModifier::getTempTableName()
{
SchemaResolver resolver(db);
+ resolver.setIgnoreSystemObjects(true);
QString name = resolver.getUniqueName("sqlitestudio_temp_table", usedTempTableNames);
usedTempTableNames << name;
return name;
diff --git a/SQLiteStudio3/coreSQLiteStudio/tablemodifier.h b/SQLiteStudio3/coreSQLiteStudio/tablemodifier.h
index 7be5a2a..4c6af24 100644
--- a/SQLiteStudio3/coreSQLiteStudio/tablemodifier.h
+++ b/SQLiteStudio3/coreSQLiteStudio/tablemodifier.h
@@ -61,7 +61,7 @@ class API_EXPORT TableModifier
bool handleExprWithTrigTable(SqliteExpr* expr);
bool handleExpr(SqliteExpr* expr);
void simpleHandleIndexes();
- void simpleHandleTriggers(const QString& view = QString::null);
+ void simpleHandleTriggers(const QString& view = QString());
SqliteQueryPtr parseQuery(const QString& ddl);
/**
@@ -121,7 +121,6 @@ class API_EXPORT TableModifier
}
Db* db = nullptr;
- Dialect dialect;
/**
* @brief Database name. The "main" is default.
diff --git a/SQLiteStudio3/coreSQLiteStudio/translations.cpp b/SQLiteStudio3/coreSQLiteStudio/translations.cpp
index 362d4fa..dc53395 100644
--- a/SQLiteStudio3/coreSQLiteStudio/translations.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/translations.cpp
@@ -24,7 +24,7 @@ void loadTranslation(const QString& baseName)
for (const QString& dirPath : SQLITESTUDIO_TRANSLATION_DIRS)
{
- dir = dirPath;
+ dir.setPath(dirPath);
for (const QString& f : dir.entryList(filters))
{
res = translator->load(f, dirPath);
@@ -73,7 +73,7 @@ QStringList getAvailableTranslations()
QStringList filters = QStringList({"*_*.qm"});
for (const QString& dirPath : SQLITESTUDIO_TRANSLATION_DIRS)
{
- dir = dirPath;
+ dir.setPath(dirPath);
for (const QString& f : dir.entryList(filters))
{
match = re.match(f);
@@ -85,7 +85,7 @@ QStringList getAvailableTranslations()
}
locales << "en";
- return locales.toList();
+ return locales.values();
}
QMap<QString,QString> getAvailableLanguages()
diff --git a/SQLiteStudio3/coreSQLiteStudio/translations/coreSQLiteStudio_ru.ts b/SQLiteStudio3/coreSQLiteStudio/translations/coreSQLiteStudio_ru.ts
index 702c2f2..956c7f0 100644
--- a/SQLiteStudio3/coreSQLiteStudio/translations/coreSQLiteStudio_ru.ts
+++ b/SQLiteStudio3/coreSQLiteStudio/translations/coreSQLiteStudio_ru.ts
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
-<TS version="2.1" language="ru_RU">
+<TS version="2.0" language="ru_RU">
<context>
<name>AbstractDb</name>
<message>
@@ -19,7 +19,7 @@
<name>BugReporter</name>
<message>
<source>Invalid login or password</source>
- <translation type="vanished">Неправильный логин или пароль</translation>
+ <translation>Неправильный логин или пароль</translation>
</message>
</context>
<context>
@@ -149,12 +149,12 @@
<message>
<location filename="../services/impl/configimpl.cpp" line="863"/>
<source>Could not start database transaction for deleting SQL history, therefore it&apos;s not deleted.</source>
- <translation type="unfinished"></translation>
+ <translation>Невозможно начать транзакцию для удаления истории SQL, поэтому она не удалена.</translation>
</message>
<message>
<location filename="../services/impl/configimpl.cpp" line="870"/>
<source>Could not commit database transaction for deleting SQL history, therefore it&apos;s not deleted.</source>
- <translation type="unfinished"></translation>
+ <translation>Невозможно завершить транзакцию для удаления истории SQL, поэтому она не удалена.</translation>
</message>
</context>
<context>
@@ -805,7 +805,7 @@ Tables, indexes, triggers and views copied to database %3 will remain.</source>
<location filename="../db/abstractdb3.h" line="328"/>
<location filename="../db/abstractdb3.h" line="332"/>
<source>Could not load extension %1: %2</source>
- <translation type="unfinished"></translation>
+ <translation>Невозможно загрузить расширение %1: %2</translation>
</message>
<message>
<location filename="../db/abstractdb3.h" line="405"/>
@@ -1055,7 +1055,7 @@ The view will remain as it is.</source>
<message>
<location filename="../common/utils.cpp" line="1022"/>
<source>Could not open file &apos;%1&apos; for reading: %2</source>
- <translation type="unfinished"></translation>
+ <translation>Невозможно открыть файл &apos;%1&apos; для чтения: %2</translation>
</message>
</context>
<context>
@@ -1137,182 +1137,182 @@ The view will remain as it is.</source>
<name>UpdateManager</name>
<message>
<source>An error occurred while checking for updates: %1.</source>
- <translation type="vanished">При проверке обновлений возникла ошибка: %1</translation>
+ <translation>При проверке обновлений возникла ошибка: %1</translation>
</message>
<message>
<source>Could not check available updates, because server responded with invalid message format. It is safe to ignore this warning.</source>
- <translation type="vanished">Невозможно проверить наличие обновлений, так как ответ сервера имеет некорректный формат. Это предупреждение можно проигнорировать.</translation>
+ <translation>Невозможно проверить наличие обновлений, так как ответ сервера имеет некорректный формат. Это предупреждение можно проигнорировать.</translation>
</message>
<message>
<source>An error occurred while reading updates metadata: %1.</source>
- <translation type="vanished">При чтении метаданных об обновлениях возникла ошибка: %1</translation>
+ <translation>При чтении метаданных об обновлениях возникла ошибка: %1</translation>
</message>
<message>
<source>Could not download updates, because server responded with invalid message format. You can try again later or download and install updates manually. See &lt;a href=&quot;%1&quot;&gt;User Manual&lt;/a&gt; for details.</source>
- <translation type="vanished">Невозможно загрузить обновления, так как ответ сервера имеет некорректный формат. Вы можете попробовать снова позже или скачать и установить обновления вручную. Подробности смотрите в &lt;a href=&quot;%1&quot;&gt;Руководстве пользователя&lt;/a&gt;.</translation>
+ <translation>Невозможно загрузить обновления, так как ответ сервера имеет некорректный формат. Вы можете попробовать снова позже или скачать и установить обновления вручную. Подробности смотрите в &lt;a href=&quot;%1&quot;&gt;Руководстве пользователя&lt;/a&gt;.</translation>
</message>
<message>
<source>Could not create temporary directory for downloading the update. Updating aborted.</source>
- <translation type="vanished">Невозможно создать временный каталог для загрузки обновления. Обновление прервано.</translation>
+ <translation>Невозможно создать временный каталог для загрузки обновления. Обновление прервано.</translation>
</message>
<message>
<source>There was no updates to download. Updating aborted.</source>
- <translation type="vanished">Нет обновлений для загрузки. Обновление прервано.</translation>
+ <translation>Нет обновлений для загрузки. Обновление прервано.</translation>
</message>
<message>
<source>Downloading: %1</source>
- <translation type="vanished">Загрузка: %1</translation>
+ <translation>Загрузка: %1</translation>
</message>
<message>
<source>Could not determinate file name from update URL: %1. Updating aborted.</source>
- <translation type="vanished">Невозможно определить имя файла из URL обновления. Обновление прервано.</translation>
+ <translation>Невозможно определить имя файла из URL обновления. Обновление прервано.</translation>
</message>
<message>
<source>Failed to open file &apos;%1&apos; for writting: %2. Updating aborted.</source>
- <translation type="vanished">Не удалось открыть файл %1 для записи: %2. Обновление прервано.</translation>
+ <translation>Не удалось открыть файл %1 для записи: %2. Обновление прервано.</translation>
</message>
<message>
<source>Installing updates.</source>
- <translation type="vanished">Установка обновлений.</translation>
+ <translation>Установка обновлений.</translation>
</message>
<message>
<source>Could not copy current application directory into %1 directory.</source>
- <translation type="vanished">Невозможно скопировать текущий каталог приложения в каталог %1.</translation>
+ <translation>Невозможно скопировать текущий каталог приложения в каталог %1.</translation>
</message>
<message>
<source>Could not create directory %1.</source>
- <translation type="vanished">Невозможно создать каталог %1.</translation>
+ <translation>Невозможно создать каталог %1.</translation>
</message>
<message>
<source>Could not rename directory %1 to %2.
Details: %3</source>
- <translation type="vanished">Невозможно переименовать каталог %1 в %2.
+ <translation>Невозможно переименовать каталог %1 в %2.
Подробности: %3</translation>
</message>
<message>
<source>Cannot not rename directory %1 to %2.
Details: %3</source>
- <translation type="vanished">Невозможно переименовать каталог %1 в %2.
+ <translation>Невозможно переименовать каталог %1 в %2.
Подробности: %3</translation>
</message>
<message>
<source>Could not move directory %1 to %2 and also failed to restore original directory, so the original SQLiteStudio directory is now located at: %3</source>
- <translation type="vanished">Невозможно переместить каталог %1 в %2, а также не удалось восстановить оригинальный каталог, поэтому оригинальный каталог SQLiteStudio теперь расположен в: %3</translation>
+ <translation>Невозможно переместить каталог %1 в %2, а также не удалось восстановить оригинальный каталог, поэтому оригинальный каталог SQLiteStudio теперь расположен в: %3</translation>
</message>
<message>
<source>Could not rename directory %1 to %2. Rolled back to the original SQLiteStudio version.</source>
- <translation type="vanished">Невозможно переименовать каталог %1 в %2. Восстановлена изначальная версия SQLiteStudio.</translation>
+ <translation>Невозможно переименовать каталог %1 в %2. Восстановлена изначальная версия SQLiteStudio.</translation>
</message>
<message>
<source>Could not unpack component %1 into %2 directory.</source>
- <translation type="vanished">Невозможно распаковать компонент %1 в каталог %2.</translation>
+ <translation>Невозможно распаковать компонент %1 в каталог %2.</translation>
</message>
<message>
<source>Could not find permissions elevator application to run update as a root. Looked for: %1</source>
- <translation type="vanished">Невозможно найти приложение повышения привилегий для запуска обновления с правами root. Были испробованы: %1</translation>
+ <translation>Невозможно найти приложение повышения привилегий для запуска обновления с правами root. Были испробованы: %1</translation>
</message>
<message>
<source>Could not execute final updating steps as root: %1</source>
- <translation type="vanished">Невозможно выполнить финальные шаги обновления с правами root: %1</translation>
+ <translation>Невозможно выполнить финальные шаги обновления с правами root: %1</translation>
</message>
<message>
<source>Could not execute final updating steps as admin: %1</source>
- <translation type="vanished">Невозможно выполнить финальные шаги обновления с правами администратора: %1</translation>
+ <translation>Невозможно выполнить финальные шаги обновления с правами администратора: %1</translation>
</message>
<message>
<source>Cannot create temporary directory for updater.</source>
- <translation type="vanished">Невозможно создать временный каталог для установщика обновлений.</translation>
+ <translation>Невозможно создать временный каталог для установщика обновлений.</translation>
</message>
<message>
<source>Cannot create updater script file.</source>
- <translation type="vanished">Невозможно создать файл скрипта обновления.</translation>
+ <translation>Невозможно создать файл скрипта обновления.</translation>
</message>
<message>
<source>Updating canceled.</source>
- <translation type="vanished">Обновление отменено.</translation>
+ <translation>Обновление отменено.</translation>
</message>
<message>
<source>Could not execute final updating steps as administrator.</source>
- <translation type="vanished">Невозможно выполнить финальные шаги обновления с правами администратора.</translation>
+ <translation>Невозможно выполнить финальные шаги обновления с правами администратора.</translation>
</message>
<message>
<source>Could not execute final updating steps as administrator. Updater startup timed out.</source>
- <translation type="vanished">Невозможно выполнить финальные шаги обновления с правами администратора. Превышен тайм-аут запуска программы обновления.</translation>
+ <translation>Невозможно выполнить финальные шаги обновления с правами администратора. Превышен тайм-аут запуска программы обновления.</translation>
</message>
<message>
<source>Could not execute final updating steps as administrator. Updater operation timed out.</source>
- <translation type="vanished">Невозможно выполнить финальные шаги обновления с правами администратора. Превышен тайм-аут операции программы обновления.</translation>
+ <translation>Невозможно выполнить финальные шаги обновления с правами администратора. Превышен тайм-аут операции программы обновления.</translation>
</message>
<message>
<source>Could not clean up temporary directory %1. You can delete it manually at any time.</source>
- <translation type="vanished">Невозможно очистить временный каталог %1. Вы можете удалить его вручную в любое время.</translation>
+ <translation>Невозможно очистить временный каталог %1. Вы можете удалить его вручную в любое время.</translation>
</message>
<message>
<source>Could not run new version for continuing update.</source>
- <translation type="vanished">Невозможно запустить новую версию приложения для продолжения обновления.</translation>
+ <translation>Невозможно запустить новую версию приложения для продолжения обновления.</translation>
</message>
<message>
<source>Package not in tar.gz format, cannot install: %1</source>
- <translation type="vanished">Пакет не в формате tar.gz, установка невозможна: %1</translation>
+ <translation>Пакет не в формате tar.gz, установка невозможна: %1</translation>
</message>
<message>
<source>Package %1 cannot be installed, because cannot move it to directory: %2</source>
- <translation type="vanished">Пакет %1 не может быть установлен, так как невозможно перенести его в каталог: %2</translation>
+ <translation>Пакет %1 не может быть установлен, так как невозможно перенести его в каталог: %2</translation>
</message>
<message>
<source>Package %1 cannot be installed, because cannot unpack it: %2</source>
- <translation type="vanished">Пакет %1 не может быть установлен, так как его невозможно распаковать: %2</translation>
+ <translation>Пакет %1 не может быть установлен, так как его невозможно распаковать: %2</translation>
</message>
<message>
<source>Package not in zip format, cannot install: %1</source>
- <translation type="vanished">Пакет не в формате zip, установка невозможна: %1</translation>
+ <translation>Пакет не в формате zip, установка невозможна: %1</translation>
</message>
<message>
<source>Package %1 cannot be installed, because cannot unzip it to directory %2: %3</source>
- <translation type="vanished">Пакет %1 не может быть установлен, так как его невозможно распаковать в каталог %2: %3</translation>
+ <translation>Пакет %1 не может быть установлен, так как его невозможно распаковать в каталог %2: %3</translation>
</message>
<message>
<source>Package %1 cannot be installed, because cannot unzip it to directory: %2</source>
- <translation type="vanished">Пакет %1 не может быть установлен, так как его невозможно распаковать в каталог: %2</translation>
+ <translation>Пакет %1 не может быть установлен, так как его невозможно распаковать в каталог: %2</translation>
</message>
<message>
<source>Could not rename directory %1 to %2.</source>
- <translation type="vanished">Невозможно переименовать каталог %1 в %2.</translation>
+ <translation>Невозможно переименовать каталог %1 в %2.</translation>
</message>
<message>
<source>Could not delete directory %1.</source>
- <translation type="vanished">Невозможно удалить каталог %1.</translation>
+ <translation>Невозможно удалить каталог %1.</translation>
</message>
<message>
<source>Error executing update command: %1
Error message: %2</source>
- <translation type="vanished">Ошибка при выполнении команды обновления: %1
+ <translation>Ошибка при выполнении команды обновления: %1
Сообщение об ошибке: %2</translation>
</message>
<message>
<source>An error occurred while downloading updates: %1. Updating aborted.</source>
- <translation type="vanished">При загрузке обновлений произошла ошибка: %1. Обновление прервано.</translation>
+ <translation>При загрузке обновлений произошла ошибка: %1. Обновление прервано.</translation>
</message>
<message>
<location filename="../services/updatemanager.cpp" line="48"/>
<source>Updates installer executable is missing.</source>
- <translation type="unfinished"></translation>
+ <translation>Отсутствует исполняемый файл установщика обновлений.</translation>
</message>
<message>
<location filename="../services/updatemanager.cpp" line="49"/>
<location filename="../services/updatemanager.cpp" line="68"/>
<source>Unable to check for updates (%1)</source>
- <translation type="unfinished"></translation>
+ <translation>Невозможно проверить обновления (%1)</translation>
</message>
<message>
<location filename="../services/updatemanager.cpp" line="66"/>
<source>details are unknown</source>
- <translation type="unfinished"></translation>
+ <translation>подробности неизвестны</translation>
</message>
<message>
<location filename="../services/updatemanager.cpp" line="81"/>
<source>Unable to run updater application (%1). Please report this.</source>
- <translation type="unfinished"></translation>
+ <translation>Невозможно запустить установщик обновлений (%1). Ссообщите пожалуйста об этом разработчику.</translation>
</message>
</context>
</TS>
diff --git a/SQLiteStudio3/coreSQLiteStudio/translations/coreSQLiteStudio_zh_CN.ts b/SQLiteStudio3/coreSQLiteStudio/translations/coreSQLiteStudio_zh_CN.ts
index 2d84208..1d68aaa 100644
--- a/SQLiteStudio3/coreSQLiteStudio/translations/coreSQLiteStudio_zh_CN.ts
+++ b/SQLiteStudio3/coreSQLiteStudio/translations/coreSQLiteStudio_zh_CN.ts
@@ -7,12 +7,12 @@
<location filename="../db/abstractdb.cpp" line="343"/>
<location filename="../db/abstractdb.cpp" line="360"/>
<source>Cannot execute query on closed database.</source>
- <translation type="unfinished"></translation>
+ <translation>无法在关闭的数据库上执行查询。</translation>
</message>
<message>
<location filename="../db/abstractdb.cpp" line="643"/>
<source>Error attaching database %1: %2</source>
- <translation type="unfinished"></translation>
+ <translation>附加数据库 %1 时发生错误:%2</translation>
</message>
</context>
<context>
@@ -28,37 +28,37 @@
<location filename="../db/chainexecutor.cpp" line="37"/>
<source>The database for executing queries was not defined.</source>
<comment>chain executor</comment>
- <translation type="unfinished"></translation>
+ <translation>用于执行查询的数据库没有被定义。</translation>
</message>
<message>
<location filename="../db/chainexecutor.cpp" line="44"/>
<source>The database for executing queries was not open.</source>
<comment>chain executor</comment>
- <translation type="unfinished"></translation>
+ <translation>用于执行查询的数据库没有打开。</translation>
</message>
<message>
<location filename="../db/chainexecutor.cpp" line="54"/>
<source>Could not disable foreign keys in the database. Details: %1</source>
<comment>chain executor</comment>
- <translation type="unfinished"></translation>
+ <translation>无法在数据库中禁用外键。详情:%1</translation>
</message>
<message>
<location filename="../db/chainexecutor.cpp" line="62"/>
<source>Could not start a database transaction. Details: %1</source>
<comment>chain executor</comment>
- <translation type="unfinished"></translation>
+ <translation>无法开始数据库事务。详情:%1</translation>
</message>
<message>
<location filename="../db/chainexecutor.cpp" line="89"/>
<source>Interrupted</source>
<comment>chain executor</comment>
- <translation type="unfinished"></translation>
+ <translation>中断</translation>
</message>
<message>
<location filename="../db/chainexecutor.cpp" line="151"/>
<source>Could not commit a database transaction. Details: %1</source>
<comment>chain executor</comment>
- <translation type="unfinished"></translation>
+ <translation>无法提交数据库事务。详情:%1</translation>
</message>
</context>
<context>
@@ -66,82 +66,82 @@
<message>
<location filename="../completionhelper.cpp" line="196"/>
<source>New row reference</source>
- <translation type="unfinished"></translation>
+ <translation type="unfinished">新的行引用</translation>
</message>
<message>
<location filename="../completionhelper.cpp" line="203"/>
<source>Old row reference</source>
- <translation type="unfinished"></translation>
+ <translation type="unfinished">旧的行引用</translation>
</message>
<message>
<location filename="../completionhelper.cpp" line="208"/>
<source>New table name</source>
- <translation type="unfinished"></translation>
+ <translation>新的表名</translation>
</message>
<message>
<location filename="../completionhelper.cpp" line="211"/>
<source>New index name</source>
- <translation type="unfinished"></translation>
+ <translation>新的索引名</translation>
</message>
<message>
<location filename="../completionhelper.cpp" line="214"/>
<source>New view name</source>
- <translation type="unfinished"></translation>
+ <translation>新的视图名</translation>
</message>
<message>
<location filename="../completionhelper.cpp" line="217"/>
<source>New trigger name</source>
- <translation type="unfinished"></translation>
+ <translation>新的触发器名</translation>
</message>
<message>
<location filename="../completionhelper.cpp" line="220"/>
<source>Table or column alias</source>
- <translation type="unfinished"></translation>
+ <translation>表或字段别名</translation>
</message>
<message>
<location filename="../completionhelper.cpp" line="223"/>
<source>transaction name</source>
- <translation type="unfinished"></translation>
+ <translation>事务名</translation>
</message>
<message>
<location filename="../completionhelper.cpp" line="226"/>
<source>New column name</source>
- <translation type="unfinished"></translation>
+ <translation>新字段名</translation>
</message>
<message>
<location filename="../completionhelper.cpp" line="229"/>
<source>Column data type</source>
- <translation type="unfinished"></translation>
+ <translation>字段数据类型</translation>
</message>
<message>
<location filename="../completionhelper.cpp" line="232"/>
<source>Constraint name</source>
- <translation type="unfinished"></translation>
+ <translation>约束名</translation>
</message>
<message>
<location filename="../completionhelper.cpp" line="245"/>
<source>Error message</source>
- <translation type="unfinished"></translation>
+ <translation>错误信息</translation>
</message>
<message>
<location filename="../completionhelper.cpp" line="289"/>
<source>Collation name</source>
- <translation type="unfinished"></translation>
+ <translation>排序规则名</translation>
</message>
<message>
<location filename="../completionhelper.cpp" line="304"/>
<source>Any word</source>
- <translation type="unfinished"></translation>
+ <translation type="unfinished">任意单词</translation>
</message>
<message>
<location filename="../completionhelper.cpp" line="485"/>
<source>Default database</source>
- <translation type="unfinished"></translation>
+ <translation>默认数据库</translation>
</message>
<message>
<location filename="../completionhelper.cpp" line="486"/>
<source>Temporary objects database</source>
- <translation type="unfinished"></translation>
+ <translation type="unfinished">临时对象数据库</translation>
</message>
</context>
<context>
@@ -149,12 +149,12 @@
<message>
<location filename="../services/impl/configimpl.cpp" line="863"/>
<source>Could not start database transaction for deleting SQL history, therefore it&apos;s not deleted.</source>
- <translation type="unfinished"></translation>
+ <translation type="unfinished">无法为删除 SQL 历史开始数据库事务,因此它没有被删除。</translation>
</message>
<message>
<location filename="../services/impl/configimpl.cpp" line="870"/>
<source>Could not commit database transaction for deleting SQL history, therefore it&apos;s not deleted.</source>
- <translation type="unfinished"></translation>
+ <translation type="unfinished">无法为删除 SQL 历史提交数据库事务,因此它没有被删除。</translation>
</message>
</context>
<context>
@@ -162,18 +162,18 @@
<message>
<location filename="../services/impl/dbmanagerimpl.cpp" line="64"/>
<source>Could not add database %1: %2</source>
- <translation type="unfinished"></translation>
+ <translation>无法添加数据库 %1:%2</translation>
</message>
<message>
<location filename="../services/impl/dbmanagerimpl.cpp" line="139"/>
<source>Database %1 could not be updated, because of an error: %2</source>
- <translation type="unfinished"></translation>
+ <translation>数据库 %1 没有被更新,由于错误:%2</translation>
</message>
<message>
<location filename="../services/impl/dbmanagerimpl.cpp" line="355"/>
<location filename="../services/impl/dbmanagerimpl.cpp" line="384"/>
<source>Database file doesn&apos;t exist.</source>
- <translation type="unfinished"></translation>
+ <translation>数据库文件不存在</translation>
</message>
<message>
<location filename="../services/impl/dbmanagerimpl.cpp" line="357"/>
@@ -185,12 +185,12 @@
<message>
<location filename="../services/impl/dbmanagerimpl.cpp" line="527"/>
<source>Database could not be initialized.</source>
- <translation type="unfinished"></translation>
+ <translation>数据库无法被初始化。</translation>
</message>
<message>
<location filename="../services/impl/dbmanagerimpl.cpp" line="537"/>
<source>No suitable database driver plugin found.</source>
- <translation type="unfinished"></translation>
+ <translation>没有找到合适的数据库驱动插件</translation>
</message>
</context>
<context>
@@ -199,12 +199,12 @@
<location filename="../dbobjectorganizer.cpp" line="380"/>
<location filename="../dbobjectorganizer.cpp" line="412"/>
<source>Error while creating table in target database: %1</source>
- <translation type="unfinished"></translation>
+ <translation>在目标数据库中创建表时发生错误:%1</translation>
</message>
<message>
<location filename="../dbobjectorganizer.cpp" line="380"/>
<source>Could not parse table.</source>
- <translation type="unfinished"></translation>
+ <translation>无法解析表。</translation>
</message>
<message>
<location filename="../dbobjectorganizer.cpp" line="426"/>
@@ -214,14 +214,14 @@
<message>
<location filename="../dbobjectorganizer.cpp" line="447"/>
<source>Error while copying data for table %1: %2</source>
- <translation type="unfinished"></translation>
+ <translation>在从表 %1 中复制数据时发生错误:%2</translation>
</message>
<message>
<location filename="../dbobjectorganizer.cpp" line="466"/>
<location filename="../dbobjectorganizer.cpp" line="473"/>
<location filename="../dbobjectorganizer.cpp" line="496"/>
<source>Error while copying data to table %1: %2</source>
- <translation type="unfinished"></translation>
+ <translation>在向表 %1 中复制数据时发生错误:%2</translation>
</message>
<message>
<location filename="../dbobjectorganizer.cpp" line="535"/>
@@ -232,17 +232,17 @@ Tables, indexes, triggers and views copied to database %3 will remain.</source>
<message>
<location filename="../dbobjectorganizer.cpp" line="542"/>
<source>Error while creating view in target database: %1</source>
- <translation type="unfinished"></translation>
+ <translation>在目标数据库中创建视图时发生错误:%1</translation>
</message>
<message>
<location filename="../dbobjectorganizer.cpp" line="547"/>
<source>Error while creating index in target database: %1</source>
- <translation type="unfinished"></translation>
+ <translation>在目标数据库中创建索引时发生错误:%1</translation>
</message>
<message>
<location filename="../dbobjectorganizer.cpp" line="552"/>
<source>Error while creating trigger in target database: %1</source>
- <translation type="unfinished"></translation>
+ <translation>在目标数据库中创建触发器时发生错误:%1</translation>
</message>
<message>
<location filename="../dbobjectorganizer.cpp" line="773"/>
@@ -257,17 +257,17 @@ Tables, indexes, triggers and views copied to database %3 will remain.</source>
<message>
<location filename="../dbversionconverter.cpp" line="932"/>
<source>Target file exists, but could not be overwritten.</source>
- <translation type="unfinished"></translation>
+ <translation>目标文件存在,但无法被覆写。</translation>
</message>
<message>
<location filename="../dbversionconverter.cpp" line="951"/>
<source>Could not find proper database plugin to create target database.</source>
- <translation type="unfinished"></translation>
+ <translation>无法找到合适的数据库插件用以创建目标数据库。</translation>
</message>
<message>
<location filename="../dbversionconverter.cpp" line="1185"/>
<source>Error while converting database: %1</source>
- <translation type="unfinished"></translation>
+ <translation>转换数据库时发生错误:%1</translation>
</message>
</context>
<context>
@@ -276,25 +276,25 @@ Tables, indexes, triggers and views copied to database %3 will remain.</source>
<location filename="../ddlhistorymodel.cpp" line="65"/>
<source>Database name</source>
<comment>ddl history header</comment>
- <translation type="unfinished"></translation>
+ <translation>数据库名</translation>
</message>
<message>
<location filename="../ddlhistorymodel.cpp" line="67"/>
<source>Database file</source>
<comment>ddl history header</comment>
- <translation type="unfinished"></translation>
+ <translation>数据库文件</translation>
</message>
<message>
<location filename="../ddlhistorymodel.cpp" line="69"/>
<source>Date of execution</source>
<comment>ddl history header</comment>
- <translation type="unfinished"></translation>
+ <translation>执行日期</translation>
</message>
<message>
<location filename="../ddlhistorymodel.cpp" line="71"/>
<source>Changes</source>
<comment>ddl history header</comment>
- <translation type="unfinished"></translation>
+ <translation type="unfinished">影响</translation>
</message>
</context>
<context>
@@ -302,42 +302,42 @@ Tables, indexes, triggers and views copied to database %3 will remain.</source>
<message>
<location filename="../services/exportmanager.cpp" line="72"/>
<source>Export plugin %1 doesn&apos;t support exporing query results.</source>
- <translation type="unfinished"></translation>
+ <translation>导出插件 %1 不支持导出查询结果。</translation>
</message>
<message>
<location filename="../services/exportmanager.cpp" line="98"/>
<source>Export plugin %1 doesn&apos;t support exporing tables.</source>
- <translation type="unfinished"></translation>
+ <translation>导出插件 %1 不支持导出表。</translation>
</message>
<message>
<location filename="../services/exportmanager.cpp" line="122"/>
<source>Export plugin %1 doesn&apos;t support exporing databases.</source>
- <translation type="unfinished"></translation>
+ <translation>导出插件 %1 不支持导出数据库。</translation>
</message>
<message>
<location filename="../services/exportmanager.cpp" line="155"/>
<source>Export format &apos;%1&apos; is not supported. Supported formats are: %2.</source>
- <translation type="unfinished"></translation>
+ <translation type="unfinished">导出格式 &apos;%1&apos; 不受支持,受支持的格式是:%2。</translation>
</message>
<message>
<location filename="../services/exportmanager.cpp" line="218"/>
<source>Export to the clipboard was successful.</source>
- <translation type="unfinished"></translation>
+ <translation>成功导出到剪贴板。</translation>
</message>
<message>
<location filename="../services/exportmanager.cpp" line="222"/>
<source>Export to the file &apos;%1&apos; was successful.</source>
- <translation type="unfinished"></translation>
+ <translation>成功导出到文件 &apos;%1&apos;。</translation>
</message>
<message>
<location filename="../services/exportmanager.cpp" line="224"/>
<source>Export was successful.</source>
- <translation type="unfinished"></translation>
+ <translation>导出成功。</translation>
</message>
<message>
<location filename="../services/exportmanager.cpp" line="266"/>
<source>Could not export to file %1. File cannot be open for writting.</source>
- <translation type="unfinished"></translation>
+ <translation>无法导出到文件 %1。文件无法以写模式打开。</translation>
</message>
</context>
<context>
@@ -345,7 +345,7 @@ Tables, indexes, triggers and views copied to database %3 will remain.</source>
<message>
<location filename="../exportworker.cpp" line="122"/>
<source>Error while exporting query results: %1</source>
- <translation type="unfinished"></translation>
+ <translation>导出查询结果时发生错误:%1</translation>
</message>
<message>
<location filename="../exportworker.cpp" line="202"/>
@@ -356,7 +356,7 @@ Tables, indexes, triggers and views copied to database %3 will remain.</source>
<location filename="../exportworker.cpp" line="346"/>
<location filename="../exportworker.cpp" line="404"/>
<source>Could not parse %1 in order to export it. It will be excluded from the export output.</source>
- <translation type="unfinished"></translation>
+ <translation type="unfinished">无法为导出解析 %1。因此它将不会被包含在导出输出中。</translation>
</message>
<message>
<location filename="../exportworker.cpp" line="608"/>
@@ -379,43 +379,43 @@ Tables, indexes, triggers and views copied to database %3 will remain.</source>
<message>
<location filename="../services/impl/functionmanagerimpl.cpp" line="234"/>
<source>Invalid number of arguments to function &apos;%1&apos;. Expected %2, but got %3.</source>
- <translation type="unfinished"></translation>
+ <translation>无效的参数个数。对于函数 %1,需要 %2 个,但得到 %3 个。</translation>
</message>
<message>
<location filename="../services/impl/functionmanagerimpl.cpp" line="347"/>
<source>No such function registered in SQLiteStudio: %1(%2)</source>
- <translation type="unfinished"></translation>
+ <translation>没有这样的一个在 SQLiteStudio 中注册的函数:%1(%2)</translation>
</message>
<message>
<location filename="../services/impl/functionmanagerimpl.cpp" line="353"/>
<source>Function %1(%2) was registered with language %3, but the plugin supporting that language is not currently loaded.</source>
- <translation type="unfinished"></translation>
+ <translation>函数 %1(%2) 以 %3 语言被注册。但是支持该语言的插件没有被正确加载。</translation>
</message>
<message>
<location filename="../services/impl/functionmanagerimpl.cpp" line="371"/>
<source>Invalid regular expression pattern: %1</source>
- <translation type="unfinished"></translation>
+ <translation>无效的正则表达式:%1</translation>
</message>
<message>
<location filename="../services/impl/functionmanagerimpl.cpp" line="390"/>
<location filename="../services/impl/functionmanagerimpl.cpp" line="423"/>
<source>Could not open file %1 for reading: %2</source>
- <translation type="unfinished"></translation>
+ <translation>无法以读模式打开文件 %1:%2</translation>
</message>
<message>
<location filename="../services/impl/functionmanagerimpl.cpp" line="445"/>
<source>Could not open file %1 for writting: %2</source>
- <translation type="unfinished"></translation>
+ <translation>无法以写模式打开文件 %1:%2</translation>
</message>
<message>
<location filename="../services/impl/functionmanagerimpl.cpp" line="465"/>
<source>Error while writting to file %1: %2</source>
- <translation type="unfinished"></translation>
+ <translation>写入文件 %1 时发生错误:%2</translation>
</message>
<message>
<location filename="../services/impl/functionmanagerimpl.cpp" line="483"/>
<source>Unsupported scripting language: %1</source>
- <translation type="unfinished"></translation>
+ <translation>不支持的脚本语言:%1</translation>
</message>
</context>
<context>
@@ -423,7 +423,7 @@ Tables, indexes, triggers and views copied to database %3 will remain.</source>
<message>
<location filename="../plugins/genericexportplugin.cpp" line="20"/>
<source>Could not initialize text codec for exporting. Using default codec: %1</source>
- <translation type="unfinished"></translation>
+ <translation>无法为导出初始化文本编解码器。使用默认的编解码器:%1</translation>
</message>
</context>
<context>
@@ -431,7 +431,7 @@ Tables, indexes, triggers and views copied to database %3 will remain.</source>
<message>
<location filename="../services/importmanager.cpp" line="96"/>
<source>Imported data to the table &apos;%1&apos; successfully.</source>
- <translation type="unfinished"></translation>
+ <translation>成功导入数据至表 %1</translation>
</message>
</context>
<context>
@@ -444,22 +444,22 @@ Tables, indexes, triggers and views copied to database %3 will remain.</source>
<message>
<location filename="../importworker.cpp" line="30"/>
<source>Could not start transaction in order to import a data: %1</source>
- <translation type="unfinished"></translation>
+ <translation>无法为导入数据开始事务:%1</translation>
</message>
<message>
<location filename="../importworker.cpp" line="52"/>
<source>Could not commit transaction for imported data: %1</source>
- <translation type="unfinished"></translation>
+ <translation>无法为导入数据提交事务:%1</translation>
</message>
<message>
<location filename="../importworker.cpp" line="100"/>
<source>Table &apos;%1&apos; has less columns than there are columns in the data to be imported. Excessive data columns will be ignored.</source>
- <translation type="unfinished"></translation>
+ <translation>表 %1 的字段数少于即将导入数据的字段数。过多的字段将会被忽略。</translation>
</message>
<message>
<location filename="../importworker.cpp" line="105"/>
<source>Table &apos;%1&apos; has more columns than there are columns in the data to be imported. Some columns in the table will be left empty.</source>
- <translation type="unfinished"></translation>
+ <translation>表 %1 的字段数多于即将导入数据的字段数。一些字段将会被置为空值。</translation>
</message>
<message>
<location filename="../importworker.cpp" line="124"/>
@@ -471,19 +471,19 @@ Tables, indexes, triggers and views copied to database %3 will remain.</source>
<location filename="../importworker.cpp" line="177"/>
<location filename="../importworker.cpp" line="184"/>
<source>Error while importing data: %1</source>
- <translation type="unfinished"></translation>
+ <translation>导入数据时发生错误:%1</translation>
</message>
<message>
<location filename="../importworker.cpp" line="133"/>
<location filename="../importworker.cpp" line="184"/>
<source>Interrupted.</source>
<comment>import process status update</comment>
- <translation type="unfinished"></translation>
+ <translation>中断。</translation>
</message>
<message>
<location filename="../importworker.cpp" line="172"/>
<source>Could not import data row number %1. The row was ignored. Problem details: %2</source>
- <translation type="unfinished"></translation>
+ <translation>无法导入行数为 %1 的数据,该行将会被忽略。问题详情:%2</translation>
</message>
</context>
<context>
@@ -491,34 +491,34 @@ Tables, indexes, triggers and views copied to database %3 will remain.</source>
<message>
<location filename="../services/impl/pluginmanagerimpl.cpp" line="543"/>
<source>Cannot load plugin %1, because it&apos;s in conflict with plugin %2.</source>
- <translation type="unfinished"></translation>
+ <translation>无法加载插件 %1,因为它与这些插件冲突:%2。</translation>
</message>
<message>
<location filename="../services/impl/pluginmanagerimpl.cpp" line="554"/>
<source>Cannot load plugin %1, because its dependency was not loaded: %2.</source>
- <translation type="unfinished"></translation>
+ <translation>无法加载插件 %1,因为它依赖的这些插件没有被加载:%2。</translation>
</message>
<message>
<location filename="../services/impl/pluginmanagerimpl.cpp" line="563"/>
<source>Cannot load plugin %1. Error details: %2</source>
- <translation type="unfinished"></translation>
+ <translation>无法加载插件 %1。错误详情:52</translation>
</message>
<message>
<location filename="../services/impl/pluginmanagerimpl.cpp" line="579"/>
<source>Cannot load plugin %1 (error while initializing plugin).</source>
- <translation type="unfinished"></translation>
+ <translation>无法加载插件 %1(初始化插件时发生错误)。</translation>
</message>
<message>
<location filename="../services/impl/pluginmanagerimpl.cpp" line="731"/>
<source>min: %1</source>
<comment>plugin dependency version</comment>
- <translation type="unfinished"></translation>
+ <translation>最小:%1</translation>
</message>
<message>
<location filename="../services/impl/pluginmanagerimpl.cpp" line="732"/>
<source>max: %1</source>
<comment>plugin dependency version</comment>
- <translation type="unfinished"></translation>
+ <translation>最大:%1</translation>
</message>
</context>
<context>
@@ -527,7 +527,7 @@ Tables, indexes, triggers and views copied to database %3 will remain.</source>
<location filename="../plugins/populateconstant.cpp" line="10"/>
<source>Constant</source>
<comment>populate constant plugin name</comment>
- <translation type="unfinished"></translation>
+ <translation>常量</translation>
</message>
</context>
<context>
@@ -535,7 +535,7 @@ Tables, indexes, triggers and views copied to database %3 will remain.</source>
<message>
<location filename="../plugins/populateconstant.ui" line="20"/>
<source>Constant value:</source>
- <translation type="unfinished"></translation>
+ <translation>常量值:</translation>
</message>
</context>
<context>
@@ -544,7 +544,7 @@ Tables, indexes, triggers and views copied to database %3 will remain.</source>
<location filename="../plugins/populatedictionary.cpp" line="15"/>
<source>Dictionary</source>
<comment>dictionary populating plugin name</comment>
- <translation type="unfinished"></translation>
+ <translation type="unfinished">字典</translation>
</message>
</context>
<context>
@@ -552,27 +552,27 @@ Tables, indexes, triggers and views copied to database %3 will remain.</source>
<message>
<location filename="../plugins/populatedictionary.ui" line="20"/>
<source>Dictionary file</source>
- <translation type="unfinished"></translation>
+ <translation type="unfinished">字典文件</translation>
</message>
<message>
<location filename="../plugins/populatedictionary.ui" line="29"/>
<source>Pick dictionary file</source>
- <translation type="unfinished"></translation>
+ <translation type="unfinished">选择字典文件</translation>
</message>
<message>
<location filename="../plugins/populatedictionary.ui" line="39"/>
<source>Word separator</source>
- <translation type="unfinished"></translation>
+ <translation>文本分隔符</translation>
</message>
<message>
<location filename="../plugins/populatedictionary.ui" line="45"/>
<source>Whitespace</source>
- <translation type="unfinished"></translation>
+ <translation>空白</translation>
</message>
<message>
<location filename="../plugins/populatedictionary.ui" line="58"/>
<source>Line break</source>
- <translation type="unfinished"></translation>
+ <translation type="unfinished">换行</translation>
</message>
<message>
<location filename="../plugins/populatedictionary.ui" line="74"/>
@@ -582,12 +582,12 @@ Tables, indexes, triggers and views copied to database %3 will remain.</source>
<message>
<location filename="../plugins/populatedictionary.ui" line="80"/>
<source>Ordered</source>
- <translation type="unfinished"></translation>
+ <translation type="unfinished">有序的</translation>
</message>
<message>
<location filename="../plugins/populatedictionary.ui" line="93"/>
<source>Randomly</source>
- <translation type="unfinished"></translation>
+ <translation type="unfinished">随机地</translation>
</message>
</context>
<context>
@@ -603,7 +603,7 @@ Tables, indexes, triggers and views copied to database %3 will remain.</source>
<message>
<location filename="../plugins/populaterandom.cpp" line="12"/>
<source>Random number</source>
- <translation type="unfinished"></translation>
+ <translation type="unfinished">随机数</translation>
</message>
</context>
<context>
@@ -611,32 +611,32 @@ Tables, indexes, triggers and views copied to database %3 will remain.</source>
<message>
<location filename="../plugins/populaterandom.ui" line="20"/>
<source>Constant prefix</source>
- <translation type="unfinished"></translation>
+ <translation type="unfinished">常量前缀</translation>
</message>
<message>
<location filename="../plugins/populaterandom.ui" line="26"/>
<source>No prefix</source>
- <translation type="unfinished"></translation>
+ <translation type="unfinished">无前缀</translation>
</message>
<message>
<location filename="../plugins/populaterandom.ui" line="39"/>
<source>Minimum value</source>
- <translation type="unfinished"></translation>
+ <translation type="unfinished">最小值</translation>
</message>
<message>
<location filename="../plugins/populaterandom.ui" line="61"/>
<source>Maximum value</source>
- <translation type="unfinished"></translation>
+ <translation type="unfinished">最大值</translation>
</message>
<message>
<location filename="../plugins/populaterandom.ui" line="86"/>
<source>Constant suffix</source>
- <translation type="unfinished"></translation>
+ <translation type="unfinished">常量后缀</translation>
</message>
<message>
<location filename="../plugins/populaterandom.ui" line="92"/>
<source>No suffix</source>
- <translation type="unfinished"></translation>
+ <translation type="unfinished">无后缀</translation>
</message>
</context>
<context>
@@ -644,7 +644,7 @@ Tables, indexes, triggers and views copied to database %3 will remain.</source>
<message>
<location filename="../plugins/populaterandomtext.cpp" line="12"/>
<source>Random text</source>
- <translation type="unfinished"></translation>
+ <translation type="unfinished">随机文本</translation>
</message>
</context>
<context>
@@ -657,12 +657,12 @@ Tables, indexes, triggers and views copied to database %3 will remain.</source>
<message>
<location filename="../plugins/populaterandomtext.ui" line="36"/>
<source>Minimum length</source>
- <translation type="unfinished"></translation>
+ <translation>最小长度</translation>
</message>
<message>
<location filename="../plugins/populaterandomtext.ui" line="64"/>
<source>Letters from a to z.</source>
- <translation type="unfinished"></translation>
+ <translation>字母a到z。</translation>
</message>
<message>
<location filename="../plugins/populaterandomtext.ui" line="67"/>
@@ -672,22 +672,22 @@ Tables, indexes, triggers and views copied to database %3 will remain.</source>
<message>
<location filename="../plugins/populaterandomtext.ui" line="77"/>
<source>Numbers from 0 to 9.</source>
- <translation type="unfinished"></translation>
+ <translation>数字0到9</translation>
</message>
<message>
<location filename="../plugins/populaterandomtext.ui" line="80"/>
<source>Numeric</source>
- <translation type="unfinished"></translation>
+ <translation>数字</translation>
</message>
<message>
<location filename="../plugins/populaterandomtext.ui" line="90"/>
<source>A whitespace, a tab and a new line character.</source>
- <translation type="unfinished"></translation>
+ <translation></translation>
</message>
<message>
<location filename="../plugins/populaterandomtext.ui" line="93"/>
<source>Whitespace</source>
- <translation type="unfinished"></translation>
+ <translation>空白</translation>
</message>
<message>
<location filename="../plugins/populaterandomtext.ui" line="103"/>
@@ -697,7 +697,7 @@ Tables, indexes, triggers and views copied to database %3 will remain.</source>
<message>
<location filename="../plugins/populaterandomtext.ui" line="106"/>
<source>Binary</source>
- <translation type="unfinished"></translation>
+ <translation type="unfinished">二进制</translation>
</message>
<message>
<location filename="../plugins/populaterandomtext.ui" line="119"/>
@@ -707,7 +707,7 @@ Tables, indexes, triggers and views copied to database %3 will remain.</source>
<message>
<location filename="../plugins/populaterandomtext.ui" line="132"/>
<source>Maximum length</source>
- <translation type="unfinished"></translation>
+ <translation>最大长度</translation>
</message>
<message>
<location filename="../plugins/populaterandomtext.ui" line="160"/>
@@ -720,7 +720,7 @@ Tables, indexes, triggers and views copied to database %3 will remain.</source>
<message>
<location filename="../plugins/populatescript.cpp" line="13"/>
<source>Script</source>
- <translation type="unfinished"></translation>
+ <translation>脚本</translation>
</message>
</context>
<context>
@@ -728,22 +728,22 @@ Tables, indexes, triggers and views copied to database %3 will remain.</source>
<message>
<location filename="../plugins/populatescript.ui" line="26"/>
<source>Initialization code (optional)</source>
- <translation type="unfinished"></translation>
+ <translation>初始化代码(可选)</translation>
</message>
<message>
<location filename="../plugins/populatescript.ui" line="45"/>
<source>Per step code</source>
- <translation type="unfinished"></translation>
+ <translation>每一步代码</translation>
</message>
<message>
<location filename="../plugins/populatescript.ui" line="70"/>
<source>Language</source>
- <translation type="unfinished"></translation>
+ <translation>语言</translation>
</message>
<message>
<location filename="../plugins/populatescript.ui" line="89"/>
<source>Help</source>
- <translation type="unfinished"></translation>
+ <translation>帮助</translation>
</message>
</context>
<context>
@@ -751,7 +751,7 @@ Tables, indexes, triggers and views copied to database %3 will remain.</source>
<message>
<location filename="../plugins/populatesequence.cpp" line="13"/>
<source>Sequence</source>
- <translation type="unfinished"></translation>
+ <translation type="unfinished">序列</translation>
</message>
</context>
<context>
@@ -759,12 +759,12 @@ Tables, indexes, triggers and views copied to database %3 will remain.</source>
<message>
<location filename="../plugins/populatesequence.ui" line="33"/>
<source>Start value:</source>
- <translation type="unfinished"></translation>
+ <translation>开始值:</translation>
</message>
<message>
<location filename="../plugins/populatesequence.ui" line="56"/>
<source>Step:</source>
- <translation type="unfinished"></translation>
+ <translation>步数:</translation>
</message>
</context>
<context>
@@ -791,7 +791,7 @@ Tables, indexes, triggers and views copied to database %3 will remain.</source>
<location filename="../db/abstractdb2.h" line="222"/>
<location filename="../db/abstractdb3.h" line="384"/>
<source>Could not open database: %1</source>
- <translation type="unfinished"></translation>
+ <translation>无法打开数据库:%1</translation>
</message>
<message>
<location filename="../db/abstractdb2.h" line="833"/>
@@ -803,12 +803,12 @@ Tables, indexes, triggers and views copied to database %3 will remain.</source>
<location filename="../db/abstractdb3.h" line="328"/>
<location filename="../db/abstractdb3.h" line="332"/>
<source>Could not load extension %1: %2</source>
- <translation type="unfinished"></translation>
+ <translation>无法加载扩展 %1:%2</translation>
</message>
<message>
<location filename="../db/abstractdb3.h" line="405"/>
<source>Could not close database: %1</source>
- <translation type="unfinished"></translation>
+ <translation>无法关闭数据库:%1</translation>
</message>
<message>
<location filename="../dbversionconverter.cpp" line="138"/>
@@ -865,7 +865,7 @@ Error details: %2</source>
<message>
<location filename="../impl/dbattacherimpl.cpp" line="115"/>
<source>Could not attach database %1: %2</source>
- <translation type="unfinished"></translation>
+ <translation>无法附加数据库 %1:%2</translation>
</message>
<message>
<location filename="../parser/parsercontext.cpp" line="108"/>
@@ -877,33 +877,33 @@ Error details: %2</source>
<location filename="../parser/sqlite2_parse.cpp" line="1904"/>
<location filename="../parser/sqlite3_parse.cpp" line="2212"/>
<source>Parser stack overflow</source>
- <translation type="unfinished"></translation>
+ <translation>解析堆栈溢出</translation>
</message>
<message>
<location filename="../parser/sqlite2_parse.cpp" line="4465"/>
<location filename="../parser/sqlite3_parse.cpp" line="5195"/>
<source>Syntax error</source>
- <translation type="unfinished"></translation>
+ <translation>语法错误</translation>
</message>
<message>
<location filename="../plugins/populatedictionary.cpp" line="30"/>
<source>Could not open dictionary file %1 for reading.</source>
- <translation type="unfinished"></translation>
+ <translation>无法以读模式打开字典文件 %1。</translation>
</message>
<message>
<location filename="../plugins/populatedictionary.cpp" line="91"/>
<source>Dictionary file must exist and be readable.</source>
- <translation type="unfinished"></translation>
+ <translation>字典文件必须存在且可读。</translation>
</message>
<message>
<location filename="../plugins/populaterandom.cpp" line="53"/>
<source>Maximum value cannot be less than minimum value.</source>
- <translation type="unfinished"></translation>
+ <translation>最大值不饿能小于最小值。</translation>
</message>
<message>
<location filename="../plugins/populaterandomtext.cpp" line="77"/>
<source>Maximum length cannot be less than minimum length.</source>
- <translation type="unfinished"></translation>
+ <translation>最大长度不能小于最小长度。</translation>
</message>
<message>
<location filename="../plugins/populaterandomtext.cpp" line="88"/>
@@ -913,7 +913,7 @@ Error details: %2</source>
<message>
<location filename="../plugins/populatescript.cpp" line="40"/>
<source>Could not find plugin to support scripting language: %1</source>
- <translation type="unfinished"></translation>
+ <translation>无法找到插件去支持脚本语言:%1</translation>
</message>
<message>
<location filename="../plugins/populatescript.cpp" line="58"/>
@@ -928,12 +928,12 @@ Error details: %2</source>
<message>
<location filename="../plugins/populatescript.cpp" line="112"/>
<source>Select implementation language.</source>
- <translation type="unfinished"></translation>
+ <translation>选择实现语言。</translation>
</message>
<message>
<location filename="../plugins/populatescript.cpp" line="113"/>
<source>Implementation code cannot be empty.</source>
- <translation type="unfinished"></translation>
+ <translation>实现代码不得为空。</translation>
</message>
<message>
<location filename="../selectresolver.cpp" line="359"/>
@@ -960,7 +960,7 @@ Error details: %2</source>
<location filename="../sqlitestudio.cpp" line="306"/>
<source>Database support</source>
<comment>plugin category name</comment>
- <translation type="unfinished"></translation>
+ <translation>数据库支持</translation>
</message>
<message>
<location filename="../sqlitestudio.cpp" line="307"/>
@@ -972,19 +972,19 @@ Error details: %2</source>
<location filename="../sqlitestudio.cpp" line="308"/>
<source>Scripting languages</source>
<comment>plugin category name</comment>
- <translation type="unfinished"></translation>
+ <translation>脚本语言</translation>
</message>
<message>
<location filename="../sqlitestudio.cpp" line="309"/>
<source>Exporting</source>
<comment>plugin category name</comment>
- <translation type="unfinished"></translation>
+ <translation>导出</translation>
</message>
<message>
<location filename="../sqlitestudio.cpp" line="310"/>
<source>Importing</source>
<comment>plugin category name</comment>
- <translation type="unfinished"></translation>
+ <translation>导入</translation>
</message>
<message>
<location filename="../sqlitestudio.cpp" line="311"/>
@@ -1010,7 +1010,7 @@ Error details: %2</source>
<message>
<location filename="../tablemodifier.cpp" line="528"/>
<source>Cannot not update trigger %1 according to table %2 modification.</source>
- <translation type="unfinished"></translation>
+ <translation>无法根据表 %2 的修改去更新触发器 %1。</translation>
</message>
<message>
<location filename="../tablemodifier.cpp" line="708"/>
@@ -1048,7 +1048,7 @@ The view will remain as it is.</source>
<message>
<location filename="../common/utils.cpp" line="1022"/>
<source>Could not open file &apos;%1&apos; for reading: %2</source>
- <translation type="unfinished"></translation>
+ <translation>无法以读模式打开文件 &apos;%1&apos;:%2</translation>
</message>
</context>
<context>
@@ -1056,17 +1056,17 @@ The view will remain as it is.</source>
<message>
<location filename="../db/queryexecutor.cpp" line="186"/>
<source>Execution interrupted.</source>
- <translation type="unfinished"></translation>
+ <translation>执行被中断。</translation>
</message>
<message>
<location filename="../db/queryexecutor.cpp" line="227"/>
<source>Database is not open.</source>
- <translation type="unfinished"></translation>
+ <translation>数据库没有打开。</translation>
</message>
<message>
<location filename="../db/queryexecutor.cpp" line="235"/>
<source>Only one query can be executed simultaneously.</source>
- <translation type="unfinished"></translation>
+ <translation type="unfinished">只能同时执行一个查询。</translation>
</message>
<message>
<location filename="../db/queryexecutor.cpp" line="339"/>
@@ -1077,7 +1077,7 @@ The view will remain as it is.</source>
<message>
<location filename="../db/queryexecutor.cpp" line="529"/>
<source>SQLiteStudio was unable to extract metadata from the query. Results won&apos;t be editable.</source>
- <translation type="unfinished"></translation>
+ <translation>SQLiteStudio 无法从查询中提取元数据。结果将不可编辑。</translation>
</message>
</context>
<context>
@@ -1090,7 +1090,7 @@ The view will remain as it is.</source>
<message>
<location filename="../plugins/scriptingqtdbproxy.cpp" line="65"/>
<source>Error from %1: %2</source>
- <translation type="unfinished"></translation>
+ <translation>来自 %1 的错误:%2</translation>
</message>
</context>
<context>
@@ -1099,31 +1099,31 @@ The view will remain as it is.</source>
<location filename="../sqlhistorymodel.cpp" line="34"/>
<source>Database</source>
<comment>sql history header</comment>
- <translation type="unfinished"></translation>
+ <translation>数据库</translation>
</message>
<message>
<location filename="../sqlhistorymodel.cpp" line="36"/>
<source>Execution date</source>
<comment>sql history header</comment>
- <translation type="unfinished"></translation>
+ <translation>执行代码</translation>
</message>
<message>
<location filename="../sqlhistorymodel.cpp" line="38"/>
<source>Time spent</source>
<comment>sql history header</comment>
- <translation type="unfinished"></translation>
+ <translation>耗时</translation>
</message>
<message>
<location filename="../sqlhistorymodel.cpp" line="40"/>
<source>Rows affected</source>
<comment>sql history header</comment>
- <translation type="unfinished"></translation>
+ <translation>影响的行数</translation>
</message>
<message>
<location filename="../sqlhistorymodel.cpp" line="42"/>
<source>SQL</source>
<comment>sql history header</comment>
- <translation type="unfinished"></translation>
+ <translation>SQL</translation>
</message>
</context>
<context>
@@ -1131,23 +1131,23 @@ The view will remain as it is.</source>
<message>
<location filename="../services/updatemanager.cpp" line="48"/>
<source>Updates installer executable is missing.</source>
- <translation type="unfinished"></translation>
+ <translation>缺少更新安装程序可执行文件。</translation>
</message>
<message>
<location filename="../services/updatemanager.cpp" line="49"/>
<location filename="../services/updatemanager.cpp" line="68"/>
<source>Unable to check for updates (%1)</source>
- <translation type="unfinished"></translation>
+ <translation>无法检查更新(%1)</translation>
</message>
<message>
<location filename="../services/updatemanager.cpp" line="66"/>
<source>details are unknown</source>
- <translation type="unfinished"></translation>
+ <translation>无法得知详情</translation>
</message>
<message>
<location filename="../services/updatemanager.cpp" line="81"/>
<source>Unable to run updater application (%1). Please report this.</source>
- <translation type="unfinished"></translation>
+ <translation type="unfinished">无法运行更新安装器(%1)。请报告这个问题。</translation>
</message>
</context>
</TS>
diff --git a/SQLiteStudio3/coreSQLiteStudio/viewmodifier.cpp b/SQLiteStudio3/coreSQLiteStudio/viewmodifier.cpp
index 1c03770..172aa69 100644
--- a/SQLiteStudio3/coreSQLiteStudio/viewmodifier.cpp
+++ b/SQLiteStudio3/coreSQLiteStudio/viewmodifier.cpp
@@ -14,12 +14,11 @@ ViewModifier::ViewModifier(Db* db, const QString& view) :
ViewModifier::ViewModifier(Db* db, const QString& database, const QString& view) :
db(db), database(database), view(view)
{
- dialect = db->getDialect();
}
void ViewModifier::alterView(const QString& newView)
{
- Parser parser(dialect);
+ Parser parser;
if (!parser.parse(newView) || parser.getQueries().size() == 0)
{
errors << QObject::tr("Could not parse DDL of the view to be created. Details: %1").arg(parser.getErrorString());
@@ -42,7 +41,7 @@ void ViewModifier::alterView(SqliteCreateViewPtr newView)
{
createView = newView;
- addMandatorySql(QString("DROP VIEW %1").arg(wrapObjIfNeeded(view, dialect)));
+ addMandatorySql(QString("DROP VIEW %1").arg(wrapObjIfNeeded(view)));
addMandatorySql(newView->detokenize());
collectNewColumns();
@@ -57,7 +56,7 @@ void ViewModifier::handleTriggers()
QList<SqliteCreateTriggerPtr> triggers = resolver.getParsedTriggersForView(view, true);
for (SqliteCreateTriggerPtr trigger : triggers)
{
- addOptionalSql(QString("DROP TRIGGER %1").arg(wrapObjIfNeeded(trigger->trigger, dialect)));
+ addOptionalSql(QString("DROP TRIGGER %1").arg(wrapObjIfNeeded(trigger->trigger)));
if (!handleNewColumns(trigger))
continue;
diff --git a/SQLiteStudio3/coreSQLiteStudio/viewmodifier.h b/SQLiteStudio3/coreSQLiteStudio/viewmodifier.h
index 6d7c770..b7bf95a 100644
--- a/SQLiteStudio3/coreSQLiteStudio/viewmodifier.h
+++ b/SQLiteStudio3/coreSQLiteStudio/viewmodifier.h
@@ -29,7 +29,6 @@ class API_EXPORT ViewModifier
bool handleNewColumns(SqliteCreateTriggerPtr trigger);
Db* db = nullptr;
- Dialect dialect;
QString database;
QString view;