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,1557 @@
|
|
1
|
+
using System;
|
2
|
+
using System.Diagnostics;
|
3
|
+
using System.Text;
|
4
|
+
using i64 = System.Int64;
|
5
|
+
using u16 = System.UInt16;
|
6
|
+
using u32 = System.UInt32;
|
7
|
+
using u64 = System.UInt64;
|
8
|
+
using u8 = System.Byte;
|
9
|
+
|
10
|
+
namespace Community.CsharpSqlite
|
11
|
+
{
|
12
|
+
using Op = Sqlite3.VdbeOp;
|
13
|
+
using sqlite_int64 = System.Int64;
|
14
|
+
using sqlite3_stmt = Sqlite3.Vdbe;
|
15
|
+
using sqlite3_value = Sqlite3.Mem;
|
16
|
+
|
17
|
+
public partial class Sqlite3
|
18
|
+
{
|
19
|
+
/*
|
20
|
+
** 2004 May 26
|
21
|
+
**
|
22
|
+
** The author disclaims copyright to this source code. In place of
|
23
|
+
** a legal notice, here is a blessing:
|
24
|
+
**
|
25
|
+
** May you do good and not evil.
|
26
|
+
** May you find forgiveness for yourself and forgive others.
|
27
|
+
** May you share freely, never taking more than you give.
|
28
|
+
**
|
29
|
+
*************************************************************************
|
30
|
+
**
|
31
|
+
** This file contains code use to implement APIs that are part of the
|
32
|
+
** VDBE.
|
33
|
+
*************************************************************************
|
34
|
+
** Included in SQLite3 port to C#-SQLite; 2008 Noah B Hart
|
35
|
+
** C#-SQLite is an independent reimplementation of the SQLite software library
|
36
|
+
**
|
37
|
+
** SQLITE_SOURCE_ID: 2010-03-09 19:31:43 4ae453ea7be69018d8c16eb8dabe05617397dc4d
|
38
|
+
**
|
39
|
+
** $Header$
|
40
|
+
*************************************************************************
|
41
|
+
*/
|
42
|
+
//#include "sqliteInt.h"
|
43
|
+
//#include "vdbeInt.h"
|
44
|
+
|
45
|
+
#if !SQLITE_OMIT_DEPRECATED
|
46
|
+
/*
|
47
|
+
** Return TRUE (non-zero) of the statement supplied as an argument needs
|
48
|
+
** to be recompiled. A statement needs to be recompiled whenever the
|
49
|
+
** execution environment changes in a way that would alter the program
|
50
|
+
** that sqlite3_prepare() generates. For example, if new functions or
|
51
|
+
** collating sequences are registered or if an authorizer function is
|
52
|
+
** added or changed.
|
53
|
+
*/
|
54
|
+
static int sqlite3_expired( sqlite3_stmt pStmt )
|
55
|
+
{
|
56
|
+
Vdbe p = (Vdbe)pStmt;
|
57
|
+
return ( p == null || p.expired ) ? 1 : 0;
|
58
|
+
}
|
59
|
+
#endif
|
60
|
+
|
61
|
+
/*
|
62
|
+
** Check on a Vdbe to make sure it has not been finalized. Log
|
63
|
+
** an error and return true if it has been finalized (or is otherwise
|
64
|
+
** invalid). Return false if it is ok.
|
65
|
+
*/
|
66
|
+
static bool vdbeSafety(Vdbe p)
|
67
|
+
{
|
68
|
+
if (p.db == null)
|
69
|
+
{
|
70
|
+
sqlite3_log(SQLITE_MISUSE, "API called with finalized prepared statement");
|
71
|
+
return true;
|
72
|
+
}
|
73
|
+
else
|
74
|
+
{
|
75
|
+
return false;
|
76
|
+
}
|
77
|
+
}
|
78
|
+
static bool vdbeSafetyNotNull(Vdbe p)
|
79
|
+
{
|
80
|
+
if (p == null)
|
81
|
+
{
|
82
|
+
sqlite3_log(SQLITE_MISUSE, "API called with NULL prepared statement");
|
83
|
+
return true;
|
84
|
+
}
|
85
|
+
else
|
86
|
+
{
|
87
|
+
return vdbeSafety(p);
|
88
|
+
}
|
89
|
+
}
|
90
|
+
|
91
|
+
/*
|
92
|
+
** The following routine destroys a virtual machine that is created by
|
93
|
+
** the sqlite3_compile() routine. The integer returned is an SQLITE_
|
94
|
+
** success/failure code that describes the result of executing the virtual
|
95
|
+
** machine.
|
96
|
+
**
|
97
|
+
** This routine sets the error code and string returned by
|
98
|
+
** sqlite3_errcode(), sqlite3_errmsg() and sqlite3_errmsg16().
|
99
|
+
*/
|
100
|
+
public static int sqlite3_finalize(ref sqlite3_stmt pStmt)
|
101
|
+
{
|
102
|
+
int rc;
|
103
|
+
if (pStmt == null)
|
104
|
+
{
|
105
|
+
rc = SQLITE_OK;
|
106
|
+
}
|
107
|
+
else
|
108
|
+
{
|
109
|
+
Vdbe v = pStmt;
|
110
|
+
sqlite3 db = v.db;
|
111
|
+
#if SQLITE_THREADSAFE
|
112
|
+
sqlite3_mutex mutex;
|
113
|
+
#endif
|
114
|
+
if (vdbeSafety(v)) return SQLITE_MISUSE_BKPT();
|
115
|
+
#if SQLITE_THREADSAFE
|
116
|
+
mutex = v.db.mutex;
|
117
|
+
#endif
|
118
|
+
sqlite3_mutex_enter(mutex);
|
119
|
+
rc = sqlite3VdbeFinalize(v);
|
120
|
+
rc = sqlite3ApiExit(db, rc);
|
121
|
+
sqlite3_mutex_leave(mutex);
|
122
|
+
}
|
123
|
+
return rc;
|
124
|
+
}
|
125
|
+
|
126
|
+
/*
|
127
|
+
** Terminate the current execution of an SQL statement and reset it
|
128
|
+
** back to its starting state so that it can be reused. A success code from
|
129
|
+
** the prior execution is returned.
|
130
|
+
**
|
131
|
+
** This routine sets the error code and string returned by
|
132
|
+
** sqlite3_errcode(), sqlite3_errmsg() and sqlite3_errmsg16().
|
133
|
+
*/
|
134
|
+
public static int sqlite3_reset(sqlite3_stmt pStmt)
|
135
|
+
{
|
136
|
+
int rc;
|
137
|
+
if (pStmt == null)
|
138
|
+
{
|
139
|
+
rc = SQLITE_OK;
|
140
|
+
}
|
141
|
+
else
|
142
|
+
{
|
143
|
+
Vdbe v = (Vdbe)pStmt;
|
144
|
+
sqlite3_mutex_enter(v.db.mutex);
|
145
|
+
rc = sqlite3VdbeReset(v);
|
146
|
+
sqlite3VdbeMakeReady(v, -1, 0, 0, 0, 0, 0);
|
147
|
+
Debug.Assert((rc & (v.db.errMask)) == rc);
|
148
|
+
rc = sqlite3ApiExit(v.db, rc);
|
149
|
+
sqlite3_mutex_leave(v.db.mutex);
|
150
|
+
}
|
151
|
+
return rc;
|
152
|
+
}
|
153
|
+
|
154
|
+
/*
|
155
|
+
** Set all the parameters in the compiled SQL statement to NULL.
|
156
|
+
*/
|
157
|
+
public static int sqlite3_clear_bindings(sqlite3_stmt pStmt)
|
158
|
+
{
|
159
|
+
int i;
|
160
|
+
int rc = SQLITE_OK;
|
161
|
+
Vdbe p = (Vdbe)pStmt;
|
162
|
+
#if SQLITE_THREADSAFE
|
163
|
+
sqlite3_mutex mutex = ( (Vdbe)pStmt ).db.mutex;
|
164
|
+
#endif
|
165
|
+
sqlite3_mutex_enter(mutex);
|
166
|
+
for (i = 0; i < p.nVar; i++)
|
167
|
+
{
|
168
|
+
sqlite3VdbeMemRelease(p.aVar[i]);
|
169
|
+
p.aVar[i].flags = MEM_Null;
|
170
|
+
}
|
171
|
+
if (p.isPrepareV2 && p.expmask != 0)
|
172
|
+
{
|
173
|
+
p.expired = true;
|
174
|
+
}
|
175
|
+
sqlite3_mutex_leave(mutex);
|
176
|
+
return rc;
|
177
|
+
}
|
178
|
+
|
179
|
+
|
180
|
+
/**************************** sqlite3_value_ *******************************
|
181
|
+
** The following routines extract information from a Mem or sqlite3_value
|
182
|
+
** structure.
|
183
|
+
*/
|
184
|
+
public static byte[] sqlite3_value_blob(sqlite3_value pVal)
|
185
|
+
{
|
186
|
+
Mem p = pVal;
|
187
|
+
if ((p.flags & (MEM_Blob | MEM_Str)) != 0)
|
188
|
+
{
|
189
|
+
sqlite3VdbeMemExpandBlob(p);
|
190
|
+
if (p.zBLOB == null && p.z != null)
|
191
|
+
{
|
192
|
+
if (p.z.Length == 0) p.zBLOB = sqlite3Malloc(1);
|
193
|
+
else
|
194
|
+
{
|
195
|
+
p.zBLOB = sqlite3Malloc(p.z.Length);
|
196
|
+
for (int i = 0; i < p.zBLOB.Length; i++) p.zBLOB[i] = (u8)p.z[i];
|
197
|
+
} p.z = null;
|
198
|
+
}
|
199
|
+
p.flags = (u16)(p.flags & ~MEM_Str);
|
200
|
+
p.flags |= MEM_Blob;
|
201
|
+
return p.zBLOB;
|
202
|
+
}
|
203
|
+
else
|
204
|
+
{
|
205
|
+
return sqlite3_value_text(pVal) == null ? null : Encoding.UTF8.GetBytes(sqlite3_value_text(pVal));
|
206
|
+
}
|
207
|
+
}
|
208
|
+
|
209
|
+
public static int sqlite3_value_bytes(sqlite3_value pVal)
|
210
|
+
{
|
211
|
+
return sqlite3ValueBytes(pVal, SQLITE_UTF8);
|
212
|
+
}
|
213
|
+
|
214
|
+
public static int sqlite3_value_bytes16(sqlite3_value pVal)
|
215
|
+
{
|
216
|
+
return sqlite3ValueBytes(pVal, SQLITE_UTF16NATIVE);
|
217
|
+
}
|
218
|
+
|
219
|
+
public static double sqlite3_value_double(sqlite3_value pVal)
|
220
|
+
{
|
221
|
+
return sqlite3VdbeRealValue(pVal);
|
222
|
+
}
|
223
|
+
|
224
|
+
public static int sqlite3_value_int(sqlite3_value pVal)
|
225
|
+
{
|
226
|
+
return (int)sqlite3VdbeIntValue(pVal);
|
227
|
+
}
|
228
|
+
|
229
|
+
public static sqlite_int64 sqlite3_value_int64(sqlite3_value pVal)
|
230
|
+
{
|
231
|
+
return sqlite3VdbeIntValue(pVal);
|
232
|
+
}
|
233
|
+
|
234
|
+
public static string sqlite3_value_text(sqlite3_value pVal)
|
235
|
+
{
|
236
|
+
return sqlite3ValueText(pVal, SQLITE_UTF8);
|
237
|
+
}
|
238
|
+
|
239
|
+
#if !SQLITE_OMIT_UTF16
|
240
|
+
public static string sqlite3_value_text16(sqlite3_value pVal){
|
241
|
+
return sqlite3ValueText(pVal, SQLITE_UTF16NATIVE);
|
242
|
+
}
|
243
|
+
public static string sqlite3_value_text16be(sqlite3_value pVal){
|
244
|
+
return sqlite3ValueText(pVal, SQLITE_UTF16BE);
|
245
|
+
}
|
246
|
+
public static string sqlite3_value_text16le(sqlite3_value pVal){
|
247
|
+
return sqlite3ValueText(pVal, SQLITE_UTF16LE);
|
248
|
+
}
|
249
|
+
#endif // * SQLITE_OMIT_UTF16 */
|
250
|
+
|
251
|
+
public static int sqlite3_value_type(sqlite3_value pval)
|
252
|
+
{
|
253
|
+
return pval.type;
|
254
|
+
}
|
255
|
+
|
256
|
+
/**************************** sqlite3_result_ *******************************
|
257
|
+
** The following routines are used by user-defined functions to specify
|
258
|
+
** the function result.
|
259
|
+
**
|
260
|
+
** The setStrOrError() funtion calls sqlite3VdbeMemSetStr() to store the
|
261
|
+
** result as a string or blob but if the string or blob is too large, it
|
262
|
+
** then sets the error code to SQLITE_TOOBIG
|
263
|
+
*/
|
264
|
+
static void setResultStrOrError(
|
265
|
+
sqlite3_context pCtx, /* Function context */
|
266
|
+
string z, /* String pointer */
|
267
|
+
int o, /* offset into string */
|
268
|
+
int n, /* Bytes in string, or negative */
|
269
|
+
u8 enc, /* Encoding of z. 0 for BLOBs */
|
270
|
+
dxDel xDel //void (*xDel)(void*) /* Destructor function */
|
271
|
+
)
|
272
|
+
{
|
273
|
+
if (sqlite3VdbeMemSetStr(pCtx.s, z, o, n, enc, xDel) == SQLITE_TOOBIG)
|
274
|
+
{
|
275
|
+
sqlite3_result_error_toobig(pCtx);
|
276
|
+
}
|
277
|
+
}
|
278
|
+
static void setResultStrOrError(
|
279
|
+
sqlite3_context pCtx, /* Function context */
|
280
|
+
string z, /* String pointer */
|
281
|
+
int n, /* Bytes in string, or negative */
|
282
|
+
u8 enc, /* Encoding of z. 0 for BLOBs */
|
283
|
+
dxDel xDel //void (*xDel)(void*) /* Destructor function */
|
284
|
+
)
|
285
|
+
{
|
286
|
+
if (sqlite3VdbeMemSetStr(pCtx.s, z, n, enc, xDel) == SQLITE_TOOBIG)
|
287
|
+
{
|
288
|
+
sqlite3_result_error_toobig(pCtx);
|
289
|
+
}
|
290
|
+
}
|
291
|
+
|
292
|
+
public static void sqlite3_result_blob(
|
293
|
+
sqlite3_context pCtx,
|
294
|
+
string z,
|
295
|
+
int n,
|
296
|
+
dxDel xDel
|
297
|
+
)
|
298
|
+
{
|
299
|
+
Debug.Assert(n >= 0);
|
300
|
+
Debug.Assert(sqlite3_mutex_held(pCtx.s.db.mutex));
|
301
|
+
setResultStrOrError(pCtx, z, n, 0, xDel);
|
302
|
+
}
|
303
|
+
|
304
|
+
public static void sqlite3_result_double(sqlite3_context pCtx, double rVal)
|
305
|
+
{
|
306
|
+
Debug.Assert(sqlite3_mutex_held(pCtx.s.db.mutex));
|
307
|
+
sqlite3VdbeMemSetDouble(pCtx.s, rVal);
|
308
|
+
}
|
309
|
+
|
310
|
+
public static void sqlite3_result_error(sqlite3_context pCtx, string z, int n)
|
311
|
+
{
|
312
|
+
Debug.Assert(sqlite3_mutex_held(pCtx.s.db.mutex));
|
313
|
+
setResultStrOrError(pCtx, z, n, SQLITE_UTF8, SQLITE_TRANSIENT);
|
314
|
+
pCtx.isError = SQLITE_ERROR;
|
315
|
+
}
|
316
|
+
|
317
|
+
#if !SQLITE_OMIT_UTF16
|
318
|
+
//void sqlite3_result_error16(sqlite3_context pCtx, const void *z, int n){
|
319
|
+
// Debug.Assert( sqlite3_mutex_held(pCtx.s.db.mutex) );
|
320
|
+
// pCtx.isError = SQLITE_ERROR;
|
321
|
+
// sqlite3VdbeMemSetStr(pCtx.s, z, n, SQLITE_UTF16NATIVE, SQLITE_TRANSIENT);
|
322
|
+
//}
|
323
|
+
#endif
|
324
|
+
|
325
|
+
public static void sqlite3_result_int(sqlite3_context pCtx, int iVal)
|
326
|
+
{
|
327
|
+
Debug.Assert(sqlite3_mutex_held(pCtx.s.db.mutex));
|
328
|
+
sqlite3VdbeMemSetInt64(pCtx.s, (i64)iVal);
|
329
|
+
}
|
330
|
+
|
331
|
+
public static void sqlite3_result_int64(sqlite3_context pCtx, i64 iVal)
|
332
|
+
{
|
333
|
+
Debug.Assert(sqlite3_mutex_held(pCtx.s.db.mutex));
|
334
|
+
sqlite3VdbeMemSetInt64(pCtx.s, iVal);
|
335
|
+
}
|
336
|
+
|
337
|
+
public static void sqlite3_result_null(sqlite3_context pCtx)
|
338
|
+
{
|
339
|
+
Debug.Assert(sqlite3_mutex_held(pCtx.s.db.mutex));
|
340
|
+
sqlite3VdbeMemSetNull(pCtx.s);
|
341
|
+
}
|
342
|
+
|
343
|
+
public static void sqlite3_result_text(
|
344
|
+
sqlite3_context pCtx,
|
345
|
+
string z,
|
346
|
+
int o, //Offset
|
347
|
+
int n,
|
348
|
+
dxDel xDel
|
349
|
+
)
|
350
|
+
{
|
351
|
+
Debug.Assert(sqlite3_mutex_held(pCtx.s.db.mutex));
|
352
|
+
setResultStrOrError(pCtx, z, o, n, SQLITE_UTF8, xDel);
|
353
|
+
}
|
354
|
+
|
355
|
+
public static void sqlite3_result_text(
|
356
|
+
sqlite3_context pCtx,
|
357
|
+
string z,
|
358
|
+
int n,
|
359
|
+
dxDel xDel
|
360
|
+
)
|
361
|
+
{
|
362
|
+
Debug.Assert(sqlite3_mutex_held(pCtx.s.db.mutex));
|
363
|
+
setResultStrOrError(pCtx, z, n, SQLITE_UTF8, xDel);
|
364
|
+
}
|
365
|
+
#if !SQLITE_OMIT_UTF16
|
366
|
+
void sqlite3_result_text16(
|
367
|
+
sqlite3_context pCtx,
|
368
|
+
string z,
|
369
|
+
int n,
|
370
|
+
dxDel xDel
|
371
|
+
){
|
372
|
+
Debug.Assert( sqlite3_mutex_held(pCtx.s.db.mutex) );
|
373
|
+
sqlite3VdbeMemSetStr(pCtx.s, z, n, SQLITE_UTF16NATIVE, xDel);
|
374
|
+
}
|
375
|
+
void sqlite3_result_text16be(
|
376
|
+
sqlite3_context pCtx,
|
377
|
+
string z,
|
378
|
+
int n,
|
379
|
+
dxDel xDel
|
380
|
+
){
|
381
|
+
Debug.Assert( sqlite3_mutex_held(pCtx.s.db.mutex) );
|
382
|
+
sqlite3VdbeMemSetStr(pCtx.s, z, n, SQLITE_UTF16BE, xDel);
|
383
|
+
}
|
384
|
+
void sqlite3_result_text16le(
|
385
|
+
sqlite3_context pCtx,
|
386
|
+
string z,
|
387
|
+
int n,
|
388
|
+
dxDel xDel
|
389
|
+
){
|
390
|
+
Debug.Assert( sqlite3_mutex_held(pCtx.s.db.mutex) );
|
391
|
+
sqlite3VdbeMemSetStr(pCtx.s, z, n, SQLITE_UTF16LE, xDel);
|
392
|
+
}
|
393
|
+
#endif // * SQLITE_OMIT_UTF16 */
|
394
|
+
|
395
|
+
public static void sqlite3_result_value(sqlite3_context pCtx, sqlite3_value pValue)
|
396
|
+
{
|
397
|
+
Debug.Assert(sqlite3_mutex_held(pCtx.s.db.mutex));
|
398
|
+
sqlite3VdbeMemCopy(pCtx.s, pValue);
|
399
|
+
}
|
400
|
+
|
401
|
+
public static void sqlite3_result_zeroblob(sqlite3_context pCtx, int n)
|
402
|
+
{
|
403
|
+
Debug.Assert(sqlite3_mutex_held(pCtx.s.db.mutex));
|
404
|
+
sqlite3VdbeMemSetZeroBlob(pCtx.s, n);
|
405
|
+
}
|
406
|
+
|
407
|
+
public static void sqlite3_result_error_code(sqlite3_context pCtx, int errCode)
|
408
|
+
{
|
409
|
+
pCtx.isError = errCode;
|
410
|
+
if ((pCtx.s.flags & MEM_Null) != 0)
|
411
|
+
{
|
412
|
+
setResultStrOrError(pCtx, sqlite3ErrStr(errCode), -1,
|
413
|
+
SQLITE_UTF8, SQLITE_STATIC);
|
414
|
+
}
|
415
|
+
}
|
416
|
+
|
417
|
+
/* Force an SQLITE_TOOBIG error. */
|
418
|
+
|
419
|
+
public static void sqlite3_result_error_toobig(sqlite3_context pCtx)
|
420
|
+
{
|
421
|
+
Debug.Assert(sqlite3_mutex_held(pCtx.s.db.mutex));
|
422
|
+
pCtx.isError = SQLITE_ERROR;
|
423
|
+
setResultStrOrError(pCtx, "string or blob too big", -1,
|
424
|
+
SQLITE_UTF8, SQLITE_STATIC);
|
425
|
+
}
|
426
|
+
|
427
|
+
/* An SQLITE_NOMEM error. */
|
428
|
+
public static void sqlite3_result_error_nomem(sqlite3_context pCtx)
|
429
|
+
{
|
430
|
+
Debug.Assert(sqlite3_mutex_held(pCtx.s.db.mutex));
|
431
|
+
sqlite3VdbeMemSetNull(pCtx.s);
|
432
|
+
pCtx.isError = SQLITE_NOMEM;
|
433
|
+
//pCtx.s.db.mallocFailed = 1;
|
434
|
+
}
|
435
|
+
|
436
|
+
/*
|
437
|
+
** Execute the statement pStmt, either until a row of data is ready, the
|
438
|
+
** statement is completely executed or an error occurs.
|
439
|
+
**
|
440
|
+
** This routine implements the bulk of the logic behind the sqlite_step()
|
441
|
+
** API. The only thing omitted is the automatic recompile if a
|
442
|
+
** schema change has occurred. That detail is handled by the
|
443
|
+
** outer sqlite3_step() wrapper procedure.
|
444
|
+
*/
|
445
|
+
public static int sqlite3Step(Vdbe p)
|
446
|
+
{
|
447
|
+
sqlite3 db;
|
448
|
+
int rc;
|
449
|
+
|
450
|
+
Debug.Assert(p != null);
|
451
|
+
if (p.magic != VDBE_MAGIC_RUN)
|
452
|
+
{
|
453
|
+
sqlite3_log(SQLITE_MISUSE,
|
454
|
+
"attempt to step a halted statement: [%s]", p.zSql);
|
455
|
+
return SQLITE_MISUSE_BKPT();
|
456
|
+
}
|
457
|
+
|
458
|
+
/* Check that malloc() has not failed. If it has, return early. */
|
459
|
+
db = p.db;
|
460
|
+
//if ( db.mallocFailed != 0 )
|
461
|
+
//{
|
462
|
+
//p->rc = SQLITE_NOMEM;
|
463
|
+
// return SQLITE_NOMEM;
|
464
|
+
//}
|
465
|
+
|
466
|
+
if (p.pc <= 0 && p.expired)
|
467
|
+
{
|
468
|
+
p.rc = SQLITE_SCHEMA;
|
469
|
+
rc = SQLITE_ERROR;
|
470
|
+
goto end_of_step;
|
471
|
+
}
|
472
|
+
if (p.pc < 0)
|
473
|
+
{
|
474
|
+
/* If there are no other statements currently running, then
|
475
|
+
** reset the interrupt flag. This prevents a call to sqlite3_interrupt
|
476
|
+
** from interrupting a statement that has not yet started.
|
477
|
+
*/
|
478
|
+
if (db.activeVdbeCnt == 0)
|
479
|
+
{
|
480
|
+
db.u1.isInterrupted = false;
|
481
|
+
}
|
482
|
+
|
483
|
+
Debug.Assert(db.writeVdbeCnt > 0 || db.autoCommit == 0 || db.nDeferredCons == 0);
|
484
|
+
#if !SQLITE_OMIT_TRACE
|
485
|
+
if (db.xProfile != null && 0 == db.init.busy)
|
486
|
+
{
|
487
|
+
double rNow = 0;
|
488
|
+
sqlite3OsCurrentTime(db.pVfs, ref rNow);
|
489
|
+
p.startTime = (u64)((rNow - (int)rNow) * 3600.0 * 24.0 * 1000000000.0);
|
490
|
+
}
|
491
|
+
#endif
|
492
|
+
|
493
|
+
db.activeVdbeCnt++;
|
494
|
+
if (p.readOnly == false) db.writeVdbeCnt++;
|
495
|
+
p.pc = 0;
|
496
|
+
}
|
497
|
+
#if !SQLITE_OMIT_EXPLAIN
|
498
|
+
if (p.explain != 0)
|
499
|
+
{
|
500
|
+
rc = sqlite3VdbeList(p);
|
501
|
+
}
|
502
|
+
else
|
503
|
+
#endif // * SQLITE_OMIT_EXPLAIN */
|
504
|
+
{
|
505
|
+
|
506
|
+
rc = sqlite3VdbeExec(p);
|
507
|
+
}
|
508
|
+
|
509
|
+
#if !SQLITE_OMIT_TRACE
|
510
|
+
/* Invoke the profile callback if there is one
|
511
|
+
*/
|
512
|
+
if (rc != SQLITE_ROW && db.xProfile != null && 0 == db.init.busy && p.zSql != null)
|
513
|
+
{
|
514
|
+
double rNow = 0;
|
515
|
+
u64 elapseTime;
|
516
|
+
|
517
|
+
sqlite3OsCurrentTime(db.pVfs, ref rNow);
|
518
|
+
elapseTime = (u64)((rNow - (int)rNow) * 3600.0 * 24.0 * 1000000000.0);
|
519
|
+
elapseTime -= p.startTime;
|
520
|
+
db.xProfile(db.pProfileArg, p.zSql, elapseTime);
|
521
|
+
}
|
522
|
+
#endif
|
523
|
+
|
524
|
+
db.errCode = rc;
|
525
|
+
if (SQLITE_NOMEM == sqlite3ApiExit(p.db, p.rc))
|
526
|
+
{
|
527
|
+
p.rc = SQLITE_NOMEM;
|
528
|
+
}
|
529
|
+
end_of_step:
|
530
|
+
/* At this point local variable rc holds the value that should be
|
531
|
+
** returned if this statement was compiled using the legacy
|
532
|
+
** sqlite3_prepare() interface. According to the docs, this can only
|
533
|
+
** be one of the values in the first Debug.Assert() below. Variable p.rc
|
534
|
+
** contains the value that would be returned if sqlite3_finalize()
|
535
|
+
** were called on statement p.
|
536
|
+
*/
|
537
|
+
Debug.Assert(rc == SQLITE_ROW || rc == SQLITE_DONE || rc == SQLITE_ERROR
|
538
|
+
|| rc == SQLITE_BUSY || rc == SQLITE_MISUSE
|
539
|
+
);
|
540
|
+
Debug.Assert(p.rc != SQLITE_ROW && p.rc != SQLITE_DONE);
|
541
|
+
if (p.isPrepareV2 && rc != SQLITE_ROW && rc != SQLITE_DONE)
|
542
|
+
{
|
543
|
+
/* If this statement was prepared using sqlite3_prepare_v2(), and an
|
544
|
+
** error has occured, then return the error code in p.rc to the
|
545
|
+
** caller. Set the error code in the database handle to the same value.
|
546
|
+
*/
|
547
|
+
rc = db.errCode = p.rc;
|
548
|
+
}
|
549
|
+
return (rc & db.errMask);
|
550
|
+
}
|
551
|
+
|
552
|
+
/*
|
553
|
+
** This is the top-level implementation of sqlite3_step(). Call
|
554
|
+
** sqlite3Step() to do most of the work. If a schema error occurs,
|
555
|
+
** call sqlite3Reprepare() and try again.
|
556
|
+
*/
|
557
|
+
public static int sqlite3_step(sqlite3_stmt pStmt)
|
558
|
+
{
|
559
|
+
int rc = SQLITE_OK; /* Result from sqlite3Step() */
|
560
|
+
int rc2 = SQLITE_OK; /* Result from sqlite3Reprepare() */
|
561
|
+
Vdbe v = (Vdbe)pStmt; /* the prepared statement */
|
562
|
+
int cnt = 0; /* Counter to prevent infinite loop of reprepares */
|
563
|
+
sqlite3 db; /* The database connection */
|
564
|
+
|
565
|
+
if (vdbeSafetyNotNull(v))
|
566
|
+
{
|
567
|
+
return SQLITE_MISUSE_BKPT();
|
568
|
+
}
|
569
|
+
db = v.db;
|
570
|
+
sqlite3_mutex_enter(db.mutex);
|
571
|
+
while ((rc = sqlite3Step(v)) == SQLITE_SCHEMA
|
572
|
+
&& cnt++ < 5
|
573
|
+
&& (rc2 = rc = sqlite3Reprepare(v)) == SQLITE_OK)
|
574
|
+
{
|
575
|
+
sqlite3_reset(pStmt);
|
576
|
+
v.expired = false;
|
577
|
+
}
|
578
|
+
if (rc2 != SQLITE_OK && ALWAYS(v.isPrepareV2) && ALWAYS(db.pErr != null))
|
579
|
+
{
|
580
|
+
/* This case occurs after failing to recompile an sql statement.
|
581
|
+
** The error message from the SQL compiler has already been loaded
|
582
|
+
** into the database handle. This block copies the error message
|
583
|
+
** from the database handle into the statement and sets the statement
|
584
|
+
** program counter to 0 to ensure that when the statement is
|
585
|
+
** finalized or reset the parser error message is available via
|
586
|
+
** sqlite3_errmsg() and sqlite3_errcode().
|
587
|
+
*/
|
588
|
+
string zErr = sqlite3_value_text(db.pErr);
|
589
|
+
sqlite3DbFree(db, ref v.zErrMsg);
|
590
|
+
//if ( 0 == db.mallocFailed )
|
591
|
+
{
|
592
|
+
v.zErrMsg = zErr;// sqlite3DbStrDup(db, zErr);
|
593
|
+
v.rc = rc2;
|
594
|
+
}
|
595
|
+
//else
|
596
|
+
//{
|
597
|
+
// v.zErrMsg = "";
|
598
|
+
// v->rc = rc = SQLITE_NOMEM;
|
599
|
+
//}
|
600
|
+
}
|
601
|
+
rc = sqlite3ApiExit(db, rc);
|
602
|
+
sqlite3_mutex_leave(db.mutex);
|
603
|
+
return rc;
|
604
|
+
}
|
605
|
+
|
606
|
+
/*
|
607
|
+
** Extract the user data from a sqlite3_context structure and return a
|
608
|
+
** pointer to it.
|
609
|
+
*/
|
610
|
+
public static object sqlite3_user_data(sqlite3_context p)
|
611
|
+
{
|
612
|
+
Debug.Assert(p != null && p.pFunc != null);
|
613
|
+
return p.pFunc.pUserData;
|
614
|
+
}
|
615
|
+
|
616
|
+
/*
|
617
|
+
** Extract the user data from a sqlite3_context structure and return a
|
618
|
+
** pointer to it.
|
619
|
+
*/
|
620
|
+
public static sqlite3 sqlite3_context_db_handle(sqlite3_context p)
|
621
|
+
{
|
622
|
+
Debug.Assert(p != null && p.pFunc != null);
|
623
|
+
return p.s.db;
|
624
|
+
}
|
625
|
+
|
626
|
+
/*
|
627
|
+
** The following is the implementation of an SQL function that always
|
628
|
+
** fails with an error message stating that the function is used in the
|
629
|
+
** wrong context. The sqlite3_overload_function() API might construct
|
630
|
+
** SQL function that use this routine so that the functions will exist
|
631
|
+
** for name resolution but are actually overloaded by the xFindFunction
|
632
|
+
** method of virtual tables.
|
633
|
+
*/
|
634
|
+
public static void sqlite3InvalidFunction(
|
635
|
+
sqlite3_context context, /* The function calling context */
|
636
|
+
int NotUsed, /* Number of arguments to the function */
|
637
|
+
sqlite3_value[] NotUsed2 /* Value of each argument */
|
638
|
+
)
|
639
|
+
{
|
640
|
+
string zName = context.pFunc.zName;
|
641
|
+
string zErr;
|
642
|
+
UNUSED_PARAMETER2(NotUsed, NotUsed2);
|
643
|
+
zErr = sqlite3_mprintf(
|
644
|
+
"unable to use function %s in the requested context", zName);
|
645
|
+
sqlite3_result_error(context, zErr, -1);
|
646
|
+
//sqlite3_free( ref zErr );
|
647
|
+
}
|
648
|
+
|
649
|
+
/*
|
650
|
+
** Allocate or return the aggregate context for a user function. A new
|
651
|
+
** context is allocated on the first call. Subsequent calls return the
|
652
|
+
** same context that was returned on prior calls.
|
653
|
+
*/
|
654
|
+
public static Mem sqlite3_aggregate_context(sqlite3_context p, int nByte)
|
655
|
+
{
|
656
|
+
Mem pMem;
|
657
|
+
Debug.Assert(p != null && p.pFunc != null && p.pFunc.xStep != null);
|
658
|
+
Debug.Assert(sqlite3_mutex_held(p.s.db.mutex));
|
659
|
+
pMem = p.pMem;
|
660
|
+
testcase(nByte < 0);
|
661
|
+
if ((pMem.flags & MEM_Agg) == 0)
|
662
|
+
{
|
663
|
+
if (nByte <= 0)
|
664
|
+
{
|
665
|
+
sqlite3VdbeMemReleaseExternal(pMem);
|
666
|
+
pMem.flags = 0;
|
667
|
+
pMem.z = null;
|
668
|
+
}
|
669
|
+
else
|
670
|
+
{
|
671
|
+
sqlite3VdbeMemGrow(pMem, nByte, 0);
|
672
|
+
pMem.flags = MEM_Agg;
|
673
|
+
pMem.u.pDef = p.pFunc;
|
674
|
+
if (pMem.z != null)
|
675
|
+
{
|
676
|
+
pMem.z = null;
|
677
|
+
}
|
678
|
+
pMem._Mem = sqlite3Malloc(pMem._Mem);
|
679
|
+
pMem._Mem.flags = 0;
|
680
|
+
pMem._Mem.z = null;
|
681
|
+
}
|
682
|
+
}
|
683
|
+
return pMem._Mem;
|
684
|
+
}
|
685
|
+
|
686
|
+
/*
|
687
|
+
** Return the auxillary data pointer, if any, for the iArg'th argument to
|
688
|
+
** the user-function defined by pCtx.
|
689
|
+
*/
|
690
|
+
public static string sqlite3_get_auxdata(sqlite3_context pCtx, int iArg)
|
691
|
+
{
|
692
|
+
VdbeFunc pVdbeFunc;
|
693
|
+
|
694
|
+
Debug.Assert(sqlite3_mutex_held(pCtx.s.db.mutex));
|
695
|
+
pVdbeFunc = pCtx.pVdbeFunc;
|
696
|
+
if (null == pVdbeFunc || iArg >= pVdbeFunc.nAux || iArg < 0)
|
697
|
+
{
|
698
|
+
return null;
|
699
|
+
}
|
700
|
+
return pVdbeFunc.apAux[iArg].pAux;
|
701
|
+
}
|
702
|
+
|
703
|
+
/*
|
704
|
+
** Set the auxillary data pointer and delete function, for the iArg'th
|
705
|
+
** argument to the user-function defined by pCtx. Any previous value is
|
706
|
+
** deleted by calling the delete function specified when it was set.
|
707
|
+
*/
|
708
|
+
public static void sqlite3_set_auxdata(
|
709
|
+
sqlite3_context pCtx,
|
710
|
+
int iArg,
|
711
|
+
string pAux,
|
712
|
+
dxDel xDelete//void (*xDelete)(void*)
|
713
|
+
)
|
714
|
+
{
|
715
|
+
AuxData pAuxData;
|
716
|
+
VdbeFunc pVdbeFunc;
|
717
|
+
if (iArg < 0) goto failed;
|
718
|
+
|
719
|
+
Debug.Assert(sqlite3_mutex_held(pCtx.s.db.mutex));
|
720
|
+
pVdbeFunc = pCtx.pVdbeFunc;
|
721
|
+
if (null == pVdbeFunc || pVdbeFunc.nAux <= iArg)
|
722
|
+
{
|
723
|
+
int nAux = (pVdbeFunc != null ? pVdbeFunc.nAux : 0);
|
724
|
+
int nMalloc = iArg; ;//VdbeFunc+ sizeof(struct AuxData)*iArg;
|
725
|
+
if (pVdbeFunc == null)
|
726
|
+
{
|
727
|
+
//pVdbeFunc = (VdbeFunc)sqlite3DbRealloc( pCtx.s.db, pVdbeFunc, nMalloc );
|
728
|
+
pVdbeFunc = new VdbeFunc();
|
729
|
+
if (null == pVdbeFunc)
|
730
|
+
{
|
731
|
+
goto failed;
|
732
|
+
}
|
733
|
+
pCtx.pVdbeFunc = pVdbeFunc;
|
734
|
+
}
|
735
|
+
pVdbeFunc.apAux[nAux] = new AuxData();//memset(pVdbeFunc.apAux[nAux], 0, sizeof(struct AuxData)*(iArg+1-nAux));
|
736
|
+
pVdbeFunc.nAux = iArg + 1;
|
737
|
+
pVdbeFunc.pFunc = pCtx.pFunc;
|
738
|
+
}
|
739
|
+
|
740
|
+
pAuxData = pVdbeFunc.apAux[iArg];
|
741
|
+
if (pAuxData.pAux != null && pAuxData.xDelete != null)
|
742
|
+
{
|
743
|
+
pAuxData.xDelete(ref pAuxData.pAux);
|
744
|
+
}
|
745
|
+
pAuxData.pAux = pAux;
|
746
|
+
pAuxData.xDelete = xDelete;
|
747
|
+
return;
|
748
|
+
|
749
|
+
failed:
|
750
|
+
if (xDelete != null)
|
751
|
+
{
|
752
|
+
xDelete(ref pAux);
|
753
|
+
}
|
754
|
+
}
|
755
|
+
|
756
|
+
#if !SQLITE_OMIT_DEPRECATED
|
757
|
+
/*
|
758
|
+
** Return the number of times the Step function of a aggregate has been
|
759
|
+
** called.
|
760
|
+
**
|
761
|
+
** This function is deprecated. Do not use it for new code. It is
|
762
|
+
** provide only to avoid breaking legacy code. New aggregate function
|
763
|
+
** implementations should keep their own counts within their aggregate
|
764
|
+
** context.
|
765
|
+
*/
|
766
|
+
static int sqlite3_aggregate_count( sqlite3_context p )
|
767
|
+
{
|
768
|
+
Debug.Assert( p != null && p.pMem != null && p.pFunc != null && p.pFunc.xStep != null );
|
769
|
+
return p.pMem.n;
|
770
|
+
}
|
771
|
+
#endif
|
772
|
+
|
773
|
+
/*
|
774
|
+
** Return the number of columns in the result set for the statement pStmt.
|
775
|
+
*/
|
776
|
+
public static int sqlite3_column_count(sqlite3_stmt pStmt)
|
777
|
+
{
|
778
|
+
Vdbe pVm = pStmt;
|
779
|
+
return pVm != null ? (int)pVm.nResColumn : 0;
|
780
|
+
}
|
781
|
+
|
782
|
+
/*
|
783
|
+
** Return the number of values available from the current row of the
|
784
|
+
** currently executing statement pStmt.
|
785
|
+
*/
|
786
|
+
public static int sqlite3_data_count(sqlite3_stmt pStmt)
|
787
|
+
{
|
788
|
+
Vdbe pVm = pStmt;
|
789
|
+
if (pVm == null || pVm.pResultSet == null) return 0;
|
790
|
+
return pVm.nResColumn;
|
791
|
+
}
|
792
|
+
|
793
|
+
|
794
|
+
/*
|
795
|
+
** Check to see if column iCol of the given statement is valid. If
|
796
|
+
** it is, return a pointer to the Mem for the value of that column.
|
797
|
+
** If iCol is not valid, return a pointer to a Mem which has a value
|
798
|
+
** of NULL.
|
799
|
+
*/
|
800
|
+
static Mem columnMem(sqlite3_stmt pStmt, int i)
|
801
|
+
{
|
802
|
+
Vdbe pVm;
|
803
|
+
int vals;
|
804
|
+
Mem pOut;
|
805
|
+
|
806
|
+
pVm = (Vdbe)pStmt;
|
807
|
+
if (pVm != null && pVm.pResultSet != null && i < pVm.nResColumn && i >= 0)
|
808
|
+
{
|
809
|
+
sqlite3_mutex_enter(pVm.db.mutex);
|
810
|
+
vals = sqlite3_data_count(pStmt);
|
811
|
+
pOut = pVm.pResultSet[i];
|
812
|
+
}
|
813
|
+
else
|
814
|
+
{
|
815
|
+
/* If the value passed as the second argument is out of range, return
|
816
|
+
** a pointer to the following public static Mem object which contains the
|
817
|
+
** value SQL NULL. Even though the Mem structure contains an element
|
818
|
+
** of type i64, on certain architecture (x86) with certain compiler
|
819
|
+
** switches (-Os), gcc may align this Mem object on a 4-byte boundary
|
820
|
+
** instead of an 8-byte one. This all works fine, except that when
|
821
|
+
** running with SQLITE_DEBUG defined the SQLite code sometimes assert()s
|
822
|
+
** that a Mem structure is located on an 8-byte boundary. To prevent
|
823
|
+
** this assert() from failing, when building with SQLITE_DEBUG defined
|
824
|
+
** using gcc, force nullMem to be 8-byte aligned using the magical
|
825
|
+
** __attribute__((aligned(8))) macro. */
|
826
|
+
// Mem nullMem
|
827
|
+
#if (SQLITE_DEBUG) && (__GNUC__)
|
828
|
+
__attribute__((aligned(8)))
|
829
|
+
#endif
|
830
|
+
//
|
831
|
+
// public static const Mem nullMem = {{0}, (double)0, 0, "", 0, MEM_Null, SQLITE_NULL, 0, 0, 0 };
|
832
|
+
Mem nullMem = null;
|
833
|
+
nullMem = sqlite3Malloc(nullMem);
|
834
|
+
if (pVm != null && ALWAYS(pVm.db != null))
|
835
|
+
{
|
836
|
+
sqlite3_mutex_enter(pVm.db.mutex);
|
837
|
+
sqlite3Error(pVm.db, SQLITE_RANGE, 0);
|
838
|
+
}
|
839
|
+
pOut = nullMem;
|
840
|
+
}
|
841
|
+
return pOut;
|
842
|
+
}
|
843
|
+
|
844
|
+
/*
|
845
|
+
** This function is called after invoking an sqlite3_value_XXX function on a
|
846
|
+
** column value (i.e. a value returned by evaluating an SQL expression in the
|
847
|
+
** select list of a SELECT statement) that may cause a malloc() failure. If
|
848
|
+
** malloc() has failed, the threads mallocFailed flag is cleared and the result
|
849
|
+
** code of statement pStmt set to SQLITE_NOMEM.
|
850
|
+
**
|
851
|
+
** Specifically, this is called from within:
|
852
|
+
**
|
853
|
+
** sqlite3_column_int()
|
854
|
+
** sqlite3_column_int64()
|
855
|
+
** sqlite3_column_text()
|
856
|
+
** sqlite3_column_text16()
|
857
|
+
** sqlite3_column_real()
|
858
|
+
** sqlite3_column_bytes()
|
859
|
+
** sqlite3_column_bytes16()
|
860
|
+
**
|
861
|
+
** But not for sqlite3_column_blob(), which never calls malloc().
|
862
|
+
*/
|
863
|
+
static void columnMallocFailure(sqlite3_stmt pStmt)
|
864
|
+
{
|
865
|
+
/* If malloc() failed during an encoding conversion within an
|
866
|
+
** sqlite3_column_XXX API, then set the return code of the statement to
|
867
|
+
** SQLITE_NOMEM. The next call to _step() (if any) will return SQLITE_ERROR
|
868
|
+
** and _finalize() will return NOMEM.
|
869
|
+
*/
|
870
|
+
Vdbe p = pStmt;
|
871
|
+
if (p != null)
|
872
|
+
{
|
873
|
+
p.rc = sqlite3ApiExit(p.db, p.rc);
|
874
|
+
sqlite3_mutex_leave(p.db.mutex);
|
875
|
+
}
|
876
|
+
}
|
877
|
+
|
878
|
+
/**************************** sqlite3_column_ *******************************
|
879
|
+
** The following routines are used to access elements of the current row
|
880
|
+
** in the result set.
|
881
|
+
*/
|
882
|
+
public static byte[] sqlite3_column_blob(sqlite3_stmt pStmt, int i)
|
883
|
+
{
|
884
|
+
byte[] val;
|
885
|
+
val = sqlite3_value_blob(columnMem(pStmt, i));
|
886
|
+
/* Even though there is no encoding conversion, value_blob() might
|
887
|
+
** need to call malloc() to expand the result of a zeroblob()
|
888
|
+
** expression.
|
889
|
+
*/
|
890
|
+
columnMallocFailure(pStmt);
|
891
|
+
return val;
|
892
|
+
}
|
893
|
+
|
894
|
+
public static int sqlite3_column_bytes(sqlite3_stmt pStmt, int i)
|
895
|
+
{
|
896
|
+
int val = sqlite3_value_bytes(columnMem(pStmt, i));
|
897
|
+
columnMallocFailure(pStmt);
|
898
|
+
return val;
|
899
|
+
}
|
900
|
+
|
901
|
+
public static int sqlite3_column_bytes16(sqlite3_stmt pStmt, int i)
|
902
|
+
{
|
903
|
+
int val = sqlite3_value_bytes16(columnMem(pStmt, i));
|
904
|
+
columnMallocFailure(pStmt);
|
905
|
+
return val;
|
906
|
+
}
|
907
|
+
|
908
|
+
public static double sqlite3_column_double(sqlite3_stmt pStmt, int i)
|
909
|
+
{
|
910
|
+
double val = sqlite3_value_double(columnMem(pStmt, i));
|
911
|
+
columnMallocFailure(pStmt);
|
912
|
+
return val;
|
913
|
+
}
|
914
|
+
|
915
|
+
public static int sqlite3_column_int(sqlite3_stmt pStmt, int i)
|
916
|
+
{
|
917
|
+
int val = sqlite3_value_int(columnMem(pStmt, i));
|
918
|
+
columnMallocFailure(pStmt);
|
919
|
+
return val;
|
920
|
+
}
|
921
|
+
|
922
|
+
|
923
|
+
public static sqlite_int64 sqlite3_column_int64(sqlite3_stmt pStmt, int i)
|
924
|
+
{
|
925
|
+
sqlite_int64 val = sqlite3_value_int64(columnMem(pStmt, i));
|
926
|
+
columnMallocFailure(pStmt);
|
927
|
+
return val;
|
928
|
+
}
|
929
|
+
|
930
|
+
public static string sqlite3_column_text(sqlite3_stmt pStmt, int i)
|
931
|
+
{
|
932
|
+
string val = sqlite3_value_text(columnMem(pStmt, i));
|
933
|
+
columnMallocFailure(pStmt);
|
934
|
+
if (String.IsNullOrEmpty(val)) return null; return val;
|
935
|
+
}
|
936
|
+
|
937
|
+
public static sqlite3_value sqlite3_column_value(sqlite3_stmt pStmt, int i)
|
938
|
+
{
|
939
|
+
Mem pOut = columnMem(pStmt, i);
|
940
|
+
if ((pOut.flags & MEM_Static) != 0)
|
941
|
+
{
|
942
|
+
pOut.flags = (u16)(pOut.flags & ~MEM_Static);
|
943
|
+
pOut.flags |= MEM_Ephem;
|
944
|
+
}
|
945
|
+
columnMallocFailure(pStmt);
|
946
|
+
return (sqlite3_value)pOut;
|
947
|
+
}
|
948
|
+
#if !SQLITE_OMIT_UTF16
|
949
|
+
//const void *sqlite3_column_text16(sqlite3_stmt pStmt, int i){
|
950
|
+
// const void *val = sqlite3_value_text16( columnMem(pStmt,i) );
|
951
|
+
// columnMallocFailure(pStmt);
|
952
|
+
// return val;
|
953
|
+
//}
|
954
|
+
#endif // * SQLITE_OMIT_UTF16 */
|
955
|
+
|
956
|
+
public static int sqlite3_column_type(sqlite3_stmt pStmt, int i)
|
957
|
+
{
|
958
|
+
int iType = sqlite3_value_type(columnMem(pStmt, i));
|
959
|
+
columnMallocFailure(pStmt);
|
960
|
+
return iType;
|
961
|
+
}
|
962
|
+
|
963
|
+
/* The following function is experimental and subject to change or
|
964
|
+
** removal */
|
965
|
+
/*int sqlite3_column_numeric_type(sqlite3_stmt pStmt, int i){
|
966
|
+
** return sqlite3_value_numeric_type( columnMem(pStmt,i) );
|
967
|
+
**}
|
968
|
+
*/
|
969
|
+
|
970
|
+
/*
|
971
|
+
** Convert the N-th element of pStmt.pColName[] into a string using
|
972
|
+
** xFunc() then return that string. If N is out of range, return 0.
|
973
|
+
**
|
974
|
+
** There are up to 5 names for each column. useType determines which
|
975
|
+
** name is returned. Here are the names:
|
976
|
+
**
|
977
|
+
** 0 The column name as it should be displayed for output
|
978
|
+
** 1 The datatype name for the column
|
979
|
+
** 2 The name of the database that the column derives from
|
980
|
+
** 3 The name of the table that the column derives from
|
981
|
+
** 4 The name of the table column that the result column derives from
|
982
|
+
**
|
983
|
+
** If the result is not a simple column reference (if it is an expression
|
984
|
+
** or a constant) then useTypes 2, 3, and 4 return NULL.
|
985
|
+
*/
|
986
|
+
public static string columnName(
|
987
|
+
sqlite3_stmt pStmt,
|
988
|
+
int N,
|
989
|
+
dxColname xFunc,
|
990
|
+
int useType
|
991
|
+
)
|
992
|
+
{
|
993
|
+
string ret = null;
|
994
|
+
Vdbe p = pStmt;
|
995
|
+
int n;
|
996
|
+
sqlite3 db = p.db;
|
997
|
+
|
998
|
+
Debug.Assert(db != null);
|
999
|
+
|
1000
|
+
n = sqlite3_column_count(pStmt);
|
1001
|
+
if (N < n && N >= 0)
|
1002
|
+
{
|
1003
|
+
N += useType * n;
|
1004
|
+
sqlite3_mutex_enter(db.mutex);
|
1005
|
+
//Debug.Assert( db.mallocFailed == 0 );
|
1006
|
+
ret = xFunc(p.aColName[N]);
|
1007
|
+
|
1008
|
+
/* A malloc may have failed inside of the xFunc() call. If this
|
1009
|
+
** is the case, clear the mallocFailed flag and return NULL.
|
1010
|
+
*/
|
1011
|
+
//if ( db.mallocFailed != 0 )
|
1012
|
+
//{
|
1013
|
+
// //db.mallocFailed = 0;
|
1014
|
+
// ret = null;
|
1015
|
+
//}
|
1016
|
+
sqlite3_mutex_leave(db.mutex);
|
1017
|
+
}
|
1018
|
+
return ret;
|
1019
|
+
}
|
1020
|
+
|
1021
|
+
/*
|
1022
|
+
** Return the name of the Nth column of the result set returned by SQL
|
1023
|
+
** statement pStmt.
|
1024
|
+
*/
|
1025
|
+
public static string sqlite3_column_name(sqlite3_stmt pStmt, int N)
|
1026
|
+
{
|
1027
|
+
return columnName(
|
1028
|
+
pStmt, N, sqlite3_value_text, COLNAME_NAME);
|
1029
|
+
}
|
1030
|
+
#if !SQLITE_OMIT_UTF16
|
1031
|
+
public static string sqlite3_column_name16(sqlite3_stmt pStmt, int N){
|
1032
|
+
return columnName(
|
1033
|
+
pStmt, N, sqlite3_value_text16, COLNAME_NAME);
|
1034
|
+
}
|
1035
|
+
#endif
|
1036
|
+
|
1037
|
+
/*
|
1038
|
+
** Constraint: If you have ENABLE_COLUMN_METADATA then you must
|
1039
|
+
** not define OMIT_DECLTYPE.
|
1040
|
+
*/
|
1041
|
+
#if SQLITE_OMIT_DECLTYPE && SQLITE_ENABLE_COLUMN_METADATA
|
1042
|
+
# error "Must not define both SQLITE_OMIT_DECLTYPE and SQLITE_ENABLE_COLUMN_METADATA"
|
1043
|
+
#endif
|
1044
|
+
|
1045
|
+
#if !SQLITE_OMIT_DECLTYPE
|
1046
|
+
/*
|
1047
|
+
** Return the column declaration type (if applicable) of the 'i'th column
|
1048
|
+
** of the result set of SQL statement pStmt.
|
1049
|
+
*/
|
1050
|
+
public static string sqlite3_column_decltype(sqlite3_stmt pStmt, int N)
|
1051
|
+
{
|
1052
|
+
return columnName(
|
1053
|
+
pStmt, N, sqlite3_value_text, COLNAME_DECLTYPE);
|
1054
|
+
}
|
1055
|
+
#if !SQLITE_OMIT_UTF16
|
1056
|
+
//const void *sqlite3_column_decltype16(sqlite3_stmt pStmt, int N){
|
1057
|
+
// return columnName(
|
1058
|
+
// pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_DECLTYPE);
|
1059
|
+
//}
|
1060
|
+
#endif // * SQLITE_OMIT_UTF16 */
|
1061
|
+
#endif // * SQLITE_OMIT_DECLTYPE */
|
1062
|
+
|
1063
|
+
#if SQLITE_ENABLE_COLUMN_METADATA
|
1064
|
+
|
1065
|
+
/*
|
1066
|
+
** Return the name of the database from which a result column derives.
|
1067
|
+
** NULL is returned if the result column is an expression or constant or
|
1068
|
+
** anything else which is not an unabiguous reference to a database column.
|
1069
|
+
*/
|
1070
|
+
static byte[] sqlite3_column_database_name(sqlite3_stmt pStmt, int N){
|
1071
|
+
return columnName(
|
1072
|
+
pStmt, N, sqlite3_value_text, COLNAME_DATABASE);
|
1073
|
+
}
|
1074
|
+
#if !SQLITE_OMIT_UTF16
|
1075
|
+
const void *sqlite3_column_database_name16(sqlite3_stmt pStmt, int N){
|
1076
|
+
return columnName(
|
1077
|
+
pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_DATABASE);
|
1078
|
+
}
|
1079
|
+
#endif //* SQLITE_OMIT_UTF16 */
|
1080
|
+
|
1081
|
+
/*
|
1082
|
+
** Return the name of the table from which a result column derives.
|
1083
|
+
** NULL is returned if the result column is an expression or constant or
|
1084
|
+
** anything else which is not an unabiguous reference to a database column.
|
1085
|
+
*/
|
1086
|
+
static byte[] qlite3_column_table_name(sqlite3_stmt pStmt, int N){
|
1087
|
+
return columnName(
|
1088
|
+
pStmt, N, sqlite3_value_text, COLNAME_TABLE);
|
1089
|
+
}
|
1090
|
+
#if !SQLITE_OMIT_UTF16
|
1091
|
+
const void *sqlite3_column_table_name16(sqlite3_stmt pStmt, int N){
|
1092
|
+
return columnName(
|
1093
|
+
pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_TABLE);
|
1094
|
+
}
|
1095
|
+
#endif //* SQLITE_OMIT_UTF16 */
|
1096
|
+
|
1097
|
+
/*
|
1098
|
+
** Return the name of the table column from which a result column derives.
|
1099
|
+
** NULL is returned if the result column is an expression or constant or
|
1100
|
+
** anything else which is not an unabiguous reference to a database column.
|
1101
|
+
*/
|
1102
|
+
static byte[] sqlite3_column_origin_name(sqlite3_stmt pStmt, int N){
|
1103
|
+
return columnName(
|
1104
|
+
pStmt, N, sqlite3_value_text, COLNAME_COLUMN);
|
1105
|
+
}
|
1106
|
+
#if !SQLITE_OMIT_UTF16
|
1107
|
+
const void *sqlite3_column_origin_name16(sqlite3_stmt pStmt, int N){
|
1108
|
+
return columnName(
|
1109
|
+
pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_COLUMN);
|
1110
|
+
}
|
1111
|
+
#endif ///* SQLITE_OMIT_UTF16 */
|
1112
|
+
#endif // * SQLITE_ENABLE_COLUMN_METADATA */
|
1113
|
+
|
1114
|
+
|
1115
|
+
/******************************* sqlite3_bind_ ***************************
|
1116
|
+
**
|
1117
|
+
** Routines used to attach values to wildcards in a compiled SQL statement.
|
1118
|
+
*/
|
1119
|
+
/*
|
1120
|
+
** Unbind the value bound to variable i in virtual machine p. This is the
|
1121
|
+
** the same as binding a NULL value to the column. If the "i" parameter is
|
1122
|
+
** out of range, then SQLITE_RANGE is returned. Othewise SQLITE_OK.
|
1123
|
+
**
|
1124
|
+
** A successful evaluation of this routine acquires the mutex on p.
|
1125
|
+
** the mutex is released if any kind of error occurs.
|
1126
|
+
**
|
1127
|
+
** The error code stored in database p.db is overwritten with the return
|
1128
|
+
** value in any case.
|
1129
|
+
*/
|
1130
|
+
public static int vdbeUnbind(Vdbe p, int i)
|
1131
|
+
{
|
1132
|
+
Mem pVar;
|
1133
|
+
if (vdbeSafetyNotNull(p))
|
1134
|
+
{
|
1135
|
+
return SQLITE_MISUSE_BKPT();
|
1136
|
+
}
|
1137
|
+
sqlite3_mutex_enter(p.db.mutex);
|
1138
|
+
if (p.magic != VDBE_MAGIC_RUN || p.pc >= 0)
|
1139
|
+
{
|
1140
|
+
sqlite3Error(p.db, SQLITE_MISUSE, 0);
|
1141
|
+
sqlite3_mutex_leave(p.db.mutex);
|
1142
|
+
sqlite3_log(SQLITE_MISUSE,
|
1143
|
+
"bind on a busy prepared statement: [%s]", p.zSql);
|
1144
|
+
return SQLITE_MISUSE_BKPT();
|
1145
|
+
}
|
1146
|
+
if (i < 1 || i > p.nVar)
|
1147
|
+
{
|
1148
|
+
sqlite3Error(p.db, SQLITE_RANGE, 0);
|
1149
|
+
sqlite3_mutex_leave(p.db.mutex);
|
1150
|
+
return SQLITE_RANGE;
|
1151
|
+
}
|
1152
|
+
i--;
|
1153
|
+
pVar = p.aVar[i];
|
1154
|
+
sqlite3VdbeMemRelease(pVar);
|
1155
|
+
pVar.flags = MEM_Null;
|
1156
|
+
sqlite3Error(p.db, SQLITE_OK, 0);
|
1157
|
+
|
1158
|
+
/* If the bit corresponding to this variable in Vdbe.expmask is set, then
|
1159
|
+
** binding a new value to this variable invalidates the current query plan.
|
1160
|
+
*/
|
1161
|
+
if (p.isPrepareV2 &&
|
1162
|
+
((i < 32 && p.expmask != 0 & ((u32)1 << i) != 0) || p.expmask == 0xffffffff)
|
1163
|
+
)
|
1164
|
+
{
|
1165
|
+
p.expired = true;
|
1166
|
+
}
|
1167
|
+
|
1168
|
+
return SQLITE_OK;
|
1169
|
+
}
|
1170
|
+
|
1171
|
+
/*
|
1172
|
+
** Bind a text or BLOB value.
|
1173
|
+
*/
|
1174
|
+
static int bindBlob(
|
1175
|
+
sqlite3_stmt pStmt, /* The statement to bind against */
|
1176
|
+
int i, /* Index of the parameter to bind */
|
1177
|
+
byte[] zData, /* Pointer to the data to be bound */
|
1178
|
+
int nData, /* Number of bytes of data to be bound */
|
1179
|
+
dxDel xDel, /* Destructor for the data */
|
1180
|
+
u8 encoding /* Encoding for the data */
|
1181
|
+
)
|
1182
|
+
{
|
1183
|
+
Vdbe p = pStmt;
|
1184
|
+
Mem pVar;
|
1185
|
+
int rc;
|
1186
|
+
|
1187
|
+
rc = vdbeUnbind(p, i);
|
1188
|
+
if (rc == SQLITE_OK)
|
1189
|
+
{
|
1190
|
+
if (zData != null)
|
1191
|
+
{
|
1192
|
+
pVar = p.aVar[i - 1];
|
1193
|
+
rc = sqlite3VdbeMemSetBlob(pVar, zData, nData, encoding, xDel);
|
1194
|
+
if (rc == SQLITE_OK && encoding != 0)
|
1195
|
+
{
|
1196
|
+
rc = sqlite3VdbeChangeEncoding(pVar, ENC(p.db));
|
1197
|
+
}
|
1198
|
+
sqlite3Error(p.db, rc, 0);
|
1199
|
+
rc = sqlite3ApiExit(p.db, rc);
|
1200
|
+
}
|
1201
|
+
sqlite3_mutex_leave(p.db.mutex);
|
1202
|
+
}
|
1203
|
+
return rc;
|
1204
|
+
}
|
1205
|
+
|
1206
|
+
/*
|
1207
|
+
** Bind a text value.
|
1208
|
+
*/
|
1209
|
+
public static int bindText(
|
1210
|
+
sqlite3_stmt pStmt, /* The statement to bind against */
|
1211
|
+
int i, /* Index of the parameter to bind */
|
1212
|
+
string zData, /* Pointer to the data to be bound */
|
1213
|
+
int nData, /* Number of bytes of data to be bound */
|
1214
|
+
dxDel xDel, /* Destructor for the data */
|
1215
|
+
u8 encoding /* Encoding for the data */
|
1216
|
+
)
|
1217
|
+
{
|
1218
|
+
Vdbe p = pStmt;
|
1219
|
+
Mem pVar;
|
1220
|
+
int rc;
|
1221
|
+
|
1222
|
+
rc = vdbeUnbind(p, i);
|
1223
|
+
if (rc == SQLITE_OK)
|
1224
|
+
{
|
1225
|
+
if (zData != null)
|
1226
|
+
{
|
1227
|
+
pVar = p.aVar[i - 1];
|
1228
|
+
rc = sqlite3VdbeMemSetStr(pVar, zData, nData, encoding, xDel);
|
1229
|
+
if (rc == SQLITE_OK && encoding != 0)
|
1230
|
+
{
|
1231
|
+
rc = sqlite3VdbeChangeEncoding(pVar, ENC(p.db));
|
1232
|
+
}
|
1233
|
+
sqlite3Error(p.db, rc, 0);
|
1234
|
+
rc = sqlite3ApiExit(p.db, rc);
|
1235
|
+
}
|
1236
|
+
sqlite3_mutex_leave(p.db.mutex);
|
1237
|
+
}
|
1238
|
+
return rc;
|
1239
|
+
}
|
1240
|
+
|
1241
|
+
public static int sqlite3_bind_double(sqlite3_stmt pStmt, int i, double rValue)
|
1242
|
+
{
|
1243
|
+
int rc;
|
1244
|
+
Vdbe p = pStmt;
|
1245
|
+
rc = vdbeUnbind(p, i);
|
1246
|
+
if (rc == SQLITE_OK)
|
1247
|
+
{
|
1248
|
+
sqlite3VdbeMemSetDouble(p.aVar[i - 1], rValue);
|
1249
|
+
sqlite3_mutex_leave(p.db.mutex);
|
1250
|
+
}
|
1251
|
+
return rc;
|
1252
|
+
}
|
1253
|
+
|
1254
|
+
public static int sqlite3_bind_int(sqlite3_stmt p, int i, int iValue)
|
1255
|
+
{
|
1256
|
+
return sqlite3_bind_int64(p, i, (i64)iValue);
|
1257
|
+
}
|
1258
|
+
|
1259
|
+
public static int sqlite3_bind_int64(sqlite3_stmt pStmt, int i, sqlite_int64 iValue)
|
1260
|
+
{
|
1261
|
+
int rc;
|
1262
|
+
Vdbe p = pStmt;
|
1263
|
+
rc = vdbeUnbind(p, i);
|
1264
|
+
if (rc == SQLITE_OK)
|
1265
|
+
{
|
1266
|
+
sqlite3VdbeMemSetInt64(p.aVar[i - 1], iValue);
|
1267
|
+
sqlite3_mutex_leave(p.db.mutex);
|
1268
|
+
}
|
1269
|
+
return rc;
|
1270
|
+
}
|
1271
|
+
|
1272
|
+
public static int sqlite3_bind_null(sqlite3_stmt pStmt, int i)
|
1273
|
+
{
|
1274
|
+
int rc;
|
1275
|
+
Vdbe p = (Vdbe)pStmt;
|
1276
|
+
rc = vdbeUnbind(p, i);
|
1277
|
+
if (rc == SQLITE_OK)
|
1278
|
+
{
|
1279
|
+
sqlite3_mutex_leave(p.db.mutex);
|
1280
|
+
} return rc;
|
1281
|
+
}
|
1282
|
+
|
1283
|
+
public static int sqlite3_bind_text(
|
1284
|
+
sqlite3_stmt pStmt,
|
1285
|
+
int i,
|
1286
|
+
string zData,
|
1287
|
+
int nData,
|
1288
|
+
dxDel xDel
|
1289
|
+
)
|
1290
|
+
{
|
1291
|
+
return bindText(pStmt, i, zData, nData, xDel, SQLITE_UTF8);
|
1292
|
+
}
|
1293
|
+
|
1294
|
+
public static int sqlite3_bind_blob(
|
1295
|
+
sqlite3_stmt pStmt,
|
1296
|
+
int i,
|
1297
|
+
byte[] zData,
|
1298
|
+
int nData,
|
1299
|
+
dxDel xDel
|
1300
|
+
)
|
1301
|
+
{
|
1302
|
+
return bindBlob(pStmt, i, zData, nData >= 0 ? nData : zData.Length, xDel, 0);
|
1303
|
+
}
|
1304
|
+
|
1305
|
+
#if !SQLITE_OMIT_UTF16
|
1306
|
+
static int sqlite3_bind_text16(
|
1307
|
+
sqlite3_stmt pStmt,
|
1308
|
+
int i,
|
1309
|
+
string zData,
|
1310
|
+
int nData,
|
1311
|
+
dxDel xDel
|
1312
|
+
){
|
1313
|
+
return bindText(pStmt, i, zData, nData, xDel, SQLITE_UTF16NATIVE);
|
1314
|
+
}
|
1315
|
+
#endif // * SQLITE_OMIT_UTF16 */
|
1316
|
+
|
1317
|
+
public static int sqlite3_bind_value(sqlite3_stmt pStmt, int i, sqlite3_value pValue)
|
1318
|
+
{
|
1319
|
+
int rc;
|
1320
|
+
switch (pValue.type)
|
1321
|
+
{
|
1322
|
+
case SQLITE_INTEGER:
|
1323
|
+
{
|
1324
|
+
rc = sqlite3_bind_int64(pStmt, i, pValue.u.i);
|
1325
|
+
break;
|
1326
|
+
}
|
1327
|
+
case SQLITE_FLOAT:
|
1328
|
+
{
|
1329
|
+
rc = sqlite3_bind_double(pStmt, i, pValue.r);
|
1330
|
+
break;
|
1331
|
+
}
|
1332
|
+
case SQLITE_BLOB:
|
1333
|
+
{
|
1334
|
+
if ((pValue.flags & MEM_Zero) != 0)
|
1335
|
+
{
|
1336
|
+
rc = sqlite3_bind_zeroblob(pStmt, i, pValue.u.nZero);
|
1337
|
+
}
|
1338
|
+
else
|
1339
|
+
{
|
1340
|
+
rc = sqlite3_bind_blob(pStmt, i, pValue.zBLOB, pValue.n, SQLITE_TRANSIENT);
|
1341
|
+
}
|
1342
|
+
break;
|
1343
|
+
}
|
1344
|
+
case SQLITE_TEXT:
|
1345
|
+
{
|
1346
|
+
rc = bindText(pStmt, i, pValue.z, pValue.n, SQLITE_TRANSIENT,
|
1347
|
+
pValue.enc);
|
1348
|
+
break;
|
1349
|
+
}
|
1350
|
+
default:
|
1351
|
+
{
|
1352
|
+
rc = sqlite3_bind_null(pStmt, i);
|
1353
|
+
break;
|
1354
|
+
}
|
1355
|
+
}
|
1356
|
+
return rc;
|
1357
|
+
}
|
1358
|
+
|
1359
|
+
public static int sqlite3_bind_zeroblob(sqlite3_stmt pStmt, int i, int n)
|
1360
|
+
{
|
1361
|
+
int rc;
|
1362
|
+
Vdbe p = pStmt;
|
1363
|
+
rc = vdbeUnbind(p, i);
|
1364
|
+
if (rc == SQLITE_OK)
|
1365
|
+
{
|
1366
|
+
sqlite3VdbeMemSetZeroBlob(p.aVar[i - 1], n);
|
1367
|
+
sqlite3_mutex_leave(p.db.mutex);
|
1368
|
+
}
|
1369
|
+
return rc;
|
1370
|
+
}
|
1371
|
+
|
1372
|
+
/*
|
1373
|
+
** Return the number of wildcards that can be potentially bound to.
|
1374
|
+
** This routine is added to support DBD::SQLite.
|
1375
|
+
*/
|
1376
|
+
public static int sqlite3_bind_parameter_count(sqlite3_stmt pStmt)
|
1377
|
+
{
|
1378
|
+
Vdbe p = (Vdbe)pStmt;
|
1379
|
+
return (p != null) ? (int)p.nVar : 0;
|
1380
|
+
}
|
1381
|
+
|
1382
|
+
/*
|
1383
|
+
** Create a mapping from variable numbers to variable names
|
1384
|
+
** in the Vdbe.azVar[] array, if such a mapping does not already
|
1385
|
+
** exist.
|
1386
|
+
*/
|
1387
|
+
public static void createVarMap(Vdbe p)
|
1388
|
+
{
|
1389
|
+
if (0 == p.okVar)
|
1390
|
+
{
|
1391
|
+
int j;
|
1392
|
+
Op pOp;
|
1393
|
+
sqlite3_mutex_enter(p.db.mutex);
|
1394
|
+
/* The race condition here is harmless. If two threads call this
|
1395
|
+
** routine on the same Vdbe at the same time, they both might end
|
1396
|
+
** up initializing the Vdbe.azVar[] array. That is a little extra
|
1397
|
+
** work but it results in the same answer.
|
1398
|
+
*/
|
1399
|
+
p.azVar = new string[p.nOp];
|
1400
|
+
for (j = 0; j < p.nOp; j++)//, pOp++ )
|
1401
|
+
{
|
1402
|
+
pOp = p.aOp[j];
|
1403
|
+
if (pOp.opcode == OP_Variable)
|
1404
|
+
{
|
1405
|
+
Debug.Assert(pOp.p1 > 0 && pOp.p1 <= p.nVar);
|
1406
|
+
p.azVar[pOp.p1 - 1] = pOp.p4.z != null ? pOp.p4.z : "";
|
1407
|
+
}
|
1408
|
+
}
|
1409
|
+
p.okVar = 1;
|
1410
|
+
sqlite3_mutex_leave(p.db.mutex);
|
1411
|
+
}
|
1412
|
+
}
|
1413
|
+
|
1414
|
+
/*
|
1415
|
+
** Return the name of a wildcard parameter. Return NULL if the index
|
1416
|
+
** is out of range or if the wildcard is unnamed.
|
1417
|
+
**
|
1418
|
+
** The result is always UTF-8.
|
1419
|
+
*/
|
1420
|
+
public static string sqlite3_bind_parameter_name(sqlite3_stmt pStmt, int i)
|
1421
|
+
{
|
1422
|
+
Vdbe p = (Vdbe)pStmt;
|
1423
|
+
if (p == null || i < 1 || i > p.nVar)
|
1424
|
+
{
|
1425
|
+
return "";
|
1426
|
+
}
|
1427
|
+
createVarMap(p);
|
1428
|
+
return p.azVar[i - 1];
|
1429
|
+
}
|
1430
|
+
|
1431
|
+
/*
|
1432
|
+
** Given a wildcard parameter name, return the index of the variable
|
1433
|
+
** with that name. If there is no variable with the given name,
|
1434
|
+
** return 0.
|
1435
|
+
*/
|
1436
|
+
public static int sqlite3VdbeParameterIndex(Vdbe p, string zName, int nName)
|
1437
|
+
{
|
1438
|
+
int i;
|
1439
|
+
if (p == null)
|
1440
|
+
{
|
1441
|
+
return 0;
|
1442
|
+
}
|
1443
|
+
createVarMap(p);
|
1444
|
+
if (zName != null && zName != "")
|
1445
|
+
{
|
1446
|
+
for (i = 0; i < p.nVar; i++)
|
1447
|
+
{
|
1448
|
+
string z = p.azVar[i];
|
1449
|
+
if (z != null && z == zName)//&& memcmp(z,zName,nName)==0 && z[nName]==0)
|
1450
|
+
{
|
1451
|
+
return i + 1;
|
1452
|
+
}
|
1453
|
+
}
|
1454
|
+
}
|
1455
|
+
return 0;
|
1456
|
+
}
|
1457
|
+
|
1458
|
+
public static int sqlite3_bind_parameter_index(sqlite3_stmt pStmt, string zName)
|
1459
|
+
{
|
1460
|
+
return sqlite3VdbeParameterIndex((Vdbe)pStmt, zName, sqlite3Strlen30(zName));
|
1461
|
+
}
|
1462
|
+
|
1463
|
+
/*
|
1464
|
+
** Transfer all bindings from the first statement over to the second.
|
1465
|
+
*/
|
1466
|
+
public static int sqlite3TransferBindings(sqlite3_stmt pFromStmt, sqlite3_stmt pToStmt)
|
1467
|
+
{
|
1468
|
+
Vdbe pFrom = (Vdbe)pFromStmt;
|
1469
|
+
Vdbe pTo = (Vdbe)pToStmt;
|
1470
|
+
int i;
|
1471
|
+
Debug.Assert(pTo.db == pFrom.db);
|
1472
|
+
Debug.Assert(pTo.nVar == pFrom.nVar);
|
1473
|
+
sqlite3_mutex_enter(pTo.db.mutex);
|
1474
|
+
for (i = 0; i < pFrom.nVar; i++)
|
1475
|
+
{
|
1476
|
+
sqlite3VdbeMemMove(pTo.aVar[i], pFrom.aVar[i]);
|
1477
|
+
}
|
1478
|
+
sqlite3_mutex_leave(pTo.db.mutex);
|
1479
|
+
return SQLITE_OK;
|
1480
|
+
}
|
1481
|
+
|
1482
|
+
#if !SQLITE_OMIT_DEPRECATED
|
1483
|
+
/*
|
1484
|
+
** Deprecated external interface. Internal/core SQLite code
|
1485
|
+
** should call sqlite3TransferBindings.
|
1486
|
+
**
|
1487
|
+
** Is is misuse to call this routine with statements from different
|
1488
|
+
** database connections. But as this is a deprecated interface, we
|
1489
|
+
** will not bother to check for that condition.
|
1490
|
+
**
|
1491
|
+
** If the two statements contain a different number of bindings, then
|
1492
|
+
** an SQLITE_ERROR is returned. Nothing else can go wrong, so otherwise
|
1493
|
+
** SQLITE_OK is returned.
|
1494
|
+
*/
|
1495
|
+
static int sqlite3_transfer_bindings( sqlite3_stmt pFromStmt, sqlite3_stmt pToStmt )
|
1496
|
+
{
|
1497
|
+
Vdbe pFrom = (Vdbe)pFromStmt;
|
1498
|
+
Vdbe pTo = (Vdbe)pToStmt;
|
1499
|
+
if ( pFrom.nVar != pTo.nVar )
|
1500
|
+
{
|
1501
|
+
return SQLITE_ERROR;
|
1502
|
+
}
|
1503
|
+
if( pTo.isPrepareV2 && pTo.expmask ){
|
1504
|
+
pTo.expired = 1;
|
1505
|
+
}
|
1506
|
+
if( pFrom.isPrepareV2 && pFrom.expmask ){
|
1507
|
+
pFrom.expired = 1;
|
1508
|
+
}
|
1509
|
+
return sqlite3TransferBindings( pFromStmt, pToStmt );
|
1510
|
+
}
|
1511
|
+
#endif
|
1512
|
+
|
1513
|
+
/*
|
1514
|
+
** Return the sqlite3* database handle to which the prepared statement given
|
1515
|
+
** in the argument belongs. This is the same database handle that was
|
1516
|
+
** the first argument to the sqlite3_prepare() that was used to create
|
1517
|
+
** the statement in the first place.
|
1518
|
+
*/
|
1519
|
+
public static sqlite3 sqlite3_db_handle(sqlite3_stmt pStmt)
|
1520
|
+
{
|
1521
|
+
return pStmt != null ? ((Vdbe)pStmt).db : null;
|
1522
|
+
}
|
1523
|
+
|
1524
|
+
/*
|
1525
|
+
** Return a pointer to the next prepared statement after pStmt associated
|
1526
|
+
** with database connection pDb. If pStmt is NULL, return the first
|
1527
|
+
** prepared statement for the database connection. Return NULL if there
|
1528
|
+
** are no more.
|
1529
|
+
*/
|
1530
|
+
|
1531
|
+
public static sqlite3_stmt sqlite3_next_stmt(sqlite3 pDb, sqlite3_stmt pStmt)
|
1532
|
+
{
|
1533
|
+
sqlite3_stmt pNext;
|
1534
|
+
sqlite3_mutex_enter(pDb.mutex);
|
1535
|
+
if (pStmt == null)
|
1536
|
+
{
|
1537
|
+
pNext = (sqlite3_stmt)pDb.pVdbe;
|
1538
|
+
}
|
1539
|
+
else
|
1540
|
+
{
|
1541
|
+
pNext = (sqlite3_stmt)((Vdbe)pStmt).pNext;
|
1542
|
+
}
|
1543
|
+
sqlite3_mutex_leave(pDb.mutex);
|
1544
|
+
return pNext;
|
1545
|
+
}
|
1546
|
+
/*
|
1547
|
+
** Return the value of a status counter for a prepared statement
|
1548
|
+
*/
|
1549
|
+
public static int sqlite3_stmt_status(sqlite3_stmt pStmt, int op, int resetFlag)
|
1550
|
+
{
|
1551
|
+
Vdbe pVdbe = (Vdbe)pStmt;
|
1552
|
+
int v = pVdbe.aCounter[op - 1];
|
1553
|
+
if (resetFlag != 0) pVdbe.aCounter[op - 1] = 0;
|
1554
|
+
return v;
|
1555
|
+
}
|
1556
|
+
}
|
1557
|
+
}
|