rhodes 2.3.2 → 2.4.0.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +18 -0
- data/CREDITS +38 -0
- data/README.md +2 -2
- data/Rakefile +60 -2
- data/bin/set-rhodes-sdk.bat +1 -0
- data/doc/application.txt +11 -0
- data/doc/build.txt +156 -39
- data/doc/configuration.txt +1 -10
- data/doc/connect-to-web-services.txt +6 -6
- data/doc/device-caps.txt +48 -5
- data/doc/extensions.txt +8 -1
- data/doc/rhom.txt +16 -0
- data/doc/synchronization.txt +56 -14
- data/doc/ui.txt +23 -2
- data/installer/instant-rhodes.nsi +6 -6
- data/lib/extensions/barcode/ext/barcode/platform/iphone/Barcode.xcodeproj/project.pbxproj +4 -2
- data/lib/extensions/barcode/ext/barcode/platform/wm/Rakefile +1 -1
- data/lib/extensions/digest-md5/ext/Rakefile +3 -3
- data/lib/extensions/digest-md5/ext/build +0 -1
- data/lib/extensions/digest-sha1/ext/Rakefile +1 -1
- data/lib/extensions/digest-sha1/ext/build +0 -1
- data/lib/extensions/digest/ext/Rakefile +3 -3
- data/lib/extensions/digest/ext/build +0 -1
- data/lib/extensions/fcntl/ext/Rakefile +1 -1
- data/lib/extensions/mspec/mspec/guards/guard.rb +4 -0
- data/lib/extensions/mspec/mspec/helpers/environment.rb +4 -0
- data/lib/extensions/nfc/ext.yml +2 -0
- data/lib/extensions/nfc/ext/build +12 -0
- data/lib/extensions/nfc/ext/build.bat +8 -0
- data/lib/extensions/nfc/ext/nfc/platform/android/AndroidManifest.xml +25 -0
- data/lib/extensions/nfc/ext/nfc/platform/android/Rakefile +94 -0
- data/lib/extensions/nfc/ext/nfc/platform/android/ext_build.files +4 -0
- data/lib/extensions/nfc/ext/nfc/platform/android/jni/src/nfc.cpp +404 -0
- data/lib/extensions/nfc/ext/nfc/platform/android/src/com/nfc/Nfc.java +138 -0
- data/lib/extensions/nfc/ext/nfc/platform/android/src/com/nfc/NfcMessage.java +34 -0
- data/lib/extensions/nfc/ext/nfc/platform/android/src/com/nfc/NfcMessagePack.java +33 -0
- data/lib/extensions/nfc/ext/nfc/platform/android/src/com/nfc/NfcRecord.java +149 -0
- data/lib/extensions/nfc/ext/nfc/shared/ruby/nfc.i +22 -0
- data/lib/extensions/nfc/ext/nfc/shared/ruby/nfc_wrap.c +2034 -0
- data/lib/extensions/nfc/nfc.rb +120 -0
- data/lib/extensions/rholang/{lang_ca.rb → rholang/lang_ca.rb} +0 -0
- data/lib/extensions/rholang/{lang_cf.rb → rholang/lang_cf.rb} +0 -0
- data/lib/extensions/rholang/{lang_chef.rb → rholang/lang_chef.rb} +0 -0
- data/lib/extensions/rholang/{lang_cs.rb → rholang/lang_cs.rb} +0 -0
- data/lib/extensions/rholang/{lang_da.rb → rholang/lang_da.rb} +0 -0
- data/lib/extensions/rholang/{lang_de.rb → rholang/lang_de.rb} +0 -0
- data/lib/extensions/rholang/{lang_es.rb → rholang/lang_es.rb} +0 -0
- data/lib/extensions/rholang/{lang_es_ar.rb → rholang/lang_es_ar.rb} +0 -0
- data/lib/extensions/rholang/{lang_fi.rb → rholang/lang_fi.rb} +0 -0
- data/lib/extensions/rholang/{lang_fr.rb → rholang/lang_fr.rb} +0 -0
- data/lib/extensions/rholang/{lang_it.rb → rholang/lang_it.rb} +0 -0
- data/lib/extensions/rholang/{lang_ko.rb → rholang/lang_ko.rb} +0 -0
- data/lib/extensions/rholang/{lang_nl.rb → rholang/lang_nl.rb} +0 -0
- data/lib/extensions/rholang/{lang_no.rb → rholang/lang_no.rb} +0 -0
- data/lib/extensions/rholang/{lang_pt.rb → rholang/lang_pt.rb} +0 -0
- data/lib/extensions/rholang/{lang_pt_br.rb → rholang/lang_pt_br.rb} +0 -0
- data/lib/extensions/rholang/{lang_ru.rb → rholang/lang_ru.rb} +0 -0
- data/lib/extensions/rholang/{lang_se.rb → rholang/lang_se.rb} +0 -0
- data/lib/extensions/rholang/{lang_sr.rb → rholang/lang_sr.rb} +0 -0
- data/lib/extensions/rholang/{rhoerror_ru.rb → rholang/rhoerror_ru.rb} +0 -0
- data/lib/extensions/rholang/{rhomsg_ru.rb → rholang/rhomsg_ru.rb} +0 -0
- data/lib/framework/date/format.rb +2 -0
- data/lib/framework/dateOrig.rb +17 -8
- data/lib/framework/rational18.rb +532 -0
- data/lib/framework/res/back_btn.wp7.png +0 -0
- data/lib/framework/res/blue_pushpin.wp7.png +0 -0
- data/lib/framework/res/blue_pushpin_small.wp7.png +0 -0
- data/lib/framework/res/callout.wp7.png +0 -0
- data/lib/framework/res/callout_link.wp7.png +0 -0
- data/lib/framework/res/esri.wp7.png +0 -0
- data/lib/framework/res/forward_btn.wp7.png +0 -0
- data/lib/framework/res/home_btn.wp7.png +0 -0
- data/lib/framework/res/options_btn.wp7.png +0 -0
- data/lib/framework/res/refresh_btn.wp7.png +0 -0
- data/lib/framework/rho/render.rb +8 -1
- data/lib/framework/rho/rho.rb +30 -7
- data/lib/framework/rho/rhoapplication.rb +9 -4
- data/lib/framework/rho/rhofsconnector.rb +5 -1
- data/lib/framework/rho/rhotabbar.rb +8 -0
- data/lib/framework/rho/rhotoolbar.rb +1 -1
- data/lib/framework/rho/rhoviewhelpers.rb +18 -1
- data/lib/framework/rhodes.rb +1 -1
- data/lib/framework/rhoframework.rb +46 -1
- data/lib/framework/rholang/localization_simplified.rb +17 -16
- data/lib/framework/rhom/rhom_db_adapter.rb +2 -2
- data/lib/framework/rhom/rhom_object_factory.rb +115 -12
- data/lib/framework/rhosystem.rb +135 -0
- data/lib/framework/version.rb +1 -1
- data/lib/rhodes.rb +1 -1
- data/lib/test/apps/rhoconfig.txt +23 -23
- data/platform/android/Rhodes/AndroidManifest.full.xml +101 -0
- data/platform/android/Rhodes/AndroidManifest.xml +10 -15
- data/platform/android/Rhodes/default.properties +11 -0
- data/platform/android/Rhodes/gen/com/rhomobile/rhodes/R.java +59 -53
- data/platform/android/Rhodes/jni/include/rhodes.h +1 -0
- data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_RhodesApplication.h +21 -0
- data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_alert_PopupActivity.h +21 -0
- data/platform/android/Rhodes/jni/include/rhodes/jni/com_rhomobile_rhodes_file_RhoFileApi.h +10 -2
- data/platform/android/Rhodes/jni/src/alert.cpp +2 -1
- data/platform/android/Rhodes/jni/src/datetimepicker.cpp +2 -0
- data/platform/android/Rhodes/jni/src/fileapi.cpp +671 -84
- data/platform/android/Rhodes/jni/src/nativebar.cpp +18 -0
- data/platform/android/Rhodes/jni/src/rhodes.cpp +92 -1
- data/platform/android/Rhodes/res/values/styles.xml +7 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/BaseActivity.java +35 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Capabilities.java +12 -13
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/LocalFileProvider.java +130 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/NativeBar.java +6 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/PushReceiver.java +5 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/PushService.java +6 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhoMenu.java +7 -36
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivity.java +43 -20
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesApplication.java +2 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +63 -28
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Utils.java +2 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/WebView.java +6 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/alert/Alert.java +19 -282
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/alert/PopupActivity.java +354 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/datetime/DateTimePickerScreen.java +4 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/event/EventStore.java +1 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/file/RhoFileApi.java +71 -5
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/geolocation/GeoLocationImpl.java +107 -37
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +10 -7
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/TabbedMainView.java +156 -56
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mapview/MapView.java +0 -1
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/ContactAccessorNew.java +40 -32
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/signature/SignatureView.java +1 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/uri/ExternalHttpHandler.java +14 -6
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/uri/LocalFileHandler.java +46 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/uri/MailUriHandler.java +4 -24
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/uri/UriHandler.java +3 -1
- data/platform/android/build/RhodesSRC_build.files +28 -25
- data/platform/android/build/android.rake +230 -54
- data/platform/android/build/androidcommon.rb +1 -1
- data/platform/android/build/librhocommon_build.files +1 -0
- data/platform/bb/Hsqldb/BlackBerry_App_Descriptor.xml +20 -0
- data/platform/bb/Hsqldb/src/com/rho/db/HsqlDBResult.java +1 -5
- data/platform/bb/Hsqldb/src/com/rho/db/HsqlDBStorage.java +6 -1
- data/platform/bb/Hsqldb/src/org/hsqldb/rowio/RowOutputBase.java +1 -1
- data/platform/bb/Hsqldb/src/org/hsqldb/rowio/RowOutputBinary.java +1 -1
- data/platform/bb/RubyVM/BlackBerry_App_Descriptor.xml +20 -0
- data/platform/bb/RubyVM/src/com/rho/IRhoRubyHelper.java +2 -0
- data/platform/bb/RubyVM/src/com/rho/RhoLogOutputSink.java +0 -1
- data/platform/bb/RubyVM/src/com/rho/RhoLogger.java +12 -10
- data/platform/bb/RubyVM/src/com/rho/RhoThread.java +16 -0
- data/platform/bb/RubyVM/src/com/rho/RhoTimer.java +89 -0
- data/platform/bb/RubyVM/src/com/rho/RhodesApp.java +20 -13
- data/platform/bb/RubyVM/src/com/rho/SplashScreen.java +1 -2
- data/platform/bb/RubyVM/src/com/rho/ThreadQueue.java +2 -2
- data/platform/bb/RubyVM/src/com/rho/TimeInterval.java +5 -0
- data/platform/bb/RubyVM/src/com/rho/db/DBAdapter.java +54 -48
- data/platform/bb/RubyVM/src/com/rho/db/IDBResult.java +0 -1
- data/platform/bb/RubyVM/src/com/rho/db/IDBStorage.java +1 -0
- data/platform/bb/RubyVM/src/com/rho/net/AsyncHttp.java +1 -1
- data/platform/bb/RubyVM/src/com/rho/sync/ClientRegister.java +1 -1
- data/platform/bb/RubyVM/src/com/rho/sync/JSONStructIterator.java +1 -1
- data/platform/bb/RubyVM/src/com/rho/sync/SyncEngine.java +16 -8
- data/platform/bb/RubyVM/src/com/rho/sync/SyncNotify.java +2 -2
- data/platform/bb/RubyVM/src/com/rho/sync/SyncSource.java +52 -29
- data/platform/bb/RubyVM/src/com/rho/sync/SyncThread.java +1 -3
- data/platform/bb/build/RubyVM_build.files +1 -0
- data/platform/bb/build/bb.rake +29 -9
- data/platform/bb/rhodes/BlackBerry_App_Descriptor.xml +23 -0
- data/platform/bb/rhodes/platform/5.0/com/rho/RhodesApplicationPlatform.java +1 -1
- data/platform/bb/rhodes/platform/5.0/com/rho/db/SqliteCopyResult.java +0 -4
- data/platform/bb/rhodes/platform/5.0/com/rho/db/SqliteResult.java +13 -20
- data/platform/bb/rhodes/platform/5.0/com/rho/db/SqliteStorage.java +183 -157
- data/platform/bb/rhodes/src/com/rho/RhoRubyHelper.java +22 -0
- data/platform/bb/rhodes/src/com/rho/RhodesApplicationPlatform.java +1 -1
- data/platform/bb/rhodes/src/com/rho/db/SqliteCopyResult.java +0 -4
- data/platform/bb/rhodes/src/com/rho/db/SqliteResult.java +13 -20
- data/platform/bb/rhodes/src/com/rho/db/SqliteStorage.java +183 -157
- data/platform/bb/rhodes/src/com/rho/rubyext/System.java +46 -1
- data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +8 -1
- data/platform/bb/rhodes/src/rhomobile/camera/CameraFilesListener.java +13 -3
- data/platform/iphone/Classes/AppManager/AppManager.h +5 -1
- data/platform/iphone/Classes/AppManager/AppManager.m +170 -7
- data/platform/iphone/Classes/DateTimePicker.m +14 -1
- data/platform/iphone/Classes/DateTimePickerDelegate.h +2 -0
- data/platform/iphone/Classes/DateTimePickerDelegate.m +36 -2
- data/platform/iphone/Classes/NativeBar.h +1 -0
- data/platform/iphone/Classes/NativeBar.m +15 -3
- data/platform/iphone/Classes/Phonebook/phonebook.m +8 -9
- data/platform/iphone/Classes/Rhodes.m +50 -6
- data/platform/iphone/Classes/SimpleMainView.m +7 -6
- data/platform/iphone/Classes/SplitView/RightViewController.h +3 -1
- data/platform/iphone/Classes/SplitView/RightViewController.m +14 -1
- data/platform/iphone/Classes/TabbedMainView.h +4 -0
- data/platform/iphone/Classes/TabbedMainView.m +43 -26
- data/platform/iphone/Info.plist +1 -1
- data/platform/iphone/RhoLib/RhoLib.xcodeproj/project.pbxproj +4 -0
- data/platform/iphone/curl/curl.xcodeproj/project.pbxproj +3 -3
- data/platform/iphone/rbuild/iphone.rake +168 -119
- data/platform/iphone/rhoextlib/rhoextlib.xcodeproj/project.pbxproj +4 -2
- data/platform/iphone/rhorubylib/rhorubylib.xcodeproj/project.pbxproj +3 -3
- data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +2 -2
- data/platform/iphone/rhosynclib/rhosynclib.xcodeproj/project.pbxproj +3 -3
- data/platform/shared/SyncClient/SyncClient.cpp +20 -8
- data/platform/shared/SyncClient/SyncClient.h +2 -1
- data/platform/shared/common/RhoDefs.h +4 -0
- data/platform/shared/common/RhoPort.h +22 -0
- data/platform/shared/common/RhoStd.h +5 -0
- data/platform/shared/common/RhoTime.cpp +73 -0
- data/platform/shared/common/RhoTime.h +26 -53
- data/platform/shared/common/RhodesApp.cpp +29 -28
- data/platform/shared/common/RhodesApp.h +4 -1
- data/platform/shared/common/StringConverter.h +37 -10
- data/platform/shared/common/app_build_capabilities.h +2 -0
- data/platform/shared/common/rhoparams.cpp +25 -12
- data/platform/shared/common/rhoparams.h +10 -8
- data/platform/shared/db/DBAdapter.cpp +0 -22
- data/platform/shared/json/RJSONTokener.c +15 -23
- data/platform/shared/net/AsyncHttp.cpp +9 -8
- data/platform/shared/net/HttpServer.cpp +61 -19
- data/platform/shared/net/HttpServer.h +2 -0
- data/platform/shared/ruby/ext/datetimepicker/datetimepicker.i +3 -0
- data/platform/shared/ruby/ext/datetimepicker/datetimepicker_wrap.c +151 -402
- data/platform/shared/ruby/ext/nativebar/nativebar.i +3 -0
- data/platform/shared/ruby/ext/nativebar/nativebar_wrap.c +154 -403
- data/platform/shared/ruby/ext/rho/rhoruby.c +4 -0
- data/platform/shared/ruby/ext/rho/rhoruby.h +2 -0
- data/platform/shared/ruby/ext/system/system.i +8 -0
- data/platform/shared/ruby/ext/system/system_wrap.c +80 -5
- data/platform/shared/ruby/file.c +6 -4
- data/platform/shared/ruby/gc.c +1 -1
- data/platform/shared/ruby/linux/ruby/config.h +7 -2
- data/platform/shared/ruby/missing/acosh.c +3 -3
- data/platform/shared/ruby/wince/_time.h +1 -1
- data/platform/shared/ruby/wince/stdlib.c +1 -1
- data/platform/shared/ruby/wince/string_wce.c +2 -2
- data/platform/shared/ruby/wince/sys/timeb.c +1 -0
- data/platform/shared/ruby/wince/time_wce.c +8 -0
- data/platform/shared/ruby/wince/wince.c +7 -7
- data/platform/shared/ruby/wince/wince.h +22 -0
- data/platform/shared/rubyext/System.cpp +19 -1
- data/platform/shared/sqlite/sqlite3.c +18993 -8129
- data/platform/shared/sqlite/sqlite3.h +953 -358
- data/platform/shared/sqlite/sqlite3ext.h +42 -0
- data/platform/shared/sync/SyncEngine.cpp +10 -0
- data/platform/shared/sync/SyncSource.cpp +41 -19
- data/platform/shared/sync/SyncSource.h +1 -1
- data/platform/shared/tcmalloc/rhomem.h +7 -2
- data/platform/shared/tcmalloc/windows/port.h +2 -0
- data/platform/shared/unzip/unzip.cpp +1 -0
- data/platform/shared/xruby/src/com/xruby/compiler/parser/RubyParser.java +11 -1
- data/platform/wm/RhoLib/RhoLib.vcproj +182 -24
- data/platform/wm/build/wm.rake +16 -3
- data/platform/wm/rhodes.sln +106 -113
- data/platform/wm/rhodes/Alert.cpp +6 -7
- data/platform/wm/rhodes/AppManager.cpp +8 -17
- data/platform/wm/rhodes/DateTimePicker.cpp +3 -0
- data/platform/wm/rhodes/DateTimePicker.h +2 -0
- data/platform/wm/rhodes/MainWindow.cpp +36 -16
- data/platform/wm/rhodes/MainWindow.h +6 -3
- data/platform/wm/rhodes/OutlookApp.cpp +3 -3
- data/platform/wm/rhodes/Rhodes.cpp +46 -27
- data/platform/wm/rhodes/Rhodes.rc +16 -3
- data/platform/wm/rhodes/RingtoneManager.cpp +7 -7
- data/platform/wm/rhodes/RingtoneManager.h +1 -1
- data/platform/wm/rhodes/Utils.cpp +2 -1
- data/platform/wm/rhodes/bluetooth/Bluetooth.cpp +1 -13
- data/platform/wm/rhodes/bluetooth/Bluetooth.h +1 -2
- data/platform/wm/rhodes/camera/Camera.cpp +6 -12
- data/platform/wm/rhodes/phonebook/phonebook.cpp +11 -11
- data/platform/wm/rhodes/phonebook/phonebook.h +1 -1
- data/platform/wm/rhodes/resource.h +3 -1
- data/platform/wm/rhodes/rho/net/NetRequestImpl.cpp +7 -5
- data/platform/wm/rhodes/rho/rubyext/GeoLocationImpl.cpp +6 -6
- data/platform/wm/rhodes/rho/rubyext/GeoLocationImpl.h +1 -1
- data/platform/wm/rhodes/rho/rubyext/NativeToolbar.cpp +6 -1
- data/platform/wm/rhodes/rho/rubyext/SystemImpl.cpp +84 -19
- data/platform/wm/rhodes/rho/rubyext/calendar.cpp +2 -2
- data/platform/wm/rhodes/rhodes.vcproj +316 -73
- data/platform/wm/rhodes/signature/Signature.cpp +336 -6
- data/platform/wm/rhodes/signature/Signature.h +55 -0
- data/platform/wm/rhodes/stdafx.h +7 -4
- data/platform/wm/rubylib/rubylib.vcproj +261 -91
- data/platform/wm/sqlite3/sqlite3.vcproj +223 -69
- data/platform/wm/syncengine/syncengine.vcproj +220 -66
- data/platform/wm/tcmalloc/tcmalloc.vcproj +197 -43
- data/platform/wp7/IronRuby/Languages/Ruby/Ruby/Builtins/ConsoleStream.cs +107 -0
- data/platform/wp7/IronRuby/Languages/Ruby/Ruby/Runtime/Loader.cs +1037 -0
- data/platform/wp7/IronRuby/Languages/Ruby/Ruby/Runtime/RubyUtils.cs +1476 -0
- data/platform/wp7/RhoAppRunner/Program.cs +55 -0
- data/platform/wp7/RhoAppRunner/Properties/AssemblyInfo.cs +36 -0
- data/platform/wp7/RhoAppRunner/RhoAppRunner.csproj +69 -0
- data/platform/wp7/RhoRubyExtGen/GenerateInitializers.cmd +7 -0
- data/platform/wp7/RhoRubyExtGen/Properties/AssemblyInfo.cs +36 -0
- data/platform/wp7/RhoRubyExtGen/RhoAsyncHttp.cs +38 -0
- data/platform/wp7/RhoRubyExtGen/RhoDatabase.cs +93 -0
- data/platform/wp7/RhoRubyExtGen/RhoJSON.cs +37 -0
- data/platform/wp7/RhoRubyExtGen/RhoNativeBar.cs +106 -0
- data/platform/wp7/RhoRubyExtGen/RhoRubyExtGen.csproj +75 -0
- data/platform/wp7/RhoRubyExtGen/RhoSyncEngine.cs +123 -0
- data/platform/wp7/RhoRubyExtGen/RhoWebView.cs +42 -0
- data/platform/wp7/RhoRubyLib/Initializers.Generated.cs +309 -0
- data/platform/wp7/RhoRubyLib/Properties/AssemblyInfo.cs +36 -0
- data/platform/wp7/RhoRubyLib/RhoAppAdapter.cs +96 -0
- data/platform/wp7/RhoRubyLib/RhoRuby.cs +296 -0
- data/platform/wp7/RhoRubyLib/RhoRubyLib.csproj +155 -0
- data/platform/wp7/RhoRubyLib/WP_PlatformAdaptationLayer.cs +107 -0
- data/platform/wp7/RhoRubyLib/common/IInputStream.cs +21 -0
- data/platform/wp7/RhoRubyLib/common/Mutex.cs +30 -0
- data/platform/wp7/RhoRubyLib/common/RhoConf.cs +389 -0
- data/platform/wp7/RhoRubyLib/common/RhoEmptyProfiler.cs +27 -0
- data/platform/wp7/RhoRubyLib/common/RhoFile.cs +332 -0
- data/platform/wp7/RhoRubyLib/common/RhoFilePath.cs +89 -0
- data/platform/wp7/RhoRubyLib/common/RhoParamArray.cs +33 -0
- data/platform/wp7/RhoRubyLib/common/RhoParams.cs +66 -0
- data/platform/wp7/RhoRubyLib/common/RhoProfiler.cs +145 -0
- data/platform/wp7/RhoRubyLib/common/RhoResourceMap.cs +68 -0
- data/platform/wp7/RhoRubyLib/common/RhoStd.cs +205 -0
- data/platform/wp7/RhoRubyLib/common/RhoThread.cs +114 -0
- data/platform/wp7/RhoRubyLib/common/RhodesApp.cs +504 -0
- data/platform/wp7/RhoRubyLib/common/ThreadQueue.cs +199 -0
- data/platform/wp7/RhoRubyLib/common/TimeInterval.cs +56 -0
- data/platform/wp7/RhoRubyLib/common/Tokenizer.cs +52 -0
- data/platform/wp7/RhoRubyLib/db/DBAdapter.cs +1129 -0
- data/platform/wp7/RhoRubyLib/db/DBAttrManager.cs +92 -0
- data/platform/wp7/RhoRubyLib/db/DBException.cs +35 -0
- data/platform/wp7/RhoRubyLib/db/IDBCallback.cs +10 -0
- data/platform/wp7/RhoRubyLib/db/IDBResult.cs +33 -0
- data/platform/wp7/RhoRubyLib/db/IDBStorage.cs +32 -0
- data/platform/wp7/RhoRubyLib/db/SqliteCopyResult.cs +79 -0
- data/platform/wp7/RhoRubyLib/db/SqliteResult.cs +267 -0
- data/platform/wp7/RhoRubyLib/db/SqliteStorage.cs +319 -0
- data/platform/wp7/RhoRubyLib/json/JSONArrayIterator.cs +63 -0
- data/platform/wp7/RhoRubyLib/json/JSONEntry.cs +96 -0
- data/platform/wp7/RhoRubyLib/json/JSONStructIterator.cs +77 -0
- data/platform/wp7/RhoRubyLib/json/JsonParser.cs +483 -0
- data/platform/wp7/RhoRubyLib/json/RJSONTokener.cs +406 -0
- data/platform/wp7/RhoRubyLib/logging/IRhoLogSink.cs +12 -0
- data/platform/wp7/RhoRubyLib/logging/RhoLogConf.cs +161 -0
- data/platform/wp7/RhoRubyLib/logging/RhoLogFileSink.cs +174 -0
- data/platform/wp7/RhoRubyLib/logging/RhoLogger.cs +320 -0
- data/platform/wp7/RhoRubyLib/net/AsyncHttp.cs +362 -0
- data/platform/wp7/RhoRubyLib/net/HttpServer.cs +466 -0
- data/platform/wp7/RhoRubyLib/net/NetRequest.cs +717 -0
- data/platform/wp7/RhoRubyLib/net/NetResponse.cs +64 -0
- data/platform/wp7/RhoRubyLib/net/URI.cs +187 -0
- data/platform/wp7/RhoRubyLib/rubyext/RhoAsyncHttp.cs +43 -0
- data/platform/wp7/RhoRubyLib/rubyext/RhoDatabase.cs +177 -0
- data/platform/wp7/RhoRubyLib/rubyext/RhoJSON.cs +39 -0
- data/platform/wp7/RhoRubyLib/rubyext/RhoKernelOps.cs +19 -0
- data/platform/wp7/RhoRubyLib/rubyext/RhoNativeBar.cs +117 -0
- data/platform/wp7/RhoRubyLib/rubyext/RhoSyncEngine.cs +199 -0
- data/platform/wp7/RhoRubyLib/rubyext/RhoWebView.cs +49 -0
- data/platform/wp7/RhoRubyLib/sync/ClientRegister.cs +142 -0
- data/platform/wp7/RhoRubyLib/sync/ISyncProtocol.cs +23 -0
- data/platform/wp7/RhoRubyLib/sync/ISyncStatusListener.cs +10 -0
- data/platform/wp7/RhoRubyLib/sync/SyncEngine.cs +1051 -0
- data/platform/wp7/RhoRubyLib/sync/SyncNotify.cs +651 -0
- data/platform/wp7/RhoRubyLib/sync/SyncProtocol_3.cs +79 -0
- data/platform/wp7/RhoRubyLib/sync/SyncSource.cs +1105 -0
- data/platform/wp7/RhoRubyLib/sync/SyncThread.cs +301 -0
- data/platform/wp7/WPApplication.sln +50 -0
- data/platform/wp7/WPApplication/App.xaml +19 -0
- data/platform/wp7/WPApplication/App.xaml.cs +211 -0
- data/platform/wp7/WPApplication/ApplicationIcon.png +0 -0
- data/platform/wp7/WPApplication/Background.png +0 -0
- data/platform/wp7/WPApplication/MainPage.xaml +44 -0
- data/platform/wp7/WPApplication/MainPage.xaml.cs +132 -0
- data/platform/wp7/WPApplication/Properties/AppManifest.xml +6 -0
- data/platform/wp7/WPApplication/Properties/AssemblyInfo.cs +35 -0
- data/platform/wp7/WPApplication/Properties/WMAppManifest.xml +32 -0
- data/platform/wp7/WPApplication/SplashScreenImage.jpg +0 -0
- data/platform/wp7/WPApplication/WPApplication.csproj +201 -0
- data/platform/wp7/WPApplication/WP_PlatformAdaptationLayer.cs +88 -0
- data/platform/wp7/WPApplication/app_manifest.txt +1 -0
- data/platform/wp7/WPApplication/readme.htm +40 -0
- data/platform/wp7/WPApplication/readme2.htm +37 -0
- data/platform/wp7/WPApplication/rho/apps/app/Model1/edit.bb.erb +29 -0
- data/platform/wp7/WPApplication/rho/apps/app/Model1/edit.erb +32 -0
- data/platform/wp7/WPApplication/rho/apps/app/Model1/index.bb.erb +21 -0
- data/platform/wp7/WPApplication/rho/apps/app/Model1/index.erb +26 -0
- data/platform/wp7/WPApplication/rho/apps/app/Model1/model1.rb +10 -0
- data/platform/wp7/WPApplication/rho/apps/app/Model1/model1_controller.rb +58 -0
- data/platform/wp7/WPApplication/rho/apps/app/Model1/new.bb.erb +29 -0
- data/platform/wp7/WPApplication/rho/apps/app/Model1/new.erb +31 -0
- data/platform/wp7/WPApplication/rho/apps/app/Model1/show.bb.erb +26 -0
- data/platform/wp7/WPApplication/rho/apps/app/Model1/show.erb +28 -0
- data/platform/wp7/WPApplication/rho/apps/app/Settings/controller.rb +75 -0
- data/platform/wp7/WPApplication/rho/apps/app/Settings/home.bb.erb +17 -0
- data/platform/wp7/WPApplication/rho/apps/app/Settings/home.erb +20 -0
- data/platform/wp7/WPApplication/rho/apps/app/Settings/index.bb.erb +32 -0
- data/platform/wp7/WPApplication/rho/apps/app/Settings/index.erb +30 -0
- data/platform/wp7/WPApplication/rho/apps/app/Settings/login.bb.erb +35 -0
- data/platform/wp7/WPApplication/rho/apps/app/Settings/login.erb +27 -0
- data/platform/wp7/WPApplication/rho/apps/app/Settings/reset.bb.erb +15 -0
- data/platform/wp7/WPApplication/rho/apps/app/Settings/reset.erb +17 -0
- data/platform/wp7/WPApplication/rho/apps/app/Settings/wait.bb.erb +3 -0
- data/platform/wp7/WPApplication/rho/apps/app/Settings/wait.erb +5 -0
- data/platform/wp7/WPApplication/rho/apps/app/application.rb +16 -0
- data/platform/wp7/WPApplication/rho/apps/app/helpers/application_helper.rb +126 -0
- data/platform/wp7/WPApplication/rho/apps/app/helpers/browser_helper.rb +18 -0
- data/platform/wp7/WPApplication/rho/apps/app/index.bb.erb +26 -0
- data/platform/wp7/WPApplication/rho/apps/app/index.erb +26 -0
- data/platform/wp7/WPApplication/rho/apps/app/layout.erb +45 -0
- data/platform/wp7/WPApplication/rho/apps/app/loading.html +11 -0
- data/platform/wp7/WPApplication/rho/apps/app_manifest.txt +1 -0
- data/platform/wp7/WPApplication/rho/apps/public/css/android.css +330 -0
- data/platform/wp7/WPApplication/rho/apps/public/css/blackberry.css +115 -0
- data/platform/wp7/WPApplication/rho/apps/public/css/iphone.css +410 -0
- data/platform/wp7/WPApplication/rho/apps/public/css/windows_mobile.css +222 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/IUI_LICENSE.txt +21 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/android/btn_check_off.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/android/btn_check_on.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/android/btn_radio_off.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/android/btn_radio_on.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/android/disclosure.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/android/ic_menu_more.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/backButton.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/blueButton.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/cancel.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/grayButton.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/disclosure.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/disclosure_detail.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/backButton.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/blueButton.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/cancel.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/chevron.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/grayButton.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/listArrowSel.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/listGroup.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/loading.gif +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/on_off.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/pinstripes.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/selection.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/thumb.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/toggle.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/toggleOn.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/toolButton.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/toolbar.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/jqtouch/whiteButton.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/radiobutton.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/select.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iphone/switch.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/iui-logo-touch-icon.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/listArrow.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/listArrowDown.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/listArrowSel.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/listGroup.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/loading.gif +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/pinstripes.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/right_button.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/selection.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/thumb.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/toggle.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/toggleOn.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/toolButton.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/toolButton_new.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/toolbar.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/images/whiteButton.png +0 -0
- data/platform/wp7/WPApplication/rho/apps/public/jqtouch/jqtouch-iphone.css +9 -0
- data/platform/wp7/WPApplication/rho/apps/public/jqtouch/jqtouch.css +374 -0
- data/platform/wp7/WPApplication/rho/apps/public/jqtouch/jqtouch.js +742 -0
- data/platform/wp7/WPApplication/rho/apps/public/jqtouch/jqtouch.transitions.js +60 -0
- data/platform/wp7/WPApplication/rho/apps/public/jqtouch/jquery.1.3.2.min.js +19 -0
- data/platform/wp7/WPApplication/rho/apps/public/js/application.js +1 -0
- data/platform/wp7/WPApplication/rho/apps/public/js/rho.js +4 -0
- data/platform/wp7/WPApplication/rho/apps/public/js/rhogeolocation-wm.js +59 -0
- data/platform/wp7/WPApplication/rho/apps/public/js/rhogeolocation.js +11 -0
- data/platform/wp7/WPApplication/rho/apps/rhoconfig.txt +32 -0
- data/platform/wp7/WPApplication/rhoconfig.txt +32 -0
- data/platform/wp7/WPApplication/windows_mobile.css +222 -0
- data/platform/wp7/build/wp.rake +261 -0
- data/platform/wp7/rhodes.sln +79 -0
- data/platform/wp7/rhodes/App.xaml +19 -0
- data/platform/wp7/rhodes/App.xaml.cs +144 -0
- data/platform/wp7/rhodes/Background.png +0 -0
- data/platform/wp7/rhodes/MainPage.xaml +44 -0
- data/platform/wp7/rhodes/MainPage.xaml.cs +98 -0
- data/platform/wp7/rhodes/Properties/AppManifest.xml +6 -0
- data/platform/wp7/rhodes/Properties/AssemblyInfo.cs +35 -0
- data/platform/wp7/rhodes/Properties/WMAppManifest.xml +31 -0
- data/platform/wp7/rhodes/Rhodes.csproj +127 -0
- data/platform/wp7/rhodes/SplashScreenImage.jpg +0 -0
- data/platform/wp7/rhodes/icon.png +0 -0
- data/platform/wp7/sqlite3/Properties/AssemblyInfo.cs +35 -0
- data/platform/wp7/sqlite3/SQLiteClient.cs +550 -0
- data/platform/wp7/sqlite3/SqliteWrapper/BtreeInt_h.cs +774 -0
- data/platform/wp7/sqlite3/SqliteWrapper/Btree_h.cs +280 -0
- data/platform/wp7/sqlite3/SqliteWrapper/ClassDiagram1.cd +1306 -0
- data/platform/wp7/sqlite3/SqliteWrapper/Delagates.cs +365 -0
- data/platform/wp7/sqlite3/SqliteWrapper/Hash_h.cs +133 -0
- data/platform/wp7/sqlite3/SqliteWrapper/VdbeInt_h.cs +620 -0
- data/platform/wp7/sqlite3/SqliteWrapper/Vdbe_h.cs +302 -0
- data/platform/wp7/sqlite3/SqliteWrapper/_Custom.cs +449 -0
- data/platform/wp7/sqlite3/SqliteWrapper/alter_c.cs +872 -0
- data/platform/wp7/sqlite3/SqliteWrapper/analyze_c.cs +757 -0
- data/platform/wp7/sqlite3/SqliteWrapper/attach_c.cs +628 -0
- data/platform/wp7/sqlite3/SqliteWrapper/auth_c.cs +268 -0
- data/platform/wp7/sqlite3/SqliteWrapper/backup_c.cs +737 -0
- data/platform/wp7/sqlite3/SqliteWrapper/bitvec_c.cs +509 -0
- data/platform/wp7/sqlite3/SqliteWrapper/btmutex_c.cs +379 -0
- data/platform/wp7/sqlite3/SqliteWrapper/btree_c.cs +9138 -0
- data/platform/wp7/sqlite3/SqliteWrapper/build_c.cs +4189 -0
- data/platform/wp7/sqlite3/SqliteWrapper/callback_c.cs +548 -0
- data/platform/wp7/sqlite3/SqliteWrapper/complete_c.cs +342 -0
- data/platform/wp7/sqlite3/SqliteWrapper/ctime_cs.cs +408 -0
- data/platform/wp7/sqlite3/SqliteWrapper/date_c.cs +1317 -0
- data/platform/wp7/sqlite3/SqliteWrapper/delete_c.cs +726 -0
- data/platform/wp7/sqlite3/SqliteWrapper/expr_c.cs +4406 -0
- data/platform/wp7/sqlite3/SqliteWrapper/fault_c.cs +115 -0
- data/platform/wp7/sqlite3/SqliteWrapper/fkey_c.cs +1330 -0
- data/platform/wp7/sqlite3/SqliteWrapper/func_c.cs +2025 -0
- data/platform/wp7/sqlite3/SqliteWrapper/global_c.cs +228 -0
- data/platform/wp7/sqlite3/SqliteWrapper/hash_c.cs +351 -0
- data/platform/wp7/sqlite3/SqliteWrapper/hwtime_c.cs +101 -0
- data/platform/wp7/sqlite3/SqliteWrapper/insert_c.cs +2122 -0
- data/platform/wp7/sqlite3/SqliteWrapper/journal_c.cs +247 -0
- data/platform/wp7/sqlite3/SqliteWrapper/keywordhash_h.cs +302 -0
- data/platform/wp7/sqlite3/SqliteWrapper/legacy_c.cs +223 -0
- data/platform/wp7/sqlite3/SqliteWrapper/loadext_c.cs +683 -0
- data/platform/wp7/sqlite3/SqliteWrapper/main_c.cs +2716 -0
- data/platform/wp7/sqlite3/SqliteWrapper/malloc_c.cs +977 -0
- data/platform/wp7/sqlite3/SqliteWrapper/mem_Pool.cs +394 -0
- data/platform/wp7/sqlite3/SqliteWrapper/memjournal_c.cs +315 -0
- data/platform/wp7/sqlite3/SqliteWrapper/mutex_c.cs +182 -0
- data/platform/wp7/sqlite3/SqliteWrapper/mutex_h.cs +91 -0
- data/platform/wp7/sqlite3/SqliteWrapper/mutex_noop_c.cs +202 -0
- data/platform/wp7/sqlite3/SqliteWrapper/mutex_w32.cs +344 -0
- data/platform/wp7/sqlite3/SqliteWrapper/notify_c.cs +347 -0
- data/platform/wp7/sqlite3/SqliteWrapper/opcodes_c.cs +171 -0
- data/platform/wp7/sqlite3/SqliteWrapper/opcodes_h.cs +346 -0
- data/platform/wp7/sqlite3/SqliteWrapper/os_c.cs +367 -0
- data/platform/wp7/sqlite3/SqliteWrapper/os_common_h.cs +174 -0
- data/platform/wp7/sqlite3/SqliteWrapper/os_h.cs +295 -0
- data/platform/wp7/sqlite3/SqliteWrapper/os_win_c.cs +1255 -0
- data/platform/wp7/sqlite3/SqliteWrapper/pager_c.cs +6078 -0
- data/platform/wp7/sqlite3/SqliteWrapper/pager_h.cs +188 -0
- data/platform/wp7/sqlite3/SqliteWrapper/parse_c.cs +4045 -0
- data/platform/wp7/sqlite3/SqliteWrapper/parse_h.cs +331 -0
- data/platform/wp7/sqlite3/SqliteWrapper/pcache1_c.cs +969 -0
- data/platform/wp7/sqlite3/SqliteWrapper/pcache_c.cs +712 -0
- data/platform/wp7/sqlite3/SqliteWrapper/pcache_h.cs +213 -0
- data/platform/wp7/sqlite3/SqliteWrapper/pragma_c.cs +1767 -0
- data/platform/wp7/sqlite3/SqliteWrapper/prepare_c.cs +1015 -0
- data/platform/wp7/sqlite3/SqliteWrapper/printf_c.cs +1300 -0
- data/platform/wp7/sqlite3/SqliteWrapper/random_c.cs +201 -0
- data/platform/wp7/sqlite3/SqliteWrapper/resolve_c.cs +1396 -0
- data/platform/wp7/sqlite3/SqliteWrapper/rowset_c.cs +519 -0
- data/platform/wp7/sqlite3/SqliteWrapper/select_c.cs +4878 -0
- data/platform/wp7/sqlite3/SqliteWrapper/sqlite3_h.cs +6253 -0
- data/platform/wp7/sqlite3/SqliteWrapper/sqlite3ext_h.cs +397 -0
- data/platform/wp7/sqlite3/SqliteWrapper/sqliteInt_h.cs +4075 -0
- data/platform/wp7/sqlite3/SqliteWrapper/sqliteLimit_h.cs +214 -0
- data/platform/wp7/sqlite3/SqliteWrapper/sqliteicu_h.cs +39 -0
- data/platform/wp7/sqlite3/SqliteWrapper/status_c.cs +155 -0
- data/platform/wp7/sqlite3/SqliteWrapper/table_c.cs +222 -0
- data/platform/wp7/sqlite3/SqliteWrapper/tokenize_c.cs +673 -0
- data/platform/wp7/sqlite3/SqliteWrapper/trigger_c.cs +1219 -0
- data/platform/wp7/sqlite3/SqliteWrapper/update_c.cs +766 -0
- data/platform/wp7/sqlite3/SqliteWrapper/utf_c.cs +612 -0
- data/platform/wp7/sqlite3/SqliteWrapper/util_c.cs +1476 -0
- data/platform/wp7/sqlite3/SqliteWrapper/vacuum_c.cs +382 -0
- data/platform/wp7/sqlite3/SqliteWrapper/vdbe_c.cs +6566 -0
- data/platform/wp7/sqlite3/SqliteWrapper/vdbeapi_c.cs +1557 -0
- data/platform/wp7/sqlite3/SqliteWrapper/vdbeaux_c.cs +4019 -0
- data/platform/wp7/sqlite3/SqliteWrapper/vdbeblob_c.cs +396 -0
- data/platform/wp7/sqlite3/SqliteWrapper/vdbemem_c.cs +1480 -0
- data/platform/wp7/sqlite3/SqliteWrapper/vdbetrace_c.cs +181 -0
- data/platform/wp7/sqlite3/SqliteWrapper/vtab_c.cs +957 -0
- data/platform/wp7/sqlite3/SqliteWrapper/walker_c.cs +174 -0
- data/platform/wp7/sqlite3/SqliteWrapper/where_c.cs +4651 -0
- data/platform/wp7/sqlite3/sqlite3.csproj +155 -0
- data/rakefile.rb +60 -2
- data/res/build-tools/7za.exe +0 -0
- data/res/build-tools/RhoAppRunner.exe +0 -0
- data/res/build-tools/xruby-0.3.3.jar +0 -0
- data/res/generators/rhogen.rb +9 -1
- data/res/generators/templates/application/app/Settings/reset.erb +1 -1
- data/res/generators/templates/application/app/layout.erb +17 -10
- data/res/generators/templates/application/build.yml +5 -3
- data/res/generators/templates/application/public/jqtouch/changes.txt +20 -0
- data/res/generators/templates/application/public/jqtouch/jqtouch.js +12 -4
- data/res/generators/templates/application/public/jqtouch/jquery.1.3.2.min.js +1 -1
- data/res/generators/templates/application/public/js/wp7.js +7 -0
- data/res/generators/templates/model/controller.rb +5 -6
- data/rhobuild.yml.example +1 -0
- data/rhodes.gemspec +2 -1
- data/spec/framework_spec/app/spec/core/dir/close_spec.rb +1 -1
- data/spec/framework_spec/app/spec/core/dir/shared/pwd.rb +13 -11
- data/spec/framework_spec/app/spec/core/env/shared/store.rb +12 -10
- data/spec/framework_spec/app/spec/core/env/update_spec.rb +1 -0
- data/spec/framework_spec/app/spec/core/file/expand_path_spec.rb +3 -2
- data/spec/framework_spec/app/spec/core/file/fixtures/file_types.rb +7 -1
- data/spec/framework_spec/app/spec/core/file/flock_spec.rb +8 -1
- data/spec/framework_spec/app/spec/core/file/ftype_spec.rb +5 -3
- data/spec/framework_spec/app/spec/core/file/lchmod_spec.rb +1 -1
- data/spec/framework_spec/app/spec/core/file/setgid_spec.rb +1 -1
- data/spec/framework_spec/app/spec/core/file/setuid_spec.rb +1 -1
- data/spec/framework_spec/app/spec/core/file/stat/ftype_spec.rb +6 -4
- data/spec/framework_spec/app/spec/core/file/truncate_spec.rb +5 -1
- data/spec/framework_spec/app/spec/core/float/to_s_spec.rb +1 -1
- data/spec/framework_spec/app/spec/core/process/gid_spec.rb +5 -3
- data/spec/framework_spec/app/spec/core/process/groups_spec.rb +11 -9
- data/spec/framework_spec/app/spec/core/process/uid_spec.rb +5 -3
- data/spec/framework_spec/app/spec/language/execution_spec.rb +10 -6
- data/spec/framework_spec/app/spec/shared/file/directory.rb +6 -1
- data/spec/framework_spec/app/spec/shared/file/executable.rb +7 -1
- data/spec/framework_spec/app/spec/shared/file/file.rb +6 -1
- data/spec/framework_spec/app/spec/shared/file/readable.rb +13 -4
- data/spec/framework_spec/app/spec/shared/file/writable.rb +6 -1
- data/spec/phone_spec/app/spec/rho_controller_spec.rb +11 -0
- data/spec/phone_spec/app/spec/rho_spec.rb +11 -0
- data/spec/phone_spec/app/spec/rhom_object_spec.rb +102 -6
- data/spec/phone_spec/app/spec/string/end_with_spec.rb +4 -1
- data/spec/phone_spec/app/spec/string/slice_spec.rb +5 -1
- data/spec/phone_spec/app/spec/string/start_with_spec.rb +4 -0
- data/spec/phone_spec/app/spec/syncengine_spec.rb +73 -6
- data/spec/phone_spec/app/spec_runner.rb +7 -3
- metadata +380 -41
- data/Manifest.txt +0 -5819
- data/platform/bb/Hsqldb/Hsqldb.cso +0 -5
- data/platform/bb/Hsqldb/Hsqldb.jdp +0 -197
- data/platform/bb/RhoBundle/RhoBundle.cso +0 -5
- data/platform/bb/RhoBundle/RhoBundle.jdp +0 -42
- data/platform/bb/RubyVM/RubyVM.cso +0 -5
- data/platform/bb/RubyVM/RubyVM.jdp +0 -467
- data/platform/bb/rhodes/rhodes.csl +0 -3
- data/platform/bb/rhodes/rhodes.cso +0 -5
- data/platform/bb/rhodes/rhodes.jdp +0 -104
@@ -0,0 +1,397 @@
|
|
1
|
+
namespace Community.CsharpSqlite
|
2
|
+
{
|
3
|
+
public partial class Sqlite3
|
4
|
+
{
|
5
|
+
/*
|
6
|
+
** 2006 June 7
|
7
|
+
**
|
8
|
+
** The author disclaims copyright to this source code. In place of
|
9
|
+
** a legal notice, here is a blessing:
|
10
|
+
**
|
11
|
+
** May you do good and not evil.
|
12
|
+
** May you find forgiveness for yourself and forgive others.
|
13
|
+
** May you share freely, never taking more than you give.
|
14
|
+
**
|
15
|
+
*************************************************************************
|
16
|
+
** This header file defines the SQLite interface for use by
|
17
|
+
** shared libraries that want to be imported as extensions into
|
18
|
+
** an SQLite instance. Shared libraries that intend to be loaded
|
19
|
+
** as extensions by SQLite should #include this file instead of
|
20
|
+
** sqlite3.h.
|
21
|
+
**
|
22
|
+
** @(#) $Id: sqlite3ext.h,v 1.25 2008/10/12 00:27:54 shane Exp $
|
23
|
+
**
|
24
|
+
*************************************************************************
|
25
|
+
** Included in SQLite3 port to C#-SQLite; 2008 Noah B Hart
|
26
|
+
** C#-SQLite is an independent reimplementation of the SQLite software library
|
27
|
+
**
|
28
|
+
** $Header$
|
29
|
+
*************************************************************************
|
30
|
+
*/
|
31
|
+
#if !_SQLITE3EXT_H_
|
32
|
+
//#define _SQLITE3EXT_H_
|
33
|
+
//#include "sqlite3.h"
|
34
|
+
|
35
|
+
//typedef struct sqlite3_api_routines sqlite3_api_routines;
|
36
|
+
|
37
|
+
/*
|
38
|
+
** The following structure holds pointers to all of the SQLite API
|
39
|
+
** routines.
|
40
|
+
**
|
41
|
+
** WARNING: In order to maintain backwards compatibility, add new
|
42
|
+
** interfaces to the end of this structure only. If you insert new
|
43
|
+
** interfaces in the middle of this structure, then older different
|
44
|
+
** versions of SQLite will not be able to load each others' shared
|
45
|
+
** libraries!
|
46
|
+
*/
|
47
|
+
//struct sqlite3_api_routines {
|
48
|
+
// void * (*aggregate_context)(sqlite3_context*,int nBytes);
|
49
|
+
// int (*aggregate_count)(sqlite3_context*);
|
50
|
+
// int (*bind_blob)(sqlite3_stmt*,int,const void*,int n,void(*)(void*));
|
51
|
+
// int (*bind_double)(sqlite3_stmt*,int,double);
|
52
|
+
// int (*bind_int)(sqlite3_stmt*,int,int);
|
53
|
+
// int (*bind_int64)(sqlite3_stmt*,int,sqlite_int64);
|
54
|
+
// int (*bind_null)(sqlite3_stmt*,int);
|
55
|
+
// int (*bind_parameter_count)(sqlite3_stmt*);
|
56
|
+
// int (*bind_parameter_index)(sqlite3_stmt*,const char*zName);
|
57
|
+
// const char * (*bind_parameter_name)(sqlite3_stmt*,int);
|
58
|
+
// int (*bind_text)(sqlite3_stmt*,int,const char*,int n,void(*)(void*));
|
59
|
+
// int (*bind_text16)(sqlite3_stmt*,int,const void*,int,void(*)(void*));
|
60
|
+
// int (*bind_value)(sqlite3_stmt*,int,const sqlite3_value*);
|
61
|
+
// int (*busy_handler)(sqlite3*,int(*)(void*,int),void*);
|
62
|
+
// int (*busy_timeout)(sqlite3*,int ms);
|
63
|
+
// int (*changes)(sqlite3*);
|
64
|
+
// int (*close)(sqlite3*);
|
65
|
+
// int (*collation_needed)(sqlite3*,void*,void(*)(void*,sqlite3*,int eTextRep,const char*));
|
66
|
+
// int (*collation_needed16)(sqlite3*,void*,void(*)(void*,sqlite3*,int eTextRep,const void*));
|
67
|
+
// const void * (*column_blob)(sqlite3_stmt*,int iCol);
|
68
|
+
// int (*column_bytes)(sqlite3_stmt*,int iCol);
|
69
|
+
// int (*column_bytes16)(sqlite3_stmt*,int iCol);
|
70
|
+
// int (*column_count)(sqlite3_stmt*pStmt);
|
71
|
+
// const char * (*column_database_name)(sqlite3_stmt*,int);
|
72
|
+
// const void * (*column_database_name16)(sqlite3_stmt*,int);
|
73
|
+
// const char * (*column_decltype)(sqlite3_stmt*,int i);
|
74
|
+
// const void * (*column_decltype16)(sqlite3_stmt*,int);
|
75
|
+
// double (*column_double)(sqlite3_stmt*,int iCol);
|
76
|
+
// int (*column_int)(sqlite3_stmt*,int iCol);
|
77
|
+
// sqlite_int64 (*column_int64)(sqlite3_stmt*,int iCol);
|
78
|
+
// const char * (*column_name)(sqlite3_stmt*,int);
|
79
|
+
// const void * (*column_name16)(sqlite3_stmt*,int);
|
80
|
+
// const char * (*column_origin_name)(sqlite3_stmt*,int);
|
81
|
+
// const void * (*column_origin_name16)(sqlite3_stmt*,int);
|
82
|
+
// const char * (*column_table_name)(sqlite3_stmt*,int);
|
83
|
+
// const void * (*column_table_name16)(sqlite3_stmt*,int);
|
84
|
+
// const unsigned char * (*column_text)(sqlite3_stmt*,int iCol);
|
85
|
+
// const void * (*column_text16)(sqlite3_stmt*,int iCol);
|
86
|
+
// int (*column_type)(sqlite3_stmt*,int iCol);
|
87
|
+
// sqlite3_value* (*column_value)(sqlite3_stmt*,int iCol);
|
88
|
+
// void * (*commit_hook)(sqlite3*,int(*)(void*),void*);
|
89
|
+
// int (*complete)(const char*sql);
|
90
|
+
// int (*complete16)(const void*sql);
|
91
|
+
// int (*create_collation)(sqlite3*,const char*,int,void*,int(*)(void*,int,const void*,int,const void*));
|
92
|
+
// int (*create_collation16)(sqlite3*,const void*,int,void*,int(*)(void*,int,const void*,int,const void*));
|
93
|
+
// int (*create_function)(sqlite3*,const char*,int,int,void*,void (*xFunc)(sqlite3_context*,int,sqlite3_value**),void (*xStep)(sqlite3_context*,int,sqlite3_value**),void (*xFinal)(sqlite3_context*));
|
94
|
+
// int (*create_function16)(sqlite3*,const void*,int,int,void*,void (*xFunc)(sqlite3_context*,int,sqlite3_value**),void (*xStep)(sqlite3_context*,int,sqlite3_value**),void (*xFinal)(sqlite3_context*));
|
95
|
+
// int (*create_module)(sqlite3*,const char*,const sqlite3_module*,void*);
|
96
|
+
// int (*data_count)(sqlite3_stmt*pStmt);
|
97
|
+
// sqlite3 * (*db_handle)(sqlite3_stmt*);
|
98
|
+
// int (*declare_vtab)(sqlite3*,const char*);
|
99
|
+
// int (*enable_shared_cache)(int);
|
100
|
+
// int (*errcode)(sqlite3*db);
|
101
|
+
// const char * (*errmsg)(sqlite3*);
|
102
|
+
// const void * (*errmsg16)(sqlite3*);
|
103
|
+
// int (*exec)(sqlite3*,const char*,sqlite3_callback,void*,char**);
|
104
|
+
// int (*expired)(sqlite3_stmt*);
|
105
|
+
// int (*finalize)(sqlite3_stmt*pStmt);
|
106
|
+
// void (*free)(void*);
|
107
|
+
// void (*free_table)(char**result);
|
108
|
+
// int (*get_autocommit)(sqlite3*);
|
109
|
+
// void * (*get_auxdata)(sqlite3_context*,int);
|
110
|
+
// int (*get_table)(sqlite3*,const char*,char***,int*,int*,char**);
|
111
|
+
// int (*global_recover)(void);
|
112
|
+
// void (*interruptx)(sqlite3*);
|
113
|
+
// sqlite_int64 (*last_insert_rowid)(sqlite3*);
|
114
|
+
// const char * (*libversion)(void);
|
115
|
+
// int (*libversion_number)(void);
|
116
|
+
// void *(*malloc)(int);
|
117
|
+
// char * (*mprintf)(const char*,...);
|
118
|
+
// int (*open)(const char*,sqlite3**);
|
119
|
+
// int (*open16)(const void*,sqlite3**);
|
120
|
+
// int (*prepare)(sqlite3*,const char*,int,sqlite3_stmt**,const char**);
|
121
|
+
// int (*prepare16)(sqlite3*,const void*,int,sqlite3_stmt**,const void**);
|
122
|
+
// void * (*profile)(sqlite3*,void(*)(void*,const char*,sqlite_u3264),void*);
|
123
|
+
// void (*progress_handler)(sqlite3*,int,int(*)(void*),void*);
|
124
|
+
// void *(*realloc)(void*,int);
|
125
|
+
// int (*reset)(sqlite3_stmt*pStmt);
|
126
|
+
// void (*result_blob)(sqlite3_context*,const void*,int,void(*)(void*));
|
127
|
+
// void (*result_double)(sqlite3_context*,double);
|
128
|
+
// void (*result_error)(sqlite3_context*,const char*,int);
|
129
|
+
// void (*result_error16)(sqlite3_context*,const void*,int);
|
130
|
+
// void (*result_int)(sqlite3_context*,int);
|
131
|
+
// void (*result_int64)(sqlite3_context*,sqlite_int64);
|
132
|
+
// void (*result_null)(sqlite3_context*);
|
133
|
+
// void (*result_text)(sqlite3_context*,const char*,int,void(*)(void*));
|
134
|
+
// void (*result_text16)(sqlite3_context*,const void*,int,void(*)(void*));
|
135
|
+
// void (*result_text16be)(sqlite3_context*,const void*,int,void(*)(void*));
|
136
|
+
// void (*result_text16le)(sqlite3_context*,const void*,int,void(*)(void*));
|
137
|
+
// void (*result_value)(sqlite3_context*,sqlite3_value*);
|
138
|
+
// void * (*rollback_hook)(sqlite3*,void(*)(void*),void*);
|
139
|
+
// int (*set_authorizer)(sqlite3*,int(*)(void*,int,const char*,const char*,const char*,const char*),void*);
|
140
|
+
// void (*set_auxdata)(sqlite3_context*,int,void*,void (*)(void*));
|
141
|
+
// char * (*snprintf)(int,char*,const char*,...);
|
142
|
+
// int (*step)(sqlite3_stmt*);
|
143
|
+
// int (*table_column_metadata)(sqlite3*,const char*,const char*,const char*,char const**,char const**,int*,int*,int*);
|
144
|
+
// void (*thread_cleanup)(void);
|
145
|
+
// int (*total_changes)(sqlite3*);
|
146
|
+
// void * (*trace)(sqlite3*,void(*xTrace)(void*,const char*),void*);
|
147
|
+
// int (*transfer_bindings)(sqlite3_stmt*,sqlite3_stmt*);
|
148
|
+
// void * (*update_hook)(sqlite3*,void(*)(void*,int ,char const*,char const*,sqlite_int64),void*);
|
149
|
+
// void * (*user_data)(sqlite3_context*);
|
150
|
+
// const void * (*value_blob)(sqlite3_value*);
|
151
|
+
// int (*value_bytes)(sqlite3_value*);
|
152
|
+
// int (*value_bytes16)(sqlite3_value*);
|
153
|
+
// double (*value_double)(sqlite3_value*);
|
154
|
+
// int (*value_int)(sqlite3_value*);
|
155
|
+
// sqlite_int64 (*value_int64)(sqlite3_value*);
|
156
|
+
// int (*value_numeric_type)(sqlite3_value*);
|
157
|
+
// const unsigned char * (*value_text)(sqlite3_value*);
|
158
|
+
// const void * (*value_text16)(sqlite3_value*);
|
159
|
+
// const void * (*value_text16be)(sqlite3_value*);
|
160
|
+
// const void * (*value_text16le)(sqlite3_value*);
|
161
|
+
// int (*value_type)(sqlite3_value*);
|
162
|
+
// char *(*vmprintf)(const char*,va_list);
|
163
|
+
// /* Added ??? */
|
164
|
+
// int (*overload_function)(sqlite3*, const char *zFuncName, int nArg);
|
165
|
+
// /* Added by 3.3.13 */
|
166
|
+
// int (*prepare_v2)(sqlite3*,const char*,int,sqlite3_stmt**,const char**);
|
167
|
+
// int (*prepare16_v2)(sqlite3*,const void*,int,sqlite3_stmt**,const void**);
|
168
|
+
// int (*clear_bindings)(sqlite3_stmt*);
|
169
|
+
// /* Added by 3.4.1 */
|
170
|
+
// int (*create_module_v2)(sqlite3*,const char*,const sqlite3_module*,void*,void (*xDestroy)(void *));
|
171
|
+
// /* Added by 3.5.0 */
|
172
|
+
// int (*bind_zeroblob)(sqlite3_stmt*,int,int);
|
173
|
+
// int (*blob_bytes)(sqlite3_blob*);
|
174
|
+
// int (*blob_close)(sqlite3_blob*);
|
175
|
+
// int (*blob_open)(sqlite3*,const char*,const char*,const char*,sqlite3_int64,int,sqlite3_blob**);
|
176
|
+
// int (*blob_read)(sqlite3_blob*,void*,int,int);
|
177
|
+
// int (*blob_write)(sqlite3_blob*,const void*,int,int);
|
178
|
+
// int (*create_collation_v2)(sqlite3*,const char*,int,void*,int(*)(void*,int,const void*,int,const void*),void(*)(void*));
|
179
|
+
// int (*file_control)(sqlite3*,const char*,int,void*);
|
180
|
+
// sqlite3_int64 (*memory_highwater)(int);
|
181
|
+
// sqlite3_int64 (*memory_used)(void);
|
182
|
+
// sqlite3_mutex *(*mutex_alloc)(int);
|
183
|
+
// void (*mutex_enter)(sqlite3_mutex*);
|
184
|
+
// void (*mutex_free)(sqlite3_mutex*);
|
185
|
+
// void (*mutex_leave)(sqlite3_mutex*);
|
186
|
+
// int (*mutex_try)(sqlite3_mutex*);
|
187
|
+
// int (*open_v2)(const char*,sqlite3**,int,const char*);
|
188
|
+
// int (*release_memory)(int);
|
189
|
+
// void (*result_error_nomem)(sqlite3_context*);
|
190
|
+
// void (*result_error_toobig)(sqlite3_context*);
|
191
|
+
// int (*sleep)(int);
|
192
|
+
// void (*soft_heap_limit)(int);
|
193
|
+
// sqlite3_vfs *(*vfs_find)(const char*);
|
194
|
+
// int (*vfs_register)(sqlite3_vfs*,int);
|
195
|
+
// int (*vfs_unregister)(sqlite3_vfs*);
|
196
|
+
// int (*xthreadsafe)(void);
|
197
|
+
// void (*result_zeroblob)(sqlite3_context*,int);
|
198
|
+
// void (*result_error_code)(sqlite3_context*,int);
|
199
|
+
// int (*test_control)(int, ...);
|
200
|
+
// void (*randomness)(int,void*);
|
201
|
+
// sqlite3 *(*context_db_handle)(sqlite3_context*);
|
202
|
+
//int (*extended_result_codes)(sqlite3*,int);
|
203
|
+
//int (*limit)(sqlite3*,int,int);
|
204
|
+
//sqlite3_stmt *(*next_stmt)(sqlite3*,sqlite3_stmt*);
|
205
|
+
//const char *(*sql)(sqlite3_stmt*);
|
206
|
+
//int (*status)(int,int*,int*,int);
|
207
|
+
//};
|
208
|
+
public class sqlite3_api_routines
|
209
|
+
{
|
210
|
+
public sqlite3 context_db_handle;
|
211
|
+
};
|
212
|
+
|
213
|
+
/*
|
214
|
+
** The following macros redefine the API routines so that they are
|
215
|
+
** redirected throught the global sqlite3_api structure.
|
216
|
+
**
|
217
|
+
** This header file is also used by the loadext.c source file
|
218
|
+
** (part of the main SQLite library - not an extension) so that
|
219
|
+
** it can get access to the sqlite3_api_routines structure
|
220
|
+
** definition. But the main library does not want to redefine
|
221
|
+
** the API. So the redefinition macros are only valid if the
|
222
|
+
** SQLITE_CORE macros is undefined.
|
223
|
+
*/
|
224
|
+
#if !SQLITE_CORE
|
225
|
+
//#define sqlite3_aggregate_context sqlite3_api->aggregate_context
|
226
|
+
#if !SQLITE_OMIT_DEPRECATED
|
227
|
+
//#define sqlite3_aggregate_count sqlite3_api->aggregate_count
|
228
|
+
#endif
|
229
|
+
//#define sqlite3_bind_blob sqlite3_api->bind_blob
|
230
|
+
//#define sqlite3_bind_double sqlite3_api->bind_double
|
231
|
+
//#define sqlite3_bind_int sqlite3_api->bind_int
|
232
|
+
//#define sqlite3_bind_int64 sqlite3_api->bind_int64
|
233
|
+
//#define sqlite3_bind_null sqlite3_api->bind_null
|
234
|
+
//#define sqlite3_bind_parameter_count sqlite3_api->bind_parameter_count
|
235
|
+
//#define sqlite3_bind_parameter_index sqlite3_api->bind_parameter_index
|
236
|
+
//#define sqlite3_bind_parameter_name sqlite3_api->bind_parameter_name
|
237
|
+
//#define sqlite3_bind_text sqlite3_api->bind_text
|
238
|
+
//#define sqlite3_bind_text16 sqlite3_api->bind_text16
|
239
|
+
//#define sqlite3_bind_value sqlite3_api->bind_value
|
240
|
+
//#define sqlite3_busy_handler sqlite3_api->busy_handler
|
241
|
+
//#define sqlite3_busy_timeout sqlite3_api->busy_timeout
|
242
|
+
//#define sqlite3_changes sqlite3_api->changes
|
243
|
+
//#define sqlite3_close sqlite3_api->close
|
244
|
+
//#define sqlite3_collation_needed sqlite3_api->collation_needed
|
245
|
+
//#define sqlite3_collation_needed16 sqlite3_api->collation_needed16
|
246
|
+
//#define sqlite3_column_blob sqlite3_api->column_blob
|
247
|
+
//#define sqlite3_column_bytes sqlite3_api->column_bytes
|
248
|
+
//#define sqlite3_column_bytes16 sqlite3_api->column_bytes16
|
249
|
+
//#define sqlite3_column_count sqlite3_api->column_count
|
250
|
+
//#define sqlite3_column_database_name sqlite3_api->column_database_name
|
251
|
+
//#define sqlite3_column_database_name16 sqlite3_api->column_database_name16
|
252
|
+
//#define sqlite3_column_decltype sqlite3_api->column_decltype
|
253
|
+
//#define sqlite3_column_decltype16 sqlite3_api->column_decltype16
|
254
|
+
//#define sqlite3_column_double sqlite3_api->column_double
|
255
|
+
//#define sqlite3_column_int sqlite3_api->column_int
|
256
|
+
//#define sqlite3_column_int64 sqlite3_api->column_int64
|
257
|
+
//#define sqlite3_column_name sqlite3_api->column_name
|
258
|
+
//#define sqlite3_column_name16 sqlite3_api->column_name16
|
259
|
+
//#define sqlite3_column_origin_name sqlite3_api->column_origin_name
|
260
|
+
//#define sqlite3_column_origin_name16 sqlite3_api->column_origin_name16
|
261
|
+
//#define sqlite3_column_table_name sqlite3_api->column_table_name
|
262
|
+
//#define sqlite3_column_table_name16 sqlite3_api->column_table_name16
|
263
|
+
//#define sqlite3_column_text sqlite3_api->column_text
|
264
|
+
//#define sqlite3_column_text16 sqlite3_api->column_text16
|
265
|
+
//#define sqlite3_column_type sqlite3_api->column_type
|
266
|
+
//#define sqlite3_column_value sqlite3_api->column_value
|
267
|
+
//#define sqlite3_commit_hook sqlite3_api->commit_hook
|
268
|
+
//#define sqlite3_complete sqlite3_api->complete
|
269
|
+
//#define sqlite3_complete16 sqlite3_api->complete16
|
270
|
+
//#define sqlite3_create_collation sqlite3_api->create_collation
|
271
|
+
//#define sqlite3_create_collation16 sqlite3_api->create_collation16
|
272
|
+
//#define sqlite3_create_function sqlite3_api->create_function
|
273
|
+
//#define sqlite3_create_function16 sqlite3_api->create_function16
|
274
|
+
//#define sqlite3_create_module sqlite3_api->create_module
|
275
|
+
//#define sqlite3_create_module_v2 sqlite3_api->create_module_v2
|
276
|
+
//#define sqlite3_data_count sqlite3_api->data_count
|
277
|
+
//#define sqlite3_db_handle sqlite3_api->db_handle
|
278
|
+
//#define sqlite3_declare_vtab sqlite3_api->declare_vtab
|
279
|
+
//#define sqlite3_enable_shared_cache sqlite3_api->enable_shared_cache
|
280
|
+
//#define sqlite3_errcode sqlite3_api->errcode
|
281
|
+
//#define sqlite3_errmsg sqlite3_api->errmsg
|
282
|
+
//#define sqlite3_errmsg16 sqlite3_api->errmsg16
|
283
|
+
//#define sqlite3_exec sqlite3_api->exec
|
284
|
+
#if !SQLITE_OMIT_DEPRECATED
|
285
|
+
//#define sqlite3_expired sqlite3_api->expired
|
286
|
+
#endif
|
287
|
+
//#define sqlite3_finalize sqlite3_api->finalize
|
288
|
+
//#define //sqlite3_free sqlite3_api->free
|
289
|
+
//#define //sqlite3_free_table sqlite3_api->free_table
|
290
|
+
//#define sqlite3_get_autocommit sqlite3_api->get_autocommit
|
291
|
+
//#define sqlite3_get_auxdata sqlite3_api->get_auxdata
|
292
|
+
//#define sqlite3_get_table sqlite3_api->get_table
|
293
|
+
#if !SQLITE_OMIT_DEPRECATED
|
294
|
+
//#define sqlite3_global_recover sqlite3_api->global_recover
|
295
|
+
#endif
|
296
|
+
//#define sqlite3_interrupt sqlite3_api->interruptx
|
297
|
+
//#define sqlite3_last_insert_rowid sqlite3_api->last_insert_rowid
|
298
|
+
//#define sqlite3_libversion sqlite3_api->libversion
|
299
|
+
//#define sqlite3_libversion_number sqlite3_api->libversion_number
|
300
|
+
//#define sqlite3Malloc sqlite3_api->malloc
|
301
|
+
//#define sqlite3_mprintf sqlite3_api->mprintf
|
302
|
+
//#define sqlite3_open sqlite3_api.open
|
303
|
+
//#define sqlite3_open16 sqlite3_api.open16
|
304
|
+
//#define sqlite3_prepare sqlite3_api.prepare
|
305
|
+
//#define sqlite3_prepare16 sqlite3_api.prepare16
|
306
|
+
//#define sqlite3_prepare_v2 sqlite3_api.prepare_v2
|
307
|
+
//#define sqlite3_prepare16_v2 sqlite3_api.prepare16_v2
|
308
|
+
//#define sqlite3_profile sqlite3_api.profile
|
309
|
+
//#define sqlite3_progress_handler sqlite3_api.progress_handler
|
310
|
+
//#define sqlite3_realloc sqlite3_api->realloc
|
311
|
+
//#define sqlite3_reset sqlite3_api->reset
|
312
|
+
//#define sqlite3_result_blob sqlite3_api->result_blob
|
313
|
+
//#define sqlite3_result_double sqlite3_api->result_double
|
314
|
+
//#define sqlite3_result_error sqlite3_api->result_error
|
315
|
+
//#define sqlite3_result_error16 sqlite3_api->result_error16
|
316
|
+
//#define sqlite3_result_int sqlite3_api->result_int
|
317
|
+
//#define sqlite3_result_int64 sqlite3_api->result_int64
|
318
|
+
//#define sqlite3_result_null sqlite3_api->result_null
|
319
|
+
//#define sqlite3_result_text sqlite3_api->result_text
|
320
|
+
//#define sqlite3_result_text16 sqlite3_api->result_text16
|
321
|
+
//#define sqlite3_result_text16be sqlite3_api->result_text16be
|
322
|
+
//#define sqlite3_result_text16le sqlite3_api->result_text16le
|
323
|
+
//#define sqlite3_result_value sqlite3_api->result_value
|
324
|
+
//#define sqlite3_rollback_hook sqlite3_api->rollback_hook
|
325
|
+
//#define sqlite3_set_authorizer sqlite3_api->set_authorizer
|
326
|
+
//#define sqlite3_set_auxdata sqlite3_api->set_auxdata
|
327
|
+
//#define sqlite3_snprintf sqlite3_api->snprintf
|
328
|
+
//#define sqlite3_step sqlite3_api->step
|
329
|
+
//#define sqlite3_table_column_metadata sqlite3_api->table_column_metadata
|
330
|
+
//#define sqlite3_thread_cleanup sqlite3_api->thread_cleanup
|
331
|
+
//#define sqlite3_total_changes sqlite3_api->total_changes
|
332
|
+
//#define sqlite3_trace sqlite3_api->trace
|
333
|
+
#if !SQLITE_OMIT_DEPRECATED
|
334
|
+
//#define sqlite3_transfer_bindings sqlite3_api->transfer_bindings
|
335
|
+
#endif
|
336
|
+
//#define sqlite3_update_hook sqlite3_api->update_hook
|
337
|
+
//#define sqlite3_user_data sqlite3_api->user_data
|
338
|
+
//#define sqlite3_value_blob sqlite3_api->value_blob
|
339
|
+
//#define sqlite3_value_bytes sqlite3_api->value_bytes
|
340
|
+
//#define sqlite3_value_bytes16 sqlite3_api->value_bytes16
|
341
|
+
//#define sqlite3_value_double sqlite3_api->value_double
|
342
|
+
//#define sqlite3_value_int sqlite3_api->value_int
|
343
|
+
//#define sqlite3_value_int64 sqlite3_api->value_int64
|
344
|
+
//#define sqlite3_value_numeric_type sqlite3_api->value_numeric_type
|
345
|
+
//#define sqlite3_value_text sqlite3_api->value_text
|
346
|
+
//#define sqlite3_value_text16 sqlite3_api->value_text16
|
347
|
+
//#define sqlite3_value_text16be sqlite3_api->value_text16be
|
348
|
+
//#define sqlite3_value_text16le sqlite3_api->value_text16le
|
349
|
+
//#define sqlite3_value_type sqlite3_api->value_type
|
350
|
+
//#define sqlite3_vmprintf sqlite3_api->vmprintf
|
351
|
+
//#define sqlite3_overload_function sqlite3_api->overload_function
|
352
|
+
//#define sqlite3_prepare_v2 sqlite3_api.prepare_v2
|
353
|
+
//#define sqlite3_prepare16_v2 sqlite3_api.prepare16_v2
|
354
|
+
//#define sqlite3_clear_bindings sqlite3_api->clear_bindings
|
355
|
+
//#define sqlite3_bind_zeroblob sqlite3_api->bind_zeroblob
|
356
|
+
//#define sqlite3_blob_bytes sqlite3_api->blob_bytes
|
357
|
+
//#define sqlite3_blob_close sqlite3_api->blob_close
|
358
|
+
//#define sqlite3_blob_open sqlite3_api->blob_open
|
359
|
+
//#define sqlite3_blob_read sqlite3_api->blob_read
|
360
|
+
//#define sqlite3_blob_write sqlite3_api->blob_write
|
361
|
+
//#define sqlite3_create_collation_v2 sqlite3_api->create_collation_v2
|
362
|
+
//#define sqlite3_file_control sqlite3_api->file_control
|
363
|
+
//#define sqlite3_memory_highwater sqlite3_api->memory_highwater
|
364
|
+
//#define sqlite3_memory_used sqlite3_api->memory_used
|
365
|
+
//#define sqlite3MutexAlloc sqlite3_api->mutex_alloc
|
366
|
+
//#define sqlite3_mutex_enter sqlite3_api->mutex_enter
|
367
|
+
//#define sqlite3_mutex_free sqlite3_api->mutex_free
|
368
|
+
//#define sqlite3_mutex_leave sqlite3_api->mutex_leave
|
369
|
+
//#define sqlite3_mutex_try sqlite3_api->mutex_try
|
370
|
+
//#define sqlite3_open_v2 sqlite3_api.open_v2
|
371
|
+
//#define sqlite3_release_memory sqlite3_api->release_memory
|
372
|
+
//#define sqlite3_result_error_nomem sqlite3_api->result_error_nomem
|
373
|
+
//#define sqlite3_result_error_toobig sqlite3_api->result_error_toobig
|
374
|
+
//#define sqlite3_sleep sqlite3_api->sleep
|
375
|
+
//#define sqlite3_soft_heap_limit sqlite3_api->soft_heap_limit
|
376
|
+
//#define sqlite3_vfs_find sqlite3_api->vfs_find
|
377
|
+
//#define sqlite3_vfs_register sqlite3_api->vfs_register
|
378
|
+
//#define sqlite3_vfs_unregister sqlite3_api->vfs_unregister
|
379
|
+
//#define sqlite3_threadsafe sqlite3_api->xthreadsafe
|
380
|
+
//#define sqlite3_result_zeroblob sqlite3_api->result_zeroblob
|
381
|
+
//#define sqlite3_result_error_code sqlite3_api->result_error_code
|
382
|
+
//#define sqlite3_test_control sqlite3_api->test_control
|
383
|
+
//#define sqlite3_randomness sqlite3_api->randomness
|
384
|
+
//#define sqlite3_context_db_handle sqlite3_api->context_db_handle
|
385
|
+
//#define sqlite3_extended_result_codes sqlite3_api->extended_result_codes
|
386
|
+
//#define sqlite3_limit sqlite3_api->limit
|
387
|
+
//#define sqlite3_next_stmt sqlite3_api->next_stmt
|
388
|
+
//#define sqlite3_sql sqlite3_api->sql
|
389
|
+
//#define sqlite3_status sqlite3_api->status
|
390
|
+
#endif //* SQLITE_CORE */
|
391
|
+
|
392
|
+
//#define SQLITE_EXTENSION_INIT1 const sqlite3_api_routines *sqlite3_api = 0;
|
393
|
+
//#define SQLITE_EXTENSION_INIT2(v) sqlite3_api = v;
|
394
|
+
|
395
|
+
#endif //* _SQLITE3EXT_H_ */
|
396
|
+
}
|
397
|
+
}
|
@@ -0,0 +1,4075 @@
|
|
1
|
+
#define SQLITE_MAX_EXPR_DEPTH
|
2
|
+
|
3
|
+
using System;
|
4
|
+
using System.Diagnostics;
|
5
|
+
using System.Runtime.InteropServices;
|
6
|
+
using System.Text;
|
7
|
+
|
8
|
+
using Bitmask = System.UInt64;
|
9
|
+
using i16 = System.Int16;
|
10
|
+
using i64 = System.Int64;
|
11
|
+
using sqlite3_int64 = System.Int64;
|
12
|
+
|
13
|
+
using u8 = System.Byte;
|
14
|
+
using u16 = System.UInt16;
|
15
|
+
using u32 = System.UInt32;
|
16
|
+
using u64 = System.UInt64;
|
17
|
+
using unsigned = System.UInt64;
|
18
|
+
|
19
|
+
using Pgno = System.UInt32;
|
20
|
+
|
21
|
+
#if !SQLITE_MAX_VARIABLE_NUMBER
|
22
|
+
using ynVar = System.Int16;
|
23
|
+
#else
|
24
|
+
using ynVar = System.Int32;
|
25
|
+
#endif
|
26
|
+
|
27
|
+
namespace Community.CsharpSqlite
|
28
|
+
{
|
29
|
+
using sqlite3_value = Sqlite3.Mem;
|
30
|
+
|
31
|
+
public partial class Sqlite3
|
32
|
+
{
|
33
|
+
/*
|
34
|
+
** 2001 September 15
|
35
|
+
**
|
36
|
+
** The author disclaims copyright to this source code. In place of
|
37
|
+
** a legal notice, here is a blessing:
|
38
|
+
**
|
39
|
+
** May you do good and not evil.
|
40
|
+
** May you find forgiveness for yourself and forgive others.
|
41
|
+
** May you share freely, never taking more than you give.
|
42
|
+
**
|
43
|
+
*************************************************************************
|
44
|
+
** Internal interface definitions for SQLite.
|
45
|
+
**
|
46
|
+
*************************************************************************
|
47
|
+
** Included in SQLite3 port to C#-SQLite; 2008 Noah B Hart
|
48
|
+
** C#-SQLite is an independent reimplementation of the SQLite software library
|
49
|
+
**
|
50
|
+
** SQLITE_SOURCE_ID: 2010-03-09 19:31:43 4ae453ea7be69018d8c16eb8dabe05617397dc4d
|
51
|
+
**
|
52
|
+
** $Header$
|
53
|
+
*************************************************************************
|
54
|
+
*/
|
55
|
+
//#if !_SQLITEINT_H_
|
56
|
+
//#define _SQLITEINT_H_
|
57
|
+
|
58
|
+
/*
|
59
|
+
** These #defines should enable >2GB file support on POSIX if the
|
60
|
+
** underlying operating system supports it. If the OS lacks
|
61
|
+
** large file support, or if the OS is windows, these should be no-ops.
|
62
|
+
**
|
63
|
+
** Ticket #2739: The _LARGEFILE_SOURCE macro must appear before any
|
64
|
+
** system #includes. Hence, this block of code must be the very first
|
65
|
+
** code in all source files.
|
66
|
+
**
|
67
|
+
** Large file support can be disabled using the -DSQLITE_DISABLE_LFS switch
|
68
|
+
** on the compiler command line. This is necessary if you are compiling
|
69
|
+
** on a recent machine (ex: Red Hat 7.2) but you want your code to work
|
70
|
+
** on an older machine (ex: Red Hat 6.0). If you compile on Red Hat 7.2
|
71
|
+
** without this option, LFS is enable. But LFS does not exist in the kernel
|
72
|
+
** in Red Hat 6.0, so the code won't work. Hence, for maximum binary
|
73
|
+
** portability you should omit LFS.
|
74
|
+
**
|
75
|
+
** Similar is true for Mac OS X. LFS is only supported on Mac OS X 9 and later.
|
76
|
+
*/
|
77
|
+
//#if !SQLITE_DISABLE_LFS
|
78
|
+
//# define _LARGE_FILE 1
|
79
|
+
//# ifndef _FILE_OFFSET_BITS
|
80
|
+
//# define _FILE_OFFSET_BITS 64
|
81
|
+
//# endif
|
82
|
+
//# define _LARGEFILE_SOURCE 1
|
83
|
+
//#endif
|
84
|
+
|
85
|
+
/*
|
86
|
+
** Include the configuration header output by 'configure' if we're using the
|
87
|
+
** autoconf-based build
|
88
|
+
*/
|
89
|
+
#if _HAVE_SQLITE_CONFIG_H
|
90
|
+
//#include "config.h"
|
91
|
+
#endif
|
92
|
+
//#include "sqliteLimit.h"
|
93
|
+
|
94
|
+
/* Disable nuisance warnings on Borland compilers */
|
95
|
+
//#if defined(__BORLANDC__)
|
96
|
+
//#pragma warn -rch /* unreachable code */
|
97
|
+
//#pragma warn -ccc /* Condition is always true or false */
|
98
|
+
//#pragma warn -aus /* Assigned value is never used */
|
99
|
+
//#pragma warn -csu /* Comparing signed and unsigned */
|
100
|
+
//#pragma warn -spa /* Suspicious pointer arithmetic */
|
101
|
+
//#endif
|
102
|
+
|
103
|
+
/* Needed for various definitions... */
|
104
|
+
//#if !_GNU_SOURCE
|
105
|
+
//#define _GNU_SOURCE
|
106
|
+
//#endif
|
107
|
+
/*
|
108
|
+
** Include standard header files as necessary
|
109
|
+
*/
|
110
|
+
#if HAVE_STDINT_H
|
111
|
+
//#include <stdint.h>
|
112
|
+
#endif
|
113
|
+
#if HAVE_INTTYPES_H
|
114
|
+
//#include <inttypes.h>
|
115
|
+
#endif
|
116
|
+
|
117
|
+
/*
|
118
|
+
** The number of samples of an index that SQLite takes in order to
|
119
|
+
** construct a histogram of the table content when running ANALYZE
|
120
|
+
** and with SQLITE_ENABLE_STAT2
|
121
|
+
*/
|
122
|
+
//#define SQLITE_INDEX_SAMPLES 10
|
123
|
+
public const int SQLITE_INDEX_SAMPLES = 10;
|
124
|
+
|
125
|
+
/*
|
126
|
+
** The following macros are used to cast pointers to integers and
|
127
|
+
** integers to pointers. The way you do this varies from one compiler
|
128
|
+
** to the next, so we have developed the following set of #if statements
|
129
|
+
** to generate appropriate macros for a wide range of compilers.
|
130
|
+
**
|
131
|
+
** The correct "ANSI" way to do this is to use the intptr_t type.
|
132
|
+
** Unfortunately, that typedef is not available on all compilers, or
|
133
|
+
** if it is available, it requires an #include of specific headers
|
134
|
+
** that very from one machine to the next.
|
135
|
+
**
|
136
|
+
** Ticket #3860: The llvm-gcc-4.2 compiler from Apple chokes on
|
137
|
+
** the ((void*)&((char*)0)[X]) construct. But MSVC chokes on ((void*)(X)).
|
138
|
+
** So we have to define the macros in different ways depending on the
|
139
|
+
** compiler.
|
140
|
+
*/
|
141
|
+
//#if defined(__PTRDIFF_TYPE__) /* This case should work for GCC */
|
142
|
+
//# define SQLITE_INT_TO_PTR(X) ((void*)(__PTRDIFF_TYPE__)(X))
|
143
|
+
//# define SQLITE_PTR_TO_INT(X) ((int)(__PTRDIFF_TYPE__)(X))
|
144
|
+
//#elif !defined(__GNUC__) /* Works for compilers other than LLVM */
|
145
|
+
//# define SQLITE_INT_TO_PTR(X) ((void*)&((char*)0)[X])
|
146
|
+
//# define SQLITE_PTR_TO_INT(X) ((int)(((char*)X)-(char*)0))
|
147
|
+
//#elif defined(HAVE_STDINT_H) /* Use this case if we have ANSI headers */
|
148
|
+
//# define SQLITE_INT_TO_PTR(X) ((void*)(intptr_t)(X))
|
149
|
+
//# define SQLITE_PTR_TO_INT(X) ((int)(intptr_t)(X))
|
150
|
+
//#else /* Generates a warning - but it always works */
|
151
|
+
//# define SQLITE_INT_TO_PTR(X) ((void*)(X))
|
152
|
+
//# define SQLITE_PTR_TO_INT(X) ((int)(X))
|
153
|
+
//#endif
|
154
|
+
|
155
|
+
/*
|
156
|
+
** The SQLITE_THREADSAFE macro must be defined as either 0 or 1.
|
157
|
+
** Older versions of SQLite used an optional THREADSAFE macro.
|
158
|
+
** We support that for legacy
|
159
|
+
*/
|
160
|
+
#if !SQLITE_THREADSAFE
|
161
|
+
#if THREADSAFE
|
162
|
+
//# define SQLITE_THREADSAFE THREADSAFE
|
163
|
+
#else
|
164
|
+
//# define SQLITE_THREADSAFE 1
|
165
|
+
const int SQLITE_THREADSAFE = 1;
|
166
|
+
#endif
|
167
|
+
#else
|
168
|
+
const int SQLITE_THREADSAFE = 1;
|
169
|
+
#endif
|
170
|
+
|
171
|
+
/*
|
172
|
+
** The SQLITE_DEFAULT_MEMSTATUS macro must be defined as either 0 or 1.
|
173
|
+
** It determines whether or not the features related to
|
174
|
+
** SQLITE_CONFIG_MEMSTATUS are available by default or not. This value can
|
175
|
+
** be overridden at runtime using the sqlite3_config() API.
|
176
|
+
*/
|
177
|
+
#if !(SQLITE_DEFAULT_MEMSTATUS)
|
178
|
+
//# define SQLITE_DEFAULT_MEMSTATUS 1
|
179
|
+
const int SQLITE_DEFAULT_MEMSTATUS = 0;
|
180
|
+
#else
|
181
|
+
const int SQLITE_DEFAULT_MEMSTATUS = 1;
|
182
|
+
#endif
|
183
|
+
|
184
|
+
/*
|
185
|
+
** Exactly one of the following macros must be defined in order to
|
186
|
+
** specify which memory allocation subsystem to use.
|
187
|
+
**
|
188
|
+
** SQLITE_SYSTEM_MALLOC // Use normal system malloc()
|
189
|
+
** SQLITE_MEMDEBUG // Debugging version of system malloc()
|
190
|
+
**
|
191
|
+
** (Historical note: There used to be several other options, but we've
|
192
|
+
** pared it down to just these two.)
|
193
|
+
**
|
194
|
+
** If none of the above are defined, then set SQLITE_SYSTEM_MALLOC as
|
195
|
+
** the default.
|
196
|
+
*/
|
197
|
+
//#if defined(SQLITE_SYSTEM_MALLOC)+defined(SQLITE_MEMDEBUG)+\
|
198
|
+
//# error "At most one of the following compile-time configuration options\
|
199
|
+
// is allows: SQLITE_SYSTEM_MALLOC, SQLITE_MEMDEBUG"
|
200
|
+
//#endif
|
201
|
+
//#if defined(SQLITE_SYSTEM_MALLOC)+defined(SQLITE_MEMDEBUG)+\
|
202
|
+
//# define SQLITE_SYSTEM_MALLOC 1
|
203
|
+
//#endif
|
204
|
+
|
205
|
+
/*
|
206
|
+
** If SQLITE_MALLOC_SOFT_LIMIT is not zero, then try to keep the
|
207
|
+
** sizes of memory allocations below this value where possible.
|
208
|
+
*/
|
209
|
+
#if !(SQLITE_MALLOC_SOFT_LIMIT)
|
210
|
+
const int SQLITE_MALLOC_SOFT_LIMIT = 1024;
|
211
|
+
#endif
|
212
|
+
|
213
|
+
/*
|
214
|
+
** We need to define _XOPEN_SOURCE as follows in order to enable
|
215
|
+
** recursive mutexes on most Unix systems. But Mac OS X is different.
|
216
|
+
** The _XOPEN_SOURCE define causes problems for Mac OS X we are told,
|
217
|
+
** so it is omitted there. See ticket #2673.
|
218
|
+
**
|
219
|
+
** Later we learn that _XOPEN_SOURCE is poorly or incorrectly
|
220
|
+
** implemented on some systems. So we avoid defining it at all
|
221
|
+
** if it is already defined or if it is unneeded because we are
|
222
|
+
** not doing a threadsafe build. Ticket #2681.
|
223
|
+
**
|
224
|
+
** See also ticket #2741.
|
225
|
+
*/
|
226
|
+
#if !_XOPEN_SOURCE && !__DARWIN__ && !__APPLE__ && SQLITE_THREADSAFE
|
227
|
+
const int _XOPEN_SOURCE = 500;//#define _XOPEN_SOURCE 500 /* Needed to enable pthread recursive mutexes */
|
228
|
+
#endif
|
229
|
+
|
230
|
+
/*
|
231
|
+
** The TCL headers are only needed when compiling the TCL bindings.
|
232
|
+
*/
|
233
|
+
#if SQLITE_TCL || TCLSH
|
234
|
+
//# include <tcl.h>
|
235
|
+
#endif
|
236
|
+
|
237
|
+
/*
|
238
|
+
** Many people are failing to set -DNDEBUG=1 when compiling SQLite.
|
239
|
+
** Setting NDEBUG makes the code smaller and run faster. So the following
|
240
|
+
** lines are added to automatically set NDEBUG unless the -DSQLITE_DEBUG=1
|
241
|
+
** option is set. Thus NDEBUG becomes an opt-in rather than an opt-out
|
242
|
+
** feature.
|
243
|
+
*/
|
244
|
+
#if !NDEBUG && !SQLITE_DEBUG
|
245
|
+
const int NDEBUG = 1;//# define NDEBUG 1
|
246
|
+
#endif
|
247
|
+
|
248
|
+
/*
|
249
|
+
** The testcase() macro is used to aid in coverage testing. When
|
250
|
+
** doing coverage testing, the condition inside the argument to
|
251
|
+
** testcase() must be evaluated both true and false in order to
|
252
|
+
** get full branch coverage. The testcase() macro is inserted
|
253
|
+
** to help ensure adequate test coverage in places where simple
|
254
|
+
** condition/decision coverage is inadequate. For example, testcase()
|
255
|
+
** can be used to make sure boundary values are tested. For
|
256
|
+
** bitmask tests, testcase() can be used to make sure each bit
|
257
|
+
** is significant and used at least once. On switch statements
|
258
|
+
** where multiple cases go to the same block of code, testcase()
|
259
|
+
** can insure that all cases are evaluated.
|
260
|
+
**
|
261
|
+
*/
|
262
|
+
#if SQLITE_COVERAGE_TEST
|
263
|
+
void sqlite3Coverage(int);
|
264
|
+
//# define testcase(X) if( X ){ sqlite3Coverage(__LINE__); }
|
265
|
+
#else
|
266
|
+
//# define testcase(X)
|
267
|
+
static void testcase<T>(T X) { }
|
268
|
+
#endif
|
269
|
+
|
270
|
+
/*
|
271
|
+
** The TESTONLY macro is used to enclose variable declarations or
|
272
|
+
** other bits of code that are needed to support the arguments
|
273
|
+
** within testcase() and assert() macros.
|
274
|
+
*/
|
275
|
+
#if !NDEBUG || SQLITE_COVERAGE_TEST
|
276
|
+
//# define TESTONLY(X) X
|
277
|
+
// -- Need workaround for C#, since inline macros don't exist
|
278
|
+
#else
|
279
|
+
//# define TESTONLY(X)
|
280
|
+
#endif
|
281
|
+
|
282
|
+
/*
|
283
|
+
** Sometimes we need a small amount of code such as a variable initialization
|
284
|
+
** to setup for a later assert() statement. We do not want this code to
|
285
|
+
** appear when assert() is disabled. The following macro is therefore
|
286
|
+
** used to contain that setup code. The "VVA" acronym stands for
|
287
|
+
** "Verification, Validation, and Accreditation". In other words, the
|
288
|
+
** code within VVA_ONLY() will only run during verification processes.
|
289
|
+
*/
|
290
|
+
#if !NDEBUG
|
291
|
+
//# define VVA_ONLY(X) X
|
292
|
+
#else
|
293
|
+
//# define VVA_ONLY(X)
|
294
|
+
#endif
|
295
|
+
|
296
|
+
/*
|
297
|
+
** The ALWAYS and NEVER macros surround boolean expressions which
|
298
|
+
** are intended to always be true or false, respectively. Such
|
299
|
+
** expressions could be omitted from the code completely. But they
|
300
|
+
** are included in a few cases in order to enhance the resilience
|
301
|
+
** of SQLite to unexpected behavior - to make the code "self-healing"
|
302
|
+
** or "ductile" rather than being "brittle" and crashing at the first
|
303
|
+
** hint of unplanned behavior.
|
304
|
+
**
|
305
|
+
** In other words, ALWAYS and NEVER are added for defensive code.
|
306
|
+
**
|
307
|
+
** When doing coverage testing ALWAYS and NEVER are hard-coded to
|
308
|
+
** be true and false so that the unreachable code then specify will
|
309
|
+
** not be counted as untested code.
|
310
|
+
*/
|
311
|
+
#if SQLITE_COVERAGE_TEST
|
312
|
+
//# define ALWAYS(X) (1)
|
313
|
+
//# define NEVER(X) (0)
|
314
|
+
#elif !NDEBUG
|
315
|
+
//# define ALWAYS(X) ((X)?1:(assert(0),0))
|
316
|
+
static bool ALWAYS(bool X) { if (X != true) Debug.Assert(false); return true; }
|
317
|
+
static int ALWAYS(int X) { if (X == 0) Debug.Assert(false); return 1; }
|
318
|
+
static bool ALWAYS<T>(T X) { if (X == null) Debug.Assert(false); return true; }
|
319
|
+
|
320
|
+
//# define NEVER(X) ((X)?(assert(0),1):0)
|
321
|
+
static bool NEVER(bool X) { if (X == true) Debug.Assert(false); return false; }
|
322
|
+
static byte NEVER(byte X) { if (X != 0) Debug.Assert(false); return 0; }
|
323
|
+
static int NEVER(int X) { if (X != 0) Debug.Assert(false); return 0; }
|
324
|
+
static bool NEVER<T>(T X) { if (X != null) Debug.Assert(false); return false; }
|
325
|
+
#else
|
326
|
+
//# define ALWAYS(X) (X)
|
327
|
+
static bool ALWAYS(bool X) { return X; }
|
328
|
+
static byte ALWAYS(byte X) { return X; }
|
329
|
+
static int ALWAYS(int X) { return X; }
|
330
|
+
static bool ALWAYS<T>( T X ) { return true; }
|
331
|
+
|
332
|
+
//# define NEVER(X) (X)
|
333
|
+
static bool NEVER(bool X) { return X; }
|
334
|
+
static byte NEVER(byte X) { return X; }
|
335
|
+
static int NEVER(int X) { return X; }
|
336
|
+
static bool NEVER<T>(T X) { return false; }
|
337
|
+
#endif
|
338
|
+
|
339
|
+
/*
|
340
|
+
** The macro unlikely() is a hint that surrounds a boolean
|
341
|
+
** expression that is usually false. Macro likely() surrounds
|
342
|
+
** a boolean expression that is usually true. GCC is able to
|
343
|
+
** use these hints to generate better code, sometimes.
|
344
|
+
*/
|
345
|
+
#if (__GNUC__) && FALSE
|
346
|
+
//# define likely(X) __builtin_expect((X),1)
|
347
|
+
//# define unlikely(X) __builtin_expect((X),0)
|
348
|
+
#else
|
349
|
+
//# define likely(X) !!(X)
|
350
|
+
static bool likely(bool X) { return !!X; }
|
351
|
+
//# define unlikely(X) !!(X)
|
352
|
+
static bool unlikely(bool X) { return !!X; }
|
353
|
+
#endif
|
354
|
+
|
355
|
+
//#include "sqlite3.h"
|
356
|
+
//#include "hash.h"
|
357
|
+
//#include "parse.h"
|
358
|
+
//#include <stdio.h>
|
359
|
+
//#include <stdlib.h>
|
360
|
+
//#include <string.h>
|
361
|
+
//#include <assert.h>
|
362
|
+
//#include <stddef.h>
|
363
|
+
|
364
|
+
/*
|
365
|
+
** If compiling for a processor that lacks floating point support,
|
366
|
+
** substitute integer for floating-point
|
367
|
+
*/
|
368
|
+
#if SQLITE_OMIT_FLOATING_POINT
|
369
|
+
//# define double sqlite_int64
|
370
|
+
//# define LONGDOUBLE_TYPE sqlite_int64
|
371
|
+
//#if !SQLITE_BIG_DBL
|
372
|
+
//# define SQLITE_BIG_DBL (((sqlite3_int64)1)<<50)
|
373
|
+
//# endif
|
374
|
+
//# define SQLITE_OMIT_DATETIME_FUNCS 1
|
375
|
+
//# define SQLITE_OMIT_TRACE 1
|
376
|
+
//# undef SQLITE_MIXED_ENDIAN_64BIT_FLOAT
|
377
|
+
//# undef SQLITE_HAVE_ISNAN
|
378
|
+
#endif
|
379
|
+
#if !SQLITE_BIG_DBL
|
380
|
+
const double SQLITE_BIG_DBL = (((sqlite3_int64)1) << 60);//# define SQLITE_BIG_DBL (1e99)
|
381
|
+
#endif
|
382
|
+
|
383
|
+
/*
|
384
|
+
** OMIT_TEMPDB is set to 1 if SQLITE_OMIT_TEMPDB is defined, or 0
|
385
|
+
** afterward. Having this macro allows us to cause the C compiler
|
386
|
+
** to omit code used by TEMP tables without messy #if !statements.
|
387
|
+
*/
|
388
|
+
#if SQLITE_OMIT_TEMPDB
|
389
|
+
//#define OMIT_TEMPDB 1
|
390
|
+
#else
|
391
|
+
static int OMIT_TEMPDB = 0;
|
392
|
+
#endif
|
393
|
+
|
394
|
+
|
395
|
+
/*
|
396
|
+
** The "file format" number is an integer that is incremented whenever
|
397
|
+
** the VDBE-level file format changes. The following macros define the
|
398
|
+
** the default file format for new databases and the maximum file format
|
399
|
+
** that the library can read.
|
400
|
+
*/
|
401
|
+
static public int SQLITE_MAX_FILE_FORMAT = 4;//#define SQLITE_MAX_FILE_FORMAT 4
|
402
|
+
//#if !SQLITE_DEFAULT_FILE_FORMAT
|
403
|
+
static int SQLITE_DEFAULT_FILE_FORMAT = 1;//# define SQLITE_DEFAULT_FILE_FORMAT 1
|
404
|
+
//#endif
|
405
|
+
|
406
|
+
/*
|
407
|
+
** Determine whether triggers are recursive by default. This can be
|
408
|
+
** changed at run-time using a pragma.
|
409
|
+
*/
|
410
|
+
#if !SQLITE_DEFAULT_RECURSIVE_TRIGGERS
|
411
|
+
//# define SQLITE_DEFAULT_RECURSIVE_TRIGGERS 0
|
412
|
+
static public bool SQLITE_DEFAULT_RECURSIVE_TRIGGERS = false;
|
413
|
+
#else
|
414
|
+
static public bool SQLITE_DEFAULT_RECURSIVE_TRIGGERS = true;
|
415
|
+
#endif
|
416
|
+
|
417
|
+
|
418
|
+
/*
|
419
|
+
** Provide a default value for SQLITE_TEMP_STORE in case it is not specified
|
420
|
+
** on the command-line
|
421
|
+
*/
|
422
|
+
#if !SQLITE_TEMP_STORE
|
423
|
+
static int SQLITE_TEMP_STORE = 1;//#define SQLITE_TEMP_STORE 1
|
424
|
+
#endif
|
425
|
+
|
426
|
+
/*
|
427
|
+
** GCC does not define the offsetof() macro so we'll have to do it
|
428
|
+
** ourselves.
|
429
|
+
*/
|
430
|
+
#if !offsetof
|
431
|
+
//#define offsetof(STRUCTURE,FIELD) ((int)((char*)&((STRUCTURE*)0)->FIELD))
|
432
|
+
#endif
|
433
|
+
|
434
|
+
/*
|
435
|
+
** Check to see if this machine uses EBCDIC. (Yes, believe it or
|
436
|
+
** not, there are still machines out there that use EBCDIC.)
|
437
|
+
*/
|
438
|
+
#if FALSE //'A' == '\301'
|
439
|
+
//# define SQLITE_EBCDIC 1
|
440
|
+
#else
|
441
|
+
const int SQLITE_ASCII = 1;//#define SQLITE_ASCII 1
|
442
|
+
#endif
|
443
|
+
|
444
|
+
/*
|
445
|
+
** Integers of known sizes. These typedefs might change for architectures
|
446
|
+
** where the sizes very. Preprocessor macros are available so that the
|
447
|
+
** types can be conveniently redefined at compile-type. Like this:
|
448
|
+
**
|
449
|
+
** cc '-Du32PTR_TYPE=long long int' ...
|
450
|
+
*/
|
451
|
+
//#if !u32_TYPE
|
452
|
+
//# ifdef HAVE_u32_T
|
453
|
+
//# define u32_TYPE u32_t
|
454
|
+
//# else
|
455
|
+
//# define u32_TYPE unsigned int
|
456
|
+
//# endif
|
457
|
+
//#endif
|
458
|
+
//#if !u3216_TYPE
|
459
|
+
//# ifdef HAVE_u3216_T
|
460
|
+
//# define u3216_TYPE u3216_t
|
461
|
+
//# else
|
462
|
+
//# define u3216_TYPE unsigned short int
|
463
|
+
//# endif
|
464
|
+
//#endif
|
465
|
+
//#if !INT16_TYPE
|
466
|
+
//# ifdef HAVE_INT16_T
|
467
|
+
//# define INT16_TYPE int16_t
|
468
|
+
//# else
|
469
|
+
//# define INT16_TYPE short int
|
470
|
+
//# endif
|
471
|
+
//#endif
|
472
|
+
//#if !u328_TYPE
|
473
|
+
//# ifdef HAVE_u328_T
|
474
|
+
//# define u328_TYPE u328_t
|
475
|
+
//# else
|
476
|
+
//# define u328_TYPE unsigned char
|
477
|
+
//# endif
|
478
|
+
//#endif
|
479
|
+
//#if !INT8_TYPE
|
480
|
+
//# ifdef HAVE_INT8_T
|
481
|
+
//# define INT8_TYPE int8_t
|
482
|
+
//# else
|
483
|
+
//# define INT8_TYPE signed char
|
484
|
+
//# endif
|
485
|
+
//#endif
|
486
|
+
//#if !LONGDOUBLE_TYPE
|
487
|
+
//# define LONGDOUBLE_TYPE long double
|
488
|
+
//#endif
|
489
|
+
//typedef sqlite_int64 i64; /* 8-byte signed integer */
|
490
|
+
//typedef sqlite_u3264 u64; /* 8-byte unsigned integer */
|
491
|
+
//typedef u32_TYPE u32; /* 4-byte unsigned integer */
|
492
|
+
//typedef u3216_TYPE u16; /* 2-byte unsigned integer */
|
493
|
+
//typedef INT16_TYPE i16; /* 2-byte signed integer */
|
494
|
+
//typedef u328_TYPE u8; /* 1-byte unsigned integer */
|
495
|
+
//typedef INT8_TYPE i8; /* 1-byte signed integer */
|
496
|
+
|
497
|
+
/*
|
498
|
+
** SQLITE_MAX_U32 is a u64 constant that is the maximum u64 value
|
499
|
+
** that can be stored in a u32 without loss of data. The value
|
500
|
+
** is 0x00000000ffffffff. But because of quirks of some compilers, we
|
501
|
+
** have to specify the value in the less intuitive manner shown:
|
502
|
+
*/
|
503
|
+
//#define SQLITE_MAX_U32 ((((u64)1)<<32)-1)
|
504
|
+
const u32 SQLITE_MAX_U32 = (u32)((((u64)1) << 32) - 1);
|
505
|
+
|
506
|
+
|
507
|
+
/*
|
508
|
+
** Macros to determine whether the machine is big or little endian,
|
509
|
+
** evaluated at runtime.
|
510
|
+
*/
|
511
|
+
#if SQLITE_AMALGAMATION
|
512
|
+
//const int sqlite3one = 1;
|
513
|
+
#else
|
514
|
+
const bool sqlite3one = true;
|
515
|
+
#endif
|
516
|
+
#if i386 || __i386__ || _M_IX86
|
517
|
+
const int ;//#define SQLITE_BIGENDIAN 0
|
518
|
+
const int ;//#define SQLITE_LITTLEENDIAN 1
|
519
|
+
const int ;//#define SQLITE_UTF16NATIVE SQLITE_UTF16LE
|
520
|
+
#else
|
521
|
+
static u8 SQLITE_BIGENDIAN = 0;//#define SQLITE_BIGENDIAN (*(char *)(&sqlite3one)==0)
|
522
|
+
static u8 SQLITE_LITTLEENDIAN = 1;//#define SQLITE_LITTLEENDIAN (*(char *)(&sqlite3one)==1)
|
523
|
+
static u8 SQLITE_UTF16NATIVE = (SQLITE_BIGENDIAN != 0 ? SQLITE_UTF16BE : SQLITE_UTF16LE);//#define SQLITE_UTF16NATIVE (SQLITE_BIGENDIAN?SQLITE_UTF16BE:SQLITE_UTF16LE)
|
524
|
+
#endif
|
525
|
+
|
526
|
+
/*
|
527
|
+
** Constants for the largest and smallest possible 64-bit signed integers.
|
528
|
+
** These macros are designed to work correctly on both 32-bit and 64-bit
|
529
|
+
** compilers.
|
530
|
+
*/
|
531
|
+
//#define LARGEST_INT64 (0xffffffff|(((i64)0x7fffffff)<<32))
|
532
|
+
//#define SMALLEST_INT64 (((i64)-1) - LARGEST_INT64)
|
533
|
+
const i64 LARGEST_INT64 = i64.MaxValue;//( 0xffffffff | ( ( (i64)0x7fffffff ) << 32 ) );
|
534
|
+
const i64 SMALLEST_INT64 = i64.MinValue;//( ( ( i64 ) - 1 ) - LARGEST_INT64 );
|
535
|
+
|
536
|
+
/*
|
537
|
+
** Round up a number to the next larger multiple of 8. This is used
|
538
|
+
** to force 8-byte alignment on 64-bit architectures.
|
539
|
+
*/
|
540
|
+
//#define ROUND8(x) (((x)+7)&~7)
|
541
|
+
static int ROUND8(int x) { return (x + 7) & ~7; }
|
542
|
+
|
543
|
+
/*
|
544
|
+
** Round down to the nearest multiple of 8
|
545
|
+
*/
|
546
|
+
//#define ROUNDDOWN8(x) ((x)&~7)
|
547
|
+
static int ROUNDDOWN8(int x) { return x & ~7; }
|
548
|
+
|
549
|
+
/*
|
550
|
+
** Assert that the pointer X is aligned to an 8-byte boundary. This
|
551
|
+
** macro is used only within assert() to verify that the code gets
|
552
|
+
** all alignment restrictions correct.
|
553
|
+
**
|
554
|
+
** Except, if SQLITE_4_BYTE_ALIGNED_MALLOC is defined, then the
|
555
|
+
** underlying malloc() implemention might return us 4-byte aligned
|
556
|
+
** pointers. In that case, only verify 4-byte alignment.
|
557
|
+
*/
|
558
|
+
//#ifdef SQLITE_4_BYTE_ALIGNED_MALLOC
|
559
|
+
//# define EIGHT_BYTE_ALIGNMENT(X) ((((char*)(X) - (char*)0)&3)==0)
|
560
|
+
//#else
|
561
|
+
//# define EIGHT_BYTE_ALIGNMENT(X) ((((char*)(X) - (char*)0)&7)==0)
|
562
|
+
//#endif
|
563
|
+
|
564
|
+
/*
|
565
|
+
** An instance of the following structure is used to store the busy-handler
|
566
|
+
** callback for a given sqlite handle.
|
567
|
+
**
|
568
|
+
** The sqlite.busyHandler member of the sqlite struct contains the busy
|
569
|
+
** callback for the database handle. Each pager opened via the sqlite
|
570
|
+
** handle is passed a pointer to sqlite.busyHandler. The busy-handler
|
571
|
+
** callback is currently invoked only from within pager.c.
|
572
|
+
*/
|
573
|
+
//typedef struct BusyHandler BusyHandler;
|
574
|
+
public class BusyHandler
|
575
|
+
{
|
576
|
+
public dxBusy xFunc;//)(void *,int); /* The busy callback */
|
577
|
+
public object pArg; /* First arg to busy callback */
|
578
|
+
public int nBusy; /* Incremented with each busy call */
|
579
|
+
};
|
580
|
+
|
581
|
+
/*
|
582
|
+
** Name of the master database table. The master database table
|
583
|
+
** is a special table that holds the names and attributes of all
|
584
|
+
** user tables and indices.
|
585
|
+
*/
|
586
|
+
const string MASTER_NAME = "sqlite_master";//#define MASTER_NAME "sqlite_master"
|
587
|
+
const string TEMP_MASTER_NAME = "sqlite_temp_master";//#define TEMP_MASTER_NAME "sqlite_temp_master"
|
588
|
+
|
589
|
+
/*
|
590
|
+
** The root-page of the master database table.
|
591
|
+
*/
|
592
|
+
const int MASTER_ROOT = 1;//#define MASTER_ROOT 1
|
593
|
+
|
594
|
+
/*
|
595
|
+
** The name of the schema table.
|
596
|
+
*/
|
597
|
+
static string SCHEMA_TABLE(int x) //#define SCHEMA_TABLE(x) ((!OMIT_TEMPDB)&&(x==1)?TEMP_MASTER_NAME:MASTER_NAME)
|
598
|
+
{ return ((OMIT_TEMPDB == 0) && (x == 1) ? TEMP_MASTER_NAME : MASTER_NAME); }
|
599
|
+
|
600
|
+
/*
|
601
|
+
** A convenience macro that returns the number of elements in
|
602
|
+
** an array.
|
603
|
+
*/
|
604
|
+
//#define ArraySize(X) ((int)(sizeof(X)/sizeof(X[0])))
|
605
|
+
static int ArraySize<T>(T[] x) { return x.Length; }
|
606
|
+
|
607
|
+
/*
|
608
|
+
** The following value as a destructor means to use sqlite3DbFree().
|
609
|
+
** This is an internal extension to SQLITE_STATIC and SQLITE_TRANSIENT.
|
610
|
+
*/
|
611
|
+
//#define SQLITE_DYNAMIC ((sqlite3_destructor_type)sqlite3DbFree)
|
612
|
+
static dxDel SQLITE_DYNAMIC;
|
613
|
+
|
614
|
+
/*
|
615
|
+
** When SQLITE_OMIT_WSD is defined, it means that the target platform does
|
616
|
+
** not support Writable Static Data (WSD) such as global and static variables.
|
617
|
+
** All variables must either be on the stack or dynamically allocated from
|
618
|
+
** the heap. When WSD is unsupported, the variable declarations scattered
|
619
|
+
** throughout the SQLite code must become constants instead. The SQLITE_WSD
|
620
|
+
** macro is used for this purpose. And instead of referencing the variable
|
621
|
+
** directly, we use its constant as a key to lookup the run-time allocated
|
622
|
+
** buffer that holds real variable. The constant is also the initializer
|
623
|
+
** for the run-time allocated buffer.
|
624
|
+
**
|
625
|
+
** In the usual case where WSD is supported, the SQLITE_WSD and GLOBAL
|
626
|
+
** macros become no-ops and have zero performance impact.
|
627
|
+
*/
|
628
|
+
#if SQLITE_OMIT_WSD
|
629
|
+
//#define SQLITE_WSD const
|
630
|
+
//#define GLOBAL(t,v) (*(t*)sqlite3_wsd_find((void*)&(v), sizeof(v)))
|
631
|
+
//#define sqlite3GlobalConfig GLOBAL(struct Sqlite3Config, sqlite3Config)
|
632
|
+
int sqlite3_wsd_init(int N, int J);
|
633
|
+
void *sqlite3_wsd_find(void *K, int L);
|
634
|
+
#else
|
635
|
+
//#define SQLITE_WSD
|
636
|
+
//#define GLOBAL(t,v) v
|
637
|
+
//#define sqlite3GlobalConfig sqlite3Config
|
638
|
+
static Sqlite3Config sqlite3GlobalConfig;
|
639
|
+
#endif
|
640
|
+
|
641
|
+
/*
|
642
|
+
** The following macros are used to suppress compiler warnings and to
|
643
|
+
** make it clear to human readers when a function parameter is deliberately
|
644
|
+
** left unused within the body of a function. This usually happens when
|
645
|
+
** a function is called via a function pointer. For example the
|
646
|
+
** implementation of an SQL aggregate step callback may not use the
|
647
|
+
** parameter indicating the number of arguments passed to the aggregate,
|
648
|
+
** if it knows that this is enforced elsewhere.
|
649
|
+
**
|
650
|
+
** When a function parameter is not used at all within the body of a function,
|
651
|
+
** it is generally named "NotUsed" or "NotUsed2" to make things even clearer.
|
652
|
+
** However, these macros may also be used to suppress warnings related to
|
653
|
+
** parameters that may or may not be used depending on compilation options.
|
654
|
+
** For example those parameters only used in assert() statements. In these
|
655
|
+
** cases the parameters are named as per the usual conventions.
|
656
|
+
*/
|
657
|
+
//#define UNUSED_PARAMETER(x) (void)(x)
|
658
|
+
static void UNUSED_PARAMETER<T>(T x) { }
|
659
|
+
|
660
|
+
//#define UNUSED_PARAMETER2(x,y) UNUSED_PARAMETER(x),UNUSED_PARAMETER(y)
|
661
|
+
static void UNUSED_PARAMETER2<T1, T2>(T1 x, T2 y) { UNUSED_PARAMETER(x); UNUSED_PARAMETER(y); }
|
662
|
+
|
663
|
+
/*
|
664
|
+
** Forward references to structures
|
665
|
+
*/
|
666
|
+
//typedef struct AggInfo AggInfo;
|
667
|
+
//typedef struct AuthContext AuthContext;
|
668
|
+
//typedef struct AutoincInfo AutoincInfo;
|
669
|
+
//typedef struct Bitvec Bitvec;
|
670
|
+
//typedef struct CollSeq CollSeq;
|
671
|
+
//typedef struct Column Column;
|
672
|
+
//typedef struct Db Db;
|
673
|
+
//typedef struct Schema Schema;
|
674
|
+
//typedef struct Expr Expr;
|
675
|
+
//typedef struct ExprList ExprList;
|
676
|
+
//typedef struct ExprSpan ExprSpan;
|
677
|
+
//typedef struct FKey FKey;
|
678
|
+
//typedef struct FuncDef FuncDef;
|
679
|
+
//typedef struct IdList IdList;
|
680
|
+
//typedef struct Index Index;
|
681
|
+
//typedef struct IndexSample IndexSample;
|
682
|
+
//typedef struct KeyClass KeyClass;
|
683
|
+
//typedef struct KeyInfo KeyInfo;
|
684
|
+
//typedef struct Lookaside Lookaside;
|
685
|
+
//typedef struct LookasideSlot LookasideSlot;
|
686
|
+
//typedef struct Module Module;
|
687
|
+
//typedef struct NameContext NameContext;
|
688
|
+
//typedef struct Parse Parse;
|
689
|
+
//typedef struct RowSet RowSet;
|
690
|
+
//typedef struct Savepoint Savepoint;
|
691
|
+
//typedef struct Select Select;
|
692
|
+
//typedef struct SrcList SrcList;
|
693
|
+
//typedef struct StrAccum StrAccum;
|
694
|
+
//typedef struct Table Table;
|
695
|
+
//typedef struct TableLock TableLock;
|
696
|
+
//typedef struct Token Token;
|
697
|
+
//typedef struct Trigger Trigger;
|
698
|
+
//typedef struct TriggerPrg TriggerPrg;
|
699
|
+
//typedef struct TriggerStep TriggerStep;
|
700
|
+
//typedef struct UnpackedRecord UnpackedRecord;
|
701
|
+
//typedef struct VTable VTable;
|
702
|
+
//typedef struct Walker Walker;
|
703
|
+
//typedef struct WherePlan WherePlan;
|
704
|
+
//typedef struct WhereInfo WhereInfo;
|
705
|
+
//typedef struct WhereLevel WhereLevel;
|
706
|
+
|
707
|
+
/*
|
708
|
+
** Defer sourcing vdbe.h and btree.h until after the "u8" and
|
709
|
+
** "BusyHandler" typedefs. vdbe.h also requires a few of the opaque
|
710
|
+
** pointer types (i.e. FuncDef) defined above.
|
711
|
+
*/
|
712
|
+
//#include "btree.h"
|
713
|
+
//#include "vdbe.h"
|
714
|
+
//#include "pager.h"
|
715
|
+
//#include "pcache_g.h"
|
716
|
+
|
717
|
+
//#include "os.h"
|
718
|
+
//#include "mutex.h"
|
719
|
+
|
720
|
+
/*
|
721
|
+
** Each database file to be accessed by the system is an instance
|
722
|
+
** of the following structure. There are normally two of these structures
|
723
|
+
** in the sqlite.aDb[] array. aDb[0] is the main database file and
|
724
|
+
** aDb[1] is the database file used to hold temporary tables. Additional
|
725
|
+
** databases may be attached.
|
726
|
+
*/
|
727
|
+
public class Db
|
728
|
+
{
|
729
|
+
public string zName; /* Name of this database */
|
730
|
+
public Btree pBt; /* The B Tree structure for this database file */
|
731
|
+
public u8 inTrans; /* 0: not writable. 1: Transaction. 2: Checkpoint */
|
732
|
+
public u8 safety_level; /* How aggressive at syncing data to disk */
|
733
|
+
public Schema pSchema; /* Pointer to database schema (possibly shared) */
|
734
|
+
};
|
735
|
+
|
736
|
+
/*
|
737
|
+
** An instance of the following structure stores a database schema.
|
738
|
+
**
|
739
|
+
** If there are no virtual tables configured in this schema, the
|
740
|
+
** Schema.db variable is set to NULL. After the first virtual table
|
741
|
+
** has been added, it is set to point to the database connection
|
742
|
+
** used to create the connection. Once a virtual table has been
|
743
|
+
** added to the Schema structure and the Schema.db variable populated,
|
744
|
+
** only that database connection may use the Schema to prepare
|
745
|
+
** statements.
|
746
|
+
*/
|
747
|
+
public class Schema
|
748
|
+
{
|
749
|
+
public int schema_cookie; /* Database schema version number for this file */
|
750
|
+
public Hash tblHash = new Hash(); /* All tables indexed by name */
|
751
|
+
public Hash idxHash = new Hash(); /* All (named) indices indexed by name */
|
752
|
+
public Hash trigHash = new Hash();/* All triggers indexed by name */
|
753
|
+
public Hash fkeyHash = new Hash();/* All foreign keys by referenced table name */
|
754
|
+
public Table pSeqTab; /* The sqlite_sequence table used by AUTOINCREMENT */
|
755
|
+
public u8 file_format; /* Schema format version for this file */
|
756
|
+
public u8 enc; /* Text encoding used by this database */
|
757
|
+
public u16 flags; /* Flags associated with this schema */
|
758
|
+
public int cache_size; /* Number of pages to use in the cache */
|
759
|
+
#if !SQLITE_OMIT_VIRTUALTABLE
|
760
|
+
public sqlite3 db; /* "Owner" connection. See comment above */
|
761
|
+
#endif
|
762
|
+
public Schema Copy()
|
763
|
+
{
|
764
|
+
if (this == null)
|
765
|
+
return null;
|
766
|
+
else
|
767
|
+
{
|
768
|
+
Schema cp = (Schema)MemberwiseClone();
|
769
|
+
return cp;
|
770
|
+
}
|
771
|
+
}
|
772
|
+
};
|
773
|
+
|
774
|
+
/*
|
775
|
+
** These macros can be used to test, set, or clear bits in the
|
776
|
+
** Db.pSchema->flags field.
|
777
|
+
*/
|
778
|
+
//#define DbHasProperty(D,I,P) (((D)->aDb[I].pSchema->flags&(P))==(P))
|
779
|
+
static bool DbHasProperty(sqlite3 D, int I, ushort P) { return (D.aDb[I].pSchema.flags & P) == P; }
|
780
|
+
//#define DbHasAnyProperty(D,I,P) (((D)->aDb[I].pSchema->flags&(P))!=0)
|
781
|
+
//#define DbSetProperty(D,I,P) (D)->aDb[I].pSchema->flags|=(P)
|
782
|
+
static void DbSetProperty(sqlite3 D, int I, ushort P) { D.aDb[I].pSchema.flags = (u16)(D.aDb[I].pSchema.flags | P); }
|
783
|
+
//#define DbClearProperty(D,I,P) (D)->aDb[I].pSchema->flags&=~(P)
|
784
|
+
static void DbClearProperty(sqlite3 D, int I, ushort P) { D.aDb[I].pSchema.flags = (u16)(D.aDb[I].pSchema.flags & ~P); }
|
785
|
+
/*
|
786
|
+
** Allowed values for the DB.pSchema->flags field.
|
787
|
+
**
|
788
|
+
** The DB_SchemaLoaded flag is set after the database schema has been
|
789
|
+
** read into internal hash tables.
|
790
|
+
**
|
791
|
+
** DB_UnresetViews means that one or more views have column names that
|
792
|
+
** have been filled out. If the schema changes, these column names might
|
793
|
+
** changes and so the view will need to be reset.
|
794
|
+
*/
|
795
|
+
//#define DB_SchemaLoaded 0x0001 /* The schema has been loaded */
|
796
|
+
//#define DB_UnresetViews 0x0002 /* Some views have defined column names */
|
797
|
+
//#define DB_Empty 0x0004 /* The file is empty (length 0 bytes) */
|
798
|
+
const u16 DB_SchemaLoaded = 0x0001;
|
799
|
+
const u16 DB_UnresetViews = 0x0002;
|
800
|
+
const u16 DB_Empty = 0x0004;
|
801
|
+
|
802
|
+
/*
|
803
|
+
** The number of different kinds of things that can be limited
|
804
|
+
** using the sqlite3_limit() interface.
|
805
|
+
*/
|
806
|
+
//#define SQLITE_N_LIMIT (SQLITE_LIMIT_TRIGGER_DEPTH+1)
|
807
|
+
const int SQLITE_N_LIMIT = SQLITE_LIMIT_TRIGGER_DEPTH + 1;
|
808
|
+
|
809
|
+
/*
|
810
|
+
** Lookaside malloc is a set of fixed-size buffers that can be used
|
811
|
+
** to satisfy small transient memory allocation requests for objects
|
812
|
+
** associated with a particular database connection. The use of
|
813
|
+
** lookaside malloc provides a significant performance enhancement
|
814
|
+
** (approx 10%) by avoiding numerous malloc/free requests while parsing
|
815
|
+
** SQL statements.
|
816
|
+
**
|
817
|
+
** The Lookaside structure holds configuration information about the
|
818
|
+
** lookaside malloc subsystem. Each available memory allocation in
|
819
|
+
** the lookaside subsystem is stored on a linked list of LookasideSlot
|
820
|
+
** objects.
|
821
|
+
**
|
822
|
+
** Lookaside allocations are only allowed for objects that are associated
|
823
|
+
** with a particular database connection. Hence, schema information cannot
|
824
|
+
** be stored in lookaside because in shared cache mode the schema information
|
825
|
+
** is shared by multiple database connections. Therefore, while parsing
|
826
|
+
** schema information, the Lookaside.bEnabled flag is cleared so that
|
827
|
+
** lookaside allocations are not used to construct the schema objects.
|
828
|
+
*/
|
829
|
+
public class Lookaside
|
830
|
+
{
|
831
|
+
public int sz; /* Size of each buffer in bytes */
|
832
|
+
public u8 bEnabled; /* False to disable new lookaside allocations */
|
833
|
+
public bool bMalloced; /* True if pStart obtained from sqlite3_malloc() */
|
834
|
+
public int nOut; /* Number of buffers currently checked out */
|
835
|
+
public int mxOut; /* Highwater mark for nOut */
|
836
|
+
public LookasideSlot pFree; /* List of available buffers */
|
837
|
+
public int pStart; /* First byte of available memory space */
|
838
|
+
public int pEnd; /* First byte past end of available space */
|
839
|
+
};
|
840
|
+
public class LookasideSlot
|
841
|
+
{
|
842
|
+
public LookasideSlot pNext; /* Next buffer in the list of free buffers */
|
843
|
+
};
|
844
|
+
|
845
|
+
/*
|
846
|
+
** A hash table for function definitions.
|
847
|
+
**
|
848
|
+
** Hash each FuncDef structure into one of the FuncDefHash.a[] slots.
|
849
|
+
** Collisions are on the FuncDef.pHash chain.
|
850
|
+
*/
|
851
|
+
public class FuncDefHash
|
852
|
+
{
|
853
|
+
public FuncDef[] a = new FuncDef[23]; /* Hash table for functions */
|
854
|
+
};
|
855
|
+
|
856
|
+
/*
|
857
|
+
** Each database connection is an instance of the following structure.
|
858
|
+
**
|
859
|
+
** The sqlite.lastRowid records the last insert rowid generated by an
|
860
|
+
** insert statement. Inserts on views do not affect its value. Each
|
861
|
+
** trigger has its own context, so that lastRowid can be updated inside
|
862
|
+
** triggers as usual. The previous value will be restored once the trigger
|
863
|
+
** exits. Upon entering a before or instead of trigger, lastRowid is no
|
864
|
+
** longer (since after version 2.8.12) reset to -1.
|
865
|
+
**
|
866
|
+
** The sqlite.nChange does not count changes within triggers and keeps no
|
867
|
+
** context. It is reset at start of sqlite3_exec.
|
868
|
+
** The sqlite.lsChange represents the number of changes made by the last
|
869
|
+
** insert, update, or delete statement. It remains constant throughout the
|
870
|
+
** length of a statement and is then updated by OP_SetCounts. It keeps a
|
871
|
+
** context stack just like lastRowid so that the count of changes
|
872
|
+
** within a trigger is not seen outside the trigger. Changes to views do not
|
873
|
+
** affect the value of lsChange.
|
874
|
+
** The sqlite.csChange keeps track of the number of current changes (since
|
875
|
+
** the last statement) and is used to update sqlite_lsChange.
|
876
|
+
**
|
877
|
+
** The member variables sqlite.errCode, sqlite.zErrMsg and sqlite.zErrMsg16
|
878
|
+
** store the most recent error code and, if applicable, string. The
|
879
|
+
** internal function sqlite3Error() is used to set these variables
|
880
|
+
** consistently.
|
881
|
+
*/
|
882
|
+
public class sqlite3
|
883
|
+
{
|
884
|
+
public sqlite3_vfs pVfs; /* OS Interface */
|
885
|
+
public int nDb; /* Number of backends currently in use */
|
886
|
+
public Db[] aDb = new Db[SQLITE_MAX_ATTACHED]; /* All backends */
|
887
|
+
public int flags; /* Miscellaneous flags. See below */
|
888
|
+
public int openFlags; /* Flags passed to sqlite3_vfs.xOpen() */
|
889
|
+
public int errCode; /* Most recent error code (SQLITE_*) */
|
890
|
+
public int errMask; /* & result codes with this before returning */
|
891
|
+
public u8 autoCommit; /* The auto-commit flag. */
|
892
|
+
public u8 temp_store; /* 1: file 2: memory 0: default */
|
893
|
+
// Cannot happen under C#
|
894
|
+
// public u8 mallocFailed; /* True if we have seen a malloc failure */
|
895
|
+
public u8 dfltLockMode; /* Default locking-mode for attached dbs */
|
896
|
+
public u8 dfltJournalMode; /* Default journal mode for attached dbs */
|
897
|
+
public int nextAutovac; /* Autovac setting after VACUUM if >=0 */
|
898
|
+
public u8 suppressErr; /* Do not issue error messages if true */
|
899
|
+
public int nextPagesize; /* Pagesize after VACUUM if >0 */
|
900
|
+
public int nTable; /* Number of tables in the database */
|
901
|
+
public CollSeq pDfltColl; /* The default collating sequence (BINARY) */
|
902
|
+
public i64 lastRowid; /* ROWID of most recent insert (see above) */
|
903
|
+
public u32 magic; /* Magic number for detect library misuse */
|
904
|
+
public int nChange; /* Value returned by sqlite3_changes() */
|
905
|
+
public int nTotalChange; /* Value returned by sqlite3_total_changes() */
|
906
|
+
public sqlite3_mutex mutex; /* Connection mutex */
|
907
|
+
public int[] aLimit = new int[SQLITE_N_LIMIT]; /* Limits */
|
908
|
+
public class sqlite3InitInfo
|
909
|
+
{ /* Information used during initialization */
|
910
|
+
public int iDb; /* When back is being initialized */
|
911
|
+
public int newTnum; /* Rootpage of table being initialized */
|
912
|
+
public u8 busy; /* TRUE if currently initializing */
|
913
|
+
public u8 orphanTrigger; /* Last statement is orphaned TEMP trigger */
|
914
|
+
};
|
915
|
+
public sqlite3InitInfo init = new sqlite3InitInfo();
|
916
|
+
public int nExtension; /* Number of loaded extensions */
|
917
|
+
public object[] aExtension; /* Array of shared library handles */
|
918
|
+
public Vdbe pVdbe; /* List of active virtual machines */
|
919
|
+
public int activeVdbeCnt; /* Number of VDBEs currently executing */
|
920
|
+
public int writeVdbeCnt; /* Number of active VDBEs that are writing */
|
921
|
+
public dxTrace xTrace;//)(void*,const char*); /* Trace function */
|
922
|
+
public object pTraceArg; /* Argument to the trace function */
|
923
|
+
public dxProfile xProfile;//)(void*,const char*,u64); /* Profiling function */
|
924
|
+
public object pProfileArg; /* Argument to profile function */
|
925
|
+
public object pCommitArg; /* Argument to xCommitCallback() */
|
926
|
+
public dxCommitCallback xCommitCallback;//)(void*); /* Invoked at every commit. */
|
927
|
+
public object pRollbackArg; /* Argument to xRollbackCallback() */
|
928
|
+
public dxRollbackCallback xRollbackCallback;//)(void*); /* Invoked at every commit. */
|
929
|
+
public object pUpdateArg;
|
930
|
+
public dxUpdateCallback xUpdateCallback;//)(void*,int, const char*,const char*,sqlite_int64);
|
931
|
+
public dxCollNeeded xCollNeeded;//)(void*,sqlite3*,int eTextRep,const char*);
|
932
|
+
public dxCollNeeded xCollNeeded16;//)(void*,sqlite3*,int eTextRep,const void*);
|
933
|
+
public object pCollNeededArg;
|
934
|
+
public sqlite3_value pErr; /* Most recent error message */
|
935
|
+
public string zErrMsg; /* Most recent error message (UTF-8 encoded) */
|
936
|
+
public string zErrMsg16; /* Most recent error message (UTF-16 encoded) */
|
937
|
+
public struct _u1
|
938
|
+
{
|
939
|
+
public bool isInterrupted; /* True if sqlite3_interrupt has been called */
|
940
|
+
public double notUsed1; /* Spacer */
|
941
|
+
}
|
942
|
+
public _u1 u1;
|
943
|
+
public Lookaside lookaside = new Lookaside(); /* Lookaside malloc configuration */
|
944
|
+
#if !SQLITE_OMIT_AUTHORIZATION
|
945
|
+
public dxAuth xAuth;//)(void*,int,const char*,const char*,const char*,const char*);
|
946
|
+
/* Access authorization function */
|
947
|
+
public object pAuthArg; /* 1st argument to the access auth function */
|
948
|
+
#endif
|
949
|
+
#if !SQLITE_OMIT_PROGRESS_CALLBACK
|
950
|
+
public dxProgress xProgress;//)(void *); /* The progress callback */
|
951
|
+
public object pProgressArg; /* Argument to the progress callback */
|
952
|
+
public int nProgressOps; /* Number of opcodes for progress callback */
|
953
|
+
#endif
|
954
|
+
#if !SQLITE_OMIT_VIRTUALTABLE
|
955
|
+
public Hash aModule; /* populated by sqlite3_create_module() */
|
956
|
+
public Table pVTab; /* vtab with active Connect/Create method */
|
957
|
+
public VTable aVTrans; /* Virtual tables with open transactions */
|
958
|
+
public int nVTrans; /* Allocated size of aVTrans */
|
959
|
+
public VTable pDisconnect; /* Disconnect these in next sqlite3_prepare() */
|
960
|
+
#endif
|
961
|
+
public FuncDefHash aFunc = new FuncDefHash(); /* Hash table of connection functions */
|
962
|
+
public Hash aCollSeq = new Hash(); /* All collating sequences */
|
963
|
+
public BusyHandler busyHandler = new BusyHandler(); /* Busy callback */
|
964
|
+
public int busyTimeout; /* Busy handler timeout, in msec */
|
965
|
+
public Db[] aDbStatic = new Db[] { new Db(), new Db() }; /* Static space for the 2 default backends */
|
966
|
+
public Savepoint pSavepoint; /* List of active savepoints */
|
967
|
+
public int nSavepoint; /* Number of non-transaction savepoints */
|
968
|
+
public int nStatement; /* Number of nested statement-transactions */
|
969
|
+
public u8 isTransactionSavepoint; /* True if the outermost savepoint is a TS */
|
970
|
+
public i64 nDeferredCons; /* Net deferred constraints this transaction. */
|
971
|
+
#if SQLITE_ENABLE_UNLOCK_NOTIFY
|
972
|
+
/* The following variables are all protected by the STATIC_MASTER
|
973
|
+
** mutex, not by sqlite3.mutex. They are used by code in notify.c.
|
974
|
+
**
|
975
|
+
** When X.pUnlockConnection==Y, that means that X is waiting for Y to
|
976
|
+
** unlock so that it can proceed.
|
977
|
+
**
|
978
|
+
** When X.pBlockingConnection==Y, that means that something that X tried
|
979
|
+
** tried to do recently failed with an SQLITE_LOCKED error due to locks
|
980
|
+
** held by Y.
|
981
|
+
*/
|
982
|
+
sqlite3 *pBlockingConnection; /* Connection that caused SQLITE_LOCKED */
|
983
|
+
sqlite3 *pUnlockConnection; /* Connection to watch for unlock */
|
984
|
+
void *pUnlockArg; /* Argument to xUnlockNotify */
|
985
|
+
void (*xUnlockNotify)(void **, int); /* Unlock notify callback */
|
986
|
+
sqlite3 *pNextBlocked; /* Next in list of all blocked connections */
|
987
|
+
#endif
|
988
|
+
};
|
989
|
+
|
990
|
+
/*
|
991
|
+
** A macro to discover the encoding of a database.
|
992
|
+
*/
|
993
|
+
//#define ENC(db) ((db)->aDb[0].pSchema->enc)
|
994
|
+
static u8 ENC(sqlite3 db) { return db.aDb[0].pSchema.enc; }
|
995
|
+
|
996
|
+
/*
|
997
|
+
** Possible values for the sqlite3.flags.
|
998
|
+
*/
|
999
|
+
//#define SQLITE_VdbeTrace 0x00000100 /* True to trace VDBE execution */
|
1000
|
+
//#define SQLITE_InternChanges 0x00000200 /* Uncommitted Hash table changes */
|
1001
|
+
//#define SQLITE_FullColNames 0x00000400 /* Show full column names on SELECT */
|
1002
|
+
//#define SQLITE_ShortColNames 0x00000800 /* Show short columns names */
|
1003
|
+
//#define SQLITE_CountRows 0x00001000 /* Count rows changed by INSERT, */
|
1004
|
+
// /* DELETE, or UPDATE and return */
|
1005
|
+
// /* the count using a callback. */
|
1006
|
+
//#define SQLITE_NullCallback 0x00002000 /* Invoke the callback once if the */
|
1007
|
+
// /* result set is empty */
|
1008
|
+
//#define SQLITE_SqlTrace 0x00004000 /* Debug print SQL as it executes */
|
1009
|
+
//#define SQLITE_VdbeListing 0x00008000 /* Debug listings of VDBE programs */
|
1010
|
+
//#define SQLITE_WriteSchema 0x00010000 /* OK to update SQLITE_MASTER */
|
1011
|
+
//#define SQLITE_NoReadlock 0x00020000 /* Readlocks are omitted when
|
1012
|
+
// ** accessing read-only databases */
|
1013
|
+
//#define SQLITE_IgnoreChecks 0x00040000 /* Do not enforce check constraints */
|
1014
|
+
//#define SQLITE_ReadUncommitted 0x0080000 /* For shared-cache mode */
|
1015
|
+
//#define SQLITE_LegacyFileFmt 0x00100000 /* Create new databases in format 1 */
|
1016
|
+
//#define SQLITE_FullFSync 0x00200000 /* Use full fsync on the backend */
|
1017
|
+
//#define SQLITE_LoadExtension 0x00400000 /* Enable load_extension */
|
1018
|
+
//#define SQLITE_RecoveryMode 0x00800000 /* Ignore schema errors */
|
1019
|
+
//#define SQLITE_ReverseOrder 0x01000000 /* Reverse unordered SELECTs */
|
1020
|
+
//#define SQLITE_RecTriggers 0x02000000 /* Enable recursive triggers */
|
1021
|
+
//#define SQLITE_ForeignKeys 0x04000000 /* Enforce foreign key constraints */
|
1022
|
+
const int SQLITE_VdbeTrace = 0x00000100; /* True to trace VDBE execution */
|
1023
|
+
const int SQLITE_InternChanges = 0x00000200; /* Uncommitted Hash table changes */
|
1024
|
+
const int SQLITE_FullColNames = 0x00000400; /* Show full column names on SELECT */
|
1025
|
+
const int SQLITE_ShortColNames = 0x00000800; /* Show short columns names */
|
1026
|
+
const int SQLITE_CountRows = 0x00001000; /* Count rows changed by INSERT, */
|
1027
|
+
/* DELETE, or UPDATE and return */
|
1028
|
+
/* the count using a callback. */
|
1029
|
+
const int SQLITE_NullCallback = 0x00002000; /* Invoke the callback once if the */
|
1030
|
+
/* result set is empty */
|
1031
|
+
const int SQLITE_SqlTrace = 0x00004000; /* Debug print SQL as it executes */
|
1032
|
+
const int SQLITE_VdbeListing = 0x00008000; /* Debug listings of VDBE programs */
|
1033
|
+
const int SQLITE_WriteSchema = 0x00010000; /* OK to update SQLITE_MASTER */
|
1034
|
+
const int SQLITE_NoReadlock = 0x00020000; /* Readlocks are omitted when
|
1035
|
+
** accessing read-only databases */
|
1036
|
+
const int SQLITE_IgnoreChecks = 0x00040000; /* Do not enforce check constraints */
|
1037
|
+
const int SQLITE_ReadUncommitted = 0x0080000; /* For shared-cache mode */
|
1038
|
+
const int SQLITE_LegacyFileFmt = 0x00100000; /* Create new databases in format 1 */
|
1039
|
+
const int SQLITE_FullFSync = 0x00200000; /* Use full fsync on the backend */
|
1040
|
+
const int SQLITE_LoadExtension = 0x00400000; /* Enable load_extension */
|
1041
|
+
const int SQLITE_RecoveryMode = 0x00800000; /* Ignore schema errors */
|
1042
|
+
const int SQLITE_ReverseOrder = 0x01000000; /* Reverse unordered SELECTs */
|
1043
|
+
const int SQLITE_RecTriggers = 0x02000000; /* Enable recursive triggers */
|
1044
|
+
const int SQLITE_ForeignKeys = 0x04000000; /* Enforce foreign key constraints */
|
1045
|
+
|
1046
|
+
/*
|
1047
|
+
** Bits of the sqlite3.flags field that are used by the
|
1048
|
+
** sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS,...) interface.
|
1049
|
+
** These must be the low-order bits of the flags field.
|
1050
|
+
*/
|
1051
|
+
//#define SQLITE_QueryFlattener 0x01 /* Disable query flattening */
|
1052
|
+
//#define SQLITE_ColumnCache 0x02 /* Disable the column cache */
|
1053
|
+
//#define SQLITE_IndexSort 0x04 /* Disable indexes for sorting */
|
1054
|
+
//#define SQLITE_IndexSearch 0x08 /* Disable indexes for searching */
|
1055
|
+
//#define SQLITE_IndexCover 0x10 /* Disable index covering table */
|
1056
|
+
//#define SQLITE_OptMask 0x1f /* Mask of all disablable opts */
|
1057
|
+
const int SQLITE_QueryFlattener = 0x01; /* Disable query flattening */
|
1058
|
+
const int SQLITE_ColumnCache = 0x02; /* Disable the column cache */
|
1059
|
+
const int SQLITE_IndexSort = 0x04; /* Disable indexes for sorting */
|
1060
|
+
const int SQLITE_IndexSearch = 0x08; /* Disable indexes for searching */
|
1061
|
+
const int SQLITE_IndexCover = 0x10; /* Disable index covering table */
|
1062
|
+
const int SQLITE_OptMask = 0x1f; /* Mask of all disablable opts */
|
1063
|
+
|
1064
|
+
/*
|
1065
|
+
** Possible values for the sqlite.magic field.
|
1066
|
+
** The numbers are obtained at random and have no special meaning, other
|
1067
|
+
** than being distinct from one another.
|
1068
|
+
*/
|
1069
|
+
const int SQLITE_MAGIC_OPEN = 0x1029a697; //#define SQLITE_MAGIC_OPEN 0xa029a697 /* Database is open */
|
1070
|
+
const int SQLITE_MAGIC_CLOSED = 0x2f3c2d33; //#define SQLITE_MAGIC_CLOSED 0x9f3c2d33 /* Database is closed */
|
1071
|
+
const int SQLITE_MAGIC_SICK = 0x3b771290; //#define SQLITE_MAGIC_SICK 0x4b771290 /* Error and awaiting close */
|
1072
|
+
const int SQLITE_MAGIC_BUSY = 0x403b7906; //#define SQLITE_MAGIC_BUSY 0xf03b7906 /* Database currently in use */
|
1073
|
+
const int SQLITE_MAGIC_ERROR = 0x55357930; //#define SQLITE_MAGIC_ERROR 0xb5357930 /* An SQLITE_MISUSE error occurred */
|
1074
|
+
|
1075
|
+
/*
|
1076
|
+
** Each SQL function is defined by an instance of the following
|
1077
|
+
** structure. A pointer to this structure is stored in the sqlite.aFunc
|
1078
|
+
** hash table. When multiple functions have the same name, the hash table
|
1079
|
+
** points to a linked list of these structures.
|
1080
|
+
*/
|
1081
|
+
public class FuncDef
|
1082
|
+
{
|
1083
|
+
public i16 nArg; /* Number of arguments. -1 means unlimited */
|
1084
|
+
public u8 iPrefEnc; /* Preferred text encoding (SQLITE_UTF8, 16LE, 16BE) */
|
1085
|
+
public u8 flags; /* Some combination of SQLITE_FUNC_* */
|
1086
|
+
public object pUserData; /* User data parameter */
|
1087
|
+
public FuncDef pNext; /* Next function with same name */
|
1088
|
+
public dxFunc xFunc;//)(sqlite3_context*,int,sqlite3_value**); /* Regular function */
|
1089
|
+
public dxStep xStep;//)(sqlite3_context*,int,sqlite3_value**); /* Aggregate step */
|
1090
|
+
public dxFinal xFinalize;//)(sqlite3_context*); /* Aggregate finalizer */
|
1091
|
+
public string zName; /* SQL name of the function. */
|
1092
|
+
public FuncDef pHash; /* Next with a different name but the same hash */
|
1093
|
+
|
1094
|
+
|
1095
|
+
public FuncDef()
|
1096
|
+
{ }
|
1097
|
+
|
1098
|
+
public FuncDef(i16 nArg, u8 iPrefEnc, u8 iflags, object pUserData, FuncDef pNext, dxFunc xFunc, dxStep xStep, dxFinal xFinalize, string zName, FuncDef pHash)
|
1099
|
+
{
|
1100
|
+
this.nArg = nArg;
|
1101
|
+
this.iPrefEnc = iPrefEnc;
|
1102
|
+
this.flags = iflags;
|
1103
|
+
this.pUserData = pUserData;
|
1104
|
+
this.pNext = pNext;
|
1105
|
+
this.xFunc = xFunc;
|
1106
|
+
this.xStep = xStep;
|
1107
|
+
this.xFinalize = xFinalize;
|
1108
|
+
this.zName = zName;
|
1109
|
+
this.pHash = pHash;
|
1110
|
+
}
|
1111
|
+
public FuncDef(string zName, u8 iPrefEnc, i16 nArg, int iArg, u8 iflags, dxFunc xFunc)
|
1112
|
+
{
|
1113
|
+
this.nArg = nArg;
|
1114
|
+
this.iPrefEnc = iPrefEnc;
|
1115
|
+
this.flags = iflags;
|
1116
|
+
this.pUserData = iArg;
|
1117
|
+
this.pNext = null;
|
1118
|
+
this.xFunc = xFunc;
|
1119
|
+
this.xStep = null;
|
1120
|
+
this.xFinalize = null;
|
1121
|
+
this.zName = zName;
|
1122
|
+
}
|
1123
|
+
|
1124
|
+
public FuncDef(string zName, u8 iPrefEnc, i16 nArg, int iArg, u8 iflags, dxStep xStep, dxFinal xFinal)
|
1125
|
+
{
|
1126
|
+
this.nArg = nArg;
|
1127
|
+
this.iPrefEnc = iPrefEnc;
|
1128
|
+
this.flags = iflags;
|
1129
|
+
this.pUserData = iArg;
|
1130
|
+
this.pNext = null;
|
1131
|
+
this.xFunc = null;
|
1132
|
+
this.xStep = xStep;
|
1133
|
+
this.xFinalize = xFinal;
|
1134
|
+
this.zName = zName;
|
1135
|
+
}
|
1136
|
+
|
1137
|
+
public FuncDef(string zName, u8 iPrefEnc, i16 nArg, object arg, dxFunc xFunc, u8 flags)
|
1138
|
+
{
|
1139
|
+
this.nArg = nArg;
|
1140
|
+
this.iPrefEnc = iPrefEnc;
|
1141
|
+
this.flags = flags;
|
1142
|
+
this.pUserData = arg;
|
1143
|
+
this.pNext = null;
|
1144
|
+
this.xFunc = xFunc;
|
1145
|
+
this.xStep = null;
|
1146
|
+
this.xFinalize = null;
|
1147
|
+
this.zName = zName;
|
1148
|
+
}
|
1149
|
+
|
1150
|
+
};
|
1151
|
+
|
1152
|
+
/*
|
1153
|
+
** Possible values for FuncDef.flags
|
1154
|
+
*/
|
1155
|
+
//#define SQLITE_FUNC_LIKE 0x01 /* Candidate for the LIKE optimization */
|
1156
|
+
//#define SQLITE_FUNC_CASE 0x02 /* Case-sensitive LIKE-type function */
|
1157
|
+
//#define SQLITE_FUNC_EPHEM 0x04 /* Ephemeral. Delete with VDBE */
|
1158
|
+
//#define SQLITE_FUNC_NEEDCOLL 0x08 /* sqlite3GetFuncCollSeq() might be called */
|
1159
|
+
//#define SQLITE_FUNC_PRIVATE 0x10 /* Allowed for internal use only */
|
1160
|
+
//#define SQLITE_FUNC_COUNT 0x20 /* Built-in count(*) aggregate */
|
1161
|
+
//#define SQLITE_FUNC_COALESCE 0x40 /* Built-in coalesce() or ifnull() function */
|
1162
|
+
const int SQLITE_FUNC_LIKE = 0x01; /* Candidate for the LIKE optimization */
|
1163
|
+
const int SQLITE_FUNC_CASE = 0x02; /* Case-sensitive LIKE-type function */
|
1164
|
+
const int SQLITE_FUNC_EPHEM = 0x04; /* Ephermeral. Delete with VDBE */
|
1165
|
+
const int SQLITE_FUNC_NEEDCOLL = 0x08;/* sqlite3GetFuncCollSeq() might be called */
|
1166
|
+
const int SQLITE_FUNC_PRIVATE = 0x10; /* Allowed for internal use only */
|
1167
|
+
const int SQLITE_FUNC_COUNT = 0x20; /* Built-in count(*) aggregate */
|
1168
|
+
const int SQLITE_FUNC_COALESCE = 0x40;/* Built-in coalesce() or ifnull() function */
|
1169
|
+
|
1170
|
+
|
1171
|
+
/*
|
1172
|
+
** The following three macros, FUNCTION(), LIKEFUNC() and AGGREGATE() are
|
1173
|
+
** used to create the initializers for the FuncDef structures.
|
1174
|
+
**
|
1175
|
+
** FUNCTION(zName, nArg, iArg, bNC, xFunc)
|
1176
|
+
** Used to create a scalar function definition of a function zName
|
1177
|
+
** implemented by C function xFunc that accepts nArg arguments. The
|
1178
|
+
** value passed as iArg is cast to a (void*) and made available
|
1179
|
+
** as the user-data (sqlite3_user_data()) for the function. If
|
1180
|
+
** argument bNC is true, then the SQLITE_FUNC_NEEDCOLL flag is set.
|
1181
|
+
**
|
1182
|
+
** AGGREGATE(zName, nArg, iArg, bNC, xStep, xFinal)
|
1183
|
+
** Used to create an aggregate function definition implemented by
|
1184
|
+
** the C functions xStep and xFinal. The first four parameters
|
1185
|
+
** are interpreted in the same way as the first 4 parameters to
|
1186
|
+
** FUNCTION().
|
1187
|
+
**
|
1188
|
+
** LIKEFUNC(zName, nArg, pArg, flags)
|
1189
|
+
** Used to create a scalar function definition of a function zName
|
1190
|
+
** that accepts nArg arguments and is implemented by a call to C
|
1191
|
+
** function likeFunc. Argument pArg is cast to a (void *) and made
|
1192
|
+
** available as the function user-data (sqlite3_user_data()). The
|
1193
|
+
** FuncDef.flags variable is set to the value passed as the flags
|
1194
|
+
** parameter.
|
1195
|
+
*/
|
1196
|
+
//#define FUNCTION(zName, nArg, iArg, bNC, xFunc) \
|
1197
|
+
// {nArg, SQLITE_UTF8, bNC*SQLITE_FUNC_NEEDCOLL, \
|
1198
|
+
//SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, #zName, 0}
|
1199
|
+
|
1200
|
+
static FuncDef FUNCTION(string zName, i16 nArg, int iArg, u8 bNC, dxFunc xFunc)
|
1201
|
+
{ return new FuncDef(zName, SQLITE_UTF8, nArg, iArg, (u8)(bNC * SQLITE_FUNC_NEEDCOLL), xFunc); }
|
1202
|
+
|
1203
|
+
//#define STR_FUNCTION(zName, nArg, pArg, bNC, xFunc) \
|
1204
|
+
// {nArg, SQLITE_UTF8, bNC*SQLITE_FUNC_NEEDCOLL, \
|
1205
|
+
//pArg, 0, xFunc, 0, 0, #zName, 0}
|
1206
|
+
|
1207
|
+
//#define LIKEFUNC(zName, nArg, arg, flags) \
|
1208
|
+
// {nArg, SQLITE_UTF8, flags, (void *)arg, 0, likeFunc, 0, 0, #zName, 0}
|
1209
|
+
static FuncDef LIKEFUNC(string zName, i16 nArg, object arg, u8 flags)
|
1210
|
+
{ return new FuncDef(zName, SQLITE_UTF8, nArg, arg, likeFunc, flags); }
|
1211
|
+
|
1212
|
+
//#define AGGREGATE(zName, nArg, arg, nc, xStep, xFinal) \
|
1213
|
+
// {nArg, SQLITE_UTF8, nc*SQLITE_FUNC_NEEDCOLL, \
|
1214
|
+
//SQLITE_INT_TO_PTR(arg), 0, 0, xStep,xFinal,#zName,0}
|
1215
|
+
|
1216
|
+
static FuncDef AGGREGATE(string zName, i16 nArg, int arg, u8 nc, dxStep xStep, dxFinal xFinal)
|
1217
|
+
{ return new FuncDef(zName, SQLITE_UTF8, nArg, arg, (u8)(nc * SQLITE_FUNC_NEEDCOLL), xStep, xFinal); }
|
1218
|
+
|
1219
|
+
/*
|
1220
|
+
** All current savepoints are stored in a linked list starting at
|
1221
|
+
** sqlite3.pSavepoint. The first element in the list is the most recently
|
1222
|
+
** opened savepoint. Savepoints are added to the list by the vdbe
|
1223
|
+
** OP_Savepoint instruction.
|
1224
|
+
*/
|
1225
|
+
//struct Savepoint {
|
1226
|
+
// char *zName; /* Savepoint name (nul-terminated) */
|
1227
|
+
// i64 nDeferredCons; /* Number of deferred fk violations */
|
1228
|
+
// Savepoint *pNext; /* Parent savepoint (if any) */
|
1229
|
+
//};
|
1230
|
+
public class Savepoint
|
1231
|
+
{
|
1232
|
+
public string zName; /* Savepoint name (nul-terminated) */
|
1233
|
+
public i64 nDeferredCons; /* Number of deferred fk violations */
|
1234
|
+
public Savepoint pNext; /* Parent savepoint (if any) */
|
1235
|
+
};
|
1236
|
+
/*
|
1237
|
+
** The following are used as the second parameter to sqlite3Savepoint(),
|
1238
|
+
** and as the P1 argument to the OP_Savepoint instruction.
|
1239
|
+
*/
|
1240
|
+
const int SAVEPOINT_BEGIN = 0; //#define SAVEPOINT_BEGIN 0
|
1241
|
+
const int SAVEPOINT_RELEASE = 1; //#define SAVEPOINT_RELEASE 1
|
1242
|
+
const int SAVEPOINT_ROLLBACK = 2; //#define SAVEPOINT_ROLLBACK 2
|
1243
|
+
|
1244
|
+
/*
|
1245
|
+
** Each SQLite module (virtual table definition) is defined by an
|
1246
|
+
** instance of the following structure, stored in the sqlite3.aModule
|
1247
|
+
** hash table.
|
1248
|
+
*/
|
1249
|
+
public class Module
|
1250
|
+
{
|
1251
|
+
public sqlite3_module pModule; /* Callback pointers */
|
1252
|
+
public string zName; /* Name passed to create_module() */
|
1253
|
+
public object pAux; /* pAux passed to create_module() */
|
1254
|
+
public dxDestroy xDestroy;//)(void *); /* Module destructor function */
|
1255
|
+
};
|
1256
|
+
|
1257
|
+
/*
|
1258
|
+
** information about each column of an SQL table is held in an instance
|
1259
|
+
** of this structure.
|
1260
|
+
*/
|
1261
|
+
public class Column
|
1262
|
+
{
|
1263
|
+
public string zName; /* Name of this column */
|
1264
|
+
public Expr pDflt; /* Default value of this column */
|
1265
|
+
public string zDflt; /* Original text of the default value */
|
1266
|
+
public string zType; /* Data type for this column */
|
1267
|
+
public string zColl; /* Collating sequence. If NULL, use the default */
|
1268
|
+
public u8 notNull; /* True if there is a NOT NULL constraint */
|
1269
|
+
public u8 isPrimKey; /* True if this column is part of the PRIMARY KEY */
|
1270
|
+
public char affinity; /* One of the SQLITE_AFF_... values */
|
1271
|
+
#if !SQLITE_OMIT_VIRTUALTABLE
|
1272
|
+
public u8 isHidden; /* True if this column is 'hidden' */
|
1273
|
+
#endif
|
1274
|
+
public Column Copy()
|
1275
|
+
{
|
1276
|
+
Column cp = (Column)MemberwiseClone();
|
1277
|
+
if (cp.pDflt != null) cp.pDflt = pDflt.Copy();
|
1278
|
+
return cp;
|
1279
|
+
}
|
1280
|
+
};
|
1281
|
+
|
1282
|
+
/*
|
1283
|
+
** A "Collating Sequence" is defined by an instance of the following
|
1284
|
+
** structure. Conceptually, a collating sequence consists of a name and
|
1285
|
+
** a comparison routine that defines the order of that sequence.
|
1286
|
+
**
|
1287
|
+
** There may two separate implementations of the collation function, one
|
1288
|
+
** that processes text in UTF-8 encoding (CollSeq.xCmp) and another that
|
1289
|
+
** processes text encoded in UTF-16 (CollSeq.xCmp16), using the machine
|
1290
|
+
** native byte order. When a collation sequence is invoked, SQLite selects
|
1291
|
+
** the version that will require the least expensive encoding
|
1292
|
+
** translations, if any.
|
1293
|
+
**
|
1294
|
+
** The CollSeq.pUser member variable is an extra parameter that passed in
|
1295
|
+
** as the first argument to the UTF-8 comparison function, xCmp.
|
1296
|
+
** CollSeq.pUser16 is the equivalent for the UTF-16 comparison function,
|
1297
|
+
** xCmp16.
|
1298
|
+
**
|
1299
|
+
** If both CollSeq.xCmp and CollSeq.xCmp16 are NULL, it means that the
|
1300
|
+
** collating sequence is undefined. Indices built on an undefined
|
1301
|
+
** collating sequence may not be read or written.
|
1302
|
+
*/
|
1303
|
+
public class CollSeq
|
1304
|
+
{
|
1305
|
+
public string zName; /* Name of the collating sequence, UTF-8 encoded */
|
1306
|
+
public u8 enc; /* Text encoding handled by xCmp() */
|
1307
|
+
public u8 type; /* One of the SQLITE_COLL_... values below */
|
1308
|
+
public object pUser; /* First argument to xCmp() */
|
1309
|
+
public dxCompare xCmp;//)(void*,int, const void*, int, const void*);
|
1310
|
+
public dxDelCollSeq xDel;//)(void*); /* Destructor for pUser */
|
1311
|
+
|
1312
|
+
public CollSeq Copy()
|
1313
|
+
{
|
1314
|
+
if (this == null)
|
1315
|
+
return null;
|
1316
|
+
else
|
1317
|
+
{
|
1318
|
+
CollSeq cp = (CollSeq)MemberwiseClone();
|
1319
|
+
return cp;
|
1320
|
+
}
|
1321
|
+
}
|
1322
|
+
};
|
1323
|
+
|
1324
|
+
/*
|
1325
|
+
** Allowed values of CollSeq.type:
|
1326
|
+
*/
|
1327
|
+
const int SQLITE_COLL_BINARY = 1;//#define SQLITE_COLL_BINARY 1 /* The default memcmp() collating sequence */
|
1328
|
+
const int SQLITE_COLL_NOCASE = 2;//#define SQLITE_COLL_NOCASE 2 /* The built-in NOCASE collating sequence */
|
1329
|
+
const int SQLITE_COLL_REVERSE = 3;//#define SQLITE_COLL_REVERSE 3 /* The built-in REVERSE collating sequence */
|
1330
|
+
const int SQLITE_COLL_USER = 0;//#define SQLITE_COLL_USER 0 /* Any other user-defined collating sequence */
|
1331
|
+
|
1332
|
+
/*
|
1333
|
+
** A sort order can be either ASC or DESC.
|
1334
|
+
*/
|
1335
|
+
const int SQLITE_SO_ASC = 0;//#define SQLITE_SO_ASC 0 /* Sort in ascending order */
|
1336
|
+
const int SQLITE_SO_DESC = 1;//#define SQLITE_SO_DESC 1 /* Sort in ascending order */
|
1337
|
+
|
1338
|
+
/*
|
1339
|
+
** Column affinity types.
|
1340
|
+
**
|
1341
|
+
** These used to have mnemonic name like 'i' for SQLITE_AFF_INTEGER and
|
1342
|
+
** 't' for SQLITE_AFF_TEXT. But we can save a little space and improve
|
1343
|
+
** the speed a little by numbering the values consecutively.
|
1344
|
+
**
|
1345
|
+
** But rather than start with 0 or 1, we begin with 'a'. That way,
|
1346
|
+
** when multiple affinity types are concatenated into a string and
|
1347
|
+
** used as the P4 operand, they will be more readable.
|
1348
|
+
**
|
1349
|
+
** Note also that the numeric types are grouped together so that testing
|
1350
|
+
** for a numeric type is a single comparison.
|
1351
|
+
*/
|
1352
|
+
const char SQLITE_AFF_TEXT = 'a';//#define SQLITE_AFF_TEXT 'a'
|
1353
|
+
const char SQLITE_AFF_NONE = 'b';//#define SQLITE_AFF_NONE 'b'
|
1354
|
+
const char SQLITE_AFF_NUMERIC = 'c';//#define SQLITE_AFF_NUMERIC 'c'
|
1355
|
+
const char SQLITE_AFF_INTEGER = 'd';//#define SQLITE_AFF_INTEGER 'd'
|
1356
|
+
const char SQLITE_AFF_REAL = 'e';//#define SQLITE_AFF_REAL 'e'
|
1357
|
+
|
1358
|
+
//#define sqlite3IsNumericAffinity(X) ((X)>=SQLITE_AFF_NUMERIC)
|
1359
|
+
|
1360
|
+
/*
|
1361
|
+
** The SQLITE_AFF_MASK values masks off the significant bits of an
|
1362
|
+
** affinity value.
|
1363
|
+
*/
|
1364
|
+
const int SQLITE_AFF_MASK = 0x67;//#define SQLITE_AFF_MASK 0x67
|
1365
|
+
|
1366
|
+
/*
|
1367
|
+
** Additional bit values that can be ORed with an affinity without
|
1368
|
+
** changing the affinity.
|
1369
|
+
*/
|
1370
|
+
const int SQLITE_JUMPIFNULL = 0x08; //#define SQLITE_JUMPIFNULL 0x08 /* jumps if either operand is NULL */
|
1371
|
+
const int SQLITE_STOREP2 = 0x10; //#define SQLITE_STOREP2 0x10 /* Store result in reg[P2] rather than jump */
|
1372
|
+
const int SQLITE_NULLEQ = 0x80; //#define SQLITE_NULLEQ 0x80 /* NULL=NULL */
|
1373
|
+
|
1374
|
+
/*
|
1375
|
+
** An object of this type is created for each virtual table present in
|
1376
|
+
** the database schema.
|
1377
|
+
**
|
1378
|
+
** If the database schema is shared, then there is one instance of this
|
1379
|
+
** structure for each database connection (sqlite3*) that uses the shared
|
1380
|
+
** schema. This is because each database connection requires its own unique
|
1381
|
+
** instance of the sqlite3_vtab* handle used to access the virtual table
|
1382
|
+
** implementation. sqlite3_vtab* handles can not be shared between
|
1383
|
+
** database connections, even when the rest of the in-memory database
|
1384
|
+
** schema is shared, as the implementation often stores the database
|
1385
|
+
** connection handle passed to it via the xConnect() or xCreate() method
|
1386
|
+
** during initialization internally. This database connection handle may
|
1387
|
+
** then used by the virtual table implementation to access real tables
|
1388
|
+
** within the database. So that they appear as part of the callers
|
1389
|
+
** transaction, these accesses need to be made via the same database
|
1390
|
+
** connection as that used to execute SQL operations on the virtual table.
|
1391
|
+
**
|
1392
|
+
** All VTable objects that correspond to a single table in a shared
|
1393
|
+
** database schema are initially stored in a linked-list pointed to by
|
1394
|
+
** the Table.pVTable member variable of the corresponding Table object.
|
1395
|
+
** When an sqlite3_prepare() operation is required to access the virtual
|
1396
|
+
** table, it searches the list for the VTable that corresponds to the
|
1397
|
+
** database connection doing the preparing so as to use the correct
|
1398
|
+
** sqlite3_vtab* handle in the compiled query.
|
1399
|
+
**
|
1400
|
+
** When an in-memory Table object is deleted (for example when the
|
1401
|
+
** schema is being reloaded for some reason), the VTable objects are not
|
1402
|
+
** deleted and the sqlite3_vtab* handles are not xDisconnect()ed
|
1403
|
+
** immediately. Instead, they are moved from the Table.pVTable list to
|
1404
|
+
** another linked list headed by the sqlite3.pDisconnect member of the
|
1405
|
+
** corresponding sqlite3 structure. They are then deleted/xDisconnected
|
1406
|
+
** next time a statement is prepared using said sqlite3*. This is done
|
1407
|
+
** to avoid deadlock issues involving multiple sqlite3.mutex mutexes.
|
1408
|
+
** Refer to comments above function sqlite3VtabUnlockList() for an
|
1409
|
+
** explanation as to why it is safe to add an entry to an sqlite3.pDisconnect
|
1410
|
+
** list without holding the corresponding sqlite3.mutex mutex.
|
1411
|
+
**
|
1412
|
+
** The memory for objects of this type is always allocated by
|
1413
|
+
** sqlite3DbMalloc(), using the connection handle stored in VTable.db as
|
1414
|
+
** the first argument.
|
1415
|
+
*/
|
1416
|
+
public class VTable
|
1417
|
+
{
|
1418
|
+
public sqlite3 db; /* Database connection associated with this table */
|
1419
|
+
public Module pMod; /* Pointer to module implementation */
|
1420
|
+
public sqlite3_vtab pVtab; /* Pointer to vtab instance */
|
1421
|
+
public int nRef; /* Number of pointers to this structure */
|
1422
|
+
public VTable pNext; /* Next in linked list (see above) */
|
1423
|
+
};
|
1424
|
+
|
1425
|
+
/*
|
1426
|
+
** Each SQL table is represented in memory by an instance of the
|
1427
|
+
** following structure.
|
1428
|
+
**
|
1429
|
+
** Table.zName is the name of the table. The case of the original
|
1430
|
+
** CREATE TABLE statement is stored, but case is not significant for
|
1431
|
+
** comparisons.
|
1432
|
+
**
|
1433
|
+
** Table.nCol is the number of columns in this table. Table.aCol is a
|
1434
|
+
** pointer to an array of Column structures, one for each column.
|
1435
|
+
**
|
1436
|
+
** If the table has an INTEGER PRIMARY KEY, then Table.iPKey is the index of
|
1437
|
+
** the column that is that key. Otherwise Table.iPKey is negative. Note
|
1438
|
+
** that the datatype of the PRIMARY KEY must be INTEGER for this field to
|
1439
|
+
** be set. An INTEGER PRIMARY KEY is used as the rowid for each row of
|
1440
|
+
** the table. If a table has no INTEGER PRIMARY KEY, then a random rowid
|
1441
|
+
** is generated for each row of the table. TF_HasPrimaryKey is set if
|
1442
|
+
** the table has any PRIMARY KEY, INTEGER or otherwise.
|
1443
|
+
**
|
1444
|
+
** Table.tnum is the page number for the root BTree page of the table in the
|
1445
|
+
** database file. If Table.iDb is the index of the database table backend
|
1446
|
+
** in sqlite.aDb[]. 0 is for the main database and 1 is for the file that
|
1447
|
+
** holds temporary tables and indices. If TF_Ephemeral is set
|
1448
|
+
** then the table is stored in a file that is automatically deleted
|
1449
|
+
** when the VDBE cursor to the table is closed. In this case Table.tnum
|
1450
|
+
** refers VDBE cursor number that holds the table open, not to the root
|
1451
|
+
** page number. Transient tables are used to hold the results of a
|
1452
|
+
** sub-query that appears instead of a real table name in the FROM clause
|
1453
|
+
** of a SELECT statement.
|
1454
|
+
*/
|
1455
|
+
public class Table
|
1456
|
+
{
|
1457
|
+
public sqlite3 dbMem; /* DB connection used for lookaside allocations. */
|
1458
|
+
public string zName; /* Name of the table or view */
|
1459
|
+
public int iPKey; /* If not negative, use aCol[iPKey] as the primary key */
|
1460
|
+
public int nCol; /* Number of columns in this table */
|
1461
|
+
public Column[] aCol; /* Information about each column */
|
1462
|
+
public Index pIndex; /* List of SQL indexes on this table. */
|
1463
|
+
public int tnum; /* Root BTree node for this table (see note above) */
|
1464
|
+
public Select pSelect; /* NULL for tables. Points to definition if a view. */
|
1465
|
+
public u16 nRef; /* Number of pointers to this Table */
|
1466
|
+
public u8 tabFlags; /* Mask of TF_* values */
|
1467
|
+
public u8 keyConf; /* What to do in case of uniqueness conflict on iPKey */
|
1468
|
+
public FKey pFKey; /* Linked list of all foreign keys in this table */
|
1469
|
+
public string zColAff; /* String defining the affinity of each column */
|
1470
|
+
#if !SQLITE_OMIT_CHECK
|
1471
|
+
public Expr pCheck; /* The AND of all CHECK constraints */
|
1472
|
+
#endif
|
1473
|
+
#if !SQLITE_OMIT_ALTERTABLE
|
1474
|
+
public int addColOffset; /* Offset in CREATE TABLE stmt to add a new column */
|
1475
|
+
#endif
|
1476
|
+
#if !SQLITE_OMIT_VIRTUALTABLE
|
1477
|
+
public VTable pVTable; /* List of VTable objects. */
|
1478
|
+
public int nModuleArg; /* Number of arguments to the module */
|
1479
|
+
public string[] azModuleArg;/* Text of all module args. [0] is module name */
|
1480
|
+
#endif
|
1481
|
+
public Trigger pTrigger; /* List of SQL triggers on this table */
|
1482
|
+
public Schema pSchema; /* Schema that contains this table */
|
1483
|
+
public Table pNextZombie; /* Next on the Parse.pZombieTab list */
|
1484
|
+
|
1485
|
+
public Table Copy()
|
1486
|
+
{
|
1487
|
+
if (this == null)
|
1488
|
+
return null;
|
1489
|
+
else
|
1490
|
+
{
|
1491
|
+
Table cp = (Table)MemberwiseClone();
|
1492
|
+
if (pIndex != null) cp.pIndex = pIndex.Copy();
|
1493
|
+
if (pSelect != null) cp.pSelect = pSelect.Copy();
|
1494
|
+
if (pTrigger != null) cp.pTrigger = pTrigger.Copy();
|
1495
|
+
if (pFKey != null) cp.pFKey = pFKey.Copy();
|
1496
|
+
#if !SQLITE_OMIT_CHECK
|
1497
|
+
// Don't Clone Checks, only copy reference via Memberwise Clone above --
|
1498
|
+
//if ( pCheck != null ) cp.pCheck = pCheck.Copy();
|
1499
|
+
#endif
|
1500
|
+
#if !SQLITE_OMIT_VIRTUALTABLE
|
1501
|
+
if ( pMod != null ) cp.pMod =pMod.Copy();
|
1502
|
+
if ( pVtab != null ) cp.pVtab =pVtab.Copy();
|
1503
|
+
#endif
|
1504
|
+
// Don't Clone Schema, only copy reference via Memberwise Clone above --
|
1505
|
+
// if ( pSchema != null ) cp.pSchema=pSchema.Copy();
|
1506
|
+
// Don't Clone pNextZombie, only copy reference via Memberwise Clone above --
|
1507
|
+
// if ( pNextZombie != null ) cp.pNextZombie=pNextZombie.Copy();
|
1508
|
+
return cp;
|
1509
|
+
}
|
1510
|
+
}
|
1511
|
+
};
|
1512
|
+
|
1513
|
+
/*
|
1514
|
+
** Allowed values for Tabe.tabFlags.
|
1515
|
+
*/
|
1516
|
+
//#define TF_Readonly 0x01 /* Read-only system table */
|
1517
|
+
//#define TF_Ephemeral 0x02 /* An ephemeral table */
|
1518
|
+
//#define TF_HasPrimaryKey 0x04 /* Table has a primary key */
|
1519
|
+
//#define TF_Autoincrement 0x08 /* Integer primary key is autoincrement */
|
1520
|
+
//#define TF_Virtual 0x10 /* Is a virtual table */
|
1521
|
+
//#define TF_NeedMetadata 0x20 /* aCol[].zType and aCol[].pColl missing */
|
1522
|
+
/*
|
1523
|
+
** Allowed values for Tabe.tabFlags.
|
1524
|
+
*/
|
1525
|
+
const int TF_Readonly = 0x01; /* Read-only system table */
|
1526
|
+
const int TF_Ephemeral = 0x02; /* An ephemeral table */
|
1527
|
+
const int TF_HasPrimaryKey = 0x04; /* Table has a primary key */
|
1528
|
+
const int TF_Autoincrement = 0x08; /* Integer primary key is autoincrement */
|
1529
|
+
const int TF_Virtual = 0x10; /* Is a virtual table */
|
1530
|
+
const int TF_NeedMetadata = 0x20; /* aCol[].zType and aCol[].pColl missing */
|
1531
|
+
|
1532
|
+
/*
|
1533
|
+
** Test to see whether or not a table is a virtual table. This is
|
1534
|
+
** done as a macro so that it will be optimized out when virtual
|
1535
|
+
** table support is omitted from the build.
|
1536
|
+
*/
|
1537
|
+
#if !SQLITE_OMIT_VIRTUALTABLE
|
1538
|
+
//# define IsVirtual(X) (((X)->tabFlags & TF_Virtual)!=0)
|
1539
|
+
static bool IsVirtual( Table X) { return (X.tabFlags & TF_Virtual)!=0;}
|
1540
|
+
//# define IsHiddenColumn(X) ((X)->isHidden)
|
1541
|
+
static bool IsVirtual( Column X) { return X.isHidden!=0;}
|
1542
|
+
#else
|
1543
|
+
//# define IsVirtual(X) 0
|
1544
|
+
static bool IsVirtual(Table T) { return false; }
|
1545
|
+
//# define IsHiddenColumn(X) 0
|
1546
|
+
static bool IsHiddenColumn(Column C) { return false; }
|
1547
|
+
#endif
|
1548
|
+
|
1549
|
+
/*
|
1550
|
+
** Each foreign key constraint is an instance of the following structure.
|
1551
|
+
**
|
1552
|
+
** A foreign key is associated with two tables. The "from" table is
|
1553
|
+
** the table that contains the REFERENCES clause that creates the foreign
|
1554
|
+
** key. The "to" table is the table that is named in the REFERENCES clause.
|
1555
|
+
** Consider this example:
|
1556
|
+
**
|
1557
|
+
** CREATE TABLE ex1(
|
1558
|
+
** a INTEGER PRIMARY KEY,
|
1559
|
+
** b INTEGER CONSTRAINT fk1 REFERENCES ex2(x)
|
1560
|
+
** );
|
1561
|
+
**
|
1562
|
+
** For foreign key "fk1", the from-table is "ex1" and the to-table is "ex2".
|
1563
|
+
**
|
1564
|
+
** Each REFERENCES clause generates an instance of the following structure
|
1565
|
+
** which is attached to the from-table. The to-table need not exist when
|
1566
|
+
** the from-table is created. The existence of the to-table is not checked.
|
1567
|
+
*/
|
1568
|
+
public class FKey
|
1569
|
+
{
|
1570
|
+
public Table pFrom; /* Table containing the REFERENCES clause (aka: Child) */
|
1571
|
+
public FKey pNextFrom; /* Next foreign key in pFrom */
|
1572
|
+
public string zTo; /* Name of table that the key points to (aka: Parent) */
|
1573
|
+
public FKey pNextTo; /* Next foreign key on table named zTo */
|
1574
|
+
public FKey pPrevTo; /* Previous foreign key on table named zTo */
|
1575
|
+
public int nCol; /* Number of columns in this key */
|
1576
|
+
/* EV: R-30323-21917 */
|
1577
|
+
public u8 isDeferred; /* True if constraint checking is deferred till COMMIT */
|
1578
|
+
public u8[] aAction = new u8[2]; /* ON DELETE and ON UPDATE actions, respectively */
|
1579
|
+
public Trigger[] apTrigger = new Trigger[2];/* Triggers for aAction[] actions */
|
1580
|
+
|
1581
|
+
public class sColMap
|
1582
|
+
{ /* Mapping of columns in pFrom to columns in zTo */
|
1583
|
+
public int iFrom; /* Index of column in pFrom */
|
1584
|
+
public string zCol; /* Name of column in zTo. If 0 use PRIMARY KEY */
|
1585
|
+
};
|
1586
|
+
public sColMap[] aCol; /* One entry for each of nCol column s */
|
1587
|
+
|
1588
|
+
public FKey Copy()
|
1589
|
+
{
|
1590
|
+
if (this == null)
|
1591
|
+
return null;
|
1592
|
+
else
|
1593
|
+
{
|
1594
|
+
FKey cp = (FKey)MemberwiseClone();
|
1595
|
+
return cp;
|
1596
|
+
}
|
1597
|
+
}
|
1598
|
+
|
1599
|
+
};
|
1600
|
+
|
1601
|
+
/*
|
1602
|
+
** SQLite supports many different ways to resolve a constraint
|
1603
|
+
** error. ROLLBACK processing means that a constraint violation
|
1604
|
+
** causes the operation in process to fail and for the current transaction
|
1605
|
+
** to be rolled back. ABORT processing means the operation in process
|
1606
|
+
** fails and any prior changes from that one operation are backed out,
|
1607
|
+
** but the transaction is not rolled back. FAIL processing means that
|
1608
|
+
** the operation in progress stops and returns an error code. But prior
|
1609
|
+
** changes due to the same operation are not backed out and no rollback
|
1610
|
+
** occurs. IGNORE means that the particular row that caused the constraint
|
1611
|
+
** error is not inserted or updated. Processing continues and no error
|
1612
|
+
** is returned. REPLACE means that preexisting database rows that caused
|
1613
|
+
** a UNIQUE constraint violation are removed so that the new insert or
|
1614
|
+
** update can proceed. Processing continues and no error is reported.
|
1615
|
+
**
|
1616
|
+
** RESTRICT, SETNULL, and CASCADE actions apply only to foreign keys.
|
1617
|
+
** RESTRICT is the same as ABORT for IMMEDIATE foreign keys and the
|
1618
|
+
** same as ROLLBACK for DEFERRED keys. SETNULL means that the foreign
|
1619
|
+
** key is set to NULL. CASCADE means that a DELETE or UPDATE of the
|
1620
|
+
** referenced table row is propagated into the row that holds the
|
1621
|
+
** foreign key.
|
1622
|
+
**
|
1623
|
+
** The following symbolic values are used to record which type
|
1624
|
+
** of action to take.
|
1625
|
+
*/
|
1626
|
+
const int OE_None = 0;//#define OE_None 0 /* There is no constraint to check */
|
1627
|
+
const int OE_Rollback = 1;//#define OE_Rollback 1 /* Fail the operation and rollback the transaction */
|
1628
|
+
const int OE_Abort = 2;//#define OE_Abort 2 /* Back out changes but do no rollback transaction */
|
1629
|
+
const int OE_Fail = 3;//#define OE_Fail 3 /* Stop the operation but leave all prior changes */
|
1630
|
+
const int OE_Ignore = 4;//#define OE_Ignore 4 /* Ignore the error. Do not do the INSERT or UPDATE */
|
1631
|
+
const int OE_Replace = 5;//#define OE_Replace 5 /* Delete existing record, then do INSERT or UPDATE */
|
1632
|
+
|
1633
|
+
const int OE_Restrict = 6;//#define OE_Restrict 6 /* OE_Abort for IMMEDIATE, OE_Rollback for DEFERRED */
|
1634
|
+
const int OE_SetNull = 7;//#define OE_SetNull 7 /* Set the foreign key value to NULL */
|
1635
|
+
const int OE_SetDflt = 8;//#define OE_SetDflt 8 /* Set the foreign key value to its default */
|
1636
|
+
const int OE_Cascade = 9;//#define OE_Cascade 9 /* Cascade the changes */
|
1637
|
+
|
1638
|
+
const int OE_Default = 99;//#define OE_Default 99 /* Do whatever the default action is */
|
1639
|
+
|
1640
|
+
|
1641
|
+
/*
|
1642
|
+
** An instance of the following structure is passed as the first
|
1643
|
+
** argument to sqlite3VdbeKeyCompare and is used to control the
|
1644
|
+
** comparison of the two index keys.
|
1645
|
+
*/
|
1646
|
+
public class KeyInfo
|
1647
|
+
{
|
1648
|
+
public sqlite3 db; /* The database connection */
|
1649
|
+
public u8 enc; /* Text encoding - one of the TEXT_Utf* values */
|
1650
|
+
public u16 nField; /* Number of entries in aColl[] */
|
1651
|
+
public u8[] aSortOrder; /* If defined an aSortOrder[i] is true, sort DESC */
|
1652
|
+
public CollSeq[] aColl = new CollSeq[1]; /* Collating sequence for each term of the key */
|
1653
|
+
public KeyInfo Copy()
|
1654
|
+
{
|
1655
|
+
return (KeyInfo)MemberwiseClone();
|
1656
|
+
}
|
1657
|
+
};
|
1658
|
+
|
1659
|
+
/*
|
1660
|
+
** An instance of the following structure holds information about a
|
1661
|
+
** single index record that has already been parsed out into individual
|
1662
|
+
** values.
|
1663
|
+
**
|
1664
|
+
** A record is an object that contains one or more fields of data.
|
1665
|
+
** Records are used to store the content of a table row and to store
|
1666
|
+
** the key of an index. A blob encoding of a record is created by
|
1667
|
+
** the OP_MakeRecord opcode of the VDBE and is disassembled by the
|
1668
|
+
** OP_Column opcode.
|
1669
|
+
**
|
1670
|
+
** This structure holds a record that has already been disassembled
|
1671
|
+
** into its constituent fields.
|
1672
|
+
*/
|
1673
|
+
public class UnpackedRecord
|
1674
|
+
{
|
1675
|
+
public KeyInfo pKeyInfo; /* Collation and sort-order information */
|
1676
|
+
public u16 nField; /* Number of entries in apMem[] */
|
1677
|
+
public u16 flags; /* Boolean settings. UNPACKED_... below */
|
1678
|
+
public i64 rowid; /* Used by UNPACKED_PREFIX_SEARCH */
|
1679
|
+
public Mem[] aMem; /* Values */
|
1680
|
+
};
|
1681
|
+
|
1682
|
+
/*
|
1683
|
+
** Allowed values of UnpackedRecord.flags
|
1684
|
+
*/
|
1685
|
+
//#define UNPACKED_NEED_FREE 0x0001 /* Memory is from sqlite3Malloc() */
|
1686
|
+
//#define UNPACKED_NEED_DESTROY 0x0002 /* apMem[]s should all be destroyed */
|
1687
|
+
//#define UNPACKED_IGNORE_ROWID 0x0004 /* Ignore trailing rowid on key1 */
|
1688
|
+
//#define UNPACKED_INCRKEY 0x0008 /* Make this key an epsilon larger */
|
1689
|
+
//#define UNPACKED_PREFIX_MATCH 0x0010 /* A prefix match is considered OK */
|
1690
|
+
//#define UNPACKED_PREFIX_SEARCH 0x0020 /* A prefix match is considered OK */
|
1691
|
+
const int UNPACKED_NEED_FREE = 0x0001; /* Memory is from sqlite3Malloc() */
|
1692
|
+
const int UNPACKED_NEED_DESTROY = 0x0002; /* apMem[]s should all be destroyed */
|
1693
|
+
const int UNPACKED_IGNORE_ROWID = 0x0004; /* Ignore trailing rowid on key1 */
|
1694
|
+
const int UNPACKED_INCRKEY = 0x0008; /* Make this key an epsilon larger */
|
1695
|
+
const int UNPACKED_PREFIX_MATCH = 0x0010; /* A prefix match is considered OK */
|
1696
|
+
const int UNPACKED_PREFIX_SEARCH = 0x0020; /* A prefix match is considered OK */
|
1697
|
+
|
1698
|
+
/*
|
1699
|
+
** Each SQL index is represented in memory by an
|
1700
|
+
** instance of the following structure.
|
1701
|
+
**
|
1702
|
+
** The columns of the table that are to be indexed are described
|
1703
|
+
** by the aiColumn[] field of this structure. For example, suppose
|
1704
|
+
** we have the following table and index:
|
1705
|
+
**
|
1706
|
+
** CREATE TABLE Ex1(c1 int, c2 int, c3 text);
|
1707
|
+
** CREATE INDEX Ex2 ON Ex1(c3,c1);
|
1708
|
+
**
|
1709
|
+
** In the Table structure describing Ex1, nCol==3 because there are
|
1710
|
+
** three columns in the table. In the Index structure describing
|
1711
|
+
** Ex2, nColumn==2 since 2 of the 3 columns of Ex1 are indexed.
|
1712
|
+
** The value of aiColumn is {2, 0}. aiColumn[0]==2 because the
|
1713
|
+
** first column to be indexed (c3) has an index of 2 in Ex1.aCol[].
|
1714
|
+
** The second column to be indexed (c1) has an index of 0 in
|
1715
|
+
** Ex1.aCol[], hence Ex2.aiColumn[1]==0.
|
1716
|
+
**
|
1717
|
+
** The Index.onError field determines whether or not the indexed columns
|
1718
|
+
** must be unique and what to do if they are not. When Index.onError=OE_None,
|
1719
|
+
** it means this is not a unique index. Otherwise it is a unique index
|
1720
|
+
** and the value of Index.onError indicate the which conflict resolution
|
1721
|
+
** algorithm to employ whenever an attempt is made to insert a non-unique
|
1722
|
+
** element.
|
1723
|
+
*/
|
1724
|
+
public class Index
|
1725
|
+
{
|
1726
|
+
public string zName; /* Name of this index */
|
1727
|
+
public int nColumn; /* Number of columns in the table used by this index */
|
1728
|
+
public int[] aiColumn; /* Which columns are used by this index. 1st is 0 */
|
1729
|
+
public int[] aiRowEst; /* Result of ANALYZE: Est. rows selected by each column */
|
1730
|
+
public Table pTable; /* The SQL table being indexed */
|
1731
|
+
public int tnum; /* Page containing root of this index in database file */
|
1732
|
+
public u8 onError; /* OE_Abort, OE_Ignore, OE_Replace, or OE_None */
|
1733
|
+
public u8 autoIndex; /* True if is automatically created (ex: by UNIQUE) */
|
1734
|
+
public string zColAff; /* String defining the affinity of each column */
|
1735
|
+
public Index pNext; /* The next index associated with the same table */
|
1736
|
+
public Schema pSchema; /* Schema containing this index */
|
1737
|
+
public u8[] aSortOrder; /* Array of size Index.nColumn. True==DESC, False==ASC */
|
1738
|
+
public string[] azColl; /* Array of collation sequence names for index */
|
1739
|
+
public IndexSample[] aSample; /* Array of SQLITE_INDEX_SAMPLES samples */
|
1740
|
+
|
1741
|
+
public Index Copy()
|
1742
|
+
{
|
1743
|
+
if (this == null)
|
1744
|
+
return null;
|
1745
|
+
else
|
1746
|
+
{
|
1747
|
+
Index cp = (Index)MemberwiseClone();
|
1748
|
+
return cp;
|
1749
|
+
}
|
1750
|
+
}
|
1751
|
+
};
|
1752
|
+
/*
|
1753
|
+
** Each sample stored in the sqlite_stat2 table is represented in memory
|
1754
|
+
** using a structure of this type.
|
1755
|
+
*/
|
1756
|
+
public struct IndexSample
|
1757
|
+
{
|
1758
|
+
public struct _u
|
1759
|
+
{ //union {
|
1760
|
+
public string z; /* Value if eType is SQLITE_TEXT */
|
1761
|
+
public byte[] zBLOB; /* Value if eType is SQLITE_BLOB */
|
1762
|
+
public double r; /* Value if eType is SQLITE_FLOAT or SQLITE_INTEGER */
|
1763
|
+
}
|
1764
|
+
public _u u;
|
1765
|
+
public u8 eType; /* SQLITE_NULL, SQLITE_INTEGER ... etc. */
|
1766
|
+
public u8 nByte; /* Size in byte of text or blob. */
|
1767
|
+
};
|
1768
|
+
|
1769
|
+
/*
|
1770
|
+
** Each token coming out of the lexer is an instance of
|
1771
|
+
** this structure. Tokens are also used as part of an expression.
|
1772
|
+
**
|
1773
|
+
** Note if Token.z==0 then Token.dyn and Token.n are undefined and
|
1774
|
+
** may contain random values. Do not make any assumptions about Token.dyn
|
1775
|
+
** and Token.n when Token.z==0.
|
1776
|
+
*/
|
1777
|
+
public class Token
|
1778
|
+
{
|
1779
|
+
#if DEBUG_CLASS_TOKEN || DEBUG_CLASS_ALL
|
1780
|
+
public string _z; /* Text of the token. Not NULL-terminated! */
|
1781
|
+
public bool dyn;// : 1; /* True for malloced memory, false for static */
|
1782
|
+
public Int32 _n;// : 31; /* Number of characters in this token */
|
1783
|
+
|
1784
|
+
public string z
|
1785
|
+
{
|
1786
|
+
get { return _z; }
|
1787
|
+
set { _z = value; }
|
1788
|
+
}
|
1789
|
+
|
1790
|
+
public Int32 n
|
1791
|
+
{
|
1792
|
+
get { return _n; }
|
1793
|
+
set { _n = value; }
|
1794
|
+
}
|
1795
|
+
#else
|
1796
|
+
public string z; /* Text of the token. Not NULL-terminated! */
|
1797
|
+
public Int32 n; /* Number of characters in this token */
|
1798
|
+
#endif
|
1799
|
+
public Token()
|
1800
|
+
{
|
1801
|
+
this.z = null;
|
1802
|
+
this.n = 0;
|
1803
|
+
}
|
1804
|
+
public Token(string z, Int32 n)
|
1805
|
+
{
|
1806
|
+
this.z = z;
|
1807
|
+
this.n = n;
|
1808
|
+
}
|
1809
|
+
public Token Copy()
|
1810
|
+
{
|
1811
|
+
if (this == null)
|
1812
|
+
return null;
|
1813
|
+
else
|
1814
|
+
{
|
1815
|
+
Token cp = (Token)MemberwiseClone();
|
1816
|
+
if (z == null || z.Length == 0)
|
1817
|
+
cp.n = 0;
|
1818
|
+
else
|
1819
|
+
if (n > z.Length) cp.n = z.Length;
|
1820
|
+
return cp;
|
1821
|
+
}
|
1822
|
+
}
|
1823
|
+
}
|
1824
|
+
|
1825
|
+
/*
|
1826
|
+
** An instance of this structure contains information needed to generate
|
1827
|
+
** code for a SELECT that contains aggregate functions.
|
1828
|
+
**
|
1829
|
+
** If Expr.op==TK_AGG_COLUMN or TK_AGG_FUNCTION then Expr.pAggInfo is a
|
1830
|
+
** pointer to this structure. The Expr.iColumn field is the index in
|
1831
|
+
** AggInfo.aCol[] or AggInfo.aFunc[] of information needed to generate
|
1832
|
+
** code for that node.
|
1833
|
+
**
|
1834
|
+
** AggInfo.pGroupBy and AggInfo.aFunc.pExpr point to fields within the
|
1835
|
+
** original Select structure that describes the SELECT statement. These
|
1836
|
+
** fields do not need to be freed when deallocating the AggInfo structure.
|
1837
|
+
*/
|
1838
|
+
public class AggInfo_col
|
1839
|
+
{ /* For each column used in source tables */
|
1840
|
+
public Table pTab; /* Source table */
|
1841
|
+
public int iTable; /* VdbeCursor number of the source table */
|
1842
|
+
public int iColumn; /* Column number within the source table */
|
1843
|
+
public int iSorterColumn; /* Column number in the sorting index */
|
1844
|
+
public int iMem; /* Memory location that acts as accumulator */
|
1845
|
+
public Expr pExpr; /* The original expression */
|
1846
|
+
};
|
1847
|
+
public class AggInfo_func
|
1848
|
+
{ /* For each aggregate function */
|
1849
|
+
public Expr pExpr; /* Expression encoding the function */
|
1850
|
+
public FuncDef pFunc; /* The aggregate function implementation */
|
1851
|
+
public int iMem; /* Memory location that acts as accumulator */
|
1852
|
+
public int iDistinct; /* Ephemeral table used to enforce DISTINCT */
|
1853
|
+
}
|
1854
|
+
public class AggInfo
|
1855
|
+
{
|
1856
|
+
public u8 directMode; /* Direct rendering mode means take data directly
|
1857
|
+
** from source tables rather than from accumulators */
|
1858
|
+
public u8 useSortingIdx; /* In direct mode, reference the sorting index rather
|
1859
|
+
** than the source table */
|
1860
|
+
public int sortingIdx; /* VdbeCursor number of the sorting index */
|
1861
|
+
public ExprList pGroupBy; /* The group by clause */
|
1862
|
+
public int nSortingColumn; /* Number of columns in the sorting index */
|
1863
|
+
public AggInfo_col[] aCol;
|
1864
|
+
public int nColumn; /* Number of used entries in aCol[] */
|
1865
|
+
public int nColumnAlloc; /* Number of slots allocated for aCol[] */
|
1866
|
+
public int nAccumulator; /* Number of columns that show through to the output.
|
1867
|
+
** Additional columns are used only as parameters to
|
1868
|
+
** aggregate functions */
|
1869
|
+
public AggInfo_func[] aFunc;
|
1870
|
+
public int nFunc; /* Number of entries in aFunc[] */
|
1871
|
+
public int nFuncAlloc; /* Number of slots allocated for aFunc[] */
|
1872
|
+
|
1873
|
+
public AggInfo Copy()
|
1874
|
+
{
|
1875
|
+
if (this == null)
|
1876
|
+
return null;
|
1877
|
+
else
|
1878
|
+
{
|
1879
|
+
AggInfo cp = (AggInfo)MemberwiseClone();
|
1880
|
+
if (pGroupBy != null) cp.pGroupBy = pGroupBy.Copy();
|
1881
|
+
return cp;
|
1882
|
+
}
|
1883
|
+
}
|
1884
|
+
};
|
1885
|
+
|
1886
|
+
/*
|
1887
|
+
** The datatype ynVar is a signed integer, either 16-bit or 32-bit.
|
1888
|
+
** Usually it is 16-bits. But if SQLITE_MAX_VARIABLE_NUMBER is greater
|
1889
|
+
** than 32767 we have to make it 32-bit. 16-bit is preferred because
|
1890
|
+
** it uses less memory in the Expr object, which is a big memory user
|
1891
|
+
** in systems with lots of prepared statements. And few applications
|
1892
|
+
** need more than about 10 or 20 variables. But some extreme users want
|
1893
|
+
** to have prepared statements with over 32767 variables, and for them
|
1894
|
+
** the option is available (at compile-time).
|
1895
|
+
*/
|
1896
|
+
//#if SQLITE_MAX_VARIABLE_NUMBER<=32767
|
1897
|
+
//typedef i16 ynVar;
|
1898
|
+
//#else
|
1899
|
+
//typedef int ynVar;
|
1900
|
+
//#endif
|
1901
|
+
|
1902
|
+
/*
|
1903
|
+
** Each node of an expression in the parse tree is an instance
|
1904
|
+
** of this structure.
|
1905
|
+
**
|
1906
|
+
** Expr.op is the opcode. The integer parser token codes are reused
|
1907
|
+
** as opcodes here. For example, the parser defines TK_GE to be an integer
|
1908
|
+
** code representing the ">=" operator. This same integer code is reused
|
1909
|
+
** to represent the greater-than-or-equal-to operator in the expression
|
1910
|
+
** tree.
|
1911
|
+
**
|
1912
|
+
** If the expression is an SQL literal (TK_INTEGER, TK_FLOAT, TK_BLOB,
|
1913
|
+
** or TK_STRING), then Expr.token contains the text of the SQL literal. If
|
1914
|
+
** the expression is a variable (TK_VARIABLE), then Expr.token contains the
|
1915
|
+
** variable name. Finally, if the expression is an SQL function (TK_FUNCTION),
|
1916
|
+
** then Expr.token contains the name of the function.
|
1917
|
+
**
|
1918
|
+
** Expr.pRight and Expr.pLeft are the left and right subexpressions of a
|
1919
|
+
** binary operator. Either or both may be NULL.
|
1920
|
+
**
|
1921
|
+
** Expr.x.pList is a list of arguments if the expression is an SQL function,
|
1922
|
+
** a CASE expression or an IN expression of the form "<lhs> IN (<y>, <z>...)".
|
1923
|
+
** Expr.x.pSelect is used if the expression is a sub-select or an expression of
|
1924
|
+
** the form "<lhs> IN (SELECT ...)". If the EP_xIsSelect bit is set in the
|
1925
|
+
** Expr.flags mask, then Expr.x.pSelect is valid. Otherwise, Expr.x.pList is
|
1926
|
+
** valid.
|
1927
|
+
**
|
1928
|
+
** An expression of the form ID or ID.ID refers to a column in a table.
|
1929
|
+
** For such expressions, Expr.op is set to TK_COLUMN and Expr.iTable is
|
1930
|
+
** the integer cursor number of a VDBE cursor pointing to that table and
|
1931
|
+
** Expr.iColumn is the column number for the specific column. If the
|
1932
|
+
** expression is used as a result in an aggregate SELECT, then the
|
1933
|
+
** value is also stored in the Expr.iAgg column in the aggregate so that
|
1934
|
+
** it can be accessed after all aggregates are computed.
|
1935
|
+
**
|
1936
|
+
** If the expression is an unbound variable marker (a question mark
|
1937
|
+
** character '?' in the original SQL) then the Expr.iTable holds the index
|
1938
|
+
** number for that variable.
|
1939
|
+
**
|
1940
|
+
** If the expression is a subquery then Expr.iColumn holds an integer
|
1941
|
+
** register number containing the result of the subquery. If the
|
1942
|
+
** subquery gives a constant result, then iTable is -1. If the subquery
|
1943
|
+
** gives a different answer at different times during statement processing
|
1944
|
+
** then iTable is the address of a subroutine that computes the subquery.
|
1945
|
+
**
|
1946
|
+
** If the Expr is of type OP_Column, and the table it is selecting from
|
1947
|
+
** is a disk table or the "old.*" pseudo-table, then pTab points to the
|
1948
|
+
** corresponding table definition.
|
1949
|
+
**
|
1950
|
+
** ALLOCATION NOTES:
|
1951
|
+
**
|
1952
|
+
** Expr objects can use a lot of memory space in database schema. To
|
1953
|
+
** help reduce memory requirements, sometimes an Expr object will be
|
1954
|
+
** truncated. And to reduce the number of memory allocations, sometimes
|
1955
|
+
** two or more Expr objects will be stored in a single memory allocation,
|
1956
|
+
** together with Expr.zToken strings.
|
1957
|
+
**
|
1958
|
+
** If the EP_Reduced and EP_TokenOnly flags are set when
|
1959
|
+
** an Expr object is truncated. When EP_Reduced is set, then all
|
1960
|
+
** the child Expr objects in the Expr.pLeft and Expr.pRight subtrees
|
1961
|
+
** are contained within the same memory allocation. Note, however, that
|
1962
|
+
** the subtrees in Expr.x.pList or Expr.x.pSelect are always separately
|
1963
|
+
** allocated, regardless of whether or not EP_Reduced is set.
|
1964
|
+
*/
|
1965
|
+
public class Expr
|
1966
|
+
{
|
1967
|
+
#if DEBUG_CLASS_EXPR || DEBUG_CLASS_ALL
|
1968
|
+
public u8 _op; /* Operation performed by this node */
|
1969
|
+
public u8 op
|
1970
|
+
{
|
1971
|
+
get { return _op; }
|
1972
|
+
set { _op = value; }
|
1973
|
+
}
|
1974
|
+
#else
|
1975
|
+
public u8 op; /* Operation performed by this node */
|
1976
|
+
#endif
|
1977
|
+
public char affinity; /* The affinity of the column or 0 if not a column */
|
1978
|
+
#if DEBUG_CLASS_EXPR || DEBUG_CLASS_ALL
|
1979
|
+
public u16 _flags; /* Various flags. EP_* See below */
|
1980
|
+
public u16 flags
|
1981
|
+
{
|
1982
|
+
get { return _flags; }
|
1983
|
+
set { _flags = value; }
|
1984
|
+
}
|
1985
|
+
public struct _u
|
1986
|
+
{
|
1987
|
+
public string _zToken; /* Token value. Zero terminated and dequoted */
|
1988
|
+
public string zToken
|
1989
|
+
{
|
1990
|
+
get { return _zToken; }
|
1991
|
+
set { _zToken = value; }
|
1992
|
+
}
|
1993
|
+
public int iValue; /* Integer value if EP_IntValue */
|
1994
|
+
}
|
1995
|
+
|
1996
|
+
#else
|
1997
|
+
public struct _u
|
1998
|
+
{
|
1999
|
+
public string zToken; /* Token value. Zero terminated and dequoted */
|
2000
|
+
public int iValue; /* Integer value if EP_IntValue */
|
2001
|
+
}
|
2002
|
+
public u16 flags; /* Various flags. EP_* See below */
|
2003
|
+
#endif
|
2004
|
+
public _u u;
|
2005
|
+
|
2006
|
+
/* If the EP_TokenOnly flag is set in the Expr.flags mask, then no
|
2007
|
+
** space is allocated for the fields below this point. An attempt to
|
2008
|
+
** access them will result in a segfault or malfunction.
|
2009
|
+
*********************************************************************/
|
2010
|
+
|
2011
|
+
public Expr pLeft; /* Left subnode */
|
2012
|
+
public Expr pRight; /* Right subnode */
|
2013
|
+
public struct _x
|
2014
|
+
{
|
2015
|
+
public ExprList pList; /* Function arguments or in "<expr> IN (<expr-list)" */
|
2016
|
+
public Select pSelect; /* Used for sub-selects and "<expr> IN (<select>)" */
|
2017
|
+
}
|
2018
|
+
public _x x;
|
2019
|
+
public CollSeq pColl; /* The collation type of the column or 0 */
|
2020
|
+
|
2021
|
+
/* If the EP_Reduced flag is set in the Expr.flags mask, then no
|
2022
|
+
** space is allocated for the fields below this point. An attempt to
|
2023
|
+
** access them will result in a segfault or malfunction.
|
2024
|
+
*********************************************************************/
|
2025
|
+
|
2026
|
+
public int iTable; /* TK_COLUMN: cursor number of table holding column
|
2027
|
+
** TK_REGISTER: register number
|
2028
|
+
** TK_TRIGGER: 1 -> new, 0 -> old */
|
2029
|
+
public ynVar iColumn; /* TK_COLUMN: column index. -1 for rowid.
|
2030
|
+
** TK_VARIABLE: variable number (always >= 1). */
|
2031
|
+
public i16 iAgg; /* Which entry in pAggInfo->aCol[] or ->aFunc[] */
|
2032
|
+
public i16 iRightJoinTable; /* If EP_FromJoin, the right table of the join */
|
2033
|
+
public u8 flags2; /* Second set of flags. EP2_... */
|
2034
|
+
public u8 op2; /* If a TK_REGISTER, the original value of Expr.op */
|
2035
|
+
public AggInfo pAggInfo; /* Used by TK_AGG_COLUMN and TK_AGG_FUNCTION */
|
2036
|
+
public Table pTab; /* Table for TK_COLUMN expressions. */
|
2037
|
+
#if SQLITE_MAX_EXPR_DEPTH //>0
|
2038
|
+
public int nHeight; /* Height of the tree headed by this node */
|
2039
|
+
public Table pZombieTab; /* List of Table objects to delete after code gen */
|
2040
|
+
#endif
|
2041
|
+
|
2042
|
+
#if DEBUG_CLASS
|
2043
|
+
public int op
|
2044
|
+
{
|
2045
|
+
get { return _op; }
|
2046
|
+
set { _op = value; }
|
2047
|
+
}
|
2048
|
+
#endif
|
2049
|
+
public void CopyFrom(Expr cf)
|
2050
|
+
{
|
2051
|
+
op = cf.op;
|
2052
|
+
affinity = cf.affinity;
|
2053
|
+
flags = cf.flags;
|
2054
|
+
u = cf.u;
|
2055
|
+
pColl = cf.pColl == null ? null : cf.pColl.Copy();
|
2056
|
+
iTable = cf.iTable;
|
2057
|
+
iColumn = cf.iColumn;
|
2058
|
+
pAggInfo = cf.pAggInfo == null ? null : cf.pAggInfo.Copy();
|
2059
|
+
iAgg = cf.iAgg;
|
2060
|
+
iRightJoinTable = cf.iRightJoinTable;
|
2061
|
+
flags2 = cf.flags2;
|
2062
|
+
pTab = cf.pTab == null ? null : cf.pTab;
|
2063
|
+
#if SQLITE_TEST || SQLITE_MAX_EXPR_DEPTH //SQLITE_MAX_EXPR_DEPTH>0
|
2064
|
+
nHeight = cf.nHeight;
|
2065
|
+
pZombieTab = cf.pZombieTab;
|
2066
|
+
#endif
|
2067
|
+
pLeft = cf.pLeft == null ? null : cf.pLeft.Copy();
|
2068
|
+
pRight = cf.pRight == null ? null : cf.pRight.Copy();
|
2069
|
+
x.pList = cf.x.pList == null ? null : cf.x.pList.Copy();
|
2070
|
+
x.pSelect = cf.x.pSelect == null ? null : cf.x.pSelect.Copy();
|
2071
|
+
}
|
2072
|
+
|
2073
|
+
public Expr Copy()
|
2074
|
+
{
|
2075
|
+
if (this == null)
|
2076
|
+
return null;
|
2077
|
+
else
|
2078
|
+
return Copy(flags);
|
2079
|
+
}
|
2080
|
+
|
2081
|
+
public Expr Copy(int flag)
|
2082
|
+
{
|
2083
|
+
Expr cp = new Expr();
|
2084
|
+
cp.op = op;
|
2085
|
+
cp.affinity = affinity;
|
2086
|
+
cp.flags = flags;
|
2087
|
+
cp.u = u;
|
2088
|
+
if ((flag & EP_TokenOnly) != 0) return cp;
|
2089
|
+
if (pLeft != null) cp.pLeft = pLeft.Copy();
|
2090
|
+
if (pRight != null) cp.pRight = pRight.Copy();
|
2091
|
+
cp.x = x;
|
2092
|
+
cp.pColl = pColl;
|
2093
|
+
if ((flag & EP_Reduced) != 0) return cp;
|
2094
|
+
cp.iTable = iTable;
|
2095
|
+
cp.iColumn = iColumn;
|
2096
|
+
cp.iAgg = iAgg;
|
2097
|
+
cp.iRightJoinTable = iRightJoinTable;
|
2098
|
+
cp.flags2 = flags2;
|
2099
|
+
cp.op2 = op2;
|
2100
|
+
cp.pAggInfo = pAggInfo;
|
2101
|
+
cp.pTab = pTab;
|
2102
|
+
#if SQLITE_MAX_EXPR_DEPTH //>0
|
2103
|
+
cp.nHeight = nHeight;
|
2104
|
+
cp.pZombieTab = pZombieTab;
|
2105
|
+
#endif
|
2106
|
+
return cp;
|
2107
|
+
}
|
2108
|
+
};
|
2109
|
+
|
2110
|
+
/*
|
2111
|
+
** The following are the meanings of bits in the Expr.flags field.
|
2112
|
+
*/
|
2113
|
+
//#define EP_FromJoin 0x0001 /* Originated in ON or USING clause of a join */
|
2114
|
+
//#define EP_Agg 0x0002 /* Contains one or more aggregate functions */
|
2115
|
+
//#define EP_Resolved 0x0004 /* IDs have been resolved to COLUMNs */
|
2116
|
+
//#define EP_Error 0x0008 /* Expression contains one or more errors */
|
2117
|
+
//#define EP_Distinct 0x0010 /* Aggregate function with DISTINCT keyword */
|
2118
|
+
//#define EP_VarSelect 0x0020 /* pSelect is correlated, not constant */
|
2119
|
+
//#define EP_DblQuoted 0x0040 /* token.z was originally in "..." */
|
2120
|
+
//#define EP_InfixFunc 0x0080 /* True for an infix function: LIKE, GLOB, etc */
|
2121
|
+
//#define EP_ExpCollate 0x0100 /* Collating sequence specified explicitly */
|
2122
|
+
//#define EP_FixedDest 0x0200 /* Result needed in a specific register */
|
2123
|
+
//#define EP_IntValue 0x0400 /* Integer value contained in u.iValue */
|
2124
|
+
//#define EP_xIsSelect 0x0800 /* x.pSelect is valid (otherwise x.pList is) */
|
2125
|
+
|
2126
|
+
//#define EP_Reduced 0x1000 /* Expr struct is EXPR_REDUCEDSIZE bytes only */
|
2127
|
+
//#define EP_TokenOnly 0x2000 /* Expr struct is EXPR_TOKENONLYSIZE bytes only */
|
2128
|
+
//#define EP_Static 0x4000 /* Held in memory not obtained from malloc() */
|
2129
|
+
|
2130
|
+
const ushort EP_FromJoin = 0x0001;
|
2131
|
+
const ushort EP_Agg = 0x0002;
|
2132
|
+
const ushort EP_Resolved = 0x0004;
|
2133
|
+
const ushort EP_Error = 0x0008;
|
2134
|
+
const ushort EP_Distinct = 0x0010;
|
2135
|
+
const ushort EP_VarSelect = 0x0020;
|
2136
|
+
const ushort EP_DblQuoted = 0x0040;
|
2137
|
+
const ushort EP_InfixFunc = 0x0080;
|
2138
|
+
const ushort EP_ExpCollate = 0x0100;
|
2139
|
+
const ushort EP_FixedDest = 0x0200;
|
2140
|
+
const ushort EP_IntValue = 0x0400;
|
2141
|
+
const ushort EP_xIsSelect = 0x0800;
|
2142
|
+
|
2143
|
+
const ushort EP_Reduced = 0x1000;
|
2144
|
+
const ushort EP_TokenOnly = 0x2000;
|
2145
|
+
const ushort EP_Static = 0x4000;
|
2146
|
+
|
2147
|
+
/*
|
2148
|
+
** The following are the meanings of bits in the Expr.flags2 field.
|
2149
|
+
*/
|
2150
|
+
//#define EP2_MallocedToken 0x0001 /* Need to sqlite3DbFree() Expr.zToken */
|
2151
|
+
//#define EP2_Irreducible 0x0002 /* Cannot EXPRDUP_REDUCE this Expr */
|
2152
|
+
const u8 EP2_MallocedToken = 0x0001;
|
2153
|
+
const u8 EP2_Irreducible = 0x0002;
|
2154
|
+
|
2155
|
+
/*
|
2156
|
+
** The pseudo-routine sqlite3ExprSetIrreducible sets the EP2_Irreducible
|
2157
|
+
** flag on an expression structure. This flag is used for VV&A only. The
|
2158
|
+
** routine is implemented as a macro that only works when in debugging mode,
|
2159
|
+
** so as not to burden production code.
|
2160
|
+
*/
|
2161
|
+
#if SQLITE_DEBUG
|
2162
|
+
//# define ExprSetIrreducible(X) (X)->flags2 |= EP2_Irreducible
|
2163
|
+
static void ExprSetIrreducible(Expr X) { X.flags2 |= EP2_Irreducible; }
|
2164
|
+
#else
|
2165
|
+
//# define ExprSetIrreducible(X)
|
2166
|
+
static void ExprSetIrreducible( Expr X ) { }
|
2167
|
+
#endif
|
2168
|
+
|
2169
|
+
/*
|
2170
|
+
** These macros can be used to test, set, or clear bits in the
|
2171
|
+
** Expr.flags field.
|
2172
|
+
*/
|
2173
|
+
//#define ExprHasProperty(E,P) (((E)->flags&(P))==(P))
|
2174
|
+
static bool ExprHasProperty(Expr E, int P) { return (E.flags & P) == P; }
|
2175
|
+
//#define ExprHasAnyProperty(E,P) (((E)->flags&(P))!=0)
|
2176
|
+
static bool ExprHasAnyProperty(Expr E, int P) { return (E.flags & P) != 0; }
|
2177
|
+
//#define ExprSetProperty(E,P) (E)->flags|=(P)
|
2178
|
+
static void ExprSetProperty(Expr E, int P) { E.flags = (ushort)(E.flags | P); }
|
2179
|
+
//#define ExprClearProperty(E,P) (E)->flags&=~(P)
|
2180
|
+
static void ExprClearProperty(Expr E, int P) { E.flags = (ushort)(E.flags & ~P); }
|
2181
|
+
|
2182
|
+
/*
|
2183
|
+
** Macros to determine the number of bytes required by a normal Expr
|
2184
|
+
** struct, an Expr struct with the EP_Reduced flag set in Expr.flags
|
2185
|
+
** and an Expr struct with the EP_TokenOnly flag set.
|
2186
|
+
*/
|
2187
|
+
//#define EXPR_FULLSIZE sizeof(Expr) /* Full size */
|
2188
|
+
//#define EXPR_REDUCEDSIZE offsetof(Expr,iTable) /* Common features */
|
2189
|
+
//#define EXPR_TOKENONLYSIZE offsetof(Expr,pLeft) /* Fewer features */
|
2190
|
+
|
2191
|
+
// We don't use these in C#, but define them anyway,
|
2192
|
+
const int EXPR_FULLSIZE = 48;
|
2193
|
+
const int EXPR_REDUCEDSIZE = 24;
|
2194
|
+
const int EXPR_TOKENONLYSIZE = 8;
|
2195
|
+
|
2196
|
+
/*
|
2197
|
+
** Flags passed to the sqlite3ExprDup() function. See the header comment
|
2198
|
+
** above sqlite3ExprDup() for details.
|
2199
|
+
*/
|
2200
|
+
//#define EXPRDUP_REDUCE 0x0001 /* Used reduced-size Expr nodes */
|
2201
|
+
const int EXPRDUP_REDUCE = 0x0001;
|
2202
|
+
|
2203
|
+
/*
|
2204
|
+
** A list of expressions. Each expression may optionally have a
|
2205
|
+
** name. An expr/name combination can be used in several ways, such
|
2206
|
+
** as the list of "expr AS ID" fields following a "SELECT" or in the
|
2207
|
+
** list of "ID = expr" items in an UPDATE. A list of expressions can
|
2208
|
+
** also be used as the argument to a function, in which case the a.zName
|
2209
|
+
** field is not used.
|
2210
|
+
*/
|
2211
|
+
public class ExprList_item
|
2212
|
+
{
|
2213
|
+
public Expr pExpr; /* The list of expressions */
|
2214
|
+
public string zName; /* Token associated with this expression */
|
2215
|
+
public string zSpan; /* Original text of the expression */
|
2216
|
+
public u8 sortOrder; /* 1 for DESC or 0 for ASC */
|
2217
|
+
public u8 done; /* A flag to indicate when processing is finished */
|
2218
|
+
public u16 iCol; /* For ORDER BY, column number in result set */
|
2219
|
+
public u16 iAlias; /* Index into Parse.aAlias[] for zName */
|
2220
|
+
}
|
2221
|
+
public class ExprList
|
2222
|
+
{
|
2223
|
+
public int nExpr; /* Number of expressions on the list */
|
2224
|
+
public int nAlloc; /* Number of entries allocated below */
|
2225
|
+
public int iECursor; /* VDBE VdbeCursor associated with this ExprList */
|
2226
|
+
public ExprList_item[] a; /* One entry for each expression */
|
2227
|
+
|
2228
|
+
public ExprList Copy()
|
2229
|
+
{
|
2230
|
+
if (this == null)
|
2231
|
+
return null;
|
2232
|
+
else
|
2233
|
+
{
|
2234
|
+
ExprList cp = (ExprList)MemberwiseClone();
|
2235
|
+
a.CopyTo(cp.a, 0);
|
2236
|
+
return cp;
|
2237
|
+
}
|
2238
|
+
}
|
2239
|
+
|
2240
|
+
};
|
2241
|
+
|
2242
|
+
/*
|
2243
|
+
** An instance of this structure is used by the parser to record both
|
2244
|
+
** the parse tree for an expression and the span of input text for an
|
2245
|
+
** expression.
|
2246
|
+
*/
|
2247
|
+
public class ExprSpan
|
2248
|
+
{
|
2249
|
+
public Expr pExpr; /* The expression parse tree */
|
2250
|
+
public string zStart; /* First character of input text */
|
2251
|
+
public string zEnd; /* One character past the end of input text */
|
2252
|
+
};
|
2253
|
+
|
2254
|
+
/*
|
2255
|
+
** An instance of this structure can hold a simple list of identifiers,
|
2256
|
+
** such as the list "a,b,c" in the following statements:
|
2257
|
+
**
|
2258
|
+
** INSERT INTO t(a,b,c) VALUES ...;
|
2259
|
+
** CREATE INDEX idx ON t(a,b,c);
|
2260
|
+
** CREATE TRIGGER trig BEFORE UPDATE ON t(a,b,c) ...;
|
2261
|
+
**
|
2262
|
+
** The IdList.a.idx field is used when the IdList represents the list of
|
2263
|
+
** column names after a table name in an INSERT statement. In the statement
|
2264
|
+
**
|
2265
|
+
** INSERT INTO t(a,b,c) ...
|
2266
|
+
**
|
2267
|
+
** If "a" is the k-th column of table "t", then IdList.a[0].idx==k.
|
2268
|
+
*/
|
2269
|
+
public class IdList_item
|
2270
|
+
{
|
2271
|
+
public string zName; /* Name of the identifier */
|
2272
|
+
public int idx; /* Index in some Table.aCol[] of a column named zName */
|
2273
|
+
}
|
2274
|
+
public class IdList
|
2275
|
+
{
|
2276
|
+
public IdList_item[] a;
|
2277
|
+
public int nId; /* Number of identifiers on the list */
|
2278
|
+
public int nAlloc; /* Number of entries allocated for a[] below */
|
2279
|
+
|
2280
|
+
public IdList Copy()
|
2281
|
+
{
|
2282
|
+
if (this == null)
|
2283
|
+
return null;
|
2284
|
+
else
|
2285
|
+
{
|
2286
|
+
IdList cp = (IdList)MemberwiseClone();
|
2287
|
+
a.CopyTo(cp.a, 0);
|
2288
|
+
return cp;
|
2289
|
+
}
|
2290
|
+
}
|
2291
|
+
};
|
2292
|
+
|
2293
|
+
/*
|
2294
|
+
** The bitmask datatype defined below is used for various optimizations.
|
2295
|
+
**
|
2296
|
+
** Changing this from a 64-bit to a 32-bit type limits the number of
|
2297
|
+
** tables in a join to 32 instead of 64. But it also reduces the size
|
2298
|
+
** of the library by 738 bytes on ix86.
|
2299
|
+
*/
|
2300
|
+
//typedef u64 Bitmask;
|
2301
|
+
|
2302
|
+
/*
|
2303
|
+
** The number of bits in a Bitmask. "BMS" means "BitMask Size".
|
2304
|
+
*/
|
2305
|
+
//#define BMS ((int)(sizeof(Bitmask)*8))
|
2306
|
+
const int BMS = ((int)(sizeof(Bitmask) * 8));
|
2307
|
+
|
2308
|
+
|
2309
|
+
/*
|
2310
|
+
** The following structure describes the FROM clause of a SELECT statement.
|
2311
|
+
** Each table or subquery in the FROM clause is a separate element of
|
2312
|
+
** the SrcList.a[] array.
|
2313
|
+
**
|
2314
|
+
** With the addition of multiple database support, the following structure
|
2315
|
+
** can also be used to describe a particular table such as the table that
|
2316
|
+
** is modified by an INSERT, DELETE, or UPDATE statement. In standard SQL,
|
2317
|
+
** such a table must be a simple name: ID. But in SQLite, the table can
|
2318
|
+
** now be identified by a database name, a dot, then the table name: ID.ID.
|
2319
|
+
**
|
2320
|
+
** The jointype starts out showing the join type between the current table
|
2321
|
+
** and the next table on the list. The parser builds the list this way.
|
2322
|
+
** But sqlite3SrcListShiftJoinType() later shifts the jointypes so that each
|
2323
|
+
** jointype expresses the join between the table and the previous table.
|
2324
|
+
*/
|
2325
|
+
public class SrcList_item
|
2326
|
+
{
|
2327
|
+
public string zDatabase; /* Name of database holding this table */
|
2328
|
+
public string zName; /* Name of the table */
|
2329
|
+
public string zAlias; /* The "B" part of a "A AS B" phrase. zName is the "A" */
|
2330
|
+
public Table pTab; /* An SQL table corresponding to zName */
|
2331
|
+
public Select pSelect; /* A SELECT statement used in place of a table name */
|
2332
|
+
public u8 isPopulated; /* Temporary table associated with SELECT is populated */
|
2333
|
+
public u8 jointype; /* Type of join between this able and the previous */
|
2334
|
+
public u8 notIndexed; /* True if there is a NOT INDEXED clause */
|
2335
|
+
public int iCursor; /* The VDBE cursor number used to access this table */
|
2336
|
+
public Expr pOn; /* The ON clause of a join */
|
2337
|
+
public IdList pUsing; /* The USING clause of a join */
|
2338
|
+
public Bitmask colUsed; /* Bit N (1<<N) set if column N of pTab is used */
|
2339
|
+
public string zIndex; /* Identifier from "INDEXED BY <zIndex>" clause */
|
2340
|
+
public Index pIndex; /* Index structure corresponding to zIndex, if any */
|
2341
|
+
}
|
2342
|
+
public class SrcList
|
2343
|
+
{
|
2344
|
+
public i16 nSrc; /* Number of tables or subqueries in the FROM clause */
|
2345
|
+
public i16 nAlloc; /* Number of entries allocated in a[] below */
|
2346
|
+
public SrcList_item[] a;/* One entry for each identifier on the list */
|
2347
|
+
public SrcList Copy()
|
2348
|
+
{
|
2349
|
+
if (this == null)
|
2350
|
+
return null;
|
2351
|
+
else
|
2352
|
+
{
|
2353
|
+
SrcList cp = (SrcList)MemberwiseClone();
|
2354
|
+
if (a != null) a.CopyTo(cp.a, 0);
|
2355
|
+
return cp;
|
2356
|
+
}
|
2357
|
+
}
|
2358
|
+
};
|
2359
|
+
|
2360
|
+
/*
|
2361
|
+
** Permitted values of the SrcList.a.jointype field
|
2362
|
+
*/
|
2363
|
+
const int JT_INNER = 0x0001; //#define JT_INNER 0x0001 /* Any kind of inner or cross join */
|
2364
|
+
const int JT_CROSS = 0x0002; //#define JT_CROSS 0x0002 /* Explicit use of the CROSS keyword */
|
2365
|
+
const int JT_NATURAL = 0x0004; //#define JT_NATURAL 0x0004 /* True for a "natural" join */
|
2366
|
+
const int JT_LEFT = 0x0008; //#define JT_LEFT 0x0008 /* Left outer join */
|
2367
|
+
const int JT_RIGHT = 0x0010; //#define JT_RIGHT 0x0010 /* Right outer join */
|
2368
|
+
const int JT_OUTER = 0x0020; //#define JT_OUTER 0x0020 /* The "OUTER" keyword is present */
|
2369
|
+
const int JT_ERROR = 0x0040; //#define JT_ERROR 0x0040 /* unknown or unsupported join type */
|
2370
|
+
|
2371
|
+
|
2372
|
+
/*
|
2373
|
+
** A WherePlan object holds information that describes a lookup
|
2374
|
+
** strategy.
|
2375
|
+
**
|
2376
|
+
** This object is intended to be opaque outside of the where.c module.
|
2377
|
+
** It is included here only so that that compiler will know how big it
|
2378
|
+
** is. None of the fields in this object should be used outside of
|
2379
|
+
** the where.c module.
|
2380
|
+
**
|
2381
|
+
** Within the union, pIdx is only used when wsFlags&WHERE_INDEXED is true.
|
2382
|
+
** pTerm is only used when wsFlags&WHERE_MULTI_OR is true. And pVtabIdx
|
2383
|
+
** is only used when wsFlags&WHERE_VIRTUALTABLE is true. It is never the
|
2384
|
+
** case that more than one of these conditions is true.
|
2385
|
+
*/
|
2386
|
+
public class WherePlan
|
2387
|
+
{
|
2388
|
+
public u32 wsFlags; /* WHERE_* flags that describe the strategy */
|
2389
|
+
public u32 nEq; /* Number of == constraints */
|
2390
|
+
public class _u
|
2391
|
+
{
|
2392
|
+
public Index pIdx; /* Index when WHERE_INDEXED is true */
|
2393
|
+
public WhereTerm pTerm; /* WHERE clause term for OR-search */
|
2394
|
+
public sqlite3_index_info pVtabIdx; /* Virtual table index to use */
|
2395
|
+
}
|
2396
|
+
public _u u = new _u();
|
2397
|
+
public void Clear()
|
2398
|
+
{
|
2399
|
+
wsFlags = 0;
|
2400
|
+
nEq = 0;
|
2401
|
+
u.pIdx = null;
|
2402
|
+
u.pTerm = null;
|
2403
|
+
u.pVtabIdx = null;
|
2404
|
+
}
|
2405
|
+
};
|
2406
|
+
|
2407
|
+
/*
|
2408
|
+
** For each nested loop in a WHERE clause implementation, the WhereInfo
|
2409
|
+
** structure contains a single instance of this structure. This structure
|
2410
|
+
** is intended to be private the the where.c module and should not be
|
2411
|
+
** access or modified by other modules.
|
2412
|
+
**
|
2413
|
+
** The pIdxInfo field is used to help pick the best index on a
|
2414
|
+
** virtual table. The pIdxInfo pointer contains indexing
|
2415
|
+
** information for the i-th table in the FROM clause before reordering.
|
2416
|
+
** All the pIdxInfo pointers are freed by whereInfoFree() in where.c.
|
2417
|
+
** All other information in the i-th WhereLevel object for the i-th table
|
2418
|
+
** after FROM clause ordering.
|
2419
|
+
*/
|
2420
|
+
public class InLoop
|
2421
|
+
{
|
2422
|
+
public int iCur; /* The VDBE cursor used by this IN operator */
|
2423
|
+
public int addrInTop; /* Top of the IN loop */
|
2424
|
+
}
|
2425
|
+
public class WhereLevel
|
2426
|
+
{
|
2427
|
+
public WherePlan plan; /* query plan for this element of the FROM clause */
|
2428
|
+
public int iLeftJoin; /* Memory cell used to implement LEFT OUTER JOIN */
|
2429
|
+
public int iTabCur; /* The VDBE cursor used to access the table */
|
2430
|
+
public int iIdxCur; /* The VDBE cursor used to access pIdx */
|
2431
|
+
public int addrBrk; /* Jump here to break out of the loop */
|
2432
|
+
public int addrNxt; /* Jump here to start the next IN combination */
|
2433
|
+
public int addrCont; /* Jump here to continue with the next loop cycle */
|
2434
|
+
public int addrFirst; /* First instruction of interior of the loop */
|
2435
|
+
public u8 iFrom; /* Which entry in the FROM clause */
|
2436
|
+
public u8 op, p5; /* Opcode and P5 of the opcode that ends the loop */
|
2437
|
+
public int p1, p2; /* Operands of the opcode used to ends the loop */
|
2438
|
+
public class _u
|
2439
|
+
{
|
2440
|
+
public class __in /* Information that depends on plan.wsFlags */
|
2441
|
+
{
|
2442
|
+
public int nIn; /* Number of entries in aInLoop[] */
|
2443
|
+
public InLoop[] aInLoop; /* Information about each nested IN operator */
|
2444
|
+
}
|
2445
|
+
public __in _in = new __in(); /* Used when plan.wsFlags&WHERE_IN_ABLE */
|
2446
|
+
}
|
2447
|
+
public _u u = new _u();
|
2448
|
+
|
2449
|
+
|
2450
|
+
/* The following field is really not part of the current level. But
|
2451
|
+
** we need a place to cache virtual table index information for each
|
2452
|
+
** virtual table in the FROM clause and the WhereLevel structure is
|
2453
|
+
** a convenient place since there is one WhereLevel for each FROM clause
|
2454
|
+
** element.
|
2455
|
+
*/
|
2456
|
+
public sqlite3_index_info pIdxInfo; /* Index info for n-th source table */
|
2457
|
+
};
|
2458
|
+
|
2459
|
+
/*
|
2460
|
+
** Flags appropriate for the wctrlFlags parameter of sqlite3WhereBegin()
|
2461
|
+
** and the WhereInfo.wctrlFlags member.
|
2462
|
+
*/
|
2463
|
+
//#define WHERE_ORDERBY_NORMAL 0x0000 /* No-op */
|
2464
|
+
//#define WHERE_ORDERBY_MIN 0x0001 /* ORDER BY processing for min() func */
|
2465
|
+
//#define WHERE_ORDERBY_MAX 0x0002 /* ORDER BY processing for max() func */
|
2466
|
+
//#define WHERE_ONEPASS_DESIRED 0x0004 /* Want to do one-pass UPDATE/DELETE */
|
2467
|
+
//#define WHERE_DUPLICATES_OK 0x0008 /* Ok to return a row more than once */
|
2468
|
+
//#define WHERE_OMIT_OPEN 0x0010 /* Table cursor are already open */
|
2469
|
+
//#define WHERE_OMIT_CLOSE 0x0020 /* Omit close of table & index cursors */
|
2470
|
+
//#define WHERE_FORCE_TABLE 0x0040 /* Do not use an index-only search */
|
2471
|
+
//#define WHERE_ONETABLE_ONLY 0x0080 /* Only code the 1st table in pTabList */
|
2472
|
+
const int WHERE_ORDERBY_NORMAL = 0x0000;
|
2473
|
+
const int WHERE_ORDERBY_MIN = 0x0001;
|
2474
|
+
const int WHERE_ORDERBY_MAX = 0x0002;
|
2475
|
+
const int WHERE_ONEPASS_DESIRED = 0x0004;
|
2476
|
+
const int WHERE_DUPLICATES_OK = 0x0008;
|
2477
|
+
const int WHERE_OMIT_OPEN = 0x0010;
|
2478
|
+
const int WHERE_OMIT_CLOSE = 0x0020;
|
2479
|
+
const int WHERE_FORCE_TABLE = 0x0040;
|
2480
|
+
const int WHERE_ONETABLE_ONLY = 0x0080;
|
2481
|
+
|
2482
|
+
/*
|
2483
|
+
** The WHERE clause processing routine has two halves. The
|
2484
|
+
** first part does the start of the WHERE loop and the second
|
2485
|
+
** half does the tail of the WHERE loop. An instance of
|
2486
|
+
** this structure is returned by the first half and passed
|
2487
|
+
** into the second half to give some continuity.
|
2488
|
+
*/
|
2489
|
+
public class WhereInfo
|
2490
|
+
{
|
2491
|
+
public Parse pParse; /* Parsing and code generating context */
|
2492
|
+
public u16 wctrlFlags; /* Flags originally passed to sqlite3WhereBegin() */
|
2493
|
+
public u8 okOnePass; /* Ok to use one-pass algorithm for UPDATE or DELETE */
|
2494
|
+
public u8 untestedTerms; /* Not all WHERE terms resolved by outer loop */
|
2495
|
+
public SrcList pTabList; /* List of tables in the join */
|
2496
|
+
public int iTop; /* The very beginning of the WHERE loop */
|
2497
|
+
public int iContinue; /* Jump here to continue with next record */
|
2498
|
+
public int iBreak; /* Jump here to break out of the loop */
|
2499
|
+
public int nLevel; /* Number of nested loop */
|
2500
|
+
public WhereClause pWC; /* Decomposition of the WHERE clause */
|
2501
|
+
public WhereLevel[] a = new WhereLevel[] { new WhereLevel() }; /* Information about each nest loop in the WHERE */
|
2502
|
+
};
|
2503
|
+
|
2504
|
+
/*
|
2505
|
+
** A NameContext defines a context in which to resolve table and column
|
2506
|
+
** names. The context consists of a list of tables (the pSrcList) field and
|
2507
|
+
** a list of named expression (pEList). The named expression list may
|
2508
|
+
** be NULL. The pSrc corresponds to the FROM clause of a SELECT or
|
2509
|
+
** to the table being operated on by INSERT, UPDATE, or DELETE. The
|
2510
|
+
** pEList corresponds to the result set of a SELECT and is NULL for
|
2511
|
+
** other statements.
|
2512
|
+
**
|
2513
|
+
** NameContexts can be nested. When resolving names, the inner-most
|
2514
|
+
** context is searched first. If no match is found, the next outer
|
2515
|
+
** context is checked. If there is still no match, the next context
|
2516
|
+
** is checked. This process continues until either a match is found
|
2517
|
+
** or all contexts are check. When a match is found, the nRef member of
|
2518
|
+
** the context containing the match is incremented.
|
2519
|
+
**
|
2520
|
+
** Each subquery gets a new NameContext. The pNext field points to the
|
2521
|
+
** NameContext in the parent query. Thus the process of scanning the
|
2522
|
+
** NameContext list corresponds to searching through successively outer
|
2523
|
+
** subqueries looking for a match.
|
2524
|
+
*/
|
2525
|
+
public class NameContext
|
2526
|
+
{
|
2527
|
+
public Parse pParse; /* The parser */
|
2528
|
+
public SrcList pSrcList; /* One or more tables used to resolve names */
|
2529
|
+
public ExprList pEList; /* Optional list of named expressions */
|
2530
|
+
public int nRef; /* Number of names resolved by this context */
|
2531
|
+
public int nErr; /* Number of errors encountered while resolving names */
|
2532
|
+
public u8 allowAgg; /* Aggregate functions allowed here */
|
2533
|
+
public u8 hasAgg; /* True if aggregates are seen */
|
2534
|
+
public u8 isCheck; /* True if resolving names in a CHECK constraint */
|
2535
|
+
public int nDepth; /* Depth of subquery recursion. 1 for no recursion */
|
2536
|
+
public AggInfo pAggInfo; /* Information about aggregates at this level */
|
2537
|
+
public NameContext pNext; /* Next outer name context. NULL for outermost */
|
2538
|
+
};
|
2539
|
+
|
2540
|
+
/*
|
2541
|
+
** An instance of the following structure contains all information
|
2542
|
+
** needed to generate code for a single SELECT statement.
|
2543
|
+
**
|
2544
|
+
** nLimit is set to -1 if there is no LIMIT clause. nOffset is set to 0.
|
2545
|
+
** If there is a LIMIT clause, the parser sets nLimit to the value of the
|
2546
|
+
** limit and nOffset to the value of the offset (or 0 if there is not
|
2547
|
+
** offset). But later on, nLimit and nOffset become the memory locations
|
2548
|
+
** in the VDBE that record the limit and offset counters.
|
2549
|
+
**
|
2550
|
+
** addrOpenEphm[] entries contain the address of OP_OpenEphemeral opcodes.
|
2551
|
+
** These addresses must be stored so that we can go back and fill in
|
2552
|
+
** the P4_KEYINFO and P2 parameters later. Neither the KeyInfo nor
|
2553
|
+
** the number of columns in P2 can be computed at the same time
|
2554
|
+
** as the OP_OpenEphm instruction is coded because not
|
2555
|
+
** enough information about the compound query is known at that point.
|
2556
|
+
** The KeyInfo for addrOpenTran[0] and [1] contains collating sequences
|
2557
|
+
** for the result set. The KeyInfo for addrOpenTran[2] contains collating
|
2558
|
+
** sequences for the ORDER BY clause.
|
2559
|
+
*/
|
2560
|
+
public class Select
|
2561
|
+
{
|
2562
|
+
public ExprList pEList; /* The fields of the result */
|
2563
|
+
public u8 op; /* One of: TK_UNION TK_ALL TK_INTERSECT TK_EXCEPT */
|
2564
|
+
public char affinity; /* MakeRecord with this affinity for SRT_Set */
|
2565
|
+
public u16 selFlags; /* Various SF_* values */
|
2566
|
+
public SrcList pSrc; /* The FROM clause */
|
2567
|
+
public Expr pWhere; /* The WHERE clause */
|
2568
|
+
public ExprList pGroupBy; /* The GROUP BY clause */
|
2569
|
+
public Expr pHaving; /* The HAVING clause */
|
2570
|
+
public ExprList pOrderBy; /* The ORDER BY clause */
|
2571
|
+
public Select pPrior; /* Prior select in a compound select statement */
|
2572
|
+
public Select pNext; /* Next select to the left in a compound */
|
2573
|
+
public Select pRightmost; /* Right-most select in a compound select statement */
|
2574
|
+
public Expr pLimit; /* LIMIT expression. NULL means not used. */
|
2575
|
+
public Expr pOffset; /* OFFSET expression. NULL means not used. */
|
2576
|
+
public int iLimit;
|
2577
|
+
public int iOffset; /* Memory registers holding LIMIT & OFFSET counters */
|
2578
|
+
public int[] addrOpenEphm = new int[3]; /* OP_OpenEphem opcodes related to this select */
|
2579
|
+
|
2580
|
+
public Select Copy()
|
2581
|
+
{
|
2582
|
+
if (this == null)
|
2583
|
+
return null;
|
2584
|
+
else
|
2585
|
+
{
|
2586
|
+
Select cp = (Select)MemberwiseClone();
|
2587
|
+
if (pEList != null) cp.pEList = pEList.Copy();
|
2588
|
+
if (pSrc != null) cp.pSrc = pSrc.Copy();
|
2589
|
+
if (pWhere != null) cp.pWhere = pWhere.Copy();
|
2590
|
+
if (pGroupBy != null) cp.pGroupBy = pGroupBy.Copy();
|
2591
|
+
if (pHaving != null) cp.pHaving = pHaving.Copy();
|
2592
|
+
if (pOrderBy != null) cp.pOrderBy = pOrderBy.Copy();
|
2593
|
+
if (pPrior != null) cp.pPrior = pPrior.Copy();
|
2594
|
+
if (pNext != null) cp.pNext = pNext.Copy();
|
2595
|
+
if (pRightmost != null) cp.pRightmost = pRightmost.Copy();
|
2596
|
+
if (pLimit != null) cp.pLimit = pLimit.Copy();
|
2597
|
+
if (pOffset != null) cp.pOffset = pOffset.Copy();
|
2598
|
+
return cp;
|
2599
|
+
}
|
2600
|
+
}
|
2601
|
+
};
|
2602
|
+
|
2603
|
+
/*
|
2604
|
+
** Allowed values for Select.selFlags. The "SF" prefix stands for
|
2605
|
+
** "Select Flag".
|
2606
|
+
*/
|
2607
|
+
//#define SF_Distinct 0x0001 /* Output should be DISTINCT */
|
2608
|
+
//#define SF_Resolved 0x0002 /* Identifiers have been resolved */
|
2609
|
+
//#define SF_Aggregate 0x0004 /* Contains aggregate functions */
|
2610
|
+
//#define SF_UsesEphemeral 0x0008 /* Uses the OpenEphemeral opcode */
|
2611
|
+
//#define SF_Expanded 0x0010 /* sqlite3SelectExpand() called on this */
|
2612
|
+
//#define SF_HasTypeInfo 0x0020 /* FROM subqueries have Table metadata */
|
2613
|
+
const int SF_Distinct = 0x0001; /* Output should be DISTINCT */
|
2614
|
+
const int SF_Resolved = 0x0002; /* Identifiers have been resolved */
|
2615
|
+
const int SF_Aggregate = 0x0004; /* Contains aggregate functions */
|
2616
|
+
const int SF_UsesEphemeral = 0x0008; /* Uses the OpenEphemeral opcode */
|
2617
|
+
const int SF_Expanded = 0x0010; /* sqlite3SelectExpand() called on this */
|
2618
|
+
const int SF_HasTypeInfo = 0x0020; /* FROM subqueries have Table metadata */
|
2619
|
+
|
2620
|
+
|
2621
|
+
/*
|
2622
|
+
** The results of a select can be distributed in several ways. The
|
2623
|
+
** "SRT" prefix means "SELECT Result Type".
|
2624
|
+
*/
|
2625
|
+
const int SRT_Union = 1;//#define SRT_Union 1 /* Store result as keys in an index */
|
2626
|
+
const int SRT_Except = 2;//#define SRT_Except 2 /* Remove result from a UNION index */
|
2627
|
+
const int SRT_Exists = 3;//#define SRT_Exists 3 /* Store 1 if the result is not empty */
|
2628
|
+
const int SRT_Discard = 4;//#define SRT_Discard 4 /* Do not save the results anywhere */
|
2629
|
+
|
2630
|
+
/* The ORDER BY clause is ignored for all of the above */
|
2631
|
+
//#define IgnorableOrderby(X) ((X->eDest)<=SRT_Discard)
|
2632
|
+
|
2633
|
+
const int SRT_Output = 5;//#define SRT_Output 5 /* Output each row of result */
|
2634
|
+
const int SRT_Mem = 6;//#define SRT_Mem 6 /* Store result in a memory cell */
|
2635
|
+
const int SRT_Set = 7;//#define SRT_Set 7 /* Store results as keys in an index */
|
2636
|
+
const int SRT_Table = 8;//#define SRT_Table 8 /* Store result as data with an automatic rowid */
|
2637
|
+
const int SRT_EphemTab = 9;//#define SRT_EphemTab 9 /* Create transient tab and store like SRT_Table /
|
2638
|
+
const int SRT_Coroutine = 10;//#define SRT_Coroutine 10 /* Generate a single row of result */
|
2639
|
+
|
2640
|
+
/*
|
2641
|
+
** A structure used to customize the behavior of sqlite3Select(). See
|
2642
|
+
** comments above sqlite3Select() for details.
|
2643
|
+
*/
|
2644
|
+
//typedef struct SelectDest SelectDest;
|
2645
|
+
public class SelectDest
|
2646
|
+
{
|
2647
|
+
public u8 eDest; /* How to dispose of the results */
|
2648
|
+
public char affinity; /* Affinity used when eDest==SRT_Set */
|
2649
|
+
public int iParm; /* A parameter used by the eDest disposal method */
|
2650
|
+
public int iMem; /* Base register where results are written */
|
2651
|
+
public int nMem; /* Number of registers allocated */
|
2652
|
+
public SelectDest()
|
2653
|
+
{
|
2654
|
+
this.eDest = 0;
|
2655
|
+
this.affinity = '\0';
|
2656
|
+
this.iParm = 0;
|
2657
|
+
this.iMem = 0;
|
2658
|
+
this.nMem = 0;
|
2659
|
+
}
|
2660
|
+
public SelectDest(u8 eDest, char affinity, int iParm)
|
2661
|
+
{
|
2662
|
+
this.eDest = eDest;
|
2663
|
+
this.affinity = affinity;
|
2664
|
+
this.iParm = iParm;
|
2665
|
+
this.iMem = 0;
|
2666
|
+
this.nMem = 0;
|
2667
|
+
}
|
2668
|
+
public SelectDest(u8 eDest, char affinity, int iParm, int iMem, int nMem)
|
2669
|
+
{
|
2670
|
+
this.eDest = eDest;
|
2671
|
+
this.affinity = affinity;
|
2672
|
+
this.iParm = iParm;
|
2673
|
+
this.iMem = iMem;
|
2674
|
+
this.nMem = nMem;
|
2675
|
+
}
|
2676
|
+
};
|
2677
|
+
|
2678
|
+
/*
|
2679
|
+
** During code generation of statements that do inserts into AUTOINCREMENT
|
2680
|
+
** tables, the following information is attached to the Table.u.autoInc.p
|
2681
|
+
** pointer of each autoincrement table to record some side information that
|
2682
|
+
** the code generator needs. We have to keep per-table autoincrement
|
2683
|
+
** information in case inserts are down within triggers. Triggers do not
|
2684
|
+
** normally coordinate their activities, but we do need to coordinate the
|
2685
|
+
** loading and saving of autoincrement information.
|
2686
|
+
*/
|
2687
|
+
public class AutoincInfo
|
2688
|
+
{
|
2689
|
+
public AutoincInfo pNext; /* Next info block in a list of them all */
|
2690
|
+
public Table pTab; /* Table this info block refers to */
|
2691
|
+
public int iDb; /* Index in sqlite3.aDb[] of database holding pTab */
|
2692
|
+
public int regCtr; /* Memory register holding the rowid counter */
|
2693
|
+
};
|
2694
|
+
|
2695
|
+
/*
|
2696
|
+
** Size of the column cache
|
2697
|
+
*/
|
2698
|
+
#if !SQLITE_N_COLCACHE
|
2699
|
+
//# define SQLITE_N_COLCACHE 10
|
2700
|
+
const int SQLITE_N_COLCACHE = 10;
|
2701
|
+
#endif
|
2702
|
+
|
2703
|
+
/*
|
2704
|
+
** At least one instance of the following structure is created for each
|
2705
|
+
** trigger that may be fired while parsing an INSERT, UPDATE or DELETE
|
2706
|
+
** statement. All such objects are stored in the linked list headed at
|
2707
|
+
** Parse.pTriggerPrg and deleted once statement compilation has been
|
2708
|
+
** completed.
|
2709
|
+
**
|
2710
|
+
** A Vdbe sub-program that implements the body and WHEN clause of trigger
|
2711
|
+
** TriggerPrg.pTrigger, assuming a default ON CONFLICT clause of
|
2712
|
+
** TriggerPrg.orconf, is stored in the TriggerPrg.pProgram variable.
|
2713
|
+
** The Parse.pTriggerPrg list never contains two entries with the same
|
2714
|
+
** values for both pTrigger and orconf.
|
2715
|
+
**
|
2716
|
+
** The TriggerPrg.aColmask[0] variable is set to a mask of old.* columns
|
2717
|
+
** accessed (or set to 0 for triggers fired as a result of INSERT
|
2718
|
+
** statements). Similarly, the TriggerPrg.aColmask[1] variable is set to
|
2719
|
+
** a mask of new.* columns used by the program.
|
2720
|
+
*/
|
2721
|
+
public class TriggerPrg
|
2722
|
+
{
|
2723
|
+
public Trigger pTrigger; /* Trigger this program was coded from */
|
2724
|
+
public int orconf; /* Default ON CONFLICT policy */
|
2725
|
+
public SubProgram pProgram; /* Program implementing pTrigger/orconf */
|
2726
|
+
public u32[] aColmask = new u32[2]; /* Masks of old.*, new.* columns accessed */
|
2727
|
+
public TriggerPrg pNext; /* Next entry in Parse.pTriggerPrg list */
|
2728
|
+
};
|
2729
|
+
|
2730
|
+
/*
|
2731
|
+
** An SQL parser context. A copy of this structure is passed through
|
2732
|
+
** the parser and down into all the parser action routine in order to
|
2733
|
+
** carry around information that is global to the entire parse.
|
2734
|
+
**
|
2735
|
+
** The structure is divided into two parts. When the parser and code
|
2736
|
+
** generate call themselves recursively, the first part of the structure
|
2737
|
+
** is constant but the second part is reset at the beginning and end of
|
2738
|
+
** each recursion.
|
2739
|
+
**
|
2740
|
+
** The nTableLock and aTableLock variables are only used if the shared-cache
|
2741
|
+
** feature is enabled (if sqlite3Tsd()->useSharedData is true). They are
|
2742
|
+
** used to store the set of table-locks required by the statement being
|
2743
|
+
** compiled. Function sqlite3TableLock() is used to add entries to the
|
2744
|
+
** list.
|
2745
|
+
*/
|
2746
|
+
public class yColCache
|
2747
|
+
{
|
2748
|
+
public int iTable; /* Table cursor number */
|
2749
|
+
public int iColumn; /* Table column number */
|
2750
|
+
public u8 tempReg; /* iReg is a temp register that needs to be freed */
|
2751
|
+
public int iLevel; /* Nesting level */
|
2752
|
+
public int iReg; /* Reg with value of this column. 0 means none. */
|
2753
|
+
public int lru; /* Least recently used entry has the smallest value */
|
2754
|
+
}
|
2755
|
+
public class Parse
|
2756
|
+
{
|
2757
|
+
public sqlite3 db; /* The main database structure */
|
2758
|
+
public int rc; /* Return code from execution */
|
2759
|
+
public string zErrMsg; /* An error message */
|
2760
|
+
public Vdbe pVdbe; /* An engine for executing database bytecode */
|
2761
|
+
public u8 colNamesSet; /* TRUE after OP_ColumnName has been issued to pVdbe */
|
2762
|
+
public u8 nameClash; /* A permanent table name clashes with temp table name */
|
2763
|
+
public u8 checkSchema; /* Causes schema cookie check after an error */
|
2764
|
+
public u8 nested; /* Number of nested calls to the parser/code generator */
|
2765
|
+
public u8 parseError; /* True after a parsing error. Ticket #1794 */
|
2766
|
+
public u8 nTempReg; /* Number of temporary registers in aTempReg[] */
|
2767
|
+
public u8 nTempInUse; /* Number of aTempReg[] currently checked out */
|
2768
|
+
public int[] aTempReg = new int[8]; /* Holding area for temporary registers */
|
2769
|
+
public int nRangeReg; /* Size of the temporary register block */
|
2770
|
+
public int iRangeReg; /* First register in temporary register block */
|
2771
|
+
public int nErr; /* Number of errors seen */
|
2772
|
+
public int nTab; /* Number of previously allocated VDBE cursors */
|
2773
|
+
public int nMem; /* Number of memory cells used so far */
|
2774
|
+
public int nSet; /* Number of sets used so far */
|
2775
|
+
public int ckBase; /* Base register of data during check constraints */
|
2776
|
+
public int iCacheLevel; /* ColCache valid when aColCache[].iLevel<=iCacheLevel */
|
2777
|
+
public int iCacheCnt; /* Counter used to generate aColCache[].lru values */
|
2778
|
+
public u8 nColCache; /* Number of entries in the column cache */
|
2779
|
+
public u8 iColCache; /* Next entry of the cache to replace */
|
2780
|
+
public yColCache[] aColCache = new yColCache[SQLITE_N_COLCACHE]; /* One for each valid column cache entry */
|
2781
|
+
public u32 writeMask; /* Start a write transaction on these databases */
|
2782
|
+
public u32 cookieMask; /* Bitmask of schema verified databases */
|
2783
|
+
public u8 isMultiWrite; /* True if statement may affect/insert multiple rows */
|
2784
|
+
public u8 mayAbort; /* True if statement may throw an ABORT exception */
|
2785
|
+
public int cookieGoto; /* Address of OP_Goto to cookie verifier subroutine */
|
2786
|
+
public int[] cookieValue = new int[SQLITE_MAX_ATTACHED + 2]; /* Values of cookies to verify */
|
2787
|
+
#if !SQLITE_OMIT_SHARED_CACHE
|
2788
|
+
public int nTableLock; /* Number of locks in aTableLock */
|
2789
|
+
public TableLock[] aTableLock; /* Required table locks for shared-cache mode */
|
2790
|
+
#endif
|
2791
|
+
public int regRowid; /* Register holding rowid of CREATE TABLE entry */
|
2792
|
+
public int regRoot; /* Register holding root page number for new objects */
|
2793
|
+
public AutoincInfo pAinc; /* Information about AUTOINCREMENT counters */
|
2794
|
+
public int nMaxArg; /* Max args passed to user function by sub-program */
|
2795
|
+
|
2796
|
+
/* Information used while coding trigger programs. */
|
2797
|
+
public Parse pToplevel; /* Parse structure for main program (or NULL) */
|
2798
|
+
public Table pTriggerTab; /* Table triggers are being coded for */
|
2799
|
+
public u32 oldmask; /* Mask of old.* columns referenced */
|
2800
|
+
public u32 newmask; /* Mask of new.* columns referenced */
|
2801
|
+
public u8 eTriggerOp; /* TK_UPDATE, TK_INSERT or TK_DELETE */
|
2802
|
+
public u8 eOrconf; /* Default ON CONFLICT policy for trigger steps */
|
2803
|
+
public u8 disableTriggers; /* True to disable triggers */
|
2804
|
+
|
2805
|
+
/* Above is constant between recursions. Below is reset before and after
|
2806
|
+
** each recursion */
|
2807
|
+
|
2808
|
+
public int nVar; /* Number of '?' variables seen in the SQL so far */
|
2809
|
+
public int nVarExpr; /* Number of used slots in apVarExpr[] */
|
2810
|
+
public int nVarExprAlloc; /* Number of allocated slots in apVarExpr[] */
|
2811
|
+
public Expr[] apVarExpr; /* Pointers to :aaa and $aaaa wildcard expressions */
|
2812
|
+
public Vdbe pReprepare; /* VM being reprepared (sqlite3Reprepare()) */
|
2813
|
+
public int nAlias; /* Number of aliased result set columns */
|
2814
|
+
public int nAliasAlloc; /* Number of allocated slots for aAlias[] */
|
2815
|
+
public int[] aAlias; /* Register used to hold aliased result */
|
2816
|
+
public u8 explain; /* True if the EXPLAIN flag is found on the query */
|
2817
|
+
public Token sNameToken; /* Token with unqualified schema object name */
|
2818
|
+
public Token sLastToken = new Token(); /* The last token parsed */
|
2819
|
+
public StringBuilder zTail; /* All SQL text past the last semicolon parsed */
|
2820
|
+
public Table pNewTable; /* A table being constructed by CREATE TABLE */
|
2821
|
+
public Trigger pNewTrigger; /* Trigger under construct by a CREATE TRIGGER */
|
2822
|
+
public string zAuthContext; /* The 6th parameter to db.xAuth callbacks */
|
2823
|
+
#if !SQLITE_OMIT_VIRTUALTABLE
|
2824
|
+
public Token sArg; /* Complete text of a module argument */
|
2825
|
+
public u8 declareVtab; /* True if inside sqlite3_declare_vtab() */
|
2826
|
+
public int nVtabLock; /* Number of virtual tables to lock */
|
2827
|
+
public Table[] apVtabLock; /* Pointer to virtual tables needing locking */
|
2828
|
+
#endif
|
2829
|
+
public int nHeight; /* Expression tree height of current sub-select */
|
2830
|
+
public Table pZombieTab; /* List of Table objects to delete after code gen */
|
2831
|
+
public TriggerPrg pTriggerPrg; /* Linked list of coded triggers */
|
2832
|
+
|
2833
|
+
// We need to create instances of the col cache
|
2834
|
+
public Parse()
|
2835
|
+
{
|
2836
|
+
for (int i = 0; i < this.aColCache.Length; i++) { this.aColCache[i] = new yColCache(); }
|
2837
|
+
}
|
2838
|
+
|
2839
|
+
public void ResetMembers() // Need to clear all the following variables during each recursion
|
2840
|
+
{
|
2841
|
+
nVar = 0;
|
2842
|
+
nVarExpr = 0;
|
2843
|
+
nVarExprAlloc = 0;
|
2844
|
+
apVarExpr = null;
|
2845
|
+
nAlias = 0;
|
2846
|
+
nAliasAlloc = 0;
|
2847
|
+
aAlias = null;
|
2848
|
+
explain = 0;
|
2849
|
+
sNameToken = new Token();
|
2850
|
+
sLastToken = new Token();
|
2851
|
+
zTail.Length = 0;
|
2852
|
+
pNewTable = null;
|
2853
|
+
pNewTrigger = null;
|
2854
|
+
zAuthContext = null;
|
2855
|
+
#if !SQLITE_OMIT_VIRTUALTABLE
|
2856
|
+
sArg = new Token();
|
2857
|
+
declareVtab = 0;
|
2858
|
+
nVtabLock = 0;
|
2859
|
+
apVtabLoc = null;
|
2860
|
+
#endif
|
2861
|
+
nHeight = 0;
|
2862
|
+
pZombieTab = null;
|
2863
|
+
pTriggerPrg = null;
|
2864
|
+
}
|
2865
|
+
Parse[] SaveBuf = new Parse[10]; //For Recursion Storage
|
2866
|
+
public void RestoreMembers() // Need to clear all the following variables during each recursion
|
2867
|
+
{
|
2868
|
+
if (SaveBuf[nested] != null)
|
2869
|
+
nVar = SaveBuf[nested].nVar;
|
2870
|
+
nVarExpr = SaveBuf[nested].nVarExpr;
|
2871
|
+
nVarExprAlloc = SaveBuf[nested].nVarExprAlloc;
|
2872
|
+
apVarExpr = SaveBuf[nested].apVarExpr;
|
2873
|
+
nAlias = SaveBuf[nested].nAlias;
|
2874
|
+
nAliasAlloc = SaveBuf[nested].nAliasAlloc;
|
2875
|
+
aAlias = SaveBuf[nested].aAlias;
|
2876
|
+
explain = SaveBuf[nested].explain;
|
2877
|
+
sNameToken = SaveBuf[nested].sNameToken;
|
2878
|
+
sLastToken = SaveBuf[nested].sLastToken;
|
2879
|
+
zTail = SaveBuf[nested].zTail;
|
2880
|
+
pNewTable = SaveBuf[nested].pNewTable;
|
2881
|
+
pNewTrigger = SaveBuf[nested].pNewTrigger;
|
2882
|
+
zAuthContext = SaveBuf[nested].zAuthContext;
|
2883
|
+
#if !SQLITE_OMIT_VIRTUALTABLE
|
2884
|
+
sArg = SaveBuf[nested].sArg ;
|
2885
|
+
declareVtab = SaveBuf[nested].declareVtab;
|
2886
|
+
nVtabLock = SaveBuf[nested].nVtabLock;
|
2887
|
+
apVtabLock = SaveBuf[nested].apVtabLock;
|
2888
|
+
#endif
|
2889
|
+
nHeight = SaveBuf[nested].nHeight;
|
2890
|
+
pZombieTab = SaveBuf[nested].pZombieTab;
|
2891
|
+
pTriggerPrg = SaveBuf[nested].pTriggerPrg;
|
2892
|
+
SaveBuf[nested] = null;
|
2893
|
+
}
|
2894
|
+
public void SaveMembers() // Need to clear all the following variables during each recursion
|
2895
|
+
{
|
2896
|
+
SaveBuf[nested] = new Parse();
|
2897
|
+
SaveBuf[nested].nVar = nVar;
|
2898
|
+
SaveBuf[nested].nVarExpr = nVarExpr;
|
2899
|
+
SaveBuf[nested].nVarExprAlloc = nVarExprAlloc;
|
2900
|
+
SaveBuf[nested].apVarExpr = apVarExpr;
|
2901
|
+
SaveBuf[nested].nAlias = nAlias;
|
2902
|
+
SaveBuf[nested].nAliasAlloc = nAliasAlloc;
|
2903
|
+
SaveBuf[nested].aAlias = aAlias;
|
2904
|
+
SaveBuf[nested].explain = explain;
|
2905
|
+
SaveBuf[nested].sNameToken = sNameToken;
|
2906
|
+
SaveBuf[nested].sLastToken = sLastToken;
|
2907
|
+
SaveBuf[nested].zTail = zTail;
|
2908
|
+
SaveBuf[nested].pNewTable = pNewTable;
|
2909
|
+
SaveBuf[nested].pNewTrigger = pNewTrigger;
|
2910
|
+
SaveBuf[nested].zAuthContext = zAuthContext;
|
2911
|
+
#if !SQLITE_OMIT_VIRTUALTABLE
|
2912
|
+
SaveBuf[nested].sArg = sArg ;
|
2913
|
+
SaveBuf[nested].declareVtab = declareVtab;
|
2914
|
+
SaveBuf[nested].nVtabLock = nVtabLock ;
|
2915
|
+
SaveBuf[nested].apVtabLock = apVtabLock ;
|
2916
|
+
#endif
|
2917
|
+
SaveBuf[nested].nHeight = nHeight;
|
2918
|
+
SaveBuf[nested].pZombieTab = pZombieTab;
|
2919
|
+
SaveBuf[nested].pTriggerPrg = pTriggerPrg;
|
2920
|
+
}
|
2921
|
+
};
|
2922
|
+
|
2923
|
+
#if SQLITE_OMIT_VIRTUALTABLE
|
2924
|
+
static bool IN_DECLARE_VTAB = false;//#define IN_DECLARE_VTAB 0
|
2925
|
+
#else
|
2926
|
+
// int ;//#define IN_DECLARE_VTAB (pParse.declareVtab)
|
2927
|
+
#endif
|
2928
|
+
|
2929
|
+
/*
|
2930
|
+
** An instance of the following structure can be declared on a stack and used
|
2931
|
+
** to save the Parse.zAuthContext value so that it can be restored later.
|
2932
|
+
*/
|
2933
|
+
public class AuthContext
|
2934
|
+
{
|
2935
|
+
public string zAuthContext; /* Put saved Parse.zAuthContext here */
|
2936
|
+
public Parse pParse; /* The Parse structure */
|
2937
|
+
};
|
2938
|
+
|
2939
|
+
/*
|
2940
|
+
** Bitfield flags for P5 value in OP_Insert and OP_Delete
|
2941
|
+
*/
|
2942
|
+
//#define OPFLAG_NCHANGE 0x01 /* Set to update db->nChange */
|
2943
|
+
//#define OPFLAG_LASTROWID 0x02 /* Set to update db->lastRowid */
|
2944
|
+
//#define OPFLAG_ISUPDATE 0x04 /* This OP_Insert is an sql UPDATE */
|
2945
|
+
//#define OPFLAG_APPEND 0x08 /* This is likely to be an append */
|
2946
|
+
//#define OPFLAG_USESEEKRESULT 0x10 /* Try to avoid a seek in BtreeInsert() */
|
2947
|
+
//#define OPFLAG_CLEARCACHE 0x20 /* Clear pseudo-table cache in OP_Column */
|
2948
|
+
const byte OPFLAG_NCHANGE = 0x01;
|
2949
|
+
const byte OPFLAG_LASTROWID = 0x02;
|
2950
|
+
const byte OPFLAG_ISUPDATE = 0x04;
|
2951
|
+
const byte OPFLAG_APPEND = 0x08;
|
2952
|
+
const byte OPFLAG_USESEEKRESULT = 0x10;
|
2953
|
+
const byte OPFLAG_CLEARCACHE = 0x20;
|
2954
|
+
|
2955
|
+
/*
|
2956
|
+
* Each trigger present in the database schema is stored as an instance of
|
2957
|
+
* struct Trigger.
|
2958
|
+
*
|
2959
|
+
* Pointers to instances of struct Trigger are stored in two ways.
|
2960
|
+
* 1. In the "trigHash" hash table (part of the sqlite3* that represents the
|
2961
|
+
* database). This allows Trigger structures to be retrieved by name.
|
2962
|
+
* 2. All triggers associated with a single table form a linked list, using the
|
2963
|
+
* pNext member of struct Trigger. A pointer to the first element of the
|
2964
|
+
* linked list is stored as the "pTrigger" member of the associated
|
2965
|
+
* struct Table.
|
2966
|
+
*
|
2967
|
+
* The "step_list" member points to the first element of a linked list
|
2968
|
+
* containing the SQL statements specified as the trigger program.
|
2969
|
+
*/
|
2970
|
+
public class Trigger
|
2971
|
+
{
|
2972
|
+
public string zName; /* The name of the trigger */
|
2973
|
+
public string table; /* The table or view to which the trigger applies */
|
2974
|
+
public u8 op; /* One of TK_DELETE, TK_UPDATE, TK_INSERT */
|
2975
|
+
public u8 tr_tm; /* One of TRIGGER_BEFORE, TRIGGER_AFTER */
|
2976
|
+
public Expr pWhen; /* The WHEN clause of the expression (may be NULL) */
|
2977
|
+
public IdList pColumns; /* If this is an UPDATE OF <column-list> trigger,
|
2978
|
+
the <column-list> is stored here */
|
2979
|
+
public Schema pSchema; /* Schema containing the trigger */
|
2980
|
+
public Schema pTabSchema; /* Schema containing the table */
|
2981
|
+
public TriggerStep step_list; /* Link list of trigger program steps */
|
2982
|
+
public Trigger pNext; /* Next trigger associated with the table */
|
2983
|
+
|
2984
|
+
public Trigger Copy()
|
2985
|
+
{
|
2986
|
+
if (this == null)
|
2987
|
+
return null;
|
2988
|
+
else
|
2989
|
+
{
|
2990
|
+
Trigger cp = (Trigger)MemberwiseClone();
|
2991
|
+
if (pWhen != null) cp.pWhen = pWhen.Copy();
|
2992
|
+
if (pColumns != null) cp.pColumns = pColumns.Copy();
|
2993
|
+
if (pSchema != null) cp.pSchema = pSchema.Copy();
|
2994
|
+
if (pTabSchema != null) cp.pTabSchema = pTabSchema.Copy();
|
2995
|
+
if (step_list != null) cp.step_list = step_list.Copy();
|
2996
|
+
if (pNext != null) cp.pNext = pNext.Copy();
|
2997
|
+
return cp;
|
2998
|
+
}
|
2999
|
+
}
|
3000
|
+
};
|
3001
|
+
|
3002
|
+
/*
|
3003
|
+
** A trigger is either a BEFORE or an AFTER trigger. The following constants
|
3004
|
+
** determine which.
|
3005
|
+
**
|
3006
|
+
** If there are multiple triggers, you might of some BEFORE and some AFTER.
|
3007
|
+
** In that cases, the constants below can be ORed together.
|
3008
|
+
*/
|
3009
|
+
const u8 TRIGGER_BEFORE = 1;//#define TRIGGER_BEFORE 1
|
3010
|
+
const u8 TRIGGER_AFTER = 2;//#define TRIGGER_AFTER 2
|
3011
|
+
|
3012
|
+
/*
|
3013
|
+
* An instance of struct TriggerStep is used to store a single SQL statement
|
3014
|
+
* that is a part of a trigger-program.
|
3015
|
+
*
|
3016
|
+
* Instances of struct TriggerStep are stored in a singly linked list (linked
|
3017
|
+
* using the "pNext" member) referenced by the "step_list" member of the
|
3018
|
+
* associated struct Trigger instance. The first element of the linked list is
|
3019
|
+
* the first step of the trigger-program.
|
3020
|
+
*
|
3021
|
+
* The "op" member indicates whether this is a "DELETE", "INSERT", "UPDATE" or
|
3022
|
+
* "SELECT" statement. The meanings of the other members is determined by the
|
3023
|
+
* value of "op" as follows:
|
3024
|
+
*
|
3025
|
+
* (op == TK_INSERT)
|
3026
|
+
* orconf -> stores the ON CONFLICT algorithm
|
3027
|
+
* pSelect -> If this is an INSERT INTO ... SELECT ... statement, then
|
3028
|
+
* this stores a pointer to the SELECT statement. Otherwise NULL.
|
3029
|
+
* target -> A token holding the quoted name of the table to insert into.
|
3030
|
+
* pExprList -> If this is an INSERT INTO ... VALUES ... statement, then
|
3031
|
+
* this stores values to be inserted. Otherwise NULL.
|
3032
|
+
* pIdList -> If this is an INSERT INTO ... (<column-names>) VALUES ...
|
3033
|
+
* statement, then this stores the column-names to be
|
3034
|
+
* inserted into.
|
3035
|
+
*
|
3036
|
+
* (op == TK_DELETE)
|
3037
|
+
* target -> A token holding the quoted name of the table to delete from.
|
3038
|
+
* pWhere -> The WHERE clause of the DELETE statement if one is specified.
|
3039
|
+
* Otherwise NULL.
|
3040
|
+
*
|
3041
|
+
* (op == TK_UPDATE)
|
3042
|
+
* target -> A token holding the quoted name of the table to update rows of.
|
3043
|
+
* pWhere -> The WHERE clause of the UPDATE statement if one is specified.
|
3044
|
+
* Otherwise NULL.
|
3045
|
+
* pExprList -> A list of the columns to update and the expressions to update
|
3046
|
+
* them to. See sqlite3Update() documentation of "pChanges"
|
3047
|
+
* argument.
|
3048
|
+
*
|
3049
|
+
*/
|
3050
|
+
public class TriggerStep
|
3051
|
+
{
|
3052
|
+
public u8 op; /* One of TK_DELETE, TK_UPDATE, TK_INSERT, TK_SELECT */
|
3053
|
+
public u8 orconf; /* OE_Rollback etc. */
|
3054
|
+
public Trigger pTrig; /* The trigger that this step is a part of */
|
3055
|
+
public Select pSelect; /* SELECT statment or RHS of INSERT INTO .. SELECT ... */
|
3056
|
+
public Token target; /* Target table for DELETE, UPDATE, INSERT */
|
3057
|
+
public Expr pWhere; /* The WHERE clause for DELETE or UPDATE steps */
|
3058
|
+
public ExprList pExprList; /* SET clause for UPDATE. VALUES clause for INSERT */
|
3059
|
+
public IdList pIdList; /* Column names for INSERT */
|
3060
|
+
public TriggerStep pNext; /* Next in the link-list */
|
3061
|
+
public TriggerStep pLast; /* Last element in link-list. Valid for 1st elem only */
|
3062
|
+
|
3063
|
+
public TriggerStep()
|
3064
|
+
{
|
3065
|
+
target = new Token();
|
3066
|
+
}
|
3067
|
+
public TriggerStep Copy()
|
3068
|
+
{
|
3069
|
+
if (this == null)
|
3070
|
+
return null;
|
3071
|
+
else
|
3072
|
+
{
|
3073
|
+
TriggerStep cp = (TriggerStep)MemberwiseClone();
|
3074
|
+
return cp;
|
3075
|
+
}
|
3076
|
+
}
|
3077
|
+
};
|
3078
|
+
|
3079
|
+
/*
|
3080
|
+
** The following structure contains information used by the sqliteFix...
|
3081
|
+
** routines as they walk the parse tree to make database references
|
3082
|
+
** explicit.
|
3083
|
+
*/
|
3084
|
+
//typedef struct DbFixer DbFixer;
|
3085
|
+
public class DbFixer
|
3086
|
+
{
|
3087
|
+
public Parse pParse; /* The parsing context. Error messages written here */
|
3088
|
+
public string zDb; /* Make sure all objects are contained in this database */
|
3089
|
+
public string zType; /* Type of the container - used for error messages */
|
3090
|
+
public Token pName; /* Name of the container - used for error messages */
|
3091
|
+
};
|
3092
|
+
|
3093
|
+
/*
|
3094
|
+
** An objected used to accumulate the text of a string where we
|
3095
|
+
** do not necessarily know how big the string will be in the end.
|
3096
|
+
*/
|
3097
|
+
public struct StrAccum
|
3098
|
+
{
|
3099
|
+
public sqlite3 db; /* Optional database for lookaside. Can be NULL */
|
3100
|
+
public StringBuilder zBase; /* A base allocation. Not from malloc. */
|
3101
|
+
public StringBuilder zText; /* The string collected so far */
|
3102
|
+
public int nChar; /* Length of the string so far */
|
3103
|
+
public int nAlloc; /* Amount of space allocated in zText */
|
3104
|
+
public int mxAlloc; /* Maximum allowed string length */
|
3105
|
+
// Cannot happen under C#
|
3106
|
+
//public u8 mallocFailed; /* Becomes true if any memory allocation fails */
|
3107
|
+
public u8 useMalloc; /* True if zText is enlargeable using realloc */
|
3108
|
+
public u8 tooBig; /* Becomes true if string size exceeds limits */
|
3109
|
+
public Mem Context;
|
3110
|
+
|
3111
|
+
public StrAccum(int n)
|
3112
|
+
{
|
3113
|
+
db = null;
|
3114
|
+
zBase = new StringBuilder(n);
|
3115
|
+
zText = new StringBuilder(n);
|
3116
|
+
nChar = 0;
|
3117
|
+
nAlloc = n;
|
3118
|
+
mxAlloc = 0;
|
3119
|
+
useMalloc = 0;
|
3120
|
+
tooBig = 0;
|
3121
|
+
Context = null;
|
3122
|
+
}
|
3123
|
+
};
|
3124
|
+
|
3125
|
+
/*
|
3126
|
+
** A pointer to this structure is used to communicate information
|
3127
|
+
** from sqlite3Init and OP_ParseSchema into the sqlite3InitCallback.
|
3128
|
+
*/
|
3129
|
+
public class InitData
|
3130
|
+
{
|
3131
|
+
public sqlite3 db; /* The database being initialized */
|
3132
|
+
public int iDb; /* 0 for main database. 1 for TEMP, 2.. for ATTACHed */
|
3133
|
+
public string pzErrMsg; /* Error message stored here */
|
3134
|
+
public int rc; /* Result code stored here */
|
3135
|
+
}
|
3136
|
+
|
3137
|
+
/*
|
3138
|
+
** Structure containing global configuration data for the SQLite library.
|
3139
|
+
**
|
3140
|
+
** This structure also contains some state information.
|
3141
|
+
*/
|
3142
|
+
public class Sqlite3Config
|
3143
|
+
{
|
3144
|
+
public bool bMemstat; /* True to enable memory status */
|
3145
|
+
public bool bCoreMutex; /* True to enable core mutexing */
|
3146
|
+
public bool bFullMutex; /* True to enable full mutexing */
|
3147
|
+
public int mxStrlen; /* Maximum string length */
|
3148
|
+
public int szLookaside; /* Default lookaside buffer size */
|
3149
|
+
public int nLookaside; /* Default lookaside buffer count */
|
3150
|
+
public sqlite3_mem_methods m; /* Low-level memory allocation interface */
|
3151
|
+
public sqlite3_mutex_methods mutex; /* Low-level mutex interface */
|
3152
|
+
public sqlite3_pcache_methods pcache; /* Low-level page-cache interface */
|
3153
|
+
public byte[] pHeap; /* Heap storage space */
|
3154
|
+
public int nHeap; /* Size of pHeap[] */
|
3155
|
+
public int mnReq, mxReq; /* Min and max heap requests sizes */
|
3156
|
+
public byte[][] pScratch2; /* Scratch memory */
|
3157
|
+
public byte[][] pScratch; /* Scratch memory */
|
3158
|
+
public int szScratch; /* Size of each scratch buffer */
|
3159
|
+
public int nScratch; /* Number of scratch buffers */
|
3160
|
+
public MemPage pPage; /* Page cache memory */
|
3161
|
+
public int szPage; /* Size of each page in pPage[] */
|
3162
|
+
public int nPage; /* Number of pages in pPage[] */
|
3163
|
+
public int mxParserStack; /* maximum depth of the parser stack */
|
3164
|
+
public bool sharedCacheEnabled; /* true if shared-cache mode enabled */
|
3165
|
+
/* The above might be initialized to non-zero. The following need to always
|
3166
|
+
** initially be zero, however. */
|
3167
|
+
public int isInit; /* True after initialization has finished */
|
3168
|
+
public int inProgress; /* True while initialization in progress */
|
3169
|
+
public int isMutexInit; /* True after mutexes are initialized */
|
3170
|
+
public int isMallocInit; /* True after malloc is initialized */
|
3171
|
+
public int isPCacheInit; /* True after malloc is initialized */
|
3172
|
+
public sqlite3_mutex pInitMutex; /* Mutex used by sqlite3_initialize() */
|
3173
|
+
public int nRefInitMutex; /* Number of users of pInitMutex */
|
3174
|
+
public dxLog xLog; //void (*xLog)(void*,int,const char*); /* Function for logging */
|
3175
|
+
public object pLogArg; /* First argument to xLog() */
|
3176
|
+
|
3177
|
+
public Sqlite3Config(int bMemstat, int bCoreMutex, bool bFullMutex, int mxStrlen, int szLookaside, int nLookaside
|
3178
|
+
, sqlite3_mem_methods m
|
3179
|
+
, sqlite3_mutex_methods mutex
|
3180
|
+
, sqlite3_pcache_methods pcache
|
3181
|
+
, byte[] pHeap
|
3182
|
+
, int nHeap,
|
3183
|
+
int mnReq, int mxReq
|
3184
|
+
, byte[][] pScratch
|
3185
|
+
, int szScratch
|
3186
|
+
, int nScratch
|
3187
|
+
, MemPage pPage
|
3188
|
+
, int szPage
|
3189
|
+
, int nPage
|
3190
|
+
, int mxParserStack
|
3191
|
+
, bool sharedCacheEnabled
|
3192
|
+
, int isInit
|
3193
|
+
, int inProgress
|
3194
|
+
, int isMutexInit
|
3195
|
+
, int isMallocInit
|
3196
|
+
, int isPCacheInit
|
3197
|
+
, sqlite3_mutex pInitMutex
|
3198
|
+
, int nRefInitMutex
|
3199
|
+
, dxLog xLog
|
3200
|
+
, object pLogArg
|
3201
|
+
)
|
3202
|
+
{
|
3203
|
+
this.bMemstat = bMemstat != 0;
|
3204
|
+
this.bCoreMutex = bCoreMutex != 0;
|
3205
|
+
this.bFullMutex = bFullMutex;
|
3206
|
+
this.mxStrlen = mxStrlen;
|
3207
|
+
this.szLookaside = szLookaside;
|
3208
|
+
this.nLookaside = nLookaside;
|
3209
|
+
this.m = m;
|
3210
|
+
this.mutex = mutex;
|
3211
|
+
this.pcache = pcache;
|
3212
|
+
this.pHeap = pHeap;
|
3213
|
+
this.nHeap = nHeap;
|
3214
|
+
this.mnReq = mnReq;
|
3215
|
+
this.mxReq = mxReq;
|
3216
|
+
this.pScratch = pScratch;
|
3217
|
+
this.szScratch = szScratch;
|
3218
|
+
this.nScratch = nScratch;
|
3219
|
+
this.pPage = pPage;
|
3220
|
+
this.szPage = szPage;
|
3221
|
+
this.nPage = nPage;
|
3222
|
+
this.mxParserStack = mxParserStack;
|
3223
|
+
this.sharedCacheEnabled = sharedCacheEnabled;
|
3224
|
+
this.isInit = isInit;
|
3225
|
+
this.inProgress = inProgress;
|
3226
|
+
this.isMutexInit = isMutexInit;
|
3227
|
+
this.isMallocInit = isMallocInit;
|
3228
|
+
this.isPCacheInit = isPCacheInit;
|
3229
|
+
this.pInitMutex = pInitMutex;
|
3230
|
+
this.nRefInitMutex = nRefInitMutex;
|
3231
|
+
this.xLog = xLog;
|
3232
|
+
this.pLogArg = pLogArg;
|
3233
|
+
}
|
3234
|
+
};
|
3235
|
+
|
3236
|
+
/*
|
3237
|
+
** Context pointer passed down through the tree-walk.
|
3238
|
+
*/
|
3239
|
+
public class Walker
|
3240
|
+
{
|
3241
|
+
public dxExprCallback xExprCallback; //)(Walker*, Expr*); /* Callback for expressions */
|
3242
|
+
public dxSelectCallback xSelectCallback; //)(Walker*,Select*); /* Callback for SELECTs */
|
3243
|
+
public Parse pParse; /* Parser context. */
|
3244
|
+
public struct uw
|
3245
|
+
{ /* Extra data for callback */
|
3246
|
+
public NameContext pNC; /* Naming context */
|
3247
|
+
public int i; /* Integer value */
|
3248
|
+
}
|
3249
|
+
public uw u;
|
3250
|
+
};
|
3251
|
+
|
3252
|
+
/* Forward declarations */
|
3253
|
+
//int sqlite3WalkExpr(Walker*, Expr*);
|
3254
|
+
//int sqlite3WalkExprList(Walker*, ExprList*);
|
3255
|
+
//int sqlite3WalkSelect(Walker*, Select*);
|
3256
|
+
//int sqlite3WalkSelectExpr(Walker*, Select*);
|
3257
|
+
//int sqlite3WalkSelectFrom(Walker*, Select*);
|
3258
|
+
|
3259
|
+
/*
|
3260
|
+
** Return code from the parse-tree walking primitives and their
|
3261
|
+
** callbacks.
|
3262
|
+
*/
|
3263
|
+
//#define WRC_Continue 0 /* Continue down into children */
|
3264
|
+
//#define WRC_Prune 1 /* Omit children but continue walking siblings */
|
3265
|
+
//#define WRC_Abort 2 /* Abandon the tree walk */
|
3266
|
+
const int WRC_Continue = 0;
|
3267
|
+
const int WRC_Prune = 1;
|
3268
|
+
const int WRC_Abort = 2;
|
3269
|
+
|
3270
|
+
|
3271
|
+
/*
|
3272
|
+
** Assuming zIn points to the first byte of a UTF-8 character,
|
3273
|
+
** advance zIn to point to the first byte of the next UTF-8 character.
|
3274
|
+
*/
|
3275
|
+
//#define SQLITE_SKIP_UTF8(zIn) { \
|
3276
|
+
// if( (*(zIn++))>=0xc0 ){ \
|
3277
|
+
// while( (*zIn & 0xc0)==0x80 ){ zIn++; } \
|
3278
|
+
// } \
|
3279
|
+
//}
|
3280
|
+
static void SQLITE_SKIP_UTF8(string zIn, ref int iz)
|
3281
|
+
{
|
3282
|
+
iz++;
|
3283
|
+
if (iz < zIn.Length && zIn[iz - 1] >= 0xC0)
|
3284
|
+
{
|
3285
|
+
while (iz < zIn.Length && (zIn[iz] & 0xC0) == 0x80) { iz++; }
|
3286
|
+
}
|
3287
|
+
}
|
3288
|
+
static void SQLITE_SKIP_UTF8(
|
3289
|
+
byte[] zIn, ref int iz)
|
3290
|
+
{
|
3291
|
+
iz++;
|
3292
|
+
if (iz < zIn.Length && zIn[iz - 1] >= 0xC0)
|
3293
|
+
{
|
3294
|
+
while (iz < zIn.Length && (zIn[iz] & 0xC0) == 0x80) { iz++; }
|
3295
|
+
}
|
3296
|
+
}
|
3297
|
+
|
3298
|
+
/*
|
3299
|
+
** The SQLITE_*_BKPT macros are substitutes for the error codes with
|
3300
|
+
** the same name but without the _BKPT suffix. These macros invoke
|
3301
|
+
** routines that report the line-number on which the error originated
|
3302
|
+
** using sqlite3_log(). The routines also provide a convenient place
|
3303
|
+
** to set a debugger breakpoint.
|
3304
|
+
*/
|
3305
|
+
//int sqlite3CorruptError(int);
|
3306
|
+
//int sqlite3MisuseError(int);
|
3307
|
+
//int sqlite3CantopenError(int);
|
3308
|
+
#if DEBUG
|
3309
|
+
//#define SQLITE_CORRUPT_BKPT sqlite3CorruptError(__LINE__)
|
3310
|
+
static int SQLITE_CORRUPT_BKPT() { return sqlite3CorruptError(0); }
|
3311
|
+
|
3312
|
+
//#define SQLITE_MISUSE_BKPT sqlite3MisuseError(__LINE__)
|
3313
|
+
static int SQLITE_MISUSE_BKPT() { return sqlite3MisuseError(0); }
|
3314
|
+
|
3315
|
+
//#define SQLITE_CANTOPEN_BKPT sqlite3CantopenError(__LINE__)
|
3316
|
+
static int SQLITE_CANTOPEN_BKPT() { return sqlite3CantopenError(0); }
|
3317
|
+
#else
|
3318
|
+
static int SQLITE_CORRUPT_BKPT() {return SQLITE_CORRUPT;}
|
3319
|
+
static int SQLITE_MISUSE_BKPT() {return SQLITE_MISUSE;}
|
3320
|
+
static int SQLITE_CANTOPEN_BKPT() {return SQLITE_CANTOPEN;}
|
3321
|
+
#endif
|
3322
|
+
|
3323
|
+
/*
|
3324
|
+
** FTS4 is really an extension for FTS3. It is enabled using the
|
3325
|
+
** SQLITE_ENABLE_FTS3 macro. But to avoid confusion we also all
|
3326
|
+
** the SQLITE_ENABLE_FTS4 macro to serve as an alisse for SQLITE_ENABLE_FTS3.
|
3327
|
+
*/
|
3328
|
+
//#if defined(SQLITE_ENABLE_FTS4) && !defined(SQLITE_ENABLE_FTS3)
|
3329
|
+
//# define SQLITE_ENABLE_FTS3
|
3330
|
+
//#endif
|
3331
|
+
|
3332
|
+
/*
|
3333
|
+
** The ctype.h header is needed for non-ASCII systems. It is also
|
3334
|
+
** needed by FTS3 when FTS3 is included in the amalgamation.
|
3335
|
+
*/
|
3336
|
+
//#if !defined(SQLITE_ASCII) || \
|
3337
|
+
// (defined(SQLITE_ENABLE_FTS3) && defined(SQLITE_AMALGAMATION))
|
3338
|
+
//# include <ctype.h>
|
3339
|
+
//#endif
|
3340
|
+
|
3341
|
+
|
3342
|
+
/*
|
3343
|
+
** The following macros mimic the standard library functions toupper(),
|
3344
|
+
** isspace(), isalnum(), isdigit() and isxdigit(), respectively. The
|
3345
|
+
** sqlite versions only work for ASCII characters, regardless of locale.
|
3346
|
+
*/
|
3347
|
+
#if SQLITE_ASCII
|
3348
|
+
//# define sqlite3Toupper(x) ((x)&~(sqlite3CtypeMap[(unsigned char)(x)]&0x20))
|
3349
|
+
|
3350
|
+
//# define sqlite3Isspace(x) (sqlite3CtypeMap[(unsigned char)(x)]&0x01)
|
3351
|
+
static bool sqlite3Isspace(byte x) { return (sqlite3CtypeMap[(byte)(x)] & 0x01) != 0; }
|
3352
|
+
static bool sqlite3Isspace(char x) { return x < 256 && (sqlite3CtypeMap[(byte)(x)] & 0x01) != 0; }
|
3353
|
+
|
3354
|
+
//# define sqlite3Isalnum(x) (sqlite3CtypeMap[(unsigned char)(x)]&0x06)
|
3355
|
+
static bool sqlite3Isalnum(byte x) { return (sqlite3CtypeMap[(byte)(x)] & 0x06) != 0; }
|
3356
|
+
static bool sqlite3Isalnum(char x) { return x < 256 && (sqlite3CtypeMap[(byte)(x)] & 0x06) != 0; }
|
3357
|
+
|
3358
|
+
//# define sqlite3Isalpha(x) (sqlite3CtypeMap[(unsigned char)(x)]&0x02)
|
3359
|
+
|
3360
|
+
//# define sqlite3Isdigit(x) (sqlite3CtypeMap[(unsigned char)(x)]&0x04)
|
3361
|
+
static bool sqlite3Isdigit(byte x) { return (sqlite3CtypeMap[((byte)x)] & 0x04) != 0; }
|
3362
|
+
static bool sqlite3Isdigit(char x) { return x < 256 && (sqlite3CtypeMap[((byte)x)] & 0x04) != 0; }
|
3363
|
+
|
3364
|
+
//# define sqlite3Isxdigit(x) (sqlite3CtypeMap[(unsigned char)(x)]&0x08)
|
3365
|
+
static bool sqlite3Isxdigit(byte x) { return (sqlite3CtypeMap[((byte)x)] & 0x08) != 0; }
|
3366
|
+
static bool sqlite3Isxdigit(char x) { return x < 256 && (sqlite3CtypeMap[((byte)x)] & 0x08) != 0; }
|
3367
|
+
|
3368
|
+
//# define sqlite3Tolower(x) (sqlite3UpperToLower[(unsigned char)(x)])
|
3369
|
+
#else
|
3370
|
+
//# define sqlite3Toupper(x) toupper((unsigned char)(x))
|
3371
|
+
//# define sqlite3Isspace(x) isspace((unsigned char)(x))
|
3372
|
+
//# define sqlite3Isalnum(x) isalnum((unsigned char)(x))
|
3373
|
+
//# define sqlite3Isalpha(x) isalpha((unsigned char)(x))
|
3374
|
+
//# define sqlite3Isdigit(x) isdigit((unsigned char)(x))
|
3375
|
+
//# define sqlite3Isxdigit(x) isxdigit((unsigned char)(x))
|
3376
|
+
//# define sqlite3Tolower(x) tolower((unsigned char)(x))
|
3377
|
+
#endif
|
3378
|
+
|
3379
|
+
/*
|
3380
|
+
** Internal function prototypes
|
3381
|
+
*/
|
3382
|
+
//int sqlite3StrICmp(const char *, const char *);
|
3383
|
+
//int sqlite3IsNumber(const char*, int*, u8);
|
3384
|
+
//int sqlite3Strlen30(const char*);
|
3385
|
+
//#define sqlite3StrNICmp sqlite3_strnicmp
|
3386
|
+
|
3387
|
+
//int sqlite3MallocInit(void);
|
3388
|
+
//void sqlite3MallocEnd(void);
|
3389
|
+
//void *sqlite3Malloc(int);
|
3390
|
+
//void *sqlite3MallocZero(int);
|
3391
|
+
//void *sqlite3DbMallocZero(sqlite3*, int);
|
3392
|
+
//void *sqlite3DbMallocRaw(sqlite3*, int);
|
3393
|
+
//char *sqlite3DbStrDup(sqlite3*,const char*);
|
3394
|
+
//char *sqlite3DbStrNDup(sqlite3*,const char*, int);
|
3395
|
+
//void *sqlite3Realloc(void*, int);
|
3396
|
+
//void *sqlite3DbReallocOrFree(sqlite3 *, void *, int);
|
3397
|
+
//void *sqlite3DbRealloc(sqlite3 *, void *, int);
|
3398
|
+
//void sqlite3DbFree(sqlite3*, void*);
|
3399
|
+
//int sqlite3MallocSize(void*);
|
3400
|
+
//int sqlite3DbMallocSize(sqlite3*, void*);
|
3401
|
+
//void *sqlite3ScratchMalloc(int);
|
3402
|
+
//void //sqlite3ScratchFree(void*);
|
3403
|
+
//void *sqlite3PageMalloc(int);
|
3404
|
+
//void sqlite3PageFree(void*);
|
3405
|
+
//void sqlite3MemSetDefault(void);
|
3406
|
+
//void sqlite3BenignMallocHooks(void (*)(void), void (*)(void));
|
3407
|
+
//int sqlite3MemoryAlarm(void (*)(void*, sqlite3_int64, int), void*, sqlite3_int64);
|
3408
|
+
|
3409
|
+
/*
|
3410
|
+
** On systems with ample stack space and that support alloca(), make
|
3411
|
+
** use of alloca() to obtain space for large automatic objects. By default,
|
3412
|
+
** obtain space from malloc().
|
3413
|
+
**
|
3414
|
+
** The alloca() routine never returns NULL. This will cause code paths
|
3415
|
+
** that deal with sqlite3StackAlloc() failures to be unreachable.
|
3416
|
+
*/
|
3417
|
+
#if SQLITE_USE_ALLOCA
|
3418
|
+
//# define sqlite3StackAllocRaw(D,N) alloca(N)
|
3419
|
+
//# define sqlite3StackAllocZero(D,N) memset(alloca(N), 0, N)
|
3420
|
+
//# define sqlite3StackFree(D,P)
|
3421
|
+
#else
|
3422
|
+
#if FALSE
|
3423
|
+
//# define sqlite3StackAllocRaw(D,N) sqlite3DbMallocRaw(D,N)
|
3424
|
+
static void sqlite3StackAllocRaw( sqlite3 D, int N ) { sqlite3DbMallocRaw( D, N ); }
|
3425
|
+
//# define sqlite3StackAllocZero(D,N) sqlite3DbMallocZero(D,N)
|
3426
|
+
static void sqlite3StackAllocZero( sqlite3 D, int N ) { sqlite3DbMallocZero( D, N ); }
|
3427
|
+
//# define sqlite3StackFree(D,P) sqlite3DbFree(D,P)
|
3428
|
+
static void sqlite3StackFree( sqlite3 D, object P ) {sqlite3DbFree( D, P ); }
|
3429
|
+
#endif
|
3430
|
+
#endif
|
3431
|
+
|
3432
|
+
#if SQLITE_ENABLE_MEMSYS3
|
3433
|
+
const sqlite3_mem_methods *sqlite3MemGetMemsys3(void);
|
3434
|
+
#endif
|
3435
|
+
#if SQLITE_ENABLE_MEMSYS5
|
3436
|
+
const sqlite3_mem_methods *sqlite3MemGetMemsys5(void);
|
3437
|
+
#endif
|
3438
|
+
|
3439
|
+
#if !SQLITE_MUTEX_OMIT
|
3440
|
+
// sqlite3_mutex_methods *sqlite3DefaultMutex(void);
|
3441
|
+
// sqlite3_mutex *sqlite3MutexAlloc(int);
|
3442
|
+
// int sqlite3MutexInit(void);
|
3443
|
+
// int sqlite3MutexEnd(void);
|
3444
|
+
#endif
|
3445
|
+
|
3446
|
+
//int sqlite3StatusValue(int);
|
3447
|
+
//void sqlite3StatusAdd(int, int);
|
3448
|
+
//void sqlite3StatusSet(int, int);
|
3449
|
+
|
3450
|
+
//#ifndef SQLITE_OMIT_FLOATING_POINT
|
3451
|
+
// int sqlite3IsNaN(double);
|
3452
|
+
//#else
|
3453
|
+
//# define sqlite3IsNaN(X) 0
|
3454
|
+
//#endif
|
3455
|
+
|
3456
|
+
//void sqlite3VXPrintf(StrAccum*, int, const char*, va_list);
|
3457
|
+
#if!SQLITE_OMIT_TRACE
|
3458
|
+
//void sqlite3XPrintf(StrAccum*, const char*, ...);
|
3459
|
+
#endif
|
3460
|
+
//char *sqlite3MPrintf(sqlite3*,const char*, ...);
|
3461
|
+
//char *sqlite3VMPrintf(sqlite3*,const char*, va_list);
|
3462
|
+
//char *sqlite3MAppendf(sqlite3*,char*,const char*,...);
|
3463
|
+
#if SQLITE_TEST || SQLITE_DEBUG
|
3464
|
+
// void sqlite3DebugPrintf(const char*, ...);
|
3465
|
+
#endif
|
3466
|
+
#if SQLITE_TEST
|
3467
|
+
// void *sqlite3TestTextToPtr(const char*);
|
3468
|
+
#endif
|
3469
|
+
//void sqlite3SetString(char **, sqlite3*, const char*, ...);
|
3470
|
+
//void sqlite3ErrorMsg(Parse*, const char*, ...);
|
3471
|
+
//int sqlite3Dequote(char*);
|
3472
|
+
//int sqlite3KeywordCode(const unsigned char*, int);
|
3473
|
+
//int sqlite3RunParser(Parse*, const char*, char **);
|
3474
|
+
//void sqlite3FinishCoding(Parse*);
|
3475
|
+
//int sqlite3GetTempReg(Parse*);
|
3476
|
+
//void sqlite3ReleaseTempReg(Parse*,int);
|
3477
|
+
//int sqlite3GetTempRange(Parse*,int);
|
3478
|
+
//void sqlite3ReleaseTempRange(Parse*,int,int);
|
3479
|
+
//Expr *sqlite3ExprAlloc(sqlite3*,int,const Token*,int);
|
3480
|
+
//Expr *sqlite3Expr(sqlite3*,int,const char*);
|
3481
|
+
//void sqlite3ExprAttachSubtrees(sqlite3*,Expr*,Expr*,Expr*);
|
3482
|
+
//Expr *sqlite3PExpr(Parse*, int, Expr*, Expr*, const Token*);
|
3483
|
+
//Expr *sqlite3ExprAnd(sqlite3*,Expr*, Expr*);
|
3484
|
+
//Expr *sqlite3ExprFunction(Parse*,ExprList*, Token*);
|
3485
|
+
//void sqlite3ExprAssignVarNumber(Parse*, Expr*);
|
3486
|
+
//void sqlite3ExprDelete(sqlite3*, Expr*);
|
3487
|
+
//ExprList *sqlite3ExprListAppend(Parse*,ExprList*,Expr*);
|
3488
|
+
//void sqlite3ExprListSetName(Parse*,ExprList*,Token*,int);
|
3489
|
+
//void sqlite3ExprListSetSpan(Parse*,ExprList*,ExprSpan*);
|
3490
|
+
//void sqlite3ExprListDelete(sqlite3*, ExprList*);
|
3491
|
+
//int sqlite3Init(sqlite3*, char**);
|
3492
|
+
//int sqlite3InitCallback(void*, int, char**, char**);
|
3493
|
+
//void sqlite3Pragma(Parse*,Token*,Token*,Token*,int);
|
3494
|
+
//void sqlite3ResetInternalSchema(sqlite3*, int);
|
3495
|
+
//void sqlite3BeginParse(Parse*,int);
|
3496
|
+
//void sqlite3CommitInternalChanges(sqlite3*);
|
3497
|
+
//Table *sqlite3ResultSetOfSelect(Parse*,Select*);
|
3498
|
+
//void sqlite3OpenMasterTable(Parse *, int);
|
3499
|
+
//void sqlite3StartTable(Parse*,Token*,Token*,int,int,int,int);
|
3500
|
+
//void sqlite3AddColumn(Parse*,Token*);
|
3501
|
+
//void sqlite3AddNotNull(Parse*, int);
|
3502
|
+
//void sqlite3AddPrimaryKey(Parse*, ExprList*, int, int, int);
|
3503
|
+
//void sqlite3AddCheckConstraint(Parse*, Expr*);
|
3504
|
+
//void sqlite3AddColumnType(Parse*,Token*);
|
3505
|
+
//void sqlite3AddDefaultValue(Parse*,ExprSpan*);
|
3506
|
+
//void sqlite3AddCollateType(Parse*, Token*);
|
3507
|
+
//void sqlite3EndTable(Parse*,Token*,Token*,Select*);
|
3508
|
+
|
3509
|
+
//Bitvec *sqlite3BitvecCreate(u32);
|
3510
|
+
//int sqlite3BitvecTest(Bitvec*, u32);
|
3511
|
+
//int sqlite3BitvecSet(Bitvec*, u32);
|
3512
|
+
//void sqlite3BitvecClear(Bitvec*, u32, void*);
|
3513
|
+
//void sqlite3BitvecDestroy(Bitvec*);
|
3514
|
+
//u32 sqlite3BitvecSize(Bitvec*);
|
3515
|
+
//int sqlite3BitvecBuiltinTest(int,int*);
|
3516
|
+
|
3517
|
+
//RowSet *sqlite3RowSetInit(sqlite3*, void*, unsigned int);
|
3518
|
+
//void sqlite3RowSetClear(RowSet*);
|
3519
|
+
//void sqlite3RowSetInsert(RowSet*, i64);
|
3520
|
+
//int sqlite3RowSetTest(RowSet*, u8 iBatch, i64);
|
3521
|
+
//int sqlite3RowSetNext(RowSet*, i64*);
|
3522
|
+
|
3523
|
+
//void sqlite3CreateView(Parse*,Token*,Token*,Token*,Select*,int,int);
|
3524
|
+
|
3525
|
+
//#if !(SQLITE_OMIT_VIEW) || !SQLITE_OMIT_VIRTUALTABLE)
|
3526
|
+
// int sqlite3ViewGetColumnNames(Parse*,Table*);
|
3527
|
+
//#else
|
3528
|
+
//# define sqlite3ViewGetColumnNames(A,B) 0
|
3529
|
+
//#endif
|
3530
|
+
|
3531
|
+
//void sqlite3DropTable(Parse*, SrcList*, int, int);
|
3532
|
+
//void sqlite3DeleteTable(Table*);
|
3533
|
+
//#if ! SQLITE_OMIT_AUTOINCREMENT
|
3534
|
+
// void sqlite3AutoincrementBegin(Parse *pParse);
|
3535
|
+
// void sqlite3AutoincrementEnd(Parse *pParse);
|
3536
|
+
//#else
|
3537
|
+
//# define sqlite3AutoincrementBegin(X)
|
3538
|
+
//# define sqlite3AutoincrementEnd(X)
|
3539
|
+
//#endif
|
3540
|
+
//void sqlite3Insert(Parse*, SrcList*, ExprList*, Select*, IdList*, int);
|
3541
|
+
//void *sqlite3ArrayAllocate(sqlite3*,void*,int,int,int*,int*,int*);
|
3542
|
+
//IdList *sqlite3IdListAppend(sqlite3*, IdList*, Token*);
|
3543
|
+
//int sqlite3IdListIndex(IdList*,const char*);
|
3544
|
+
//SrcList *sqlite3SrcListEnlarge(sqlite3*, SrcList*, int, int);
|
3545
|
+
//SrcList *sqlite3SrcListAppend(sqlite3*, SrcList*, Token*, Token*);
|
3546
|
+
//SrcList *sqlite3SrcListAppendFromTerm(Parse*, SrcList*, Token*, Token*,
|
3547
|
+
// Token*, Select*, Expr*, IdList*);
|
3548
|
+
//void sqlite3SrcListIndexedBy(Parse *, SrcList *, Token *);
|
3549
|
+
//int sqlite3IndexedByLookup(Parse *, struct SrcList_item *);
|
3550
|
+
//void sqlite3SrcListShiftJoinType(SrcList*);
|
3551
|
+
//void sqlite3SrcListAssignCursors(Parse*, SrcList*);
|
3552
|
+
//void sqlite3IdListDelete(sqlite3*, IdList*);
|
3553
|
+
//void sqlite3SrcListDelete(sqlite3*, SrcList*);
|
3554
|
+
//Index *sqlite3CreateIndex(Parse*,Token*,Token*,SrcList*,ExprList*,int,Token*,
|
3555
|
+
// Token*, int, int);
|
3556
|
+
//void sqlite3DropIndex(Parse*, SrcList*, int);
|
3557
|
+
//int sqlite3Select(Parse*, Select*, SelectDest*);
|
3558
|
+
//Select *sqlite3SelectNew(Parse*,ExprList*,SrcList*,Expr*,ExprList*,
|
3559
|
+
// Expr*,ExprList*,int,Expr*,Expr*);
|
3560
|
+
//void sqlite3SelectDelete(sqlite3*, Select*);
|
3561
|
+
//Table *sqlite3SrcListLookup(Parse*, SrcList*);
|
3562
|
+
//int sqlite3IsReadOnly(Parse*, Table*, int);
|
3563
|
+
//void sqlite3OpenTable(Parse*, int iCur, int iDb, Table*, int);
|
3564
|
+
#if (SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !(SQLITE_OMIT_SUBQUERY)
|
3565
|
+
//Expr *sqlite3LimitWhere(Parse *, SrcList *, Expr *, ExprList *, Expr *, Expr *, char *);
|
3566
|
+
#endif
|
3567
|
+
//void sqlite3DeleteFrom(Parse*, SrcList*, Expr*);
|
3568
|
+
//void sqlite3Update(Parse*, SrcList*, ExprList*, Expr*, int);
|
3569
|
+
//WhereInfo *sqlite3WhereBegin(Parse*, SrcList*, Expr*, ExprList**, u16);
|
3570
|
+
//void sqlite3WhereEnd(WhereInfo*);
|
3571
|
+
//int sqlite3ExprCodeGetColumn(Parse*, Table*, int, int, int);
|
3572
|
+
//void sqlite3ExprCodeMove(Parse*, int, int, int);
|
3573
|
+
//void sqlite3ExprCodeCopy(Parse*, int, int, int);
|
3574
|
+
//void sqlite3ExprCacheStore(Parse*, int, int, int);
|
3575
|
+
//void sqlite3ExprCachePush(Parse*);
|
3576
|
+
//void sqlite3ExprCachePop(Parse*, int);
|
3577
|
+
//void sqlite3ExprCacheRemove(Parse*, int, int);
|
3578
|
+
//void sqlite3ExprCacheClear(Parse*);
|
3579
|
+
//void sqlite3ExprCacheAffinityChange(Parse*, int, int);
|
3580
|
+
//void sqlite3ExprHardCopy(Parse*,int,int);
|
3581
|
+
//int sqlite3ExprCode(Parse*, Expr*, int);
|
3582
|
+
//int sqlite3ExprCodeTemp(Parse*, Expr*, int*);
|
3583
|
+
//int sqlite3ExprCodeTarget(Parse*, Expr*, int);
|
3584
|
+
//int sqlite3ExprCodeAndCache(Parse*, Expr*, int);
|
3585
|
+
//void sqlite3ExprCodeConstants(Parse*, Expr*);
|
3586
|
+
//int sqlite3ExprCodeExprList(Parse*, ExprList*, int, int);
|
3587
|
+
//void sqlite3ExprIfTrue(Parse*, Expr*, int, int);
|
3588
|
+
//void sqlite3ExprIfFalse(Parse*, Expr*, int, int);
|
3589
|
+
//Table *sqlite3FindTable(sqlite3*,const char*, const char*);
|
3590
|
+
//Table *sqlite3LocateTable(Parse*,int isView,const char*, const char*);
|
3591
|
+
//Index *sqlite3FindIndex(sqlite3*,const char*, const char*);
|
3592
|
+
//void sqlite3UnlinkAndDeleteTable(sqlite3*,int,const char*);
|
3593
|
+
//void sqlite3UnlinkAndDeleteIndex(sqlite3*,int,const char*);
|
3594
|
+
//void sqlite3Vacuum(Parse*);
|
3595
|
+
//int sqlite3RunVacuum(char**, sqlite3*);
|
3596
|
+
//char *sqlite3NameFromToken(sqlite3*, Token*);
|
3597
|
+
//int sqlite3ExprCompare(Expr*, Expr*);
|
3598
|
+
//void sqlite3ExprAnalyzeAggregates(NameContext*, Expr*);
|
3599
|
+
//void sqlite3ExprAnalyzeAggList(NameContext*,ExprList*);
|
3600
|
+
//Vdbe *sqlite3GetVdbe(Parse*);
|
3601
|
+
//void sqlite3PrngSaveState(void);
|
3602
|
+
//void sqlite3PrngRestoreState(void);
|
3603
|
+
//void sqlite3PrngResetState(void);
|
3604
|
+
//void sqlite3RollbackAll(sqlite3*);
|
3605
|
+
//void sqlite3CodeVerifySchema(Parse*, int);
|
3606
|
+
//void sqlite3BeginTransaction(Parse*, int);
|
3607
|
+
//void sqlite3CommitTransaction(Parse*);
|
3608
|
+
//void sqlite3RollbackTransaction(Parse*);
|
3609
|
+
//void sqlite3Savepoint(Parse*, int, Token*);
|
3610
|
+
//void sqlite3CloseSavepoints(sqlite3 *);
|
3611
|
+
//int sqlite3ExprIsConstant(Expr*);
|
3612
|
+
//int sqlite3ExprIsConstantNotJoin(Expr*);
|
3613
|
+
//int sqlite3ExprIsConstantOrFunction(Expr*);
|
3614
|
+
//int sqlite3ExprIsInteger(Expr*, int*);
|
3615
|
+
//int sqlite3ExprCanBeNull(const Expr*);
|
3616
|
+
//void sqlite3ExprCodeIsNullJump(Vdbe*, const Expr*, int, int);
|
3617
|
+
//int sqlite3ExprNeedsNoAffinityChange(const Expr*, char);
|
3618
|
+
//int sqlite3IsRowid(const char*);
|
3619
|
+
//void sqlite3GenerateRowDelete(Parse*, Table*, int, int, int, Trigger *, int);
|
3620
|
+
//void sqlite3GenerateRowIndexDelete(Parse*, Table*, int, int*);
|
3621
|
+
//int sqlite3GenerateIndexKey(Parse*, Index*, int, int, int);
|
3622
|
+
//void sqlite3GenerateConstraintChecks(Parse*,Table*,int,int,
|
3623
|
+
// int*,int,int,int,int,int*);
|
3624
|
+
//void sqlite3CompleteInsertion(Parse*, Table*, int, int, int*, int, int, int);
|
3625
|
+
//int sqlite3OpenTableAndIndices(Parse*, Table*, int, int);
|
3626
|
+
//void sqlite3BeginWriteOperation(Parse*, int, int);
|
3627
|
+
//void sqlite3MultiWrite(Parse*);
|
3628
|
+
//void sqlite3MayAbort(Parse *);
|
3629
|
+
//void sqlite3HaltConstraint(Parse*, int, char*, int);
|
3630
|
+
//Expr *sqlite3ExprDup(sqlite3*,Expr*,int);
|
3631
|
+
//ExprList *sqlite3ExprListDup(sqlite3*,ExprList*,int);
|
3632
|
+
//SrcList *sqlite3SrcListDup(sqlite3*,SrcList*,int);
|
3633
|
+
//IdList *sqlite3IdListDup(sqlite3*,IdList*);
|
3634
|
+
//Select *sqlite3SelectDup(sqlite3*,Select*,int);
|
3635
|
+
//void sqlite3FuncDefInsert(FuncDefHash*, FuncDef*);
|
3636
|
+
//FuncDef *sqlite3FindFunction(sqlite3*,const char*,int,int,u8,int);
|
3637
|
+
//void sqlite3RegisterBuiltinFunctions(sqlite3*);
|
3638
|
+
//void sqlite3RegisterDateTimeFunctions(void);
|
3639
|
+
//void sqlite3RegisterGlobalFunctions(void);
|
3640
|
+
//int sqlite3SafetyCheckOk(sqlite3*);
|
3641
|
+
//int sqlite3SafetyCheckSickOrOk(sqlite3*);
|
3642
|
+
//void sqlite3ChangeCookie(Parse*, int);
|
3643
|
+
#if !(SQLITE_OMIT_VIEW) && !(SQLITE_OMIT_TRIGGER)
|
3644
|
+
//void sqlite3MaterializeView(Parse*, Table*, Expr*, int);
|
3645
|
+
#endif
|
3646
|
+
|
3647
|
+
#if !SQLITE_OMIT_TRIGGER
|
3648
|
+
//void sqlite3BeginTrigger(Parse*, Token*,Token*,int,int,IdList*,SrcList*,
|
3649
|
+
// Expr*,int, int);
|
3650
|
+
//void sqlite3FinishTrigger(Parse*, TriggerStep*, Token*);
|
3651
|
+
//void sqlite3DropTrigger(Parse*, SrcList*, int);
|
3652
|
+
//Trigger *sqlite3TriggersExist(Parse *, Table*, int, ExprList*, int *pMask);
|
3653
|
+
//Trigger *sqlite3TriggerList(Parse *, Table *);
|
3654
|
+
// void sqlite3CodeRowTrigger(Parse*, Trigger *, int, ExprList*, int, Table *,
|
3655
|
+
// int, int, int);
|
3656
|
+
//void sqliteViewTriggers(Parse*, Table*, Expr*, int, ExprList*);
|
3657
|
+
//void sqlite3DeleteTriggerStep(sqlite3*, TriggerStep*);
|
3658
|
+
//TriggerStep *sqlite3TriggerSelectStep(sqlite3*,Select*);
|
3659
|
+
//TriggerStep *sqlite3TriggerInsertStep(sqlite3*,Token*, IdList*,
|
3660
|
+
// ExprList*,Select*,u8);
|
3661
|
+
//TriggerStep *sqlite3TriggerUpdateStep(sqlite3*,Token*,ExprList*, Expr*, u8);
|
3662
|
+
//TriggerStep *sqlite3TriggerDeleteStep(sqlite3*,Token*, Expr*);
|
3663
|
+
//void sqlite3DeleteTrigger(sqlite3*, Trigger*);
|
3664
|
+
//void sqlite3UnlinkAndDeleteTrigger(sqlite3*,int,const char*);
|
3665
|
+
// u32 sqlite3TriggerColmask(Parse*,Trigger*,ExprList*,int,int,Table*,int);
|
3666
|
+
//# define sqlite3ParseToplevel(p) ((p)->pToplevel ? (p)->pToplevel : (p))
|
3667
|
+
static Parse sqlite3ParseToplevel(Parse p) { return p.pToplevel != null ? p.pToplevel : p; }
|
3668
|
+
#else
|
3669
|
+
static void sqlite3BeginTrigger( Parse A, Token B, Token C, int D, int E, IdList F, SrcList G, Expr H, int I, int J ) { }
|
3670
|
+
static void sqlite3FinishTrigger( Parse P, TriggerStep TS, Token T ) { }
|
3671
|
+
static TriggerStep sqlite3TriggerSelectStep( sqlite3 A, Select B ) { return null; }
|
3672
|
+
static TriggerStep sqlite3TriggerInsertStep( sqlite3 A, Token B, IdList C, ExprList D, Select E, u8 F ) { return null; }
|
3673
|
+
static TriggerStep sqlite3TriggerUpdateStep( sqlite3 A, Token B, ExprList C, Expr D, u8 E ) { return null; }
|
3674
|
+
static TriggerStep sqlite3TriggerDeleteStep( sqlite3 A, Token B, Expr C ) { return null; }
|
3675
|
+
static u32 sqlite3TriggerColmask( Parse A, Trigger B, ExprList C, int D, int E, Table F, int G ) { return 0; }
|
3676
|
+
|
3677
|
+
//# define sqlite3TriggersExist(B,C,D,E,F) 0
|
3678
|
+
static Trigger sqlite3TriggersExist( Parse B, Table C, int D, ExprList E, ref int F ) { return null; }
|
3679
|
+
|
3680
|
+
//# define sqlite3DeleteTrigger(A,B)
|
3681
|
+
static void sqlite3DeleteTrigger( sqlite3 A, ref Trigger B ) { }
|
3682
|
+
static void sqlite3DeleteTriggerStep( sqlite3 A, ref TriggerStep B ) { }
|
3683
|
+
|
3684
|
+
//# define sqlite3DropTriggerPtr(A,B)
|
3685
|
+
static void sqlite3DropTriggerPtr( Parse A, Trigger B ) { }
|
3686
|
+
static void sqlite3DropTrigger( Parse A, SrcList B, int C ) { }
|
3687
|
+
|
3688
|
+
//# define sqlite3UnlinkAndDeleteTrigger(A,B,C)
|
3689
|
+
static void sqlite3UnlinkAndDeleteTrigger( sqlite3 A, int B, string C ) { }
|
3690
|
+
|
3691
|
+
//# define sqlite3CodeRowTrigger(A,B,C,D,E,F,G,H,I)
|
3692
|
+
static void sqlite3CodeRowTrigger( Parse A, Trigger B, int C, ExprList D, int E, Table F, int G, int H, int I ) { }
|
3693
|
+
|
3694
|
+
//# define sqlite3CodeRowTriggerDirect(A,B,C,D,E,F)
|
3695
|
+
static Trigger sqlite3TriggerList( Parse pParse, Table pTab ) { return null; } //# define sqlite3TriggerList(X, Y) 0
|
3696
|
+
|
3697
|
+
//# define sqlite3ParseToplevel(p) p
|
3698
|
+
static Parse sqlite3ParseToplevel( Parse p ) { return p; }
|
3699
|
+
|
3700
|
+
//# define sqlite3TriggerOldmask(A,B,C,D,E,F) 0
|
3701
|
+
static u32 sqlite3TriggerOldmask( Parse A, Trigger B, int C, ExprList D, Table E, int F ) { return 0; }
|
3702
|
+
#endif
|
3703
|
+
|
3704
|
+
//int sqlite3JoinType(Parse*, Token*, Token*, Token*);
|
3705
|
+
//void sqlite3CreateForeignKey(Parse*, ExprList*, Token*, ExprList*, int);
|
3706
|
+
//void sqlite3DeferForeignKey(Parse*, int);
|
3707
|
+
#if !SQLITE_OMIT_AUTHORIZATION
|
3708
|
+
void sqlite3AuthRead(Parse*,Expr*,Schema*,SrcList*);
|
3709
|
+
int sqlite3AuthCheck(Parse*,int, const char*, const char*, const char*);
|
3710
|
+
void sqlite3AuthContextPush(Parse*, AuthContext*, const char*);
|
3711
|
+
void sqlite3AuthContextPop(AuthContext*);
|
3712
|
+
int sqlite3AuthReadCol(Parse*, const char *, const char *, int);
|
3713
|
+
#else
|
3714
|
+
//# define sqlite3AuthRead(a,b,c,d)
|
3715
|
+
static void sqlite3AuthRead(Parse a, Expr b, Schema c, SrcList d) { }
|
3716
|
+
|
3717
|
+
//# define sqlite3AuthCheck(a,b,c,d,e) SQLITE_OK
|
3718
|
+
static int sqlite3AuthCheck(Parse a, int b, string c, byte[] d, byte[] e) { return SQLITE_OK; }
|
3719
|
+
|
3720
|
+
//# define sqlite3AuthContextPush(a,b,c)
|
3721
|
+
static void sqlite3AuthContextPush(Parse a, AuthContext b, string c) { }
|
3722
|
+
|
3723
|
+
//# define sqlite3AuthContextPop(a) ((void)(a))
|
3724
|
+
static Parse sqlite3AuthContextPop(Parse a) { return a; }
|
3725
|
+
#endif
|
3726
|
+
//void sqlite3Attach(Parse*, Expr*, Expr*, Expr*);
|
3727
|
+
//void sqlite3Detach(Parse*, Expr*);
|
3728
|
+
//int sqlite3BtreeFactory(sqlite3 db, const char *zFilename,
|
3729
|
+
// int omitJournal, int nCache, int flags, Btree **ppBtree);
|
3730
|
+
//int sqlite3FixInit(DbFixer*, Parse*, int, const char*, const Token*);
|
3731
|
+
//int sqlite3FixSrcList(DbFixer*, SrcList*);
|
3732
|
+
//int sqlite3FixSelect(DbFixer*, Select*);
|
3733
|
+
//int sqlite3FixExpr(DbFixer*, Expr*);
|
3734
|
+
//int sqlite3FixExprList(DbFixer*, ExprList*);
|
3735
|
+
//int sqlite3FixTriggerStep(DbFixer*, TriggerStep*);
|
3736
|
+
//int sqlite3AtoF(const char *z, double*);
|
3737
|
+
//int sqlite3GetInt32(const char *, int*);
|
3738
|
+
//int sqlite3FitsIn64Bits(const char *, int);
|
3739
|
+
//int sqlite3Utf16ByteLen(const void pData, int nChar);
|
3740
|
+
//int sqlite3Utf8CharLen(const char pData, int nByte);
|
3741
|
+
//int sqlite3Utf8Read(const u8*, const u8**);
|
3742
|
+
|
3743
|
+
/*
|
3744
|
+
** Routines to read and write variable-length integers. These used to
|
3745
|
+
** be defined locally, but now we use the varint routines in the util.c
|
3746
|
+
** file. Code should use the MACRO forms below, as the Varint32 versions
|
3747
|
+
** are coded to assume the single byte case is already handled (which
|
3748
|
+
** the MACRO form does).
|
3749
|
+
*/
|
3750
|
+
//int sqlite3PutVarint(unsigned char*, u64);
|
3751
|
+
//int putVarint32(unsigned char*, u32);
|
3752
|
+
//u8 sqlite3GetVarint(const unsigned char *, u64 *);
|
3753
|
+
//u8 sqlite3GetVarint32(const unsigned char *, u32 *);
|
3754
|
+
//int sqlite3VarintLen(u64 v);
|
3755
|
+
|
3756
|
+
/*
|
3757
|
+
** The header of a record consists of a sequence variable-length integers.
|
3758
|
+
** These integers are almost always small and are encoded as a single byte.
|
3759
|
+
** The following macros take advantage this fact to provide a fast encode
|
3760
|
+
** and decode of the integers in a record header. It is faster for the common
|
3761
|
+
** case where the integer is a single byte. It is a little slower when the
|
3762
|
+
** integer is two or more bytes. But overall it is faster.
|
3763
|
+
**
|
3764
|
+
** The following expressions are equivalent:
|
3765
|
+
**
|
3766
|
+
** x = sqlite3GetVarint32( A, B );
|
3767
|
+
** x = putVarint32( A, B );
|
3768
|
+
**
|
3769
|
+
** x = getVarint32( A, B );
|
3770
|
+
** x = putVarint32( A, B );
|
3771
|
+
**
|
3772
|
+
*/
|
3773
|
+
//#define getVarint32(A,B) (u8)((*(A)<(u8)0x80) ? ((B) = (u32)*(A)),1 : sqlite3GetVarint32((A), (u32 *)&(B)))
|
3774
|
+
//#define putVarint32(A,B) (u8)(((u32)(B)<(u32)0x80) ? (*(A) = (unsigned char)(B)),1 : sqlite3PutVarint32((A), (B)))
|
3775
|
+
//#define getVarint sqlite3GetVarint
|
3776
|
+
//#define putVarint sqlite3PutVarint
|
3777
|
+
|
3778
|
+
|
3779
|
+
//const char *sqlite3IndexAffinityStr(Vdbe *, Index *);
|
3780
|
+
//void sqlite3TableAffinityStr(Vdbe *, Table *);
|
3781
|
+
//char sqlite3CompareAffinity(Expr pExpr, char aff2);
|
3782
|
+
//int sqlite3IndexAffinityOk(Expr pExpr, char idx_affinity);
|
3783
|
+
//char sqlite3ExprAffinity(Expr pExpr);
|
3784
|
+
//int sqlite3Atoi64(const char*, i64*);
|
3785
|
+
//void sqlite3Error(sqlite3*, int, const char*,...);
|
3786
|
+
//void *sqlite3HexToBlob(sqlite3*, const char *z, int n);
|
3787
|
+
//int sqlite3TwoPartName(Parse *, Token *, Token *, Token **);
|
3788
|
+
//const char *sqlite3ErrStr(int);
|
3789
|
+
//int sqlite3ReadSchema(Parse pParse);
|
3790
|
+
//CollSeq *sqlite3FindCollSeq(sqlite3*,u8 enc, const char*,int);
|
3791
|
+
//CollSeq *sqlite3LocateCollSeq(Parse *pParse, const char*zName);
|
3792
|
+
//CollSeq *sqlite3ExprCollSeq(Parse pParse, Expr pExpr);
|
3793
|
+
//Expr *sqlite3ExprSetColl(Parse pParse, Expr *, Token *);
|
3794
|
+
//int sqlite3CheckCollSeq(Parse *, CollSeq *);
|
3795
|
+
//int sqlite3CheckObjectName(Parse *, const char *);
|
3796
|
+
//void sqlite3VdbeSetChanges(sqlite3 *, int);
|
3797
|
+
|
3798
|
+
//const void *sqlite3ValueText(sqlite3_value*, u8);
|
3799
|
+
//int sqlite3ValueBytes(sqlite3_value*, u8);
|
3800
|
+
//void sqlite3ValueSetStr(sqlite3_value*, int, const void *,u8,
|
3801
|
+
// // void(*)(void*));
|
3802
|
+
//void sqlite3ValueFree(sqlite3_value*);
|
3803
|
+
//sqlite3_value *sqlite3ValueNew(sqlite3 *);
|
3804
|
+
//char *sqlite3Utf16to8(sqlite3 *, const void*, int, u8);
|
3805
|
+
//#ifdef SQLITE_ENABLE_STAT2
|
3806
|
+
//char *sqlite3Utf8to16(sqlite3 *, u8, char *, int, int *);
|
3807
|
+
//#endif
|
3808
|
+
//int sqlite3ValueFromExpr(sqlite3 *, Expr *, u8, u8, sqlite3_value **);
|
3809
|
+
//void sqlite3ValueApplyAffinity(sqlite3_value *, u8, u8);
|
3810
|
+
//#if !SQLITE_AMALGAMATION
|
3811
|
+
//extern const unsigned char sqlite3OpcodeProperty[];
|
3812
|
+
//extern const unsigned char sqlite3UpperToLower[];
|
3813
|
+
//extern const unsigned char sqlite3CtypeMap[];
|
3814
|
+
//extern struct Sqlite3Config sqlite3Config;
|
3815
|
+
//extern FuncDefHash sqlite3GlobalFunctions;
|
3816
|
+
//extern int sqlite3PendingByte;
|
3817
|
+
//#endif
|
3818
|
+
//void sqlite3RootPageMoved(Db*, int, int);
|
3819
|
+
//void sqlite3Reindex(Parse*, Token*, Token*);
|
3820
|
+
//void sqlite3AlterFunctions(sqlite3*);
|
3821
|
+
//void sqlite3AlterRenameTable(Parse*, SrcList*, Token*);
|
3822
|
+
//int sqlite3GetToken(const unsigned char *, int *);
|
3823
|
+
//void sqlite3NestedParse(Parse*, const char*, ...);
|
3824
|
+
//void sqlite3ExpirePreparedStatements(sqlite3*);
|
3825
|
+
//int sqlite3CodeSubselect(Parse *, Expr *, int, int);
|
3826
|
+
//void sqlite3SelectPrep(Parse*, Select*, NameContext*);
|
3827
|
+
//int sqlite3ResolveExprNames(NameContext*, Expr*);
|
3828
|
+
//void sqlite3ResolveSelectNames(Parse*, Select*, NameContext*);
|
3829
|
+
//int sqlite3ResolveOrderGroupBy(Parse*, Select*, ExprList*, const char*);
|
3830
|
+
//void sqlite3ColumnDefault(Vdbe *, Table *, int, int);
|
3831
|
+
//void sqlite3AlterFinishAddColumn(Parse *, Token *);
|
3832
|
+
//void sqlite3AlterBeginAddColumn(Parse *, SrcList *);
|
3833
|
+
//CollSeq *sqlite3GetCollSeq(sqlite3*, u8, CollSeq *, const char*);
|
3834
|
+
//char sqlite3AffinityType(const char*);
|
3835
|
+
//void sqlite3Analyze(Parse*, Token*, Token*);
|
3836
|
+
//int sqlite3InvokeBusyHandler(BusyHandler*);
|
3837
|
+
//int sqlite3FindDb(sqlite3*, Token*);
|
3838
|
+
//int sqlite3FindDbName(sqlite3 *, const char *);
|
3839
|
+
//int sqlite3AnalysisLoad(sqlite3*,int iDB);
|
3840
|
+
//void sqlite3DeleteIndexSamples(Index*);
|
3841
|
+
//void sqlite3DefaultRowEst(Index*);
|
3842
|
+
//void sqlite3RegisterLikeFunctions(sqlite3*, int);
|
3843
|
+
//int sqlite3IsLikeFunction(sqlite3*,Expr*,int*,char*);
|
3844
|
+
//void sqlite3MinimumFileFormat(Parse*, int, int);
|
3845
|
+
//void sqlite3SchemaFree(void *);
|
3846
|
+
//Schema *sqlite3SchemaGet(sqlite3 *, Btree *);
|
3847
|
+
//int sqlite3SchemaToIndex(sqlite3 db, Schema *);
|
3848
|
+
//KeyInfo *sqlite3IndexKeyinfo(Parse *, Index *);
|
3849
|
+
//int sqlite3CreateFunc(sqlite3 *, const char *, int, int, void *,
|
3850
|
+
// void (*)(sqlite3_context*,int,sqlite3_value **),
|
3851
|
+
// void (*)(sqlite3_context*,int,sqlite3_value **), void (*)(sqlite3_context*));
|
3852
|
+
//int sqlite3ApiExit(sqlite3 db, int);
|
3853
|
+
//int sqlite3OpenTempDatabase(Parse *);
|
3854
|
+
|
3855
|
+
//void sqlite3StrAccumAppend(StrAccum*,const char*,int);
|
3856
|
+
//char *sqlite3StrAccumFinish(StrAccum*);
|
3857
|
+
//void sqlite3StrAccumReset(StrAccum*);
|
3858
|
+
//void sqlite3SelectDestInit(SelectDest*,int,int);
|
3859
|
+
//Expr *sqlite3CreateColumnExpr(sqlite3 *, SrcList *, int, int);
|
3860
|
+
|
3861
|
+
//void sqlite3BackupRestart(sqlite3_backup *);
|
3862
|
+
//void sqlite3BackupUpdate(sqlite3_backup *, Pgno, const u8 *);
|
3863
|
+
|
3864
|
+
/*
|
3865
|
+
** The interface to the LEMON-generated parser
|
3866
|
+
*/
|
3867
|
+
//void *sqlite3ParserAlloc(void*(*)(size_t));
|
3868
|
+
//void sqlite3ParserFree(void*, void(*)(void*));
|
3869
|
+
//void sqlite3Parser(void*, int, Token, Parse*);
|
3870
|
+
#if YYTRACKMAXSTACKDEPTH
|
3871
|
+
int sqlite3ParserStackPeak(void*);
|
3872
|
+
#endif
|
3873
|
+
|
3874
|
+
//void sqlite3AutoLoadExtensions(sqlite3*);
|
3875
|
+
#if !SQLITE_OMIT_LOAD_EXTENSION
|
3876
|
+
//void sqlite3CloseExtensions(sqlite3*);
|
3877
|
+
#else
|
3878
|
+
//# define sqlite3CloseExtensions(X)
|
3879
|
+
#endif
|
3880
|
+
|
3881
|
+
#if !SQLITE_OMIT_SHARED_CACHE
|
3882
|
+
//void sqlite3TableLock(Parse *, int, int, u8, const char *);
|
3883
|
+
#else
|
3884
|
+
//#define sqlite3TableLock(v,w,x,y,z)
|
3885
|
+
static void sqlite3TableLock(Parse p, int p1, int p2, u8 p3, byte[] p4) { }
|
3886
|
+
static void sqlite3TableLock(Parse p, int p1, int p2, u8 p3, string p4) { }
|
3887
|
+
#endif
|
3888
|
+
|
3889
|
+
#if SQLITE_TEST
|
3890
|
+
///int sqlite3Utf8To8(unsigned char*);
|
3891
|
+
#endif
|
3892
|
+
|
3893
|
+
#if SQLITE_OMIT_VIRTUALTABLE
|
3894
|
+
//# define sqlite3VtabClear(Y)
|
3895
|
+
static void sqlite3VtabClear(Table Y) { }
|
3896
|
+
|
3897
|
+
//# define sqlite3VtabSync(X,Y) SQLITE_OK
|
3898
|
+
static int sqlite3VtabSync(sqlite3 X, string Y) { return SQLITE_OK; }
|
3899
|
+
|
3900
|
+
//# define sqlite3VtabRollback(X)
|
3901
|
+
static void sqlite3VtabRollback(sqlite3 X) { }
|
3902
|
+
|
3903
|
+
//# define sqlite3VtabCommit(X)
|
3904
|
+
static void sqlite3VtabCommit(sqlite3 X) { }
|
3905
|
+
|
3906
|
+
//# define sqlite3VtabInSync(db) 0
|
3907
|
+
//# define sqlite3VtabLock(X)
|
3908
|
+
static void sqlite3VtabLock(VTable X) { }
|
3909
|
+
|
3910
|
+
//# define sqlite3VtabUnlock(X)
|
3911
|
+
static void sqlite3VtabUnlock(VTable X) { }
|
3912
|
+
|
3913
|
+
//# define sqlite3VtabUnlockList(X)
|
3914
|
+
static void sqlite3VtabUnlockList(sqlite3 X) { }
|
3915
|
+
|
3916
|
+
static void sqlite3VtabArgExtend(Parse P, Token T) { }//# define sqlite3VtabArgExtend(P, T)
|
3917
|
+
static void sqlite3VtabArgInit(Parse P) { }//# define sqlite3VtabArgInit(P)
|
3918
|
+
static void sqlite3VtabBeginParse(Parse P, Token T, Token T1, Token T2) { }//# define sqlite3VtabBeginParse(P, T, T1, T2);
|
3919
|
+
static void sqlite3VtabFinishParse<T>(Parse P, T t) { }//# define sqlite3VtabFinishParse(P, T)
|
3920
|
+
static bool sqlite3VtabInSync(sqlite3 db) { return false; }
|
3921
|
+
|
3922
|
+
static VTable sqlite3GetVTable(sqlite3 db, Table T) { return null; }
|
3923
|
+
#else
|
3924
|
+
//void sqlite3VtabClear(Table*);
|
3925
|
+
//int sqlite3VtabSync(sqlite3 db, int rc);
|
3926
|
+
//int sqlite3VtabRollback(sqlite3 db);
|
3927
|
+
//int sqlite3VtabCommit(sqlite3 db);
|
3928
|
+
//void sqlite3VtabLock(VTable *);
|
3929
|
+
//void sqlite3VtabUnlock(VTable *);
|
3930
|
+
//void sqlite3VtabUnlockList(sqlite3*);
|
3931
|
+
//# define sqlite3VtabInSync(db) ((db)->nVTrans>0 && (db)->aVTrans==0)
|
3932
|
+
static bool sqlite3VtabInSync( sqlite3 db ) { return ( db.nVTrans > 0 && db.aVTrans == 0 ); }
|
3933
|
+
#endif
|
3934
|
+
//void sqlite3VtabMakeWritable(Parse*,Table*);
|
3935
|
+
//void sqlite3VtabBeginParse(Parse*, Token*, Token*, Token*);
|
3936
|
+
//void sqlite3VtabFinishParse(Parse*, Token*);
|
3937
|
+
//void sqlite3VtabArgInit(Parse*);
|
3938
|
+
//void sqlite3VtabArgExtend(Parse*, Token*);
|
3939
|
+
//int sqlite3VtabCallCreate(sqlite3*, int, const char *, char **);
|
3940
|
+
//int sqlite3VtabCallConnect(Parse*, Table*);
|
3941
|
+
//int sqlite3VtabCallDestroy(sqlite3*, int, const char *);
|
3942
|
+
//int sqlite3VtabBegin(sqlite3 *, VTable *);
|
3943
|
+
//FuncDef *sqlite3VtabOverloadFunction(sqlite3 *,FuncDef*, int nArg, Expr*);
|
3944
|
+
//void sqlite3InvalidFunction(sqlite3_context*,int,sqlite3_value**);
|
3945
|
+
//int sqlite3VdbeParameterIndex(Vdbe*, const char*, int);
|
3946
|
+
//int sqlite3TransferBindings(sqlite3_stmt *, sqlite3_stmt *);
|
3947
|
+
//int sqlite3Reprepare(Vdbe*);
|
3948
|
+
//void sqlite3ExprListCheckLength(Parse*, ExprList*, const char*);
|
3949
|
+
//CollSeq *sqlite3BinaryCompareCollSeq(Parse *, Expr *, Expr *);
|
3950
|
+
//int sqlite3TempInMemory(const sqlite3*);
|
3951
|
+
//VTable *sqlite3GetVTable(sqlite3*, Table*);
|
3952
|
+
|
3953
|
+
/* Declarations for functions in fkey.c. All of these are replaced by
|
3954
|
+
** no-op macros if OMIT_FOREIGN_KEY is defined. In this case no foreign
|
3955
|
+
** key functionality is available. If OMIT_TRIGGER is defined but
|
3956
|
+
** OMIT_FOREIGN_KEY is not, only some of the functions are no-oped. In
|
3957
|
+
** this case foreign keys are parsed, but no other functionality is
|
3958
|
+
** provided (enforcement of FK constraints requires the triggers sub-system).
|
3959
|
+
*/
|
3960
|
+
#if !(SQLITE_OMIT_FOREIGN_KEY) && !(SQLITE_OMIT_TRIGGER)
|
3961
|
+
//void sqlite3FkCheck(Parse*, Table*, int, int);
|
3962
|
+
//void sqlite3FkDropTable(Parse*, SrcList *, Table*);
|
3963
|
+
//void sqlite3FkActions(Parse*, Table*, ExprList*, int);
|
3964
|
+
//int sqlite3FkRequired(Parse*, Table*, int*, int);
|
3965
|
+
//u32 sqlite3FkOldmask(Parse*, Table*);
|
3966
|
+
//FKey *sqlite3FkReferences(Table *);
|
3967
|
+
#else
|
3968
|
+
//#define sqlite3FkActions(a,b,c,d)
|
3969
|
+
static void sqlite3FkActions( Parse a, Table b, ExprList c, int d ) { }
|
3970
|
+
|
3971
|
+
//#define sqlite3FkCheck(a,b,c,d)
|
3972
|
+
static void sqlite3FkCheck( Parse a, Table b, int c, int d ) { }
|
3973
|
+
|
3974
|
+
//#define sqlite3FkDropTable(a,b,c)
|
3975
|
+
static void sqlite3FkDropTable( Parse a, SrcList b, Table c ) { }
|
3976
|
+
|
3977
|
+
//#define sqlite3FkOldmask(a,b) 0
|
3978
|
+
static u32 sqlite3FkOldmask( Parse a, Table b ) { return 0; }
|
3979
|
+
|
3980
|
+
//#define sqlite3FkRequired(a,b,c,d) 0
|
3981
|
+
static int sqlite3FkRequired( Parse a, Table b, int[] c, int d ) { return 0; }
|
3982
|
+
#endif
|
3983
|
+
#if !SQLITE_OMIT_FOREIGN_KEY
|
3984
|
+
//void sqlite3FkDelete(Table*);
|
3985
|
+
#else
|
3986
|
+
//#define sqlite3FkDelete(a)
|
3987
|
+
static void sqlite3FkDelete(Table a) {}
|
3988
|
+
#endif
|
3989
|
+
|
3990
|
+
/*
|
3991
|
+
** Available fault injectors. Should be numbered beginning with 0.
|
3992
|
+
*/
|
3993
|
+
const int SQLITE_FAULTINJECTOR_MALLOC = 0;//#define SQLITE_FAULTINJECTOR_MALLOC 0
|
3994
|
+
const int SQLITE_FAULTINJECTOR_COUNT = 1;//#define SQLITE_FAULTINJECTOR_COUNT 1
|
3995
|
+
|
3996
|
+
/*
|
3997
|
+
** The interface to the code in fault.c used for identifying "benign"
|
3998
|
+
** malloc failures. This is only present if SQLITE_OMIT_BUILTIN_TEST
|
3999
|
+
** is not defined.
|
4000
|
+
*/
|
4001
|
+
#if !SQLITE_OMIT_BUILTIN_TEST
|
4002
|
+
//void sqlite3BeginBenignMalloc(void);
|
4003
|
+
//void sqlite3EndBenignMalloc(void);
|
4004
|
+
#else
|
4005
|
+
//#define sqlite3BeginBenignMalloc()
|
4006
|
+
//#define sqlite3EndBenignMalloc()
|
4007
|
+
#endif
|
4008
|
+
|
4009
|
+
const int IN_INDEX_ROWID = 1;//#define IN_INDEX_ROWID 1
|
4010
|
+
const int IN_INDEX_EPH = 2;//#define IN_INDEX_EPH 2
|
4011
|
+
const int IN_INDEX_INDEX = 3;//#define IN_INDEX_INDEX 3
|
4012
|
+
//int sqlite3FindInIndex(Parse *, Expr *, int*);
|
4013
|
+
|
4014
|
+
#if SQLITE_ENABLE_ATOMIC_WRITE
|
4015
|
+
// int sqlite3JournalOpen(sqlite3_vfs *, const char *, sqlite3_file *, int, int);
|
4016
|
+
// int sqlite3JournalSize(sqlite3_vfs *);
|
4017
|
+
// int sqlite3JournalCreate(sqlite3_file *);
|
4018
|
+
#else
|
4019
|
+
//#define sqlite3JournalSize(pVfs) ((pVfs)->szOsFile)
|
4020
|
+
static int sqlite3JournalSize(sqlite3_vfs pVfs) { return pVfs.szOsFile; }
|
4021
|
+
#endif
|
4022
|
+
|
4023
|
+
//void sqlite3MemJournalOpen(sqlite3_file *);
|
4024
|
+
//int sqlite3MemJournalSize(void);
|
4025
|
+
//int sqlite3IsMemJournal(sqlite3_file *);
|
4026
|
+
|
4027
|
+
#if SQLITE_MAX_EXPR_DEPTH//>0
|
4028
|
+
// void sqlite3ExprSetHeight(Parse pParse, Expr p);
|
4029
|
+
// int sqlite3SelectExprHeight(Select *);
|
4030
|
+
//int sqlite3ExprCheckHeight(Parse*, int);
|
4031
|
+
#else
|
4032
|
+
//#define sqlite3ExprSetHeight(x,y)
|
4033
|
+
//#define sqlite3SelectExprHeight(x) 0
|
4034
|
+
//#define sqlite3ExprCheckHeight(x,y)
|
4035
|
+
#endif
|
4036
|
+
|
4037
|
+
//u32 sqlite3Get4byte(const u8*);
|
4038
|
+
//void sqlite3sqlite3Put4byte(u8*, u32);
|
4039
|
+
|
4040
|
+
#if SQLITE_ENABLE_UNLOCK_NOTIFY
|
4041
|
+
void sqlite3ConnectionBlocked(sqlite3 *, sqlite3 *);
|
4042
|
+
void sqlite3ConnectionUnlocked(sqlite3 *db);
|
4043
|
+
void sqlite3ConnectionClosed(sqlite3 *db);
|
4044
|
+
#else
|
4045
|
+
static void sqlite3ConnectionBlocked(sqlite3 x, sqlite3 y) { } //#define sqlite3ConnectionBlocked(x,y)
|
4046
|
+
static void sqlite3ConnectionUnlocked(sqlite3 x) { } //#define sqlite3ConnectionUnlocked(x)
|
4047
|
+
static void sqlite3ConnectionClosed(sqlite3 x) { } //#define sqlite3ConnectionClosed(x)
|
4048
|
+
#endif
|
4049
|
+
|
4050
|
+
#if SQLITE_DEBUG
|
4051
|
+
// void sqlite3ParserTrace(FILE*, char *);
|
4052
|
+
#endif
|
4053
|
+
|
4054
|
+
/*
|
4055
|
+
** If the SQLITE_ENABLE IOTRACE exists then the global variable
|
4056
|
+
** sqlite3IoTrace is a pointer to a printf-like routine used to
|
4057
|
+
** print I/O tracing messages.
|
4058
|
+
*/
|
4059
|
+
#if SQLITE_ENABLE_IOTRACE
|
4060
|
+
static bool SQLite3IoTrace = false;
|
4061
|
+
//#define IOTRACE(A) if( sqlite3IoTrace ){ sqlite3IoTrace A; }
|
4062
|
+
static void IOTRACE( string X, params object[] ap ) { if ( SQLite3IoTrace ) { printf( X, ap ); } }
|
4063
|
+
|
4064
|
+
// void sqlite3VdbeIOTraceSql(Vdbe);
|
4065
|
+
//SQLITE_EXTERN void (*sqlite3IoTrace)(const char*,...);
|
4066
|
+
#else
|
4067
|
+
//#define IOTRACE(A)
|
4068
|
+
static void IOTRACE(string F, params object[] ap) { }
|
4069
|
+
//#define sqlite3VdbeIOTraceSql(X)
|
4070
|
+
static void sqlite3VdbeIOTraceSql(Vdbe X) { }
|
4071
|
+
#endif
|
4072
|
+
|
4073
|
+
//#endif
|
4074
|
+
}
|
4075
|
+
}
|