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,213 @@
|
|
1
|
+
using System;
|
2
|
+
using System.Diagnostics;
|
3
|
+
using System.IO;
|
4
|
+
|
5
|
+
using i16 = System.Int16;
|
6
|
+
using u32 = System.UInt32;
|
7
|
+
using Pgno = System.UInt32;
|
8
|
+
|
9
|
+
namespace Community.CsharpSqlite
|
10
|
+
{
|
11
|
+
public partial class Sqlite3
|
12
|
+
{
|
13
|
+
/*
|
14
|
+
** 2008 August 05
|
15
|
+
**
|
16
|
+
** The author disclaims copyright to this source code. In place of
|
17
|
+
** a legal notice, here is a blessing:
|
18
|
+
**
|
19
|
+
** May you do good and not evil.
|
20
|
+
** May you find forgiveness for yourself and forgive others.
|
21
|
+
** May you share freely, never taking more than you give.
|
22
|
+
**
|
23
|
+
*************************************************************************
|
24
|
+
** This header file defines the interface that the sqlite page cache
|
25
|
+
** subsystem.
|
26
|
+
*************************************************************************
|
27
|
+
** Included in SQLite3 port to C#-SQLite; 2008 Noah B Hart
|
28
|
+
** C#-SQLite is an independent reimplementation of the SQLite software library
|
29
|
+
**
|
30
|
+
** SQLITE_SOURCE_ID: 2009-12-07 16:39:13 1ed88e9d01e9eda5cbc622e7614277f29bcc551c
|
31
|
+
**
|
32
|
+
** $Header$
|
33
|
+
*************************************************************************
|
34
|
+
*/
|
35
|
+
|
36
|
+
#if !_PCACHE_H_
|
37
|
+
|
38
|
+
//typedef struct PgHdr PgHdr;
|
39
|
+
//typedef struct PCache PCache;
|
40
|
+
|
41
|
+
/*
|
42
|
+
** Every page in the cache is controlled by an instance of the following
|
43
|
+
** structure.
|
44
|
+
*/
|
45
|
+
public class PgHdr
|
46
|
+
{
|
47
|
+
public byte[] pData; /* Content of this page */
|
48
|
+
public MemPage pExtra; /* Extra content */
|
49
|
+
public PgHdr pDirty; /* Transient list of dirty pages */
|
50
|
+
public Pgno pgno; /* The page number for this page */
|
51
|
+
public Pager pPager; /* The pager to which this page belongs */
|
52
|
+
#if SQLITE_CHECK_PAGES || (SQLITE_DEBUG)
|
53
|
+
public int pageHash; /* Hash of page content */
|
54
|
+
#endif
|
55
|
+
public int flags; /* PGHDR flags defined below */
|
56
|
+
/**********************************************************************
|
57
|
+
** Elements above are public. All that follows is private to pcache.c
|
58
|
+
** and should not be accessed by other modules.
|
59
|
+
*/
|
60
|
+
public int nRef; /* Number of users of this page */
|
61
|
+
public PCache pCache; /* Cache that owns this page */
|
62
|
+
public bool CacheAllocated; /* True, if allocated from cache */
|
63
|
+
|
64
|
+
public PgHdr pDirtyNext; /* Next element in list of dirty pages */
|
65
|
+
public PgHdr pDirtyPrev; /* Previous element in list of dirty pages */
|
66
|
+
public PgHdr1 pPgHdr1; /* Cache page header this this page */
|
67
|
+
|
68
|
+
public static implicit operator bool( PgHdr b )
|
69
|
+
{
|
70
|
+
return ( b != null );
|
71
|
+
}
|
72
|
+
|
73
|
+
|
74
|
+
public void Clear()
|
75
|
+
{
|
76
|
+
sqlite3_free(ref this.pData);
|
77
|
+
this.pData = null;
|
78
|
+
this.pExtra = null;
|
79
|
+
this.pDirty = null;
|
80
|
+
this.pgno = 0;
|
81
|
+
this.pPager = null;
|
82
|
+
#if SQLITE_CHECK_PAGES
|
83
|
+
this.pageHash=0;
|
84
|
+
#endif
|
85
|
+
this.flags = 0;
|
86
|
+
this.nRef = 0;
|
87
|
+
this.pCache = null;
|
88
|
+
this.pDirtyNext = null;
|
89
|
+
this.pDirtyPrev = null;
|
90
|
+
this.pPgHdr1 = null;
|
91
|
+
}
|
92
|
+
};
|
93
|
+
|
94
|
+
/* Bit values for PgHdr.flags */
|
95
|
+
//#define PGHDR_DIRTY 0x002 /* Page has changed */
|
96
|
+
//#define PGHDR_NEED_SYNC 0x004 /* Fsync the rollback journal before
|
97
|
+
// ** writing this page to the database */
|
98
|
+
//#define PGHDR_NEED_READ 0x008 /* Content is unread */
|
99
|
+
//#define PGHDR_REUSE_UNLIKELY 0x010 /* A hint that reuse is unlikely */
|
100
|
+
//#define PGHDR_DONT_WRITE 0x020 /* Do not write content to disk */
|
101
|
+
|
102
|
+
const int PGHDR_DIRTY = 0x002; /* Page has changed */
|
103
|
+
const int PGHDR_NEED_SYNC = 0x004;/* Fsync the rollback journal before
|
104
|
+
** writing this page to the database */
|
105
|
+
const int PGHDR_NEED_READ = 0x008;/* Content is unread */
|
106
|
+
const int PGHDR_REUSE_UNLIKELY = 0x010;/* A hint that reuse is unlikely */
|
107
|
+
const int PGHDR_DONT_WRITE = 0x020;/* Do not write content to disk */
|
108
|
+
|
109
|
+
/* Initialize and shutdown the page cache subsystem */
|
110
|
+
//int sqlite3PcacheInitialize(void);
|
111
|
+
//void sqlite3PcacheShutdown(void);
|
112
|
+
|
113
|
+
/* Page cache buffer management:
|
114
|
+
** These routines implement SQLITE_CONFIG_PAGECACHE.
|
115
|
+
*/
|
116
|
+
//void sqlite3PCacheBufferSetup(void *, int sz, int n);
|
117
|
+
|
118
|
+
/* Create a new pager cache.
|
119
|
+
** Under memory stress, invoke xStress to try to make pages clean.
|
120
|
+
** Only clean and unpinned pages can be reclaimed.
|
121
|
+
*/
|
122
|
+
//void sqlite3PcacheOpen(
|
123
|
+
// int szPage, /* Size of every page */
|
124
|
+
// int szExtra, /* Extra space associated with each page */
|
125
|
+
// int bPurgeable, /* True if pages are on backing store */
|
126
|
+
// int (*xStress)(void*, PgHdr*), /* Call to try to make pages clean */
|
127
|
+
// void pStress, /* Argument to xStress */
|
128
|
+
// PCache pToInit /* Preallocated space for the PCache */
|
129
|
+
//);
|
130
|
+
|
131
|
+
/* Modify the page-size after the cache has been created. */
|
132
|
+
//void sqlite3PcacheSetPageSize(PCache *, int);
|
133
|
+
|
134
|
+
/* Return the size in bytes of a PCache object. Used to preallocate
|
135
|
+
** storage space.
|
136
|
+
*/
|
137
|
+
//int sqlite3PcacheSize(void);
|
138
|
+
|
139
|
+
/* One release per successful fetch. Page is pinned until released.
|
140
|
+
** Reference counted.
|
141
|
+
*/
|
142
|
+
//int sqlite3PcacheFetch(PCache*, Pgno, int createFlag, PgHdr**);
|
143
|
+
//void sqlite3PcacheRelease(PgHdr*);
|
144
|
+
|
145
|
+
//void sqlite3PcacheDrop(PgHdr*); /* Remove page from cache */
|
146
|
+
//void sqlite3PcacheMakeDirty(PgHdr*); /* Make sure page is marked dirty */
|
147
|
+
//void sqlite3PcacheMakeClean(PgHdr*); /* Mark a single page as clean */
|
148
|
+
//void sqlite3PcacheCleanAll(PCache*); /* Mark all dirty list pages as clean */
|
149
|
+
|
150
|
+
/* Change a page number. Used by incr-vacuum. */
|
151
|
+
//void sqlite3PcacheMove(PgHdr*, Pgno);
|
152
|
+
|
153
|
+
/* Remove all pages with pgno>x. Reset the cache if x==0 */
|
154
|
+
//void sqlite3PcacheTruncate(PCache*, Pgno x);
|
155
|
+
|
156
|
+
/* Get a list of all dirty pages in the cache, sorted by page number */
|
157
|
+
//PgHdr *sqlite3PcacheDirtyList(PCache*);
|
158
|
+
|
159
|
+
/* Reset and close the cache object */
|
160
|
+
//void sqlite3PcacheClose(PCache*);
|
161
|
+
|
162
|
+
/* Clear flags from pages of the page cache */
|
163
|
+
//void sqlite3PcacheClearSyncFlags(PCache *);
|
164
|
+
|
165
|
+
/* Discard the contents of the cache */
|
166
|
+
//void sqlite3PcacheClear(PCache*);
|
167
|
+
|
168
|
+
/* Return the total number of outstanding page references */
|
169
|
+
//int sqlite3PcacheRefCount(PCache*);
|
170
|
+
|
171
|
+
/* Increment the reference count of an existing page */
|
172
|
+
//void sqlite3PcacheRef(PgHdr*);
|
173
|
+
|
174
|
+
//int sqlite3PcachePageRefcount(PgHdr*);
|
175
|
+
|
176
|
+
|
177
|
+
/* Return the total number of pages stored in the cache */
|
178
|
+
//int sqlite3PcachePagecount(PCache*);
|
179
|
+
|
180
|
+
#if SQLITE_CHECK_PAGES
|
181
|
+
/* Iterate through all dirty pages currently stored in the cache. This
|
182
|
+
** interface is only available if SQLITE_CHECK_PAGES is defined when the
|
183
|
+
** library is built.
|
184
|
+
*/
|
185
|
+
|
186
|
+
//void sqlite3PcacheIterateDirty(PCache pCache, void (*xIter)(PgHdr *));
|
187
|
+
#endif
|
188
|
+
|
189
|
+
/* Set and get the suggested cache-size for the specified pager-cache.
|
190
|
+
**
|
191
|
+
** If no global maximum is configured, then the system attempts to limit
|
192
|
+
** the total number of pages cached by purgeable pager-caches to the sum
|
193
|
+
** of the suggested cache-sizes.
|
194
|
+
*/
|
195
|
+
//void sqlite3PcacheSetCachesize(PCache *, int);
|
196
|
+
#if SQLITE_TEST
|
197
|
+
//int sqlite3PcacheGetCachesize(PCache *);
|
198
|
+
#endif
|
199
|
+
|
200
|
+
#if SQLITE_ENABLE_MEMORY_MANAGEMENT
|
201
|
+
/* Try to return memory used by the pcache module to the main memory heap */
|
202
|
+
//int sqlite3PcacheReleaseMemory(int);
|
203
|
+
#endif
|
204
|
+
|
205
|
+
#if SQLITE_TEST
|
206
|
+
//void sqlite3PcacheStats(int*,int*,int*,int*);
|
207
|
+
#endif
|
208
|
+
|
209
|
+
//void sqlite3PCacheSetDefault(void);
|
210
|
+
|
211
|
+
#endif //* _PCACHE_H_ */
|
212
|
+
}
|
213
|
+
}
|
@@ -0,0 +1,1767 @@
|
|
1
|
+
using System;
|
2
|
+
using System.Diagnostics;
|
3
|
+
using System.Text;
|
4
|
+
|
5
|
+
using i64 = System.Int64;
|
6
|
+
using u8 = System.Byte;
|
7
|
+
|
8
|
+
namespace Community.CsharpSqlite
|
9
|
+
{
|
10
|
+
public partial class Sqlite3
|
11
|
+
{
|
12
|
+
/*
|
13
|
+
** 2003 April 6
|
14
|
+
**
|
15
|
+
** The author disclaims copyright to this source code. In place of
|
16
|
+
** a legal notice, here is a blessing:
|
17
|
+
**
|
18
|
+
** May you do good and not evil.
|
19
|
+
** May you find forgiveness for yourself and forgive others.
|
20
|
+
** May you share freely, never taking more than you give.
|
21
|
+
**
|
22
|
+
*************************************************************************
|
23
|
+
** This file contains code used to implement the PRAGMA command.
|
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
|
+
** SQLITE_SOURCE_ID: 2010-03-09 19:31:43 4ae453ea7be69018d8c16eb8dabe05617397dc4d
|
29
|
+
**
|
30
|
+
** $Header: Community.CsharpSqlite/src/pragma_c.cs,v 6604176a7dbe 2010/03/12 23:35:36 Noah $
|
31
|
+
*************************************************************************
|
32
|
+
*/
|
33
|
+
//#include "sqliteInt.h"
|
34
|
+
|
35
|
+
/* Ignore this whole file if pragmas are disabled
|
36
|
+
*/
|
37
|
+
#if !SQLITE_OMIT_PRAGMA
|
38
|
+
|
39
|
+
/*
|
40
|
+
** Interpret the given string as a safety level. Return 0 for OFF,
|
41
|
+
** 1 for ON or NORMAL and 2 for FULL. Return 1 for an empty or
|
42
|
+
** unrecognized string argument.
|
43
|
+
**
|
44
|
+
** Note that the values returned are one less that the values that
|
45
|
+
** should be passed into sqlite3BtreeSetSafetyLevel(). The is done
|
46
|
+
** to support legacy SQL code. The safety level used to be boolean
|
47
|
+
** and older scripts may have used numbers 0 for OFF and 1 for ON.
|
48
|
+
*/
|
49
|
+
static u8 getSafetyLevel( string z )
|
50
|
+
{
|
51
|
+
// /* 123456789 123456789 */
|
52
|
+
string zText = "onoffalseyestruefull";
|
53
|
+
int[] iOffset = new int[] { 0, 1, 2, 4, 9, 12, 16 };
|
54
|
+
int[] iLength = new int[] { 2, 2, 3, 5, 3, 4, 4 };
|
55
|
+
u8[] iValue = new u8[] { 1, 0, 0, 0, 1, 1, 2 };
|
56
|
+
int i, n;
|
57
|
+
if ( sqlite3Isdigit( z[0] ) )
|
58
|
+
{
|
59
|
+
return (u8)atoi( z );
|
60
|
+
}
|
61
|
+
n = sqlite3Strlen30( z );
|
62
|
+
for ( i = 0; i < ArraySize( iLength ); i++ )
|
63
|
+
{
|
64
|
+
if ( iLength[i] == n && sqlite3StrNICmp( zText.Substring( iOffset[i] ), z, n ) == 0 )
|
65
|
+
{
|
66
|
+
return iValue[i];
|
67
|
+
}
|
68
|
+
}
|
69
|
+
return 1;
|
70
|
+
}
|
71
|
+
|
72
|
+
/*
|
73
|
+
** Interpret the given string as a boolean value.
|
74
|
+
*/
|
75
|
+
static u8 getBoolean( string z )
|
76
|
+
{
|
77
|
+
return (u8)( getSafetyLevel( z ) & 1 );
|
78
|
+
}
|
79
|
+
|
80
|
+
/*
|
81
|
+
** Interpret the given string as a locking mode value.
|
82
|
+
*/
|
83
|
+
static int getLockingMode( string z )
|
84
|
+
{
|
85
|
+
if ( z != null )
|
86
|
+
{
|
87
|
+
if ( 0 == sqlite3StrICmp( z, "exclusive" ) ) return PAGER_LOCKINGMODE_EXCLUSIVE;
|
88
|
+
if ( 0 == sqlite3StrICmp( z, "normal" ) ) return PAGER_LOCKINGMODE_NORMAL;
|
89
|
+
}
|
90
|
+
return PAGER_LOCKINGMODE_QUERY;
|
91
|
+
}
|
92
|
+
|
93
|
+
#if !SQLITE_OMIT_AUTOVACUUM
|
94
|
+
/*
|
95
|
+
** Interpret the given string as an auto-vacuum mode value.
|
96
|
+
**
|
97
|
+
** The following strings, "none", "full" and "incremental" are
|
98
|
+
** acceptable, as are their numeric equivalents: 0, 1 and 2 respectively.
|
99
|
+
*/
|
100
|
+
static u8 getAutoVacuum( string z )
|
101
|
+
{
|
102
|
+
int i;
|
103
|
+
if ( 0 == sqlite3StrICmp( z, "none" ) ) return BTREE_AUTOVACUUM_NONE;
|
104
|
+
if ( 0 == sqlite3StrICmp( z, "full" ) ) return BTREE_AUTOVACUUM_FULL;
|
105
|
+
if ( 0 == sqlite3StrICmp( z, "incremental" ) ) return BTREE_AUTOVACUUM_INCR;
|
106
|
+
i = atoi( z );
|
107
|
+
return (u8)( ( i >= 0 && i <= 2 ) ? i : 0 );
|
108
|
+
}
|
109
|
+
#endif // * if !SQLITE_OMIT_AUTOVACUUM */
|
110
|
+
|
111
|
+
#if !SQLITE_OMIT_PAGER_PRAGMAS
|
112
|
+
/*
|
113
|
+
** Interpret the given string as a temp db location. Return 1 for file
|
114
|
+
** backed temporary databases, 2 for the Red-Black tree in memory database
|
115
|
+
** and 0 to use the compile-time default.
|
116
|
+
*/
|
117
|
+
static int getTempStore( string z )
|
118
|
+
{
|
119
|
+
if ( z[0] >= '0' && z[0] <= '2' )
|
120
|
+
{
|
121
|
+
return z[0] - '0';
|
122
|
+
}
|
123
|
+
else if ( sqlite3StrICmp( z, "file" ) == 0 )
|
124
|
+
{
|
125
|
+
return 1;
|
126
|
+
}
|
127
|
+
else if ( sqlite3StrICmp( z, "memory" ) == 0 )
|
128
|
+
{
|
129
|
+
return 2;
|
130
|
+
}
|
131
|
+
else
|
132
|
+
{
|
133
|
+
return 0;
|
134
|
+
}
|
135
|
+
}
|
136
|
+
#endif // * SQLITE_PAGER_PRAGMAS */
|
137
|
+
|
138
|
+
#if !SQLITE_OMIT_PAGER_PRAGMAS
|
139
|
+
/*
|
140
|
+
** Invalidate temp storage, either when the temp storage is changed
|
141
|
+
** from default, or when 'file' and the temp_store_directory has changed
|
142
|
+
*/
|
143
|
+
static int invalidateTempStorage( Parse pParse )
|
144
|
+
{
|
145
|
+
sqlite3 db = pParse.db;
|
146
|
+
if ( db.aDb[1].pBt != null )
|
147
|
+
{
|
148
|
+
if ( 0 == db.autoCommit || sqlite3BtreeIsInReadTrans( db.aDb[1].pBt ) )
|
149
|
+
{
|
150
|
+
sqlite3ErrorMsg( pParse, "temporary storage cannot be changed " +
|
151
|
+
"from within a transaction" );
|
152
|
+
return SQLITE_ERROR;
|
153
|
+
}
|
154
|
+
sqlite3BtreeClose( ref db.aDb[1].pBt );
|
155
|
+
db.aDb[1].pBt = null;
|
156
|
+
sqlite3ResetInternalSchema( db, 0 );
|
157
|
+
}
|
158
|
+
return SQLITE_OK;
|
159
|
+
}
|
160
|
+
#endif // * SQLITE_PAGER_PRAGMAS */
|
161
|
+
|
162
|
+
#if !SQLITE_OMIT_PAGER_PRAGMAS
|
163
|
+
/*
|
164
|
+
** If the TEMP database is open, close it and mark the database schema
|
165
|
+
** as needing reloading. This must be done when using the SQLITE_TEMP_STORE
|
166
|
+
** or DEFAULT_TEMP_STORE pragmas.
|
167
|
+
*/
|
168
|
+
static int changeTempStorage( Parse pParse, string zStorageType )
|
169
|
+
{
|
170
|
+
int ts = getTempStore( zStorageType );
|
171
|
+
sqlite3 db = pParse.db;
|
172
|
+
if ( db.temp_store == ts ) return SQLITE_OK;
|
173
|
+
if ( invalidateTempStorage( pParse ) != SQLITE_OK )
|
174
|
+
{
|
175
|
+
return SQLITE_ERROR;
|
176
|
+
}
|
177
|
+
db.temp_store = (u8)ts;
|
178
|
+
return SQLITE_OK;
|
179
|
+
}
|
180
|
+
#endif // * SQLITE_PAGER_PRAGMAS */
|
181
|
+
|
182
|
+
/*
|
183
|
+
** Generate code to return a single integer value.
|
184
|
+
*/
|
185
|
+
static void returnSingleInt( Parse pParse, string zLabel, i64 value )
|
186
|
+
{
|
187
|
+
Vdbe v = sqlite3GetVdbe( pParse );
|
188
|
+
int mem = ++pParse.nMem;
|
189
|
+
//i64* pI64 = sqlite3DbMallocRaw( pParse->db, sizeof( value ) );
|
190
|
+
//if ( pI64 )
|
191
|
+
//{
|
192
|
+
// memcpy( pI64, &value, sizeof( value ) );
|
193
|
+
//}
|
194
|
+
//sqlite3VdbeAddOp4( v, OP_Int64, 0, mem, 0, (char*)pI64, P4_INT64 );
|
195
|
+
sqlite3VdbeAddOp4( v, OP_Int64, 0, mem, 0, value, P4_INT64 );
|
196
|
+
sqlite3VdbeSetNumCols( v, 1 );
|
197
|
+
sqlite3VdbeSetColName( v, 0, COLNAME_NAME, zLabel, SQLITE_STATIC );
|
198
|
+
sqlite3VdbeAddOp2( v, OP_ResultRow, mem, 1 );
|
199
|
+
}
|
200
|
+
|
201
|
+
#if !SQLITE_OMIT_FLAG_PRAGMAS
|
202
|
+
/*
|
203
|
+
** Check to see if zRight and zLeft refer to a pragma that queries
|
204
|
+
** or changes one of the flags in db.flags. Return 1 if so and 0 if not.
|
205
|
+
** Also, implement the pragma.
|
206
|
+
*/
|
207
|
+
struct sPragmaType
|
208
|
+
{
|
209
|
+
public string zName; /* Name of the pragma */
|
210
|
+
public int mask; /* Mask for the db.flags value */
|
211
|
+
public sPragmaType( string zName, int mask )
|
212
|
+
{
|
213
|
+
this.zName = zName;
|
214
|
+
this.mask = mask;
|
215
|
+
}
|
216
|
+
}
|
217
|
+
static int flagPragma( Parse pParse, string zLeft, string zRight )
|
218
|
+
{
|
219
|
+
sPragmaType[] aPragma = new sPragmaType[]{
|
220
|
+
new sPragmaType( "full_column_names", SQLITE_FullColNames ),
|
221
|
+
new sPragmaType( "short_column_names", SQLITE_ShortColNames ),
|
222
|
+
new sPragmaType( "count_changes", SQLITE_CountRows ),
|
223
|
+
new sPragmaType( "empty_result_callbacks", SQLITE_NullCallback ),
|
224
|
+
new sPragmaType( "legacy_file_format", SQLITE_LegacyFileFmt ),
|
225
|
+
new sPragmaType( "fullfsync", SQLITE_FullFSync ),
|
226
|
+
new sPragmaType( "reverse_unordered_selects", SQLITE_ReverseOrder ),
|
227
|
+
#if SQLITE_DEBUG
|
228
|
+
new sPragmaType( "sql_trace", SQLITE_SqlTrace ),
|
229
|
+
new sPragmaType( "vdbe_listing", SQLITE_VdbeListing ),
|
230
|
+
new sPragmaType( "vdbe_trace", SQLITE_VdbeTrace ),
|
231
|
+
#endif
|
232
|
+
#if !SQLITE_OMIT_CHECK
|
233
|
+
new sPragmaType( "ignore_check_constraints", SQLITE_IgnoreChecks ),
|
234
|
+
#endif
|
235
|
+
/* The following is VERY experimental */
|
236
|
+
new sPragmaType( "writable_schema", SQLITE_WriteSchema|SQLITE_RecoveryMode ),
|
237
|
+
new sPragmaType( "omit_readlock", SQLITE_NoReadlock ),
|
238
|
+
|
239
|
+
/* TODO: Maybe it shouldn't be possible to change the ReadUncommitted
|
240
|
+
** flag if there are any active statements. */
|
241
|
+
new sPragmaType( "read_uncommitted", SQLITE_ReadUncommitted ),
|
242
|
+
new sPragmaType( "recursive_triggers", SQLITE_RecTriggers ),
|
243
|
+
|
244
|
+
/* This flag may only be set if both foreign-key and trigger support
|
245
|
+
** are present in the build. */
|
246
|
+
#if !(SQLITE_OMIT_FOREIGN_KEY) && !(SQLITE_OMIT_TRIGGER)
|
247
|
+
new sPragmaType( "foreign_keys", SQLITE_ForeignKeys ),
|
248
|
+
#endif
|
249
|
+
};
|
250
|
+
int i;
|
251
|
+
sPragmaType p;
|
252
|
+
for ( i = 0; i < ArraySize( aPragma ); i++ )//, p++)
|
253
|
+
{
|
254
|
+
p = aPragma[i];
|
255
|
+
if ( sqlite3StrICmp( zLeft, p.zName ) == 0 )
|
256
|
+
{
|
257
|
+
sqlite3 db = pParse.db;
|
258
|
+
Vdbe v;
|
259
|
+
v = sqlite3GetVdbe( pParse );
|
260
|
+
Debug.Assert( v != null ); /* Already allocated by sqlite3Pragma() */
|
261
|
+
if ( ALWAYS( v ) )
|
262
|
+
{
|
263
|
+
if ( null == zRight )
|
264
|
+
{
|
265
|
+
returnSingleInt( pParse, p.zName, ( ( db.flags & p.mask ) != 0 ) ? 1 : 0 );
|
266
|
+
}
|
267
|
+
else
|
268
|
+
{
|
269
|
+
int mask = p.mask; /* Mask of bits to set or clear. */
|
270
|
+
if ( db.autoCommit == 0 )
|
271
|
+
{
|
272
|
+
/* Foreign key support may not be enabled or disabled while not
|
273
|
+
** in auto-commit mode. */
|
274
|
+
mask &= ~( SQLITE_ForeignKeys );
|
275
|
+
}
|
276
|
+
if ( getBoolean( zRight ) != 0 )
|
277
|
+
{
|
278
|
+
db.flags |= mask;
|
279
|
+
}
|
280
|
+
else
|
281
|
+
{
|
282
|
+
db.flags &= ~mask;
|
283
|
+
}
|
284
|
+
|
285
|
+
/* Many of the flag-pragmas modify the code generated by the SQL
|
286
|
+
** compiler (eg. count_changes). So add an opcode to expire all
|
287
|
+
** compiled SQL statements after modifying a pragma value.
|
288
|
+
*/
|
289
|
+
sqlite3VdbeAddOp2( v, OP_Expire, 0, 0 );
|
290
|
+
}
|
291
|
+
}
|
292
|
+
|
293
|
+
return 1;
|
294
|
+
}
|
295
|
+
}
|
296
|
+
return 0;
|
297
|
+
}
|
298
|
+
#endif // * SQLITE_OMIT_FLAG_PRAGMAS */
|
299
|
+
|
300
|
+
/*
|
301
|
+
** Return a human-readable name for a constraint resolution action.
|
302
|
+
*/
|
303
|
+
#if !SQLITE_OMIT_FOREIGN_KEY
|
304
|
+
static string actionName( int action )
|
305
|
+
{
|
306
|
+
string zName;
|
307
|
+
switch ( action )
|
308
|
+
{
|
309
|
+
case OE_SetNull: zName = "SET NULL"; break;
|
310
|
+
case OE_SetDflt: zName = "SET DEFAULT"; break;
|
311
|
+
case OE_Cascade: zName = "CASCADE"; break;
|
312
|
+
case OE_Restrict: zName = "RESTRICT"; break;
|
313
|
+
default: zName = "NO ACTION";
|
314
|
+
Debug.Assert( action == OE_None ); break;
|
315
|
+
}
|
316
|
+
return zName;
|
317
|
+
}
|
318
|
+
#endif
|
319
|
+
|
320
|
+
/*
|
321
|
+
** Process a pragma statement.
|
322
|
+
**
|
323
|
+
** Pragmas are of this form:
|
324
|
+
**
|
325
|
+
** PRAGMA [database.]id [= value]
|
326
|
+
**
|
327
|
+
** The identifier might also be a string. The value is a string, and
|
328
|
+
** identifier, or a number. If minusFlag is true, then the value is
|
329
|
+
** a number that was preceded by a minus sign.
|
330
|
+
**
|
331
|
+
** If the left side is "database.id" then pId1 is the database name
|
332
|
+
** and pId2 is the id. If the left side is just "id" then pId1 is the
|
333
|
+
** id and pId2 is any empty string.
|
334
|
+
*/
|
335
|
+
class EncName
|
336
|
+
{
|
337
|
+
public string zName;
|
338
|
+
public u8 enc;
|
339
|
+
|
340
|
+
public EncName( string zName, u8 enc )
|
341
|
+
{
|
342
|
+
this.zName = zName;
|
343
|
+
this.enc = enc;
|
344
|
+
}
|
345
|
+
};
|
346
|
+
|
347
|
+
// OVERLOADS, so I don't need to rewrite parse.c
|
348
|
+
static void sqlite3Pragma( Parse pParse, Token pId1, Token pId2, int null_4, int minusFlag )
|
349
|
+
{ sqlite3Pragma( pParse, pId1, pId2, null, minusFlag ); }
|
350
|
+
static void sqlite3Pragma(
|
351
|
+
Parse pParse,
|
352
|
+
Token pId1, /* First part of [database.]id field */
|
353
|
+
Token pId2, /* Second part of [database.]id field, or NULL */
|
354
|
+
Token pValue, /* Token for <value>, or NULL */
|
355
|
+
int minusFlag /* True if a '-' sign preceded <value> */
|
356
|
+
)
|
357
|
+
{
|
358
|
+
string zLeft = null; /* Nul-terminated UTF-8 string <id> */
|
359
|
+
string zRight = null; /* Nul-terminated UTF-8 string <value>, or NULL */
|
360
|
+
string zDb = null; /* The database name */
|
361
|
+
Token pId = new Token();/* Pointer to <id> token */
|
362
|
+
int iDb; /* Database index for <database> */
|
363
|
+
sqlite3 db = pParse.db;
|
364
|
+
Db pDb;
|
365
|
+
Vdbe v = pParse.pVdbe = sqlite3VdbeCreate( db );
|
366
|
+
if ( v == null ) return;
|
367
|
+
sqlite3VdbeRunOnlyOnce(v);
|
368
|
+
pParse.nMem = 2;
|
369
|
+
|
370
|
+
/* Interpret the [database.] part of the pragma statement. iDb is the
|
371
|
+
** index of the database this pragma is being applied to in db.aDb[]. */
|
372
|
+
iDb = sqlite3TwoPartName( pParse, pId1, pId2, ref pId );
|
373
|
+
if ( iDb < 0 ) return;
|
374
|
+
pDb = db.aDb[iDb];
|
375
|
+
|
376
|
+
/* If the temp database has been explicitly named as part of the
|
377
|
+
** pragma, make sure it is open.
|
378
|
+
*/
|
379
|
+
if ( iDb == 1 && sqlite3OpenTempDatabase( pParse ) != 0 )
|
380
|
+
{
|
381
|
+
return;
|
382
|
+
}
|
383
|
+
|
384
|
+
zLeft = sqlite3NameFromToken( db, pId );
|
385
|
+
if ( zLeft == "" ) return;
|
386
|
+
if ( minusFlag != 0 )
|
387
|
+
{
|
388
|
+
zRight = ( pValue == null ) ? "" : sqlite3MPrintf( db, "-%T", pValue );
|
389
|
+
}
|
390
|
+
else
|
391
|
+
{
|
392
|
+
zRight = sqlite3NameFromToken( db, pValue );
|
393
|
+
}
|
394
|
+
|
395
|
+
Debug.Assert( pId2 != null );
|
396
|
+
zDb = pId2.n > 0 ? pDb.zName : null;
|
397
|
+
#if !SQLITE_OMIT_AUTHORIZATION
|
398
|
+
if ( sqlite3AuthCheck( pParse, SQLITE_PRAGMA, zLeft, zRight, zDb ) )
|
399
|
+
{
|
400
|
+
goto pragma_out;
|
401
|
+
}
|
402
|
+
#endif
|
403
|
+
#if !SQLITE_OMIT_PAGER_PRAGMAS
|
404
|
+
/*
|
405
|
+
** PRAGMA [database.]default_cache_size
|
406
|
+
** PRAGMA [database.]default_cache_size=N
|
407
|
+
**
|
408
|
+
** The first form reports the current persistent setting for the
|
409
|
+
** page cache size. The value returned is the maximum number of
|
410
|
+
** pages in the page cache. The second form sets both the current
|
411
|
+
** page cache size value and the persistent page cache size value
|
412
|
+
** stored in the database file.
|
413
|
+
**
|
414
|
+
** The default cache size is stored in meta-value 2 of page 1 of the
|
415
|
+
** database file. The cache size is actually the absolute value of
|
416
|
+
** this memory location. The sign of meta-value 2 determines the
|
417
|
+
** synchronous setting. A negative value means synchronous is off
|
418
|
+
** and a positive value means synchronous is on.
|
419
|
+
*/
|
420
|
+
if ( sqlite3StrICmp( zLeft, "default_cache_size" ) == 0 )
|
421
|
+
{
|
422
|
+
VdbeOpList[] getCacheSize = new VdbeOpList[]{
|
423
|
+
new VdbeOpList( OP_Transaction, 0, 0, 0), /* 0 */
|
424
|
+
new VdbeOpList( OP_ReadCookie, 0, 1, BTREE_DEFAULT_CACHE_SIZE), /* 1 */
|
425
|
+
new VdbeOpList( OP_IfPos, 1, 7, 0),
|
426
|
+
new VdbeOpList( OP_Integer, 0, 2, 0),
|
427
|
+
new VdbeOpList( OP_Subtract, 1, 2, 1),
|
428
|
+
new VdbeOpList( OP_IfPos, 1, 7, 0),
|
429
|
+
new VdbeOpList( OP_Integer, 0, 1, 0), /* 6 */
|
430
|
+
new VdbeOpList( OP_ResultRow, 1, 1, 0),
|
431
|
+
};
|
432
|
+
int addr;
|
433
|
+
if ( sqlite3ReadSchema( pParse ) != 0 ) goto pragma_out;
|
434
|
+
sqlite3VdbeUsesBtree( v, iDb );
|
435
|
+
if ( null == zRight )
|
436
|
+
{
|
437
|
+
sqlite3VdbeSetNumCols( v, 1 );
|
438
|
+
sqlite3VdbeSetColName( v, 0, COLNAME_NAME, "cache_size", SQLITE_STATIC );
|
439
|
+
pParse.nMem += 2;
|
440
|
+
addr = sqlite3VdbeAddOpList( v, getCacheSize.Length, getCacheSize );
|
441
|
+
sqlite3VdbeChangeP1( v, addr, iDb );
|
442
|
+
sqlite3VdbeChangeP1( v, addr + 1, iDb );
|
443
|
+
sqlite3VdbeChangeP1( v, addr + 6, SQLITE_DEFAULT_CACHE_SIZE );
|
444
|
+
}
|
445
|
+
else
|
446
|
+
{
|
447
|
+
int size = atoi( zRight );
|
448
|
+
if ( size < 0 ) size = -size;
|
449
|
+
sqlite3BeginWriteOperation( pParse, 0, iDb );
|
450
|
+
sqlite3VdbeAddOp2( v, OP_Integer, size, 1 );
|
451
|
+
sqlite3VdbeAddOp3( v, OP_ReadCookie, iDb, 2, BTREE_DEFAULT_CACHE_SIZE );
|
452
|
+
addr = sqlite3VdbeAddOp2( v, OP_IfPos, 2, 0 );
|
453
|
+
sqlite3VdbeAddOp2( v, OP_Integer, -size, 1 );
|
454
|
+
sqlite3VdbeJumpHere( v, addr );
|
455
|
+
sqlite3VdbeAddOp3( v, OP_SetCookie, iDb, BTREE_DEFAULT_CACHE_SIZE, 1 );
|
456
|
+
pDb.pSchema.cache_size = size;
|
457
|
+
sqlite3BtreeSetCacheSize( pDb.pBt, pDb.pSchema.cache_size );
|
458
|
+
}
|
459
|
+
}
|
460
|
+
else
|
461
|
+
|
462
|
+
/*
|
463
|
+
** PRAGMA [database.]page_size
|
464
|
+
** PRAGMA [database.]page_size=N
|
465
|
+
**
|
466
|
+
** The first form reports the current setting for the
|
467
|
+
** database page size in bytes. The second form sets the
|
468
|
+
** database page size value. The value can only be set if
|
469
|
+
** the database has not yet been created.
|
470
|
+
*/
|
471
|
+
if ( sqlite3StrICmp( zLeft, "page_size" ) == 0 )
|
472
|
+
{
|
473
|
+
Btree pBt = pDb.pBt;
|
474
|
+
Debug.Assert( pBt != null );
|
475
|
+
if ( null == zRight )
|
476
|
+
{
|
477
|
+
int size = ALWAYS( pBt ) ? sqlite3BtreeGetPageSize( pBt ) : 0;
|
478
|
+
returnSingleInt( pParse, "page_size", size );
|
479
|
+
}
|
480
|
+
else
|
481
|
+
{
|
482
|
+
/* Malloc may fail when setting the page-size, as there is an internal
|
483
|
+
** buffer that the pager module resizes using sqlite3_realloc().
|
484
|
+
*/
|
485
|
+
db.nextPagesize = atoi( zRight );
|
486
|
+
if ( SQLITE_NOMEM == sqlite3BtreeSetPageSize( pBt, db.nextPagesize, -1, 0 ) )
|
487
|
+
{
|
488
|
+
//// db.mallocFailed = 1;
|
489
|
+
}
|
490
|
+
}
|
491
|
+
}
|
492
|
+
else
|
493
|
+
|
494
|
+
/*
|
495
|
+
** PRAGMA [database.]max_page_count
|
496
|
+
** PRAGMA [database.]max_page_count=N
|
497
|
+
**
|
498
|
+
** The first form reports the current setting for the
|
499
|
+
** maximum number of pages in the database file. The
|
500
|
+
** second form attempts to change this setting. Both
|
501
|
+
** forms return the current setting.
|
502
|
+
*/
|
503
|
+
if ( sqlite3StrICmp( zLeft, "max_page_count" ) == 0 )
|
504
|
+
{
|
505
|
+
Btree pBt = pDb.pBt;
|
506
|
+
int newMax = 0;
|
507
|
+
Debug.Assert( pBt != null );
|
508
|
+
if ( zRight != null )
|
509
|
+
{
|
510
|
+
newMax = atoi( zRight );
|
511
|
+
}
|
512
|
+
if ( ALWAYS( pBt ) )
|
513
|
+
{
|
514
|
+
newMax = (int)sqlite3BtreeMaxPageCount( pBt, newMax );
|
515
|
+
}
|
516
|
+
returnSingleInt( pParse, "max_page_count", newMax );
|
517
|
+
}
|
518
|
+
else
|
519
|
+
|
520
|
+
/*
|
521
|
+
** PRAGMA [database.]secure_delete
|
522
|
+
** PRAGMA [database.]secure_delete=ON/OFF
|
523
|
+
**
|
524
|
+
** The first form reports the current setting for the
|
525
|
+
** secure_delete flag. The second form changes the secure_delete
|
526
|
+
** flag setting and reports thenew value.
|
527
|
+
*/
|
528
|
+
if (sqlite3StrICmp(zLeft, "secure_delete") == 0)
|
529
|
+
{
|
530
|
+
Btree pBt = pDb.pBt;
|
531
|
+
int b = -1;
|
532
|
+
Debug.Assert(pBt != null);
|
533
|
+
if (zRight != null)
|
534
|
+
{
|
535
|
+
b = getBoolean(zRight);
|
536
|
+
}
|
537
|
+
if (pId2.n == 0 && b >= 0)
|
538
|
+
{
|
539
|
+
int ii;
|
540
|
+
for (ii = 0; ii < db.nDb; ii++)
|
541
|
+
{
|
542
|
+
sqlite3BtreeSecureDelete(db.aDb[ii].pBt, b);
|
543
|
+
}
|
544
|
+
}
|
545
|
+
b = sqlite3BtreeSecureDelete(pBt, b);
|
546
|
+
returnSingleInt(pParse, "secure_delete", b);
|
547
|
+
}
|
548
|
+
|
549
|
+
else
|
550
|
+
/*
|
551
|
+
** PRAGMA [database.]page_count
|
552
|
+
**
|
553
|
+
** Return the number of pages in the specified database.
|
554
|
+
*/
|
555
|
+
if ( sqlite3StrICmp( zLeft, "page_count" ) == 0 )
|
556
|
+
{
|
557
|
+
int iReg;
|
558
|
+
if ( sqlite3ReadSchema( pParse ) != 0 ) goto pragma_out;
|
559
|
+
sqlite3CodeVerifySchema( pParse, iDb );
|
560
|
+
iReg = ++pParse.nMem;
|
561
|
+
sqlite3VdbeAddOp2( v, OP_Pagecount, iDb, iReg );
|
562
|
+
sqlite3VdbeAddOp2( v, OP_ResultRow, iReg, 1 );
|
563
|
+
sqlite3VdbeSetNumCols( v, 1 );
|
564
|
+
sqlite3VdbeSetColName( v, 0, COLNAME_NAME, "page_count", SQLITE_STATIC );
|
565
|
+
}
|
566
|
+
else
|
567
|
+
|
568
|
+
/*
|
569
|
+
** PRAGMA [database.]page_count
|
570
|
+
**
|
571
|
+
** Return the number of pages in the specified database.
|
572
|
+
*/
|
573
|
+
if ( zLeft == "page_count" )
|
574
|
+
{
|
575
|
+
Vdbe _v;
|
576
|
+
int iReg;
|
577
|
+
_v = sqlite3GetVdbe( pParse );
|
578
|
+
if ( _v == null || sqlite3ReadSchema( pParse ) != 0 ) goto pragma_out;
|
579
|
+
sqlite3CodeVerifySchema( pParse, iDb );
|
580
|
+
iReg = ++pParse.nMem;
|
581
|
+
sqlite3VdbeAddOp2( _v, OP_Pagecount, iDb, iReg );
|
582
|
+
sqlite3VdbeAddOp2( _v, OP_ResultRow, iReg, 1 );
|
583
|
+
sqlite3VdbeSetNumCols( _v, 1 );
|
584
|
+
sqlite3VdbeSetColName( _v, 0, COLNAME_NAME, "page_count", SQLITE_STATIC );
|
585
|
+
}
|
586
|
+
else
|
587
|
+
|
588
|
+
/*
|
589
|
+
** PRAGMA [database.]locking_mode
|
590
|
+
** PRAGMA [database.]locking_mode = (normal|exclusive)
|
591
|
+
*/
|
592
|
+
if ( sqlite3StrICmp( zLeft, "locking_mode" ) == 0 )
|
593
|
+
{
|
594
|
+
string zRet = "normal";
|
595
|
+
int eMode = getLockingMode( zRight );
|
596
|
+
|
597
|
+
if ( pId2.n == 0 && eMode == PAGER_LOCKINGMODE_QUERY )
|
598
|
+
{
|
599
|
+
/* Simple "PRAGMA locking_mode;" statement. This is a query for
|
600
|
+
** the current default locking mode (which may be different to
|
601
|
+
** the locking-mode of the main database).
|
602
|
+
*/
|
603
|
+
eMode = db.dfltLockMode;
|
604
|
+
}
|
605
|
+
else
|
606
|
+
{
|
607
|
+
Pager pPager;
|
608
|
+
if ( pId2.n == 0 )
|
609
|
+
{
|
610
|
+
/* This indicates that no database name was specified as part
|
611
|
+
** of the PRAGMA command. In this case the locking-mode must be
|
612
|
+
** set on all attached databases, as well as the main db file.
|
613
|
+
**
|
614
|
+
** Also, the sqlite3.dfltLockMode variable is set so that
|
615
|
+
** any subsequently attached databases also use the specified
|
616
|
+
** locking mode.
|
617
|
+
*/
|
618
|
+
int ii;
|
619
|
+
Debug.Assert( pDb == db.aDb[0] );
|
620
|
+
for ( ii = 2; ii < db.nDb; ii++ )
|
621
|
+
{
|
622
|
+
pPager = sqlite3BtreePager( db.aDb[ii].pBt );
|
623
|
+
sqlite3PagerLockingMode( pPager, eMode );
|
624
|
+
}
|
625
|
+
db.dfltLockMode = (u8)eMode;
|
626
|
+
}
|
627
|
+
pPager = sqlite3BtreePager( pDb.pBt );
|
628
|
+
eMode = sqlite3PagerLockingMode( pPager, eMode ) ? 1 : 0;
|
629
|
+
}
|
630
|
+
|
631
|
+
Debug.Assert( eMode == PAGER_LOCKINGMODE_NORMAL || eMode == PAGER_LOCKINGMODE_EXCLUSIVE );
|
632
|
+
if ( eMode == PAGER_LOCKINGMODE_EXCLUSIVE )
|
633
|
+
{
|
634
|
+
zRet = "exclusive";
|
635
|
+
}
|
636
|
+
sqlite3VdbeSetNumCols( v, 1 );
|
637
|
+
sqlite3VdbeSetColName( v, 0, COLNAME_NAME, "locking_mode", SQLITE_STATIC );
|
638
|
+
sqlite3VdbeAddOp4( v, OP_String8, 0, 1, 0, zRet, 0 );
|
639
|
+
sqlite3VdbeAddOp2( v, OP_ResultRow, 1, 1 );
|
640
|
+
}
|
641
|
+
else
|
642
|
+
/*
|
643
|
+
** PRAGMA [database.]journal_mode
|
644
|
+
** PRAGMA [database.]journal_mode = (delete|persist|off|truncate|memory)
|
645
|
+
*/
|
646
|
+
if ( zLeft == "journal_mode" )
|
647
|
+
{
|
648
|
+
int eMode;
|
649
|
+
string[] azModeName = new string[] {
|
650
|
+
"delete", "persist", "off", "truncate", "memory"
|
651
|
+
};
|
652
|
+
|
653
|
+
if ( null == zRight )
|
654
|
+
{
|
655
|
+
eMode = PAGER_JOURNALMODE_QUERY;
|
656
|
+
}
|
657
|
+
else
|
658
|
+
{
|
659
|
+
int n = sqlite3Strlen30( zRight );
|
660
|
+
eMode = azModeName.Length - 1;//sizeof(azModeName)/sizeof(azModeName[0]) - 1;
|
661
|
+
while (eMode >= 0 && String.Compare(zRight, azModeName[eMode], StringComparison.InvariantCultureIgnoreCase) != 0)
|
662
|
+
{
|
663
|
+
eMode--;
|
664
|
+
}
|
665
|
+
}
|
666
|
+
if ( pId2.n == 0 && eMode == PAGER_JOURNALMODE_QUERY )
|
667
|
+
{
|
668
|
+
/* Simple "PRAGMA journal_mode;" statement. This is a query for
|
669
|
+
** the current default journal mode (which may be different to
|
670
|
+
** the journal-mode of the main database).
|
671
|
+
*/
|
672
|
+
eMode = db.dfltJournalMode;
|
673
|
+
}
|
674
|
+
else
|
675
|
+
{
|
676
|
+
Pager pPager;
|
677
|
+
if ( pId2.n == 0 )
|
678
|
+
{
|
679
|
+
/* This indicates that no database name was specified as part
|
680
|
+
** of the PRAGMA command. In this case the journal-mode must be
|
681
|
+
** set on all attached databases, as well as the main db file.
|
682
|
+
**
|
683
|
+
** Also, the sqlite3.dfltJournalMode variable is set so that
|
684
|
+
** any subsequently attached databases also use the specified
|
685
|
+
** journal mode.
|
686
|
+
*/
|
687
|
+
int ii;
|
688
|
+
Debug.Assert( pDb == db.aDb[0] );
|
689
|
+
for ( ii = 1; ii < db.nDb; ii++ )
|
690
|
+
{
|
691
|
+
if ( db.aDb[ii].pBt != null )
|
692
|
+
{
|
693
|
+
pPager = sqlite3BtreePager( db.aDb[ii].pBt );
|
694
|
+
sqlite3PagerJournalMode( pPager, eMode );
|
695
|
+
}
|
696
|
+
}
|
697
|
+
db.dfltJournalMode = (u8)eMode;
|
698
|
+
}
|
699
|
+
pPager = sqlite3BtreePager( pDb.pBt );
|
700
|
+
eMode = sqlite3PagerJournalMode( pPager, eMode );
|
701
|
+
}
|
702
|
+
Debug.Assert( eMode == PAGER_JOURNALMODE_DELETE
|
703
|
+
|| eMode == PAGER_JOURNALMODE_TRUNCATE
|
704
|
+
|| eMode == PAGER_JOURNALMODE_PERSIST
|
705
|
+
|| eMode == PAGER_JOURNALMODE_OFF
|
706
|
+
|| eMode == PAGER_JOURNALMODE_MEMORY );
|
707
|
+
sqlite3VdbeSetNumCols( v, 1 );
|
708
|
+
sqlite3VdbeSetColName( v, 0, COLNAME_NAME, "journal_mode", SQLITE_STATIC );
|
709
|
+
sqlite3VdbeAddOp4( v, OP_String8, 0, 1, 0,
|
710
|
+
azModeName[eMode], P4_STATIC );
|
711
|
+
sqlite3VdbeAddOp2( v, OP_ResultRow, 1, 1 );
|
712
|
+
}
|
713
|
+
else
|
714
|
+
|
715
|
+
/*
|
716
|
+
** PRAGMA [database.]journal_size_limit
|
717
|
+
** PRAGMA [database.]journal_size_limit=N
|
718
|
+
**
|
719
|
+
** Get or set the size limit on rollback journal files.
|
720
|
+
*/
|
721
|
+
if ( sqlite3StrICmp( zLeft, "journal_size_limit" ) == 0 )
|
722
|
+
{
|
723
|
+
Pager pPager = sqlite3BtreePager( pDb.pBt );
|
724
|
+
i64 iLimit = -2;
|
725
|
+
if ( !String.IsNullOrEmpty( zRight ) )
|
726
|
+
{
|
727
|
+
sqlite3Atoi64( zRight, ref iLimit );
|
728
|
+
if ( iLimit < -1 ) iLimit = -1;
|
729
|
+
}
|
730
|
+
iLimit = sqlite3PagerJournalSizeLimit( pPager, iLimit );
|
731
|
+
returnSingleInt( pParse, "journal_size_limit", iLimit );
|
732
|
+
}
|
733
|
+
else
|
734
|
+
|
735
|
+
#endif // * SQLITE_OMIT_PAGER_PRAGMAS */
|
736
|
+
|
737
|
+
/*
|
738
|
+
** PRAGMA [database.]auto_vacuum
|
739
|
+
** PRAGMA [database.]auto_vacuum=N
|
740
|
+
**
|
741
|
+
** Get or set the value of the database 'auto-vacuum' parameter.
|
742
|
+
** The value is one of: 0 NONE 1 FULL 2 INCREMENTAL
|
743
|
+
*/
|
744
|
+
#if !SQLITE_OMIT_AUTOVACUUM
|
745
|
+
if ( sqlite3StrICmp( zLeft, "auto_vacuum" ) == 0 )
|
746
|
+
{
|
747
|
+
Btree pBt = pDb.pBt;
|
748
|
+
Debug.Assert( pBt != null );
|
749
|
+
if ( sqlite3ReadSchema( pParse ) != 0 )
|
750
|
+
{
|
751
|
+
goto pragma_out;
|
752
|
+
}
|
753
|
+
if ( null == zRight )
|
754
|
+
{
|
755
|
+
int auto_vacuum;
|
756
|
+
if ( ALWAYS( pBt ) )
|
757
|
+
{
|
758
|
+
auto_vacuum = sqlite3BtreeGetAutoVacuum( pBt );
|
759
|
+
}
|
760
|
+
else
|
761
|
+
{
|
762
|
+
auto_vacuum = SQLITE_DEFAULT_AUTOVACUUM;
|
763
|
+
}
|
764
|
+
returnSingleInt( pParse, "auto_vacuum", auto_vacuum );
|
765
|
+
}
|
766
|
+
else
|
767
|
+
{
|
768
|
+
int eAuto = getAutoVacuum( zRight );
|
769
|
+
Debug.Assert( eAuto >= 0 && eAuto <= 2 );
|
770
|
+
db.nextAutovac = (u8)eAuto;
|
771
|
+
if ( ALWAYS( eAuto >= 0 ) )
|
772
|
+
{
|
773
|
+
/* Call SetAutoVacuum() to set initialize the internal auto and
|
774
|
+
** incr-vacuum flags. This is required in case this connection
|
775
|
+
** creates the database file. It is important that it is created
|
776
|
+
** as an auto-vacuum capable db.
|
777
|
+
*/
|
778
|
+
int rc = sqlite3BtreeSetAutoVacuum( pBt, eAuto );
|
779
|
+
if ( rc == SQLITE_OK && ( eAuto == 1 || eAuto == 2 ) )
|
780
|
+
{
|
781
|
+
/* When setting the auto_vacuum mode to either "full" or
|
782
|
+
** "incremental", write the value of meta[6] in the database
|
783
|
+
** file. Before writing to meta[6], check that meta[3] indicates
|
784
|
+
** that this really is an auto-vacuum capable database.
|
785
|
+
*/
|
786
|
+
VdbeOpList[] setMeta6 = new VdbeOpList[] {
|
787
|
+
new VdbeOpList( OP_Transaction, 0, 1, 0), /* 0 */
|
788
|
+
new VdbeOpList( OP_ReadCookie, 0, 1, BTREE_LARGEST_ROOT_PAGE), /* 1 */
|
789
|
+
new VdbeOpList( OP_If, 1, 0, 0), /* 2 */
|
790
|
+
new VdbeOpList( OP_Halt, SQLITE_OK, OE_Abort, 0), /* 3 */
|
791
|
+
new VdbeOpList( OP_Integer, 0, 1, 0), /* 4 */
|
792
|
+
new VdbeOpList( OP_SetCookie, 0, BTREE_INCR_VACUUM, 1), /* 5 */
|
793
|
+
};
|
794
|
+
int iAddr;
|
795
|
+
iAddr = sqlite3VdbeAddOpList( v, ArraySize( setMeta6 ), setMeta6 );
|
796
|
+
sqlite3VdbeChangeP1( v, iAddr, iDb );
|
797
|
+
sqlite3VdbeChangeP1( v, iAddr + 1, iDb );
|
798
|
+
sqlite3VdbeChangeP2( v, iAddr + 2, iAddr + 4 );
|
799
|
+
sqlite3VdbeChangeP1( v, iAddr + 4, eAuto - 1 );
|
800
|
+
sqlite3VdbeChangeP1( v, iAddr + 5, iDb );
|
801
|
+
sqlite3VdbeUsesBtree( v, iDb );
|
802
|
+
}
|
803
|
+
}
|
804
|
+
}
|
805
|
+
}
|
806
|
+
else
|
807
|
+
#endif
|
808
|
+
|
809
|
+
/*
|
810
|
+
** PRAGMA [database.]incremental_vacuum(N)
|
811
|
+
**
|
812
|
+
** Do N steps of incremental vacuuming on a database.
|
813
|
+
*/
|
814
|
+
#if !SQLITE_OMIT_AUTOVACUUM
|
815
|
+
if ( sqlite3StrICmp( zLeft, "incremental_vacuum" ) == 0 )
|
816
|
+
{
|
817
|
+
int iLimit = 0, addr;
|
818
|
+
if ( sqlite3ReadSchema( pParse ) != 0 )
|
819
|
+
{
|
820
|
+
goto pragma_out;
|
821
|
+
}
|
822
|
+
if ( zRight == null || !sqlite3GetInt32( zRight, ref iLimit ) || iLimit <= 0 )
|
823
|
+
{
|
824
|
+
iLimit = 0x7fffffff;
|
825
|
+
}
|
826
|
+
sqlite3BeginWriteOperation( pParse, 0, iDb );
|
827
|
+
sqlite3VdbeAddOp2( v, OP_Integer, iLimit, 1 );
|
828
|
+
addr = sqlite3VdbeAddOp1( v, OP_IncrVacuum, iDb );
|
829
|
+
sqlite3VdbeAddOp1( v, OP_ResultRow, 1 );
|
830
|
+
sqlite3VdbeAddOp2( v, OP_AddImm, 1, -1 );
|
831
|
+
sqlite3VdbeAddOp2( v, OP_IfPos, 1, addr );
|
832
|
+
sqlite3VdbeJumpHere( v, addr );
|
833
|
+
}
|
834
|
+
else
|
835
|
+
#endif
|
836
|
+
|
837
|
+
#if !SQLITE_OMIT_PAGER_PRAGMAS
|
838
|
+
/*
|
839
|
+
** PRAGMA [database.]cache_size
|
840
|
+
** PRAGMA [database.]cache_size=N
|
841
|
+
**
|
842
|
+
** The first form reports the current local setting for the
|
843
|
+
** page cache size. The local setting can be different from
|
844
|
+
** the persistent cache size value that is stored in the database
|
845
|
+
** file itself. The value returned is the maximum number of
|
846
|
+
** pages in the page cache. The second form sets the local
|
847
|
+
** page cache size value. It does not change the persistent
|
848
|
+
** cache size stored on the disk so the cache size will revert
|
849
|
+
** to its default value when the database is closed and reopened.
|
850
|
+
** N should be a positive integer.
|
851
|
+
*/
|
852
|
+
if ( sqlite3StrICmp( zLeft, "cache_size" ) == 0 )
|
853
|
+
{
|
854
|
+
if ( sqlite3ReadSchema( pParse ) != 0 ) goto pragma_out;
|
855
|
+
if ( null == zRight )
|
856
|
+
{
|
857
|
+
returnSingleInt( pParse, "cache_size", pDb.pSchema.cache_size );
|
858
|
+
}
|
859
|
+
else
|
860
|
+
{
|
861
|
+
int size = atoi( zRight );
|
862
|
+
if ( size < 0 ) size = -size;
|
863
|
+
pDb.pSchema.cache_size = size;
|
864
|
+
sqlite3BtreeSetCacheSize( pDb.pBt, pDb.pSchema.cache_size );
|
865
|
+
}
|
866
|
+
}
|
867
|
+
else
|
868
|
+
|
869
|
+
/*
|
870
|
+
** PRAGMA temp_store
|
871
|
+
** PRAGMA temp_store = "default"|"memory"|"file"
|
872
|
+
**
|
873
|
+
** Return or set the local value of the temp_store flag. Changing
|
874
|
+
** the local value does not make changes to the disk file and the default
|
875
|
+
** value will be restored the next time the database is opened.
|
876
|
+
**
|
877
|
+
** Note that it is possible for the library compile-time options to
|
878
|
+
** override this setting
|
879
|
+
*/
|
880
|
+
if ( sqlite3StrICmp( zLeft, "temp_store" ) == 0 )
|
881
|
+
{
|
882
|
+
if ( zRight == null )
|
883
|
+
{
|
884
|
+
returnSingleInt( pParse, "temp_store", db.temp_store );
|
885
|
+
}
|
886
|
+
else
|
887
|
+
{
|
888
|
+
changeTempStorage( pParse, zRight );
|
889
|
+
}
|
890
|
+
}
|
891
|
+
else
|
892
|
+
|
893
|
+
/*
|
894
|
+
** PRAGMA temp_store_directory
|
895
|
+
** PRAGMA temp_store_directory = ""|"directory_name"
|
896
|
+
**
|
897
|
+
** Return or set the local value of the temp_store_directory flag. Changing
|
898
|
+
** the value sets a specific directory to be used for temporary files.
|
899
|
+
** Setting to a null string reverts to the default temporary directory search.
|
900
|
+
** If temporary directory is changed, then invalidateTempStorage.
|
901
|
+
**
|
902
|
+
*/
|
903
|
+
if ( sqlite3StrICmp( zLeft, "temp_store_directory" ) == 0 )
|
904
|
+
{
|
905
|
+
if ( null == zRight )
|
906
|
+
{
|
907
|
+
if ( sqlite3_temp_directory != "" )
|
908
|
+
{
|
909
|
+
sqlite3VdbeSetNumCols( v, 1 );
|
910
|
+
sqlite3VdbeSetColName( v, 0, COLNAME_NAME,
|
911
|
+
"temp_store_directory", SQLITE_STATIC );
|
912
|
+
sqlite3VdbeAddOp4( v, OP_String8, 0, 1, 0, sqlite3_temp_directory, 0 );
|
913
|
+
sqlite3VdbeAddOp2( v, OP_ResultRow, 1, 1 );
|
914
|
+
}
|
915
|
+
}
|
916
|
+
else
|
917
|
+
{
|
918
|
+
#if !SQLITE_OMIT_WSD
|
919
|
+
if ( zRight.Length > 0 )
|
920
|
+
{
|
921
|
+
int rc;
|
922
|
+
int res = 0;
|
923
|
+
rc = sqlite3OsAccess( db.pVfs, zRight, SQLITE_ACCESS_READWRITE, ref res );
|
924
|
+
if ( rc != SQLITE_OK || res == 0 )
|
925
|
+
{
|
926
|
+
sqlite3ErrorMsg( pParse, "not a writable directory" );
|
927
|
+
goto pragma_out;
|
928
|
+
}
|
929
|
+
}
|
930
|
+
if ( SQLITE_TEMP_STORE == 0
|
931
|
+
|| ( SQLITE_TEMP_STORE == 1 && db.temp_store <= 1 )
|
932
|
+
|| ( SQLITE_TEMP_STORE == 2 && db.temp_store == 1 )
|
933
|
+
)
|
934
|
+
{
|
935
|
+
invalidateTempStorage( pParse );
|
936
|
+
}
|
937
|
+
//sqlite3_free( ref sqlite3_temp_directory );
|
938
|
+
if ( zRight.Length > 0 )
|
939
|
+
{
|
940
|
+
sqlite3_temp_directory = zRight;//sqlite3DbStrDup(0, zRight);
|
941
|
+
}
|
942
|
+
else
|
943
|
+
{
|
944
|
+
sqlite3_temp_directory = "";
|
945
|
+
}
|
946
|
+
#endif //* SQLITE_OMIT_WSD */
|
947
|
+
}
|
948
|
+
}
|
949
|
+
else
|
950
|
+
|
951
|
+
#if !(SQLITE_ENABLE_LOCKING_STYLE)
|
952
|
+
# if (__APPLE__)
|
953
|
+
//# define SQLITE_ENABLE_LOCKING_STYLE 1
|
954
|
+
# else
|
955
|
+
//# define SQLITE_ENABLE_LOCKING_STYLE 0
|
956
|
+
# endif
|
957
|
+
#endif
|
958
|
+
#if SQLITE_ENABLE_LOCKING_STYLE
|
959
|
+
/*
|
960
|
+
** PRAGMA [database.]lock_proxy_file
|
961
|
+
** PRAGMA [database.]lock_proxy_file = ":auto:"|"lock_file_path"
|
962
|
+
**
|
963
|
+
** Return or set the value of the lock_proxy_file flag. Changing
|
964
|
+
** the value sets a specific file to be used for database access locks.
|
965
|
+
**
|
966
|
+
*/
|
967
|
+
if ( sqlite3StrICmp( zLeft, "lock_proxy_file" ) == 0 )
|
968
|
+
{
|
969
|
+
if ( zRight !="")
|
970
|
+
{
|
971
|
+
Pager pPager = sqlite3BtreePager( pDb.pBt );
|
972
|
+
int proxy_file_path = 0;
|
973
|
+
sqlite3_file pFile = sqlite3PagerFile( pPager );
|
974
|
+
sqlite3OsFileControl( pFile, SQLITE_GET_LOCKPROXYFILE,
|
975
|
+
ref proxy_file_path );
|
976
|
+
|
977
|
+
if ( proxy_file_path!=0 )
|
978
|
+
{
|
979
|
+
sqlite3VdbeSetNumCols( v, 1 );
|
980
|
+
sqlite3VdbeSetColName( v, 0, COLNAME_NAME,
|
981
|
+
"lock_proxy_file", SQLITE_STATIC );
|
982
|
+
sqlite3VdbeAddOp4( v, OP_String8, 0, 1, 0, proxy_file_path, 0 );
|
983
|
+
sqlite3VdbeAddOp2( v, OP_ResultRow, 1, 1 );
|
984
|
+
}
|
985
|
+
}
|
986
|
+
else
|
987
|
+
{
|
988
|
+
Pager pPager = sqlite3BtreePager( pDb.pBt );
|
989
|
+
sqlite3_file pFile = sqlite3PagerFile( pPager );
|
990
|
+
int res;
|
991
|
+
int iDummy = 0;
|
992
|
+
if ( zRight[0]!=0 )
|
993
|
+
{
|
994
|
+
iDummy = zRight[0];
|
995
|
+
res = sqlite3OsFileControl( pFile, SQLITE_SET_LOCKPROXYFILE,
|
996
|
+
ref iDummy );
|
997
|
+
}
|
998
|
+
else
|
999
|
+
{
|
1000
|
+
res = sqlite3OsFileControl( pFile, SQLITE_SET_LOCKPROXYFILE,
|
1001
|
+
ref iDummy );
|
1002
|
+
}
|
1003
|
+
if ( res != SQLITE_OK )
|
1004
|
+
{
|
1005
|
+
sqlite3ErrorMsg( pParse, "failed to set lock proxy file" );
|
1006
|
+
goto pragma_out;
|
1007
|
+
}
|
1008
|
+
}
|
1009
|
+
}
|
1010
|
+
else
|
1011
|
+
#endif //* SQLITE_ENABLE_LOCKING_STYLE */
|
1012
|
+
|
1013
|
+
/*
|
1014
|
+
** PRAGMA [database.]synchronous
|
1015
|
+
** PRAGMA [database.]synchronous=OFF|ON|NORMAL|FULL
|
1016
|
+
**
|
1017
|
+
** Return or set the local value of the synchronous flag. Changing
|
1018
|
+
** the local value does not make changes to the disk file and the
|
1019
|
+
** default value will be restored the next time the database is
|
1020
|
+
** opened.
|
1021
|
+
*/
|
1022
|
+
if ( sqlite3StrICmp( zLeft, "synchronous" ) == 0 )
|
1023
|
+
{
|
1024
|
+
if ( sqlite3ReadSchema( pParse ) != 0 ) goto pragma_out;
|
1025
|
+
if ( null == zRight )
|
1026
|
+
{
|
1027
|
+
returnSingleInt( pParse, "synchronous", pDb.safety_level - 1 );
|
1028
|
+
}
|
1029
|
+
else
|
1030
|
+
{
|
1031
|
+
if ( 0 == db.autoCommit )
|
1032
|
+
{
|
1033
|
+
sqlite3ErrorMsg( pParse,
|
1034
|
+
"Safety level may not be changed inside a transaction" );
|
1035
|
+
}
|
1036
|
+
else
|
1037
|
+
{
|
1038
|
+
pDb.safety_level = (byte)( getSafetyLevel( zRight ) + 1 );
|
1039
|
+
}
|
1040
|
+
}
|
1041
|
+
}
|
1042
|
+
else
|
1043
|
+
#endif // * SQLITE_OMIT_PAGER_PRAGMAS */
|
1044
|
+
|
1045
|
+
#if !SQLITE_OMIT_FLAG_PRAGMAS
|
1046
|
+
if ( flagPragma( pParse, zLeft, zRight ) != 0 )
|
1047
|
+
{
|
1048
|
+
/* The flagPragma() subroutine also generates any necessary code
|
1049
|
+
** there is nothing more to do here */
|
1050
|
+
}
|
1051
|
+
else
|
1052
|
+
#endif // * SQLITE_OMIT_FLAG_PRAGMAS */
|
1053
|
+
|
1054
|
+
#if !SQLITE_OMIT_SCHEMA_PRAGMAS
|
1055
|
+
/*
|
1056
|
+
** PRAGMA table_info(<table>)
|
1057
|
+
**
|
1058
|
+
** Return a single row for each column of the named table. The columns of
|
1059
|
+
** the returned data set are:
|
1060
|
+
**
|
1061
|
+
** cid: Column id (numbered from left to right, starting at 0)
|
1062
|
+
** name: Column name
|
1063
|
+
** type: Column declaration type.
|
1064
|
+
** notnull: True if 'NOT NULL' is part of column declaration
|
1065
|
+
** dflt_value: The default value for the column, if any.
|
1066
|
+
*/
|
1067
|
+
if ( sqlite3StrICmp( zLeft, "table_info" ) == 0 && zRight != null )
|
1068
|
+
{
|
1069
|
+
Table pTab;
|
1070
|
+
if ( sqlite3ReadSchema( pParse ) != 0 ) goto pragma_out;
|
1071
|
+
pTab = sqlite3FindTable( db, zRight, zDb );
|
1072
|
+
if ( pTab != null )
|
1073
|
+
{
|
1074
|
+
int i;
|
1075
|
+
int nHidden = 0;
|
1076
|
+
Column pCol;
|
1077
|
+
sqlite3VdbeSetNumCols( v, 6 );
|
1078
|
+
pParse.nMem = 6;
|
1079
|
+
sqlite3VdbeSetColName( v, 0, COLNAME_NAME, "cid", SQLITE_STATIC );
|
1080
|
+
sqlite3VdbeSetColName( v, 1, COLNAME_NAME, "name", SQLITE_STATIC );
|
1081
|
+
sqlite3VdbeSetColName( v, 2, COLNAME_NAME, "type", SQLITE_STATIC );
|
1082
|
+
sqlite3VdbeSetColName( v, 3, COLNAME_NAME, "notnull", SQLITE_STATIC );
|
1083
|
+
sqlite3VdbeSetColName( v, 4, COLNAME_NAME, "dflt_value", SQLITE_STATIC );
|
1084
|
+
sqlite3VdbeSetColName( v, 5, COLNAME_NAME, "pk", SQLITE_STATIC );
|
1085
|
+
sqlite3ViewGetColumnNames( pParse, pTab );
|
1086
|
+
for ( i = 0; i < pTab.nCol; i++ )//, pCol++)
|
1087
|
+
{
|
1088
|
+
pCol = pTab.aCol[i];
|
1089
|
+
if ( IsHiddenColumn( pCol ) )
|
1090
|
+
{
|
1091
|
+
nHidden++;
|
1092
|
+
continue;
|
1093
|
+
}
|
1094
|
+
sqlite3VdbeAddOp2( v, OP_Integer, i - nHidden, 1 );
|
1095
|
+
sqlite3VdbeAddOp4( v, OP_String8, 0, 2, 0, pCol.zName, 0 );
|
1096
|
+
sqlite3VdbeAddOp4( v, OP_String8, 0, 3, 0,
|
1097
|
+
pCol.zType != null ? pCol.zType : "", 0 );
|
1098
|
+
sqlite3VdbeAddOp2( v, OP_Integer, ( pCol.notNull != 0 ? 1 : 0 ), 4 );
|
1099
|
+
if ( pCol.zDflt != null )
|
1100
|
+
{
|
1101
|
+
sqlite3VdbeAddOp4( v, OP_String8, 0, 5, 0, pCol.zDflt, 0 );
|
1102
|
+
}
|
1103
|
+
else
|
1104
|
+
{
|
1105
|
+
sqlite3VdbeAddOp2( v, OP_Null, 0, 5 );
|
1106
|
+
}
|
1107
|
+
sqlite3VdbeAddOp2( v, OP_Integer, pCol.isPrimKey != 0 ? 1 : 0, 6 );
|
1108
|
+
sqlite3VdbeAddOp2( v, OP_ResultRow, 1, 6 );
|
1109
|
+
}
|
1110
|
+
}
|
1111
|
+
}
|
1112
|
+
else
|
1113
|
+
|
1114
|
+
if ( sqlite3StrICmp( zLeft, "index_info" ) == 0 && zRight != null )
|
1115
|
+
{
|
1116
|
+
Index pIdx;
|
1117
|
+
Table pTab;
|
1118
|
+
if ( sqlite3ReadSchema( pParse ) != 0 ) goto pragma_out;
|
1119
|
+
pIdx = sqlite3FindIndex( db, zRight, zDb );
|
1120
|
+
if ( pIdx != null )
|
1121
|
+
{
|
1122
|
+
int i;
|
1123
|
+
pTab = pIdx.pTable;
|
1124
|
+
sqlite3VdbeSetNumCols( v, 3 );
|
1125
|
+
pParse.nMem = 3;
|
1126
|
+
sqlite3VdbeSetColName( v, 0, COLNAME_NAME, "seqno", SQLITE_STATIC );
|
1127
|
+
sqlite3VdbeSetColName( v, 1, COLNAME_NAME, "cid", SQLITE_STATIC );
|
1128
|
+
sqlite3VdbeSetColName( v, 2, COLNAME_NAME, "name", SQLITE_STATIC );
|
1129
|
+
for ( i = 0; i < pIdx.nColumn; i++ )
|
1130
|
+
{
|
1131
|
+
int cnum = pIdx.aiColumn[i];
|
1132
|
+
sqlite3VdbeAddOp2( v, OP_Integer, i, 1 );
|
1133
|
+
sqlite3VdbeAddOp2( v, OP_Integer, cnum, 2 );
|
1134
|
+
Debug.Assert( pTab.nCol > cnum );
|
1135
|
+
sqlite3VdbeAddOp4( v, OP_String8, 0, 3, 0, pTab.aCol[cnum].zName, 0 );
|
1136
|
+
sqlite3VdbeAddOp2( v, OP_ResultRow, 1, 3 );
|
1137
|
+
}
|
1138
|
+
}
|
1139
|
+
}
|
1140
|
+
else
|
1141
|
+
|
1142
|
+
if ( sqlite3StrICmp( zLeft, "index_list" ) == 0 && zRight != null )
|
1143
|
+
{
|
1144
|
+
Index pIdx;
|
1145
|
+
Table pTab;
|
1146
|
+
if ( sqlite3ReadSchema( pParse ) != 0 ) goto pragma_out;
|
1147
|
+
pTab = sqlite3FindTable( db, zRight, zDb );
|
1148
|
+
if ( pTab != null )
|
1149
|
+
{
|
1150
|
+
v = sqlite3GetVdbe( pParse );
|
1151
|
+
pIdx = pTab.pIndex;
|
1152
|
+
if ( pIdx != null )
|
1153
|
+
{
|
1154
|
+
int i = 0;
|
1155
|
+
sqlite3VdbeSetNumCols( v, 3 );
|
1156
|
+
pParse.nMem = 3;
|
1157
|
+
sqlite3VdbeSetColName( v, 0, COLNAME_NAME, "seq", SQLITE_STATIC );
|
1158
|
+
sqlite3VdbeSetColName( v, 1, COLNAME_NAME, "name", SQLITE_STATIC );
|
1159
|
+
sqlite3VdbeSetColName( v, 2, COLNAME_NAME, "unique", SQLITE_STATIC );
|
1160
|
+
while ( pIdx != null )
|
1161
|
+
{
|
1162
|
+
sqlite3VdbeAddOp2( v, OP_Integer, i, 1 );
|
1163
|
+
sqlite3VdbeAddOp4( v, OP_String8, 0, 2, 0, pIdx.zName, 0 );
|
1164
|
+
sqlite3VdbeAddOp2( v, OP_Integer, ( pIdx.onError != OE_None ) ? 1 : 0, 3 );
|
1165
|
+
sqlite3VdbeAddOp2( v, OP_ResultRow, 1, 3 );
|
1166
|
+
++i;
|
1167
|
+
pIdx = pIdx.pNext;
|
1168
|
+
}
|
1169
|
+
}
|
1170
|
+
}
|
1171
|
+
}
|
1172
|
+
else
|
1173
|
+
|
1174
|
+
if ( sqlite3StrICmp( zLeft, "database_list" ) == 0 )
|
1175
|
+
{
|
1176
|
+
int i;
|
1177
|
+
if ( sqlite3ReadSchema( pParse ) != 0 ) goto pragma_out;
|
1178
|
+
sqlite3VdbeSetNumCols( v, 3 );
|
1179
|
+
pParse.nMem = 3;
|
1180
|
+
sqlite3VdbeSetColName( v, 0, COLNAME_NAME, "seq", SQLITE_STATIC );
|
1181
|
+
sqlite3VdbeSetColName( v, 1, COLNAME_NAME, "name", SQLITE_STATIC );
|
1182
|
+
sqlite3VdbeSetColName( v, 2, COLNAME_NAME, "file", SQLITE_STATIC );
|
1183
|
+
for ( i = 0; i < db.nDb; i++ )
|
1184
|
+
{
|
1185
|
+
if ( db.aDb[i].pBt == null ) continue;
|
1186
|
+
Debug.Assert( db.aDb[i].zName != null );
|
1187
|
+
sqlite3VdbeAddOp2( v, OP_Integer, i, 1 );
|
1188
|
+
sqlite3VdbeAddOp4( v, OP_String8, 0, 2, 0, db.aDb[i].zName, 0 );
|
1189
|
+
sqlite3VdbeAddOp4( v, OP_String8, 0, 3, 0,
|
1190
|
+
sqlite3BtreeGetFilename( db.aDb[i].pBt ), 0 );
|
1191
|
+
sqlite3VdbeAddOp2( v, OP_ResultRow, 1, 3 );
|
1192
|
+
}
|
1193
|
+
}
|
1194
|
+
else
|
1195
|
+
|
1196
|
+
if ( sqlite3StrICmp( zLeft, "collation_list" ) == 0 )
|
1197
|
+
{
|
1198
|
+
int i = 0;
|
1199
|
+
HashElem p;
|
1200
|
+
sqlite3VdbeSetNumCols( v, 2 );
|
1201
|
+
pParse.nMem = 2;
|
1202
|
+
sqlite3VdbeSetColName( v, 0, COLNAME_NAME, "seq", SQLITE_STATIC );
|
1203
|
+
sqlite3VdbeSetColName( v, 1, COLNAME_NAME, "name", SQLITE_STATIC );
|
1204
|
+
for ( p = db.aCollSeq.first; p != null; p = p.next )//( p = sqliteHashFirst( db.aCollSeq ) ; p; p = sqliteHashNext( p ) )
|
1205
|
+
{
|
1206
|
+
CollSeq pColl = ( (CollSeq[])p.data )[0];// sqliteHashData( p );
|
1207
|
+
sqlite3VdbeAddOp2( v, OP_Integer, i++, 1 );
|
1208
|
+
sqlite3VdbeAddOp4( v, OP_String8, 0, 2, 0, pColl.zName, 0 );
|
1209
|
+
sqlite3VdbeAddOp2( v, OP_ResultRow, 1, 2 );
|
1210
|
+
}
|
1211
|
+
}
|
1212
|
+
else
|
1213
|
+
#endif // * SQLITE_OMIT_SCHEMA_PRAGMAS */
|
1214
|
+
|
1215
|
+
#if !SQLITE_OMIT_FOREIGN_KEY
|
1216
|
+
if ( sqlite3StrICmp( zLeft, "foreign_key_list" ) == 0 && zRight != null )
|
1217
|
+
{
|
1218
|
+
FKey pFK;
|
1219
|
+
Table pTab;
|
1220
|
+
if ( sqlite3ReadSchema( pParse ) != 0 ) goto pragma_out;
|
1221
|
+
pTab = sqlite3FindTable( db, zRight, zDb );
|
1222
|
+
if ( pTab != null )
|
1223
|
+
{
|
1224
|
+
v = sqlite3GetVdbe( pParse );
|
1225
|
+
pFK = pTab.pFKey;
|
1226
|
+
if ( pFK != null )
|
1227
|
+
{
|
1228
|
+
int i = 0;
|
1229
|
+
sqlite3VdbeSetNumCols( v, 8 );
|
1230
|
+
pParse.nMem = 8;
|
1231
|
+
sqlite3VdbeSetColName( v, 0, COLNAME_NAME, "id", SQLITE_STATIC );
|
1232
|
+
sqlite3VdbeSetColName( v, 1, COLNAME_NAME, "seq", SQLITE_STATIC );
|
1233
|
+
sqlite3VdbeSetColName( v, 2, COLNAME_NAME, "table", SQLITE_STATIC );
|
1234
|
+
sqlite3VdbeSetColName( v, 3, COLNAME_NAME, "from", SQLITE_STATIC );
|
1235
|
+
sqlite3VdbeSetColName( v, 4, COLNAME_NAME, "to", SQLITE_STATIC );
|
1236
|
+
sqlite3VdbeSetColName( v, 5, COLNAME_NAME, "on_update", SQLITE_STATIC );
|
1237
|
+
sqlite3VdbeSetColName( v, 6, COLNAME_NAME, "on_delete", SQLITE_STATIC );
|
1238
|
+
sqlite3VdbeSetColName( v, 7, COLNAME_NAME, "match", SQLITE_STATIC );
|
1239
|
+
while ( pFK != null )
|
1240
|
+
{
|
1241
|
+
int j;
|
1242
|
+
for ( j = 0; j < pFK.nCol; j++ )
|
1243
|
+
{
|
1244
|
+
string zCol = pFK.aCol[j].zCol;
|
1245
|
+
string zOnDelete = actionName( pFK.aAction[0] );
|
1246
|
+
string zOnUpdate = actionName( pFK.aAction[1] );
|
1247
|
+
sqlite3VdbeAddOp2( v, OP_Integer, i, 1 );
|
1248
|
+
sqlite3VdbeAddOp2( v, OP_Integer, j, 2 );
|
1249
|
+
sqlite3VdbeAddOp4( v, OP_String8, 0, 3, 0, pFK.zTo, 0 );
|
1250
|
+
sqlite3VdbeAddOp4( v, OP_String8, 0, 4, 0,
|
1251
|
+
pTab.aCol[pFK.aCol[j].iFrom].zName, 0 );
|
1252
|
+
sqlite3VdbeAddOp4( v, zCol != null ? OP_String8 : OP_Null, 0, 5, 0, zCol, 0 );
|
1253
|
+
sqlite3VdbeAddOp4( v, OP_String8, 0, 6, 0, zOnUpdate, 0 );
|
1254
|
+
sqlite3VdbeAddOp4( v, OP_String8, 0, 7, 0, zOnDelete, 0 );
|
1255
|
+
sqlite3VdbeAddOp4( v, OP_String8, 0, 8, 0, "NONE", 0 );
|
1256
|
+
sqlite3VdbeAddOp2( v, OP_ResultRow, 1, 8 );
|
1257
|
+
}
|
1258
|
+
++i;
|
1259
|
+
pFK = pFK.pNextFrom;
|
1260
|
+
}
|
1261
|
+
}
|
1262
|
+
}
|
1263
|
+
}
|
1264
|
+
else
|
1265
|
+
#endif // * !SQLITE_OMIT_FOREIGN_KEY) */
|
1266
|
+
|
1267
|
+
#if !NDEBUG
|
1268
|
+
if ( sqlite3StrICmp( zLeft, "parser_trace" ) == 0 )
|
1269
|
+
{
|
1270
|
+
if ( zRight != null )
|
1271
|
+
{
|
1272
|
+
if ( getBoolean( zRight ) != 0 )
|
1273
|
+
{
|
1274
|
+
sqlite3ParserTrace( Console.Out, "parser: " );
|
1275
|
+
}
|
1276
|
+
else
|
1277
|
+
{
|
1278
|
+
sqlite3ParserTrace( null, "" );
|
1279
|
+
}
|
1280
|
+
}
|
1281
|
+
}
|
1282
|
+
else
|
1283
|
+
#endif
|
1284
|
+
|
1285
|
+
/* Reinstall the LIKE and GLOB functions. The variant of LIKE
|
1286
|
+
** used will be case sensitive or not depending on the RHS.
|
1287
|
+
*/
|
1288
|
+
if ( sqlite3StrICmp( zLeft, "case_sensitive_like" ) == 0 )
|
1289
|
+
{
|
1290
|
+
if ( zRight != null )
|
1291
|
+
{
|
1292
|
+
sqlite3RegisterLikeFunctions( db, getBoolean( zRight ) );
|
1293
|
+
}
|
1294
|
+
}
|
1295
|
+
else
|
1296
|
+
|
1297
|
+
#if !SQLITE_INTEGRITY_CHECK_ERROR_MAX
|
1298
|
+
//const int SQLITE_INTEGRITY_CHECK_ERROR_MAX = 100;
|
1299
|
+
#endif
|
1300
|
+
|
1301
|
+
#if !SQLITE_OMIT_INTEGRITY_CHECK
|
1302
|
+
/* Pragma "quick_check" is an experimental reduced version of
|
1303
|
+
** integrity_check designed to detect most database corruption
|
1304
|
+
** without most of the overhead of a full integrity-check.
|
1305
|
+
*/
|
1306
|
+
if ( sqlite3StrICmp( zLeft, "integrity_check" ) == 0
|
1307
|
+
|| sqlite3StrICmp( zLeft, "quick_check" ) == 0
|
1308
|
+
)
|
1309
|
+
{
|
1310
|
+
const int SQLITE_INTEGRITY_CHECK_ERROR_MAX = 100;
|
1311
|
+
int i, j, addr, mxErr;
|
1312
|
+
|
1313
|
+
/* Code that appears at the end of the integrity check. If no error
|
1314
|
+
** messages have been generated, output OK. Otherwise output the
|
1315
|
+
** error message
|
1316
|
+
*/
|
1317
|
+
VdbeOpList[] endCode = new VdbeOpList[] {
|
1318
|
+
new VdbeOpList( OP_AddImm, 1, 0, 0), /* 0 */
|
1319
|
+
new VdbeOpList( OP_IfNeg, 1, 0, 0), /* 1 */
|
1320
|
+
new VdbeOpList( OP_String8, 0, 3, 0), /* 2 */
|
1321
|
+
new VdbeOpList( OP_ResultRow, 3, 1, 0),
|
1322
|
+
};
|
1323
|
+
|
1324
|
+
bool isQuick = ( zLeft[0] == 'q' );
|
1325
|
+
|
1326
|
+
/* Initialize the VDBE program */
|
1327
|
+
if ( sqlite3ReadSchema( pParse ) != 0 ) goto pragma_out;
|
1328
|
+
pParse.nMem = 6;
|
1329
|
+
sqlite3VdbeSetNumCols( v, 1 );
|
1330
|
+
sqlite3VdbeSetColName( v, 0, COLNAME_NAME, "integrity_check", SQLITE_STATIC );
|
1331
|
+
|
1332
|
+
/* Set the maximum error count */
|
1333
|
+
mxErr = SQLITE_INTEGRITY_CHECK_ERROR_MAX;
|
1334
|
+
if ( zRight != null )
|
1335
|
+
{
|
1336
|
+
mxErr = atoi( zRight );
|
1337
|
+
if ( mxErr <= 0 )
|
1338
|
+
{
|
1339
|
+
mxErr = SQLITE_INTEGRITY_CHECK_ERROR_MAX;
|
1340
|
+
}
|
1341
|
+
}
|
1342
|
+
sqlite3VdbeAddOp2( v, OP_Integer, mxErr, 1 ); /* reg[1] holds errors left */
|
1343
|
+
|
1344
|
+
/* Do an integrity check on each database file */
|
1345
|
+
for ( i = 0; i < db.nDb; i++ )
|
1346
|
+
{
|
1347
|
+
HashElem x;
|
1348
|
+
Hash pTbls;
|
1349
|
+
int cnt = 0;
|
1350
|
+
|
1351
|
+
if ( OMIT_TEMPDB != 0 && i == 1 ) continue;
|
1352
|
+
|
1353
|
+
sqlite3CodeVerifySchema( pParse, i );
|
1354
|
+
addr = sqlite3VdbeAddOp1( v, OP_IfPos, 1 ); /* Halt if out of errors */
|
1355
|
+
sqlite3VdbeAddOp2( v, OP_Halt, 0, 0 );
|
1356
|
+
sqlite3VdbeJumpHere( v, addr );
|
1357
|
+
|
1358
|
+
/* Do an integrity check of the B-Tree
|
1359
|
+
**
|
1360
|
+
** Begin by filling registers 2, 3, ... with the root pages numbers
|
1361
|
+
** for all tables and indices in the database.
|
1362
|
+
*/
|
1363
|
+
pTbls = db.aDb[i].pSchema.tblHash;
|
1364
|
+
for ( x = pTbls.first; x != null; x = x.next )
|
1365
|
+
{// for(x=sqliteHashFirst(pTbls); x; x=sqliteHashNext(x)){
|
1366
|
+
Table pTab = (Table)x.data;// sqliteHashData( x );
|
1367
|
+
Index pIdx;
|
1368
|
+
sqlite3VdbeAddOp2( v, OP_Integer, pTab.tnum, 2 + cnt );
|
1369
|
+
cnt++;
|
1370
|
+
for ( pIdx = pTab.pIndex; pIdx != null; pIdx = pIdx.pNext )
|
1371
|
+
{
|
1372
|
+
sqlite3VdbeAddOp2( v, OP_Integer, pIdx.tnum, 2 + cnt );
|
1373
|
+
cnt++;
|
1374
|
+
}
|
1375
|
+
}
|
1376
|
+
|
1377
|
+
/* Make sure sufficient number of registers have been allocated */
|
1378
|
+
if ( pParse.nMem < cnt + 4 )
|
1379
|
+
{
|
1380
|
+
pParse.nMem = cnt + 4;
|
1381
|
+
}
|
1382
|
+
|
1383
|
+
/* Do the b-tree integrity checks */
|
1384
|
+
sqlite3VdbeAddOp3( v, OP_IntegrityCk, 2, cnt, 1 );
|
1385
|
+
sqlite3VdbeChangeP5( v, (u8)i );
|
1386
|
+
addr = sqlite3VdbeAddOp1( v, OP_IsNull, 2 );
|
1387
|
+
sqlite3VdbeAddOp4( v, OP_String8, 0, 3, 0,
|
1388
|
+
sqlite3MPrintf( db, "*** in database %s ***\n", db.aDb[i].zName ),
|
1389
|
+
P4_DYNAMIC );
|
1390
|
+
sqlite3VdbeAddOp3( v, OP_Move, 2, 4, 1 );
|
1391
|
+
sqlite3VdbeAddOp3( v, OP_Concat, 4, 3, 2 );
|
1392
|
+
sqlite3VdbeAddOp2( v, OP_ResultRow, 2, 1 );
|
1393
|
+
sqlite3VdbeJumpHere( v, addr );
|
1394
|
+
|
1395
|
+
/* Make sure all the indices are constructed correctly.
|
1396
|
+
*/
|
1397
|
+
for ( x = pTbls.first; x != null && !isQuick; x = x.next )
|
1398
|
+
{
|
1399
|
+
;// for(x=sqliteHashFirst(pTbls); x && !isQuick; x=sqliteHashNext(x)){
|
1400
|
+
Table pTab = (Table)x.data;// sqliteHashData( x );
|
1401
|
+
Index pIdx;
|
1402
|
+
int loopTop;
|
1403
|
+
|
1404
|
+
if ( pTab.pIndex == null ) continue;
|
1405
|
+
addr = sqlite3VdbeAddOp1( v, OP_IfPos, 1 ); /* Stop if out of errors */
|
1406
|
+
sqlite3VdbeAddOp2( v, OP_Halt, 0, 0 );
|
1407
|
+
sqlite3VdbeJumpHere( v, addr );
|
1408
|
+
sqlite3OpenTableAndIndices( pParse, pTab, 1, OP_OpenRead );
|
1409
|
+
sqlite3VdbeAddOp2( v, OP_Integer, 0, 2 ); /* reg(2) will count entries */
|
1410
|
+
loopTop = sqlite3VdbeAddOp2( v, OP_Rewind, 1, 0 );
|
1411
|
+
sqlite3VdbeAddOp2( v, OP_AddImm, 2, 1 ); /* increment entry count */
|
1412
|
+
for ( j = 0, pIdx = pTab.pIndex; pIdx != null; pIdx = pIdx.pNext, j++ )
|
1413
|
+
{
|
1414
|
+
int jmp2;
|
1415
|
+
int r1;
|
1416
|
+
VdbeOpList[] idxErr = new VdbeOpList[] {
|
1417
|
+
new VdbeOpList( OP_AddImm, 1, -1, 0),
|
1418
|
+
new VdbeOpList( OP_String8, 0, 3, 0), /* 1 */
|
1419
|
+
new VdbeOpList( OP_Rowid, 1, 4, 0),
|
1420
|
+
new VdbeOpList( OP_String8, 0, 5, 0), /* 3 */
|
1421
|
+
new VdbeOpList( OP_String8, 0, 6, 0), /* 4 */
|
1422
|
+
new VdbeOpList( OP_Concat, 4, 3, 3),
|
1423
|
+
new VdbeOpList( OP_Concat, 5, 3, 3),
|
1424
|
+
new VdbeOpList( OP_Concat, 6, 3, 3),
|
1425
|
+
new VdbeOpList( OP_ResultRow, 3, 1, 0),
|
1426
|
+
new VdbeOpList( OP_IfPos, 1, 0, 0), /* 9 */
|
1427
|
+
new VdbeOpList( OP_Halt, 0, 0, 0),
|
1428
|
+
};
|
1429
|
+
r1 = sqlite3GenerateIndexKey( pParse, pIdx, 1, 3, false );
|
1430
|
+
jmp2 = sqlite3VdbeAddOp4Int( v, OP_Found, j + 2, 0, r1, pIdx.nColumn + 1 );
|
1431
|
+
addr = sqlite3VdbeAddOpList( v, ArraySize( idxErr ), idxErr );
|
1432
|
+
sqlite3VdbeChangeP4( v, addr + 1, "rowid ", SQLITE_STATIC );
|
1433
|
+
sqlite3VdbeChangeP4( v, addr + 3, " missing from index ", SQLITE_STATIC );
|
1434
|
+
sqlite3VdbeChangeP4( v, addr + 4, pIdx.zName, P4_STATIC );
|
1435
|
+
sqlite3VdbeJumpHere( v, addr + 9 );
|
1436
|
+
sqlite3VdbeJumpHere( v, jmp2 );
|
1437
|
+
}
|
1438
|
+
sqlite3VdbeAddOp2( v, OP_Next, 1, loopTop + 1 );
|
1439
|
+
sqlite3VdbeJumpHere( v, loopTop );
|
1440
|
+
for ( j = 0, pIdx = pTab.pIndex; pIdx != null; pIdx = pIdx.pNext, j++ )
|
1441
|
+
{
|
1442
|
+
VdbeOpList[] cntIdx = new VdbeOpList[] {
|
1443
|
+
new VdbeOpList( OP_Integer, 0, 3, 0),
|
1444
|
+
new VdbeOpList( OP_Rewind, 0, 0, 0), /* 1 */
|
1445
|
+
new VdbeOpList( OP_AddImm, 3, 1, 0),
|
1446
|
+
new VdbeOpList( OP_Next, 0, 0, 0), /* 3 */
|
1447
|
+
new VdbeOpList( OP_Eq, 2, 0, 3), /* 4 */
|
1448
|
+
new VdbeOpList( OP_AddImm, 1, -1, 0),
|
1449
|
+
new VdbeOpList( OP_String8, 0, 2, 0), /* 6 */
|
1450
|
+
new VdbeOpList( OP_String8, 0, 3, 0), /* 7 */
|
1451
|
+
new VdbeOpList( OP_Concat, 3, 2, 2),
|
1452
|
+
new VdbeOpList( OP_ResultRow, 2, 1, 0),
|
1453
|
+
};
|
1454
|
+
addr = sqlite3VdbeAddOp1( v, OP_IfPos, 1 );
|
1455
|
+
sqlite3VdbeAddOp2( v, OP_Halt, 0, 0 );
|
1456
|
+
sqlite3VdbeJumpHere( v, addr );
|
1457
|
+
addr = sqlite3VdbeAddOpList( v, ArraySize( cntIdx ), cntIdx );
|
1458
|
+
sqlite3VdbeChangeP1( v, addr + 1, j + 2 );
|
1459
|
+
sqlite3VdbeChangeP2( v, addr + 1, addr + 4 );
|
1460
|
+
sqlite3VdbeChangeP1( v, addr + 3, j + 2 );
|
1461
|
+
sqlite3VdbeChangeP2( v, addr + 3, addr + 2 );
|
1462
|
+
sqlite3VdbeJumpHere( v, addr + 4 );
|
1463
|
+
sqlite3VdbeChangeP4( v, addr + 6,
|
1464
|
+
"wrong # of entries in index ", P4_STATIC );
|
1465
|
+
sqlite3VdbeChangeP4( v, addr + 7, pIdx.zName, P4_STATIC );
|
1466
|
+
}
|
1467
|
+
}
|
1468
|
+
}
|
1469
|
+
addr = sqlite3VdbeAddOpList( v, ArraySize( endCode ), endCode );
|
1470
|
+
sqlite3VdbeChangeP2( v, addr, -mxErr );
|
1471
|
+
sqlite3VdbeJumpHere( v, addr + 1 );
|
1472
|
+
sqlite3VdbeChangeP4( v, addr + 2, "ok", P4_STATIC );
|
1473
|
+
}
|
1474
|
+
else
|
1475
|
+
#endif // * SQLITE_OMIT_INTEGRITY_CHECK */
|
1476
|
+
|
1477
|
+
/*
|
1478
|
+
** PRAGMA encoding
|
1479
|
+
** PRAGMA encoding = "utf-8"|"utf-16"|"utf-16le"|"utf-16be"
|
1480
|
+
**
|
1481
|
+
** In its first form, this pragma returns the encoding of the main
|
1482
|
+
** database. If the database is not initialized, it is initialized now.
|
1483
|
+
**
|
1484
|
+
** The second form of this pragma is a no-op if the main database file
|
1485
|
+
** has not already been initialized. In this case it sets the default
|
1486
|
+
** encoding that will be used for the main database file if a new file
|
1487
|
+
** is created. If an existing main database file is opened, then the
|
1488
|
+
** default text encoding for the existing database is used.
|
1489
|
+
**
|
1490
|
+
** In all cases new databases created using the ATTACH command are
|
1491
|
+
** created to use the same default text encoding as the main database. If
|
1492
|
+
** the main database has not been initialized and/or created when ATTACH
|
1493
|
+
** is executed, this is done before the ATTACH operation.
|
1494
|
+
**
|
1495
|
+
** In the second form this pragma sets the text encoding to be used in
|
1496
|
+
** new database files created using this database handle. It is only
|
1497
|
+
** useful if invoked immediately after the main database i
|
1498
|
+
*/
|
1499
|
+
if ( sqlite3StrICmp( zLeft, "encoding" ) == 0 )
|
1500
|
+
{
|
1501
|
+
EncName[] encnames = new EncName[] {
|
1502
|
+
new EncName( "UTF8", SQLITE_UTF8 ),
|
1503
|
+
new EncName( "UTF-8", SQLITE_UTF8 ),/* Must be element [1] */
|
1504
|
+
new EncName( "UTF-16le", SQLITE_UTF16LE ),/* Must be element [2] */
|
1505
|
+
new EncName( "UTF-16be", SQLITE_UTF16BE ), /* Must be element [3] */
|
1506
|
+
new EncName( "UTF16le", SQLITE_UTF16LE ),
|
1507
|
+
new EncName( "UTF16be", SQLITE_UTF16BE ),
|
1508
|
+
new EncName( "UTF-16", 0 ), /* SQLITE_UTF16NATIVE */
|
1509
|
+
new EncName( "UTF16", 0 ), /* SQLITE_UTF16NATIVE */
|
1510
|
+
new EncName( null, 0 )
|
1511
|
+
};
|
1512
|
+
int iEnc;
|
1513
|
+
if ( null == zRight )
|
1514
|
+
{ /* "PRAGMA encoding" */
|
1515
|
+
if ( sqlite3ReadSchema( pParse ) != 0 ) goto pragma_out;
|
1516
|
+
sqlite3VdbeSetNumCols( v, 1 );
|
1517
|
+
sqlite3VdbeSetColName( v, 0, COLNAME_NAME, "encoding", SQLITE_STATIC );
|
1518
|
+
sqlite3VdbeAddOp2( v, OP_String8, 0, 1 );
|
1519
|
+
Debug.Assert( encnames[SQLITE_UTF8].enc == SQLITE_UTF8 );
|
1520
|
+
Debug.Assert( encnames[SQLITE_UTF16LE].enc == SQLITE_UTF16LE );
|
1521
|
+
Debug.Assert( encnames[SQLITE_UTF16BE].enc == SQLITE_UTF16BE );
|
1522
|
+
sqlite3VdbeChangeP4( v, -1, encnames[ENC( pParse.db )].zName, P4_STATIC );
|
1523
|
+
sqlite3VdbeAddOp2( v, OP_ResultRow, 1, 1 );
|
1524
|
+
}
|
1525
|
+
#if !SQLITE_OMIT_UTF16
|
1526
|
+
else
|
1527
|
+
{ /* "PRAGMA encoding = XXX" */
|
1528
|
+
/* Only change the value of sqlite.enc if the database handle is not
|
1529
|
+
** initialized. If the main database exists, the new sqlite.enc value
|
1530
|
+
** will be overwritten when the schema is next loaded. If it does not
|
1531
|
+
** already exists, it will be created to use the new encoding value.
|
1532
|
+
*/
|
1533
|
+
if (
|
1534
|
+
//!(DbHasProperty(db, 0, DB_SchemaLoaded)) ||
|
1535
|
+
//DbHasProperty(db, 0, DB_Empty)
|
1536
|
+
( db.flags & DB_SchemaLoaded ) != DB_SchemaLoaded || ( db.flags & DB_Empty ) == DB_Empty
|
1537
|
+
)
|
1538
|
+
{
|
1539
|
+
for ( iEnc = 0 ; encnames[iEnc].zName != null ; iEnc++ )
|
1540
|
+
{
|
1541
|
+
if ( 0 == sqlite3StrICmp( zRight, encnames[iEnc].zName ) )
|
1542
|
+
{
|
1543
|
+
pParse.db.aDbStatic[0].pSchema.enc = encnames[iEnc].enc != 0 ? encnames[iEnc].enc : SQLITE_UTF16NATIVE;
|
1544
|
+
break;
|
1545
|
+
}
|
1546
|
+
}
|
1547
|
+
if ( encnames[iEnc].zName == null )
|
1548
|
+
{
|
1549
|
+
sqlite3ErrorMsg( pParse, "unsupported encoding: %s", zRight );
|
1550
|
+
}
|
1551
|
+
}
|
1552
|
+
}
|
1553
|
+
#endif
|
1554
|
+
}
|
1555
|
+
else
|
1556
|
+
|
1557
|
+
#if !SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS
|
1558
|
+
/*
|
1559
|
+
** PRAGMA [database.]schema_version
|
1560
|
+
** PRAGMA [database.]schema_version = <integer>
|
1561
|
+
**
|
1562
|
+
** PRAGMA [database.]user_version
|
1563
|
+
** PRAGMA [database.]user_version = <integer>
|
1564
|
+
**
|
1565
|
+
** The pragma's schema_version and user_version are used to set or get
|
1566
|
+
** the value of the schema-version and user-version, respectively. Both
|
1567
|
+
** the schema-version and the user-version are 32-bit signed integers
|
1568
|
+
** stored in the database header.
|
1569
|
+
**
|
1570
|
+
** The schema-cookie is usually only manipulated internally by SQLite. It
|
1571
|
+
** is incremented by SQLite whenever the database schema is modified (by
|
1572
|
+
** creating or dropping a table or index). The schema version is used by
|
1573
|
+
** SQLite each time a query is executed to ensure that the internal cache
|
1574
|
+
** of the schema used when compiling the SQL query matches the schema of
|
1575
|
+
** the database against which the compiled query is actually executed.
|
1576
|
+
** Subverting this mechanism by using "PRAGMA schema_version" to modify
|
1577
|
+
** the schema-version is potentially dangerous and may lead to program
|
1578
|
+
** crashes or database corruption. Use with caution!
|
1579
|
+
**
|
1580
|
+
** The user-version is not used internally by SQLite. It may be used by
|
1581
|
+
** applications for any purpose.
|
1582
|
+
*/
|
1583
|
+
if ( sqlite3StrICmp( zLeft, "schema_version" ) == 0
|
1584
|
+
|| sqlite3StrICmp( zLeft, "user_version" ) == 0
|
1585
|
+
|| sqlite3StrICmp( zLeft, "freelist_count" ) == 0
|
1586
|
+
)
|
1587
|
+
{
|
1588
|
+
int iCookie; /* Cookie index. 1 for schema-cookie, 6 for user-cookie. */
|
1589
|
+
sqlite3VdbeUsesBtree( v, iDb );
|
1590
|
+
switch ( zLeft[0] )
|
1591
|
+
{
|
1592
|
+
case 'f':
|
1593
|
+
case 'F':
|
1594
|
+
iCookie = BTREE_FREE_PAGE_COUNT;
|
1595
|
+
break;
|
1596
|
+
case 's':
|
1597
|
+
case 'S':
|
1598
|
+
iCookie = BTREE_SCHEMA_VERSION;
|
1599
|
+
break;
|
1600
|
+
default:
|
1601
|
+
iCookie = BTREE_USER_VERSION;
|
1602
|
+
break;
|
1603
|
+
}
|
1604
|
+
|
1605
|
+
if ( zRight != null && iCookie != BTREE_FREE_PAGE_COUNT )
|
1606
|
+
{
|
1607
|
+
/* Write the specified cookie value */
|
1608
|
+
VdbeOpList[] setCookie = new VdbeOpList[] {
|
1609
|
+
new VdbeOpList( OP_Transaction, 0, 1, 0), /* 0 */
|
1610
|
+
new VdbeOpList( OP_Integer, 0, 1, 0), /* 1 */
|
1611
|
+
new VdbeOpList( OP_SetCookie, 0, 0, 1), /* 2 */
|
1612
|
+
};
|
1613
|
+
int addr = sqlite3VdbeAddOpList( v, ArraySize( setCookie ), setCookie );
|
1614
|
+
sqlite3VdbeChangeP1( v, addr, iDb );
|
1615
|
+
sqlite3VdbeChangeP1( v, addr + 1, atoi( zRight ) );
|
1616
|
+
sqlite3VdbeChangeP1( v, addr + 2, iDb );
|
1617
|
+
sqlite3VdbeChangeP2( v, addr + 2, iCookie );
|
1618
|
+
}
|
1619
|
+
else
|
1620
|
+
{
|
1621
|
+
/* Read the specified cookie value */
|
1622
|
+
VdbeOpList[] readCookie = new VdbeOpList[] {
|
1623
|
+
new VdbeOpList( OP_Transaction, 0, 0, 0), /* 0 */
|
1624
|
+
new VdbeOpList( OP_ReadCookie, 0, 1, 0), /* 1 */
|
1625
|
+
new VdbeOpList( OP_ResultRow, 1, 1, 0)
|
1626
|
+
};
|
1627
|
+
int addr = sqlite3VdbeAddOpList( v, readCookie.Length, readCookie );// ArraySize(readCookie), readCookie);
|
1628
|
+
sqlite3VdbeChangeP1( v, addr, iDb );
|
1629
|
+
sqlite3VdbeChangeP1( v, addr + 1, iDb );
|
1630
|
+
sqlite3VdbeChangeP3( v, addr + 1, iCookie );
|
1631
|
+
sqlite3VdbeSetNumCols( v, 1 );
|
1632
|
+
sqlite3VdbeSetColName( v, 0, COLNAME_NAME, zLeft, SQLITE_TRANSIENT );
|
1633
|
+
}
|
1634
|
+
}
|
1635
|
+
else if ( sqlite3StrICmp( zLeft, "reload_schema" ) == 0 )
|
1636
|
+
{
|
1637
|
+
/* force schema reloading*/
|
1638
|
+
sqlite3ResetInternalSchema( db, 0 );
|
1639
|
+
}
|
1640
|
+
else if ( sqlite3StrICmp( zLeft, "file_format" ) == 0 )
|
1641
|
+
{
|
1642
|
+
pDb.pSchema.file_format = (u8)atoi( zRight );
|
1643
|
+
sqlite3ResetInternalSchema( db, 0 );
|
1644
|
+
}
|
1645
|
+
|
1646
|
+
else
|
1647
|
+
#endif // * SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS */
|
1648
|
+
|
1649
|
+
#if !SQLITE_OMIT_COMPILEOPTION_DIAGS
|
1650
|
+
/*
|
1651
|
+
** PRAGMA compile_options
|
1652
|
+
**
|
1653
|
+
** Return the names of all compile-time options used in this build,
|
1654
|
+
** one option per row.
|
1655
|
+
*/
|
1656
|
+
if( sqlite3StrICmp(zLeft, "compile_options")==0 ){
|
1657
|
+
int i = 0;
|
1658
|
+
string zOpt;
|
1659
|
+
sqlite3VdbeSetNumCols(v, 1);
|
1660
|
+
pParse.nMem = 1;
|
1661
|
+
sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "compile_option", SQLITE_STATIC);
|
1662
|
+
while ((zOpt = sqlite3_compileoption_get(i++)) != null)
|
1663
|
+
{
|
1664
|
+
sqlite3VdbeAddOp4(v, OP_String8, 0, 1, 0, zOpt, 0);
|
1665
|
+
sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1);
|
1666
|
+
}
|
1667
|
+
}else
|
1668
|
+
#endif //* SQLITE_OMIT_COMPILEOPTION_DIAGS */
|
1669
|
+
|
1670
|
+
#if SQLITE_DEBUG || SQLITE_TEST
|
1671
|
+
/*
|
1672
|
+
** Report the current state of file logs for all databases
|
1673
|
+
*/
|
1674
|
+
if ( sqlite3StrICmp( zLeft, "lock_status" ) == 0 )
|
1675
|
+
{
|
1676
|
+
string[] azLockName = {
|
1677
|
+
"unlocked", "shared", "reserved", "pending", "exclusive"
|
1678
|
+
};
|
1679
|
+
int i;
|
1680
|
+
sqlite3VdbeSetNumCols( v, 2 );
|
1681
|
+
pParse.nMem = 2;
|
1682
|
+
sqlite3VdbeSetColName( v, 0, COLNAME_NAME, "database", SQLITE_STATIC );
|
1683
|
+
sqlite3VdbeSetColName( v, 1, COLNAME_NAME, "status", SQLITE_STATIC );
|
1684
|
+
for ( i = 0; i < db.nDb; i++ )
|
1685
|
+
{
|
1686
|
+
Btree pBt;
|
1687
|
+
Pager pPager;
|
1688
|
+
string zState = "unknown";
|
1689
|
+
int j = 0;
|
1690
|
+
if ( db.aDb[i].zName == null ) continue;
|
1691
|
+
sqlite3VdbeAddOp4( v, OP_String8, 0, 1, 0, db.aDb[i].zName, P4_STATIC );
|
1692
|
+
pBt = db.aDb[i].pBt;
|
1693
|
+
if ( pBt == null || ( pPager = sqlite3BtreePager( pBt ) ) == null )
|
1694
|
+
{
|
1695
|
+
zState = "closed";
|
1696
|
+
}
|
1697
|
+
else if ( sqlite3_file_control( db, i != 0 ? db.aDb[i].zName : null,
|
1698
|
+
SQLITE_FCNTL_LOCKSTATE, ref j ) == SQLITE_OK )
|
1699
|
+
{
|
1700
|
+
zState = azLockName[j];
|
1701
|
+
}
|
1702
|
+
sqlite3VdbeAddOp4( v, OP_String8, 0, 2, 0, zState, P4_STATIC );
|
1703
|
+
sqlite3VdbeAddOp2( v, OP_ResultRow, 1, 2 );
|
1704
|
+
}
|
1705
|
+
}
|
1706
|
+
else
|
1707
|
+
#endif
|
1708
|
+
|
1709
|
+
#if SQLITE_HAS_CODEC
|
1710
|
+
if( sqlite3StrICmp(zLeft, "key")==0 && zRight ){
|
1711
|
+
sqlite3_key(db, zRight, sqlite3Strlen30(zRight));
|
1712
|
+
}else
|
1713
|
+
if( sqlite3StrICmp(zLeft, "rekey")==0 && zRight ){
|
1714
|
+
sqlite3_rekey(db, zRight, sqlite3Strlen30(zRight));
|
1715
|
+
}else
|
1716
|
+
if( zRight && (sqlite3StrICmp(zLeft, "hexkey")==0 ||
|
1717
|
+
sqlite3StrICmp(zLeft, "hexrekey")==0) ){
|
1718
|
+
int i, h1, h2;
|
1719
|
+
char zKey[40];
|
1720
|
+
for(i=0; (h1 = zRight[i])!=0 && (h2 = zRight[i+1])!=0; i+=2){
|
1721
|
+
h1 += 9*(1&(h1>>6));
|
1722
|
+
h2 += 9*(1&(h2>>6));
|
1723
|
+
zKey[i/2] = (h2 & 0x0f) | ((h1 & 0xf)<<4);
|
1724
|
+
}
|
1725
|
+
if( (zLeft[3] & 0xf)==0xb ){
|
1726
|
+
sqlite3_key(db, zKey, i/2);
|
1727
|
+
}else{
|
1728
|
+
sqlite3_rekey(db, zKey, i/2);
|
1729
|
+
}
|
1730
|
+
}else
|
1731
|
+
#endif
|
1732
|
+
#if SQLITE_HAS_CODEC || SQLITE_ENABLE_CEROD
|
1733
|
+
if( sqlite3StrICmp(zLeft, "activate_extensions")==0 ){
|
1734
|
+
#if SQLITE_HAS_CODEC
|
1735
|
+
if( sqlite3StrNICmp(zRight, "see-", 4)==0 ){
|
1736
|
+
sqlite3_activate_see(&zRight[4]);
|
1737
|
+
}
|
1738
|
+
#endif
|
1739
|
+
#if SQLITE_ENABLE_CEROD
|
1740
|
+
if( sqlite3StrNICmp(zRight, "cerod-", 6)==0 ){
|
1741
|
+
sqlite3_activate_cerod(&zRight[6]);
|
1742
|
+
}
|
1743
|
+
#endif
|
1744
|
+
}else
|
1745
|
+
#endif
|
1746
|
+
{ /* Empty ELSE clause */}
|
1747
|
+
|
1748
|
+
/*
|
1749
|
+
** Reset the safety level, in case the fullfsync flag or synchronous
|
1750
|
+
** setting changed.
|
1751
|
+
*/
|
1752
|
+
#if !SQLITE_OMIT_PAGER_PRAGMAS
|
1753
|
+
if ( db.autoCommit != 0 )
|
1754
|
+
{
|
1755
|
+
sqlite3BtreeSetSafetyLevel( pDb.pBt, pDb.safety_level,
|
1756
|
+
( ( db.flags & SQLITE_FullFSync ) != 0 ) ? 1 : 0 );
|
1757
|
+
}
|
1758
|
+
#endif
|
1759
|
+
pragma_out:
|
1760
|
+
sqlite3DbFree( db, ref zLeft );
|
1761
|
+
sqlite3DbFree( db, ref zRight );
|
1762
|
+
;
|
1763
|
+
}
|
1764
|
+
|
1765
|
+
#endif // * SQLITE_OMIT_PRAGMA
|
1766
|
+
}
|
1767
|
+
}
|