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,1317 @@
|
|
1
|
+
using System;
|
2
|
+
using System.Diagnostics;
|
3
|
+
using System.Text;
|
4
|
+
|
5
|
+
using time_t = System.Int64;
|
6
|
+
using sqlite3_int64 = System.Int64;
|
7
|
+
using i64 = System.Int64;
|
8
|
+
using u64 = System.UInt64;
|
9
|
+
|
10
|
+
namespace Community.CsharpSqlite
|
11
|
+
{
|
12
|
+
using sqlite3_value = Sqlite3.Mem;
|
13
|
+
|
14
|
+
public partial class Sqlite3
|
15
|
+
{
|
16
|
+
/*
|
17
|
+
** 2003 October 31
|
18
|
+
**
|
19
|
+
** The author disclaims copyright to this source code. In place of
|
20
|
+
** a legal notice, here is a blessing:
|
21
|
+
**
|
22
|
+
** May you do good and not evil.
|
23
|
+
** May you find forgiveness for yourself and forgive others.
|
24
|
+
** May you share freely, never taking more than you give.
|
25
|
+
**
|
26
|
+
*************************************************************************
|
27
|
+
** This file contains the C functions that implement date and time
|
28
|
+
** functions for SQLite.
|
29
|
+
**
|
30
|
+
** There is only one exported symbol in this file - the function
|
31
|
+
** sqlite3RegisterDateTimeFunctions() found at the bottom of the file.
|
32
|
+
** All other code has file scope.
|
33
|
+
**
|
34
|
+
** SQLite processes all times and dates as Julian Day numbers. The
|
35
|
+
** dates and times are stored as the number of days since noon
|
36
|
+
** in Greenwich on November 24, 4714 B.C. according to the Gregorian
|
37
|
+
** calendar system.
|
38
|
+
**
|
39
|
+
** 1970-01-01 00:00:00 is JD 2440587.5
|
40
|
+
** 2000-01-01 00:00:00 is JD 2451544.5
|
41
|
+
**
|
42
|
+
** This implemention requires years to be expressed as a 4-digit number
|
43
|
+
** which means that only dates between 0000-01-01 and 9999-12-31 can
|
44
|
+
** be represented, even though julian day numbers allow a much wider
|
45
|
+
** range of dates.
|
46
|
+
**
|
47
|
+
** The Gregorian calendar system is used for all dates and times,
|
48
|
+
** even those that predate the Gregorian calendar. Historians usually
|
49
|
+
** use the Julian calendar for dates prior to 1582-10-15 and for some
|
50
|
+
** dates afterwards, depending on locale. Beware of this difference.
|
51
|
+
**
|
52
|
+
** The conversion algorithms are implemented based on descriptions
|
53
|
+
** in the following text:
|
54
|
+
**
|
55
|
+
** Jean Meeus
|
56
|
+
** Astronomical Algorithms, 2nd Edition, 1998
|
57
|
+
** ISBM 0-943396-61-1
|
58
|
+
** Willmann-Bell, Inc
|
59
|
+
** Richmond, Virginia (USA)
|
60
|
+
*************************************************************************
|
61
|
+
** Included in SQLite3 port to C#-SQLite; 2008 Noah B Hart
|
62
|
+
** C#-SQLite is an independent reimplementation of the SQLite software library
|
63
|
+
**
|
64
|
+
** SQLITE_SOURCE_ID: 2010-03-09 19:31:43 4ae453ea7be69018d8c16eb8dabe05617397dc4d
|
65
|
+
**
|
66
|
+
** $Header$
|
67
|
+
*************************************************************************
|
68
|
+
*/
|
69
|
+
//#include "sqliteInt.h"
|
70
|
+
//#include <stdlib.h>
|
71
|
+
//#include <assert.h>
|
72
|
+
//#include <time.h>
|
73
|
+
|
74
|
+
#if !SQLITE_OMIT_DATETIME_FUNCS
|
75
|
+
|
76
|
+
/*
|
77
|
+
** On recent Windows platforms, the localtime_s() function is available
|
78
|
+
** as part of the "Secure CRT". It is essentially equivalent to
|
79
|
+
** localtime_r() available under most POSIX platforms, except that the
|
80
|
+
** order of the parameters is reversed.
|
81
|
+
**
|
82
|
+
** See http://msdn.microsoft.com/en-us/library/a442x3ye(VS.80).aspx.
|
83
|
+
**
|
84
|
+
** If the user has not indicated to use localtime_r() or localtime_s()
|
85
|
+
** already, check for an MSVC build environment that provides
|
86
|
+
** localtime_s().
|
87
|
+
*/
|
88
|
+
//#if !(HAVE_LOCALTIME_R) && !(HAVE_LOCALTIME_S) && (_MSC_VER) && (_CRT_INSECURE_DEPRECATE)
|
89
|
+
//#define HAVE_LOCALTIME_S
|
90
|
+
//#endif
|
91
|
+
|
92
|
+
/*
|
93
|
+
** A structure for holding a single date and time.
|
94
|
+
*/
|
95
|
+
//typedef struct DateTime DateTime;
|
96
|
+
public class DateTime
|
97
|
+
{
|
98
|
+
public sqlite3_int64 iJD; /* The julian day number times 86400000 */
|
99
|
+
public int Y, M, D; /* Year, month, and day */
|
100
|
+
public int h, m; /* Hour and minutes */
|
101
|
+
public int tz; /* Timezone offset in minutes */
|
102
|
+
public double s; /* Seconds */
|
103
|
+
public byte validYMD; /* True (1) if Y,M,D are valid */
|
104
|
+
public byte validHMS; /* True (1) if h,m,s are valid */
|
105
|
+
public byte validJD; /* True (1) if iJD is valid */
|
106
|
+
public byte validTZ; /* True (1) if tz is valid */
|
107
|
+
|
108
|
+
public void CopyTo( DateTime ct )
|
109
|
+
{
|
110
|
+
ct.iJD = iJD;
|
111
|
+
ct.Y = Y;
|
112
|
+
ct.M = M;
|
113
|
+
ct.D = D;
|
114
|
+
ct.h = h;
|
115
|
+
ct.m = m;
|
116
|
+
ct.tz = tz;
|
117
|
+
ct.s = s;
|
118
|
+
ct.validYMD = validYMD;
|
119
|
+
ct.validHMS = validHMS;
|
120
|
+
ct.validJD = validJD;
|
121
|
+
ct.validTZ = validJD;
|
122
|
+
}
|
123
|
+
};
|
124
|
+
|
125
|
+
|
126
|
+
/*
|
127
|
+
** Convert zDate into one or more integers. Additional arguments
|
128
|
+
** come in groups of 5 as follows:
|
129
|
+
**
|
130
|
+
** N number of digits in the integer
|
131
|
+
** min minimum allowed value of the integer
|
132
|
+
** max maximum allowed value of the integer
|
133
|
+
** nextC first character after the integer
|
134
|
+
** pVal where to write the integers value.
|
135
|
+
**
|
136
|
+
** Conversions continue until one with nextC==0 is encountered.
|
137
|
+
** The function returns the number of successful conversions.
|
138
|
+
*/
|
139
|
+
static int getDigits( string zDate, int N0, int min0, int max0, char nextC0, ref int pVal0, int N1, int min1, int max1, char nextC1, ref int pVal1 )
|
140
|
+
{
|
141
|
+
int c0 = getDigits( zDate + '\0', N0, min0, max0, nextC0, ref pVal0 );
|
142
|
+
return c0 == 0 ? 0 : c0 + getDigits( zDate.Substring( zDate.IndexOf( nextC0 ) + 1 ) + '\0', N1, min1, max1, nextC1, ref pVal1 );
|
143
|
+
}
|
144
|
+
static int getDigits( string zDate, int N0, int min0, int max0, char nextC0, ref int pVal0, int N1, int min1, int max1, char nextC1, ref int pVal1, int N2, int min2, int max2, char nextC2, ref int pVal2 )
|
145
|
+
{
|
146
|
+
int c0 = getDigits( zDate + '\0', N0, min0, max0, nextC0, ref pVal0 );
|
147
|
+
if ( c0 == 0 ) return 0;
|
148
|
+
string zDate1 = zDate.Substring( zDate.IndexOf( nextC0 ) + 1 );
|
149
|
+
int c1 = getDigits( zDate1 + '\0', N1, min1, max1, nextC1, ref pVal1 );
|
150
|
+
if ( c1 == 0 ) return c0;
|
151
|
+
return c0 + c1 + getDigits( zDate1.Substring( zDate1.IndexOf( nextC1 ) + 1 ) + '\0', N2, min2, max2, nextC2, ref pVal2 );
|
152
|
+
}
|
153
|
+
static int getDigits( string zDate, int N, int min, int max, char nextC, ref int pVal )
|
154
|
+
{
|
155
|
+
//va_list ap;
|
156
|
+
int val;
|
157
|
+
//int N;
|
158
|
+
//int min;
|
159
|
+
//int max;
|
160
|
+
//char nextC;
|
161
|
+
//int pVal;
|
162
|
+
int cnt = 0;
|
163
|
+
//va_start( ap, zDate );
|
164
|
+
int zIndex = 0;
|
165
|
+
//do
|
166
|
+
//{
|
167
|
+
//N = (int)va_arg( ap, "int" );
|
168
|
+
//min = (int)va_arg( ap, "int" );
|
169
|
+
//max = (int)va_arg( ap, "int" );
|
170
|
+
//nextC = (char)va_arg( ap, "char" );
|
171
|
+
//pVal = (int)va_arg( ap, "int" );
|
172
|
+
val = 0;
|
173
|
+
while ( N-- != 0 )
|
174
|
+
{
|
175
|
+
if ( !sqlite3Isdigit( zDate[zIndex] ) )
|
176
|
+
{
|
177
|
+
goto end_getDigits;
|
178
|
+
}
|
179
|
+
val = val * 10 + zDate[zIndex] - '0';
|
180
|
+
zIndex++;
|
181
|
+
}
|
182
|
+
if ( val < min || val > max || zIndex < zDate.Length && ( nextC != 0 && nextC != zDate[zIndex] ) )
|
183
|
+
{
|
184
|
+
goto end_getDigits;
|
185
|
+
}
|
186
|
+
pVal = val;
|
187
|
+
zIndex++;
|
188
|
+
cnt++;
|
189
|
+
//} while ( nextC != 0 && zIndex < zDate.Length );
|
190
|
+
end_getDigits:
|
191
|
+
//va_end( ap );
|
192
|
+
return cnt;
|
193
|
+
}
|
194
|
+
|
195
|
+
/*
|
196
|
+
** Read text from z[] and convert into a floating point number. Return
|
197
|
+
** the number of digits converted.
|
198
|
+
*/
|
199
|
+
//#define getValue sqlite3AtoF
|
200
|
+
|
201
|
+
/*
|
202
|
+
** Parse a timezone extension on the end of a date-time.
|
203
|
+
** The extension is of the form:
|
204
|
+
**
|
205
|
+
** (+/-)HH:MM
|
206
|
+
**
|
207
|
+
**
|
208
|
+
** Or the "zulu" notation:
|
209
|
+
**
|
210
|
+
** Z
|
211
|
+
**
|
212
|
+
** If the parse is successful, write the number of minutes
|
213
|
+
** of change in p.tz and return 0. If a parser error occurs,
|
214
|
+
** return non-zero.
|
215
|
+
**
|
216
|
+
** A missing specifier is not considered an error.
|
217
|
+
*/
|
218
|
+
static int parseTimezone( string zDate, DateTime p )
|
219
|
+
{
|
220
|
+
int sgn = 0;
|
221
|
+
int nHr = 0; int nMn = 0;
|
222
|
+
char c;
|
223
|
+
zDate = zDate.Trim();// while ( sqlite3Isspace( *(u8*)zDate ) ) { zDate++; }
|
224
|
+
p.tz = 0;
|
225
|
+
c = zDate.Length == 0 ? '\0' : zDate[0];
|
226
|
+
if ( c == '-' )
|
227
|
+
{
|
228
|
+
sgn = -1;
|
229
|
+
}
|
230
|
+
else if ( c == '+' )
|
231
|
+
{
|
232
|
+
sgn = +1;
|
233
|
+
}
|
234
|
+
else if ( c == 'Z' || c == 'z' )
|
235
|
+
{
|
236
|
+
zDate = zDate.Substring( 1 ).Trim();//zDate++;
|
237
|
+
goto zulu_time;
|
238
|
+
}
|
239
|
+
else
|
240
|
+
{
|
241
|
+
return c != '\0' ? 1 : 0;
|
242
|
+
}
|
243
|
+
//zDate++;
|
244
|
+
if ( getDigits( zDate.Substring( 1 ), 2, 0, 14, ':', ref nHr, 2, 0, 59, '\0', ref nMn ) != 2 )
|
245
|
+
{
|
246
|
+
return 1;
|
247
|
+
}
|
248
|
+
//zDate += 5;
|
249
|
+
p.tz = sgn * ( nMn + nHr * 60 );
|
250
|
+
if ( zDate.Length == 6 ) zDate = "";
|
251
|
+
else if ( zDate.Length > 6 ) zDate = zDate.Substring( 6 ).Trim();// while ( sqlite3Isspace( *(u8*)zDate ) ) { zDate++; }
|
252
|
+
zulu_time:
|
253
|
+
return zDate != "" ? 1 : 0;
|
254
|
+
}
|
255
|
+
|
256
|
+
/*
|
257
|
+
** Parse times of the form HH:MM or HH:MM:SS or HH:MM:SS.FFFF.
|
258
|
+
** The HH, MM, and SS must each be exactly 2 digits. The
|
259
|
+
** fractional seconds FFFF can be one or more digits.
|
260
|
+
**
|
261
|
+
** Return 1 if there is a parsing error and 0 on success.
|
262
|
+
*/
|
263
|
+
static int parseHhMmSs( string zDate, DateTime p )
|
264
|
+
{
|
265
|
+
int h = 0; int m = 0; int s = 0;
|
266
|
+
double ms = 0.0;
|
267
|
+
if ( getDigits( zDate, 2, 0, 24, ':', ref h, 2, 0, 59, '\0', ref m ) != 2 )
|
268
|
+
{
|
269
|
+
return 1;
|
270
|
+
}
|
271
|
+
int zIndex = 5;// zDate += 5;
|
272
|
+
if ( zIndex < zDate.Length && zDate[zIndex] == ':' )
|
273
|
+
{
|
274
|
+
zIndex++;// zDate++;
|
275
|
+
if ( getDigits( zDate.Substring( zIndex ), 2, 0, 59, '\0', ref s ) != 1 )
|
276
|
+
{
|
277
|
+
return 1;
|
278
|
+
}
|
279
|
+
zIndex += 2;// zDate += 2;
|
280
|
+
if ( zIndex + 1 < zDate.Length && zDate[zIndex] == '.' && sqlite3Isdigit( zDate[zIndex + 1] ) )
|
281
|
+
{
|
282
|
+
double rScale = 1.0;
|
283
|
+
zIndex++;// zDate++;
|
284
|
+
while ( zIndex < zDate.Length && sqlite3Isdigit( zDate[zIndex] )
|
285
|
+
)
|
286
|
+
{
|
287
|
+
ms = ms * 10.0 + zDate[zIndex] - '0';
|
288
|
+
rScale *= 10.0;
|
289
|
+
zIndex++;//zDate++;
|
290
|
+
}
|
291
|
+
ms /= rScale;
|
292
|
+
}
|
293
|
+
}
|
294
|
+
else
|
295
|
+
{
|
296
|
+
s = 0;
|
297
|
+
}
|
298
|
+
p.validJD = 0;
|
299
|
+
p.validHMS = 1;
|
300
|
+
p.h = h;
|
301
|
+
p.m = m;
|
302
|
+
p.s = s + ms;
|
303
|
+
if ( zIndex < zDate.Length && parseTimezone( zDate.Substring( zIndex ), p ) != 0 ) return 1;
|
304
|
+
p.validTZ = (byte)( ( p.tz != 0 ) ? 1 : 0 );
|
305
|
+
return 0;
|
306
|
+
}
|
307
|
+
|
308
|
+
/*
|
309
|
+
** Convert from YYYY-MM-DD HH:MM:SS to julian day. We always assume
|
310
|
+
** that the YYYY-MM-DD is according to the Gregorian calendar.
|
311
|
+
**
|
312
|
+
** Reference: Meeus page 61
|
313
|
+
*/
|
314
|
+
static void computeJD( DateTime p )
|
315
|
+
{
|
316
|
+
int Y, M, D, A, B, X1, X2;
|
317
|
+
|
318
|
+
if ( p.validJD != 0 ) return;
|
319
|
+
if ( p.validYMD != 0 )
|
320
|
+
{
|
321
|
+
Y = p.Y;
|
322
|
+
M = p.M;
|
323
|
+
D = p.D;
|
324
|
+
}
|
325
|
+
else
|
326
|
+
{
|
327
|
+
Y = 2000; /* If no YMD specified, assume 2000-Jan-01 */
|
328
|
+
M = 1;
|
329
|
+
D = 1;
|
330
|
+
}
|
331
|
+
if ( M <= 2 )
|
332
|
+
{
|
333
|
+
Y--;
|
334
|
+
M += 12;
|
335
|
+
}
|
336
|
+
A = Y / 100;
|
337
|
+
B = 2 - A + ( A / 4 );
|
338
|
+
X1 = (int)( 36525 * ( Y + 4716 ) / 100 );
|
339
|
+
X2 = (int)( 306001 * ( M + 1 ) / 10000 );
|
340
|
+
p.iJD = (long)( ( X1 + X2 + D + B - 1524.5 ) * 86400000 );
|
341
|
+
p.validJD = 1;
|
342
|
+
if ( p.validHMS != 0 )
|
343
|
+
{
|
344
|
+
p.iJD += (long)( p.h * 3600000 + p.m * 60000 + p.s * 1000 );
|
345
|
+
if ( p.validTZ != 0 )
|
346
|
+
{
|
347
|
+
p.iJD -= p.tz * 60000;
|
348
|
+
p.validYMD = 0;
|
349
|
+
p.validHMS = 0;
|
350
|
+
p.validTZ = 0;
|
351
|
+
}
|
352
|
+
}
|
353
|
+
}
|
354
|
+
|
355
|
+
/*
|
356
|
+
** Parse dates of the form
|
357
|
+
**
|
358
|
+
** YYYY-MM-DD HH:MM:SS.FFF
|
359
|
+
** YYYY-MM-DD HH:MM:SS
|
360
|
+
** YYYY-MM-DD HH:MM
|
361
|
+
** YYYY-MM-DD
|
362
|
+
**
|
363
|
+
** Write the result into the DateTime structure and return 0
|
364
|
+
** on success and 1 if the input string is not a well-formed
|
365
|
+
** date.
|
366
|
+
*/
|
367
|
+
static int parseYyyyMmDd( string zDate, DateTime p )
|
368
|
+
{
|
369
|
+
int Y = 0; int M = 0; int D = 0; bool neg;
|
370
|
+
|
371
|
+
int zIndex = 0;
|
372
|
+
if ( zDate[zIndex] == '-' )
|
373
|
+
{
|
374
|
+
zIndex++;// zDate++;
|
375
|
+
neg = true;
|
376
|
+
}
|
377
|
+
else
|
378
|
+
{
|
379
|
+
neg = false;
|
380
|
+
}
|
381
|
+
if ( getDigits( zDate.Substring( zIndex ), 4, 0, 9999, '-', ref Y, 2, 1, 12, '-', ref M, 2, 1, 31, '\0', ref D ) != 3 )
|
382
|
+
{
|
383
|
+
return 1;
|
384
|
+
}
|
385
|
+
zIndex += 10;// zDate += 10;
|
386
|
+
while ( zIndex < zDate.Length && ( sqlite3Isspace( zDate[zIndex] ) || 'T' == zDate[zIndex] ) ) { zIndex++; }//zDate++; }
|
387
|
+
if ( zIndex < zDate.Length && parseHhMmSs( zDate.Substring( zIndex ), p ) == 0 )
|
388
|
+
{
|
389
|
+
/* We got the time */
|
390
|
+
}
|
391
|
+
else if ( zIndex >= zDate.Length )// zDate[zIndex] == '\0')
|
392
|
+
{
|
393
|
+
p.validHMS = 0;
|
394
|
+
}
|
395
|
+
else
|
396
|
+
{
|
397
|
+
return 1;
|
398
|
+
}
|
399
|
+
p.validJD = 0;
|
400
|
+
p.validYMD = 1;
|
401
|
+
p.Y = neg ? -Y : Y;
|
402
|
+
p.M = M;
|
403
|
+
p.D = D;
|
404
|
+
if ( p.validTZ != 0 )
|
405
|
+
{
|
406
|
+
computeJD( p );
|
407
|
+
}
|
408
|
+
return 0;
|
409
|
+
}
|
410
|
+
|
411
|
+
/*
|
412
|
+
** Set the time to the current time reported by the VFS
|
413
|
+
*/
|
414
|
+
static void setDateTimeToCurrent( sqlite3_context context, DateTime p )
|
415
|
+
{
|
416
|
+
double r = 0;
|
417
|
+
sqlite3 db = sqlite3_context_db_handle( context );
|
418
|
+
sqlite3OsCurrentTime( db.pVfs, ref r );
|
419
|
+
p.iJD = (sqlite3_int64)( r * 86400000.0 + 0.5 );
|
420
|
+
p.validJD = 1;
|
421
|
+
}
|
422
|
+
|
423
|
+
/*
|
424
|
+
** Attempt to parse the given string into a Julian Day Number. Return
|
425
|
+
** the number of errors.
|
426
|
+
**
|
427
|
+
** The following are acceptable forms for the input string:
|
428
|
+
**
|
429
|
+
** YYYY-MM-DD HH:MM:SS.FFF +/-HH:MM
|
430
|
+
** DDDD.DD
|
431
|
+
** now
|
432
|
+
**
|
433
|
+
** In the first form, the +/-HH:MM is always optional. The fractional
|
434
|
+
** seconds extension (the ".FFF") is optional. The seconds portion
|
435
|
+
** (":SS.FFF") is option. The year and date can be omitted as long
|
436
|
+
** as there is a time string. The time string can be omitted as long
|
437
|
+
** as there is a year and date.
|
438
|
+
*/
|
439
|
+
static int parseDateOrTime(
|
440
|
+
sqlite3_context context,
|
441
|
+
string zDate,
|
442
|
+
ref DateTime p
|
443
|
+
)
|
444
|
+
{
|
445
|
+
int isRealNum = 0; /* Return from sqlite3IsNumber(). Not used */
|
446
|
+
if ( parseYyyyMmDd( zDate, p ) == 0 )
|
447
|
+
{
|
448
|
+
return 0;
|
449
|
+
}
|
450
|
+
else if ( parseHhMmSs( zDate, p ) == 0 )
|
451
|
+
{
|
452
|
+
return 0;
|
453
|
+
}
|
454
|
+
else if ( sqlite3StrICmp( zDate, "now" ) == 0 )
|
455
|
+
{
|
456
|
+
setDateTimeToCurrent( context, p );
|
457
|
+
return 0;
|
458
|
+
}
|
459
|
+
else if ( sqlite3IsNumber( zDate, ref isRealNum, SQLITE_UTF8 ) != 0 )
|
460
|
+
{
|
461
|
+
double r = 0;
|
462
|
+
sqlite3AtoF( zDate, ref r );// getValue( zDate, ref r );
|
463
|
+
p.iJD = (sqlite3_int64)( r * 86400000.0 + 0.5 );
|
464
|
+
p.validJD = 1;
|
465
|
+
return 0;
|
466
|
+
}
|
467
|
+
return 1;
|
468
|
+
}
|
469
|
+
|
470
|
+
/*
|
471
|
+
** Compute the Year, Month, and Day from the julian day number.
|
472
|
+
*/
|
473
|
+
static void computeYMD( DateTime p )
|
474
|
+
{
|
475
|
+
int Z, A, B, C, D, E, X1;
|
476
|
+
if ( p.validYMD != 0 ) return;
|
477
|
+
if ( 0 == p.validJD )
|
478
|
+
{
|
479
|
+
p.Y = 2000;
|
480
|
+
p.M = 1;
|
481
|
+
p.D = 1;
|
482
|
+
}
|
483
|
+
else
|
484
|
+
{
|
485
|
+
Z = (int)( ( p.iJD + 43200000 ) / 86400000 );
|
486
|
+
A = (int)( ( Z - 1867216.25 ) / 36524.25 );
|
487
|
+
A = Z + 1 + A - ( A / 4 );
|
488
|
+
B = A + 1524;
|
489
|
+
C = (int)( ( B - 122.1 ) / 365.25 );
|
490
|
+
D = (int)( ( 36525 * C ) / 100 );
|
491
|
+
E = (int)( ( B - D ) / 30.6001 );
|
492
|
+
X1 = (int)( 30.6001 * E );
|
493
|
+
p.D = B - D - X1;
|
494
|
+
p.M = E < 14 ? E - 1 : E - 13;
|
495
|
+
p.Y = p.M > 2 ? C - 4716 : C - 4715;
|
496
|
+
}
|
497
|
+
p.validYMD = 1;
|
498
|
+
}
|
499
|
+
|
500
|
+
/*
|
501
|
+
** Compute the Hour, Minute, and Seconds from the julian day number.
|
502
|
+
*/
|
503
|
+
static void computeHMS( DateTime p )
|
504
|
+
{
|
505
|
+
int s;
|
506
|
+
if ( p.validHMS != 0 ) return;
|
507
|
+
computeJD( p );
|
508
|
+
s = (int)( ( p.iJD + 43200000 ) % 86400000 );
|
509
|
+
p.s = s / 1000.0;
|
510
|
+
s = (int)p.s;
|
511
|
+
p.s -= s;
|
512
|
+
p.h = s / 3600;
|
513
|
+
s -= p.h * 3600;
|
514
|
+
p.m = s / 60;
|
515
|
+
p.s += s - p.m * 60;
|
516
|
+
p.validHMS = 1;
|
517
|
+
}
|
518
|
+
|
519
|
+
/*
|
520
|
+
** Compute both YMD and HMS
|
521
|
+
*/
|
522
|
+
static void computeYMD_HMS( DateTime p )
|
523
|
+
{
|
524
|
+
computeYMD( p );
|
525
|
+
computeHMS( p );
|
526
|
+
}
|
527
|
+
|
528
|
+
/*
|
529
|
+
** Clear the YMD and HMS and the TZ
|
530
|
+
*/
|
531
|
+
static void clearYMD_HMS_TZ( DateTime p )
|
532
|
+
{
|
533
|
+
p.validYMD = 0;
|
534
|
+
p.validHMS = 0;
|
535
|
+
p.validTZ = 0;
|
536
|
+
}
|
537
|
+
|
538
|
+
#if !SQLITE_OMIT_LOCALTIME
|
539
|
+
/*
|
540
|
+
** Compute the difference (in milliseconds)
|
541
|
+
** between localtime and UTC (a.k.a. GMT)
|
542
|
+
** for the time value p where p is in UTC.
|
543
|
+
*/
|
544
|
+
static int localtimeOffset( DateTime p )
|
545
|
+
{
|
546
|
+
DateTime x; DateTime y = new DateTime();
|
547
|
+
time_t t;
|
548
|
+
x = p;
|
549
|
+
computeYMD_HMS( x );
|
550
|
+
if ( x.Y < 1971 || x.Y >= 2038 )
|
551
|
+
{
|
552
|
+
x.Y = 2000;
|
553
|
+
x.M = 1;
|
554
|
+
x.D = 1;
|
555
|
+
x.h = 0;
|
556
|
+
x.m = 0;
|
557
|
+
x.s = 0.0;
|
558
|
+
}
|
559
|
+
else
|
560
|
+
{
|
561
|
+
int s = (int)( x.s + 0.5 );
|
562
|
+
x.s = s;
|
563
|
+
}
|
564
|
+
x.tz = 0;
|
565
|
+
x.validJD = 0;
|
566
|
+
computeJD( x );
|
567
|
+
t = (long)( x.iJD / 1000 - 210866760000L );// (time_t)(x.iJD/1000 - 21086676*(i64)10000);
|
568
|
+
#if HAVE_LOCALTIME_R
|
569
|
+
{
|
570
|
+
struct tm sLocal;
|
571
|
+
localtime_r(&t, sLocal);
|
572
|
+
y.Y = sLocal.tm_year + 1900;
|
573
|
+
y.M = sLocal.tm_mon + 1;
|
574
|
+
y.D = sLocal.tm_mday;
|
575
|
+
y.h = sLocal.tm_hour;
|
576
|
+
y.m = sLocal.tm_min;
|
577
|
+
y.s = sLocal.tm_sec;
|
578
|
+
}
|
579
|
+
#elif (HAVE_LOCALTIME_S) //defined(HAVE_LOCALTIME_S) && HAVE_LOCALTIME_S
|
580
|
+
{
|
581
|
+
struct tm sLocal;
|
582
|
+
localtime_s(&sLocal, t);
|
583
|
+
y.Y = sLocal.tm_year + 1900;
|
584
|
+
y.M = sLocal.tm_mon + 1;
|
585
|
+
y.D = sLocal.tm_mday;
|
586
|
+
y.h = sLocal.tm_hour;
|
587
|
+
y.m = sLocal.tm_min;
|
588
|
+
y.s = sLocal.tm_sec;
|
589
|
+
}
|
590
|
+
#else
|
591
|
+
{
|
592
|
+
tm pTm;
|
593
|
+
sqlite3_mutex_enter( sqlite3MutexAlloc( SQLITE_MUTEX_STATIC_MASTER ) );
|
594
|
+
pTm = localtime( t );
|
595
|
+
y.Y = pTm.tm_year;// +1900;
|
596
|
+
y.M = pTm.tm_mon;// +1;
|
597
|
+
y.D = pTm.tm_mday;
|
598
|
+
y.h = pTm.tm_hour;
|
599
|
+
y.m = pTm.tm_min;
|
600
|
+
y.s = pTm.tm_sec;
|
601
|
+
sqlite3_mutex_leave( sqlite3MutexAlloc( SQLITE_MUTEX_STATIC_MASTER ) );
|
602
|
+
}
|
603
|
+
#endif
|
604
|
+
y.validYMD = 1;
|
605
|
+
y.validHMS = 1;
|
606
|
+
y.validJD = 0;
|
607
|
+
y.validTZ = 0;
|
608
|
+
computeJD( y );
|
609
|
+
return (int)( y.iJD - x.iJD );
|
610
|
+
}
|
611
|
+
#endif //* SQLITE_OMIT_LOCALTIME */
|
612
|
+
|
613
|
+
/*
|
614
|
+
** Process a modifier to a date-time stamp. The modifiers are
|
615
|
+
** as follows:
|
616
|
+
**
|
617
|
+
** NNN days
|
618
|
+
** NNN hours
|
619
|
+
** NNN minutes
|
620
|
+
** NNN.NNNN seconds
|
621
|
+
** NNN months
|
622
|
+
** NNN years
|
623
|
+
** start of month
|
624
|
+
** start of year
|
625
|
+
** start of week
|
626
|
+
** start of day
|
627
|
+
** weekday N
|
628
|
+
** unixepoch
|
629
|
+
** localtime
|
630
|
+
** utc
|
631
|
+
**
|
632
|
+
** Return 0 on success and 1 if there is any kind of error.
|
633
|
+
*/
|
634
|
+
static int parseModifier( string zMod, DateTime p )
|
635
|
+
{
|
636
|
+
int rc = 1;
|
637
|
+
int n;
|
638
|
+
double r = 0;
|
639
|
+
StringBuilder z = new StringBuilder( zMod.ToLower() );
|
640
|
+
string zBuf;//[30];
|
641
|
+
//z = zBuf;
|
642
|
+
//for(n=0; n<ArraySize(zBuf)-1 && zMod[n]; n++){
|
643
|
+
// z.Append( zMod.Substring( n ).ToLower() );
|
644
|
+
//}
|
645
|
+
//z[n] = 0;
|
646
|
+
switch ( z[0] )
|
647
|
+
#if !SQLITE_OMIT_LOCALTIME
|
648
|
+
{
|
649
|
+
case 'l':
|
650
|
+
{
|
651
|
+
/* localtime
|
652
|
+
**
|
653
|
+
** Assuming the current time value is UTC (a.k.a. GMT), shift it to
|
654
|
+
** show local time.
|
655
|
+
*/
|
656
|
+
if ( z.ToString() == "localtime" )
|
657
|
+
{
|
658
|
+
computeJD( p );
|
659
|
+
p.iJD += localtimeOffset( p );
|
660
|
+
clearYMD_HMS_TZ( p );
|
661
|
+
rc = 0;
|
662
|
+
}
|
663
|
+
break;
|
664
|
+
}
|
665
|
+
#endif
|
666
|
+
case 'u':
|
667
|
+
{
|
668
|
+
/*
|
669
|
+
** unixepoch
|
670
|
+
**
|
671
|
+
** Treat the current value of p.iJD as the number of
|
672
|
+
** seconds since 1970. Convert to a real julian day number.
|
673
|
+
*/
|
674
|
+
if ( z.ToString() == "unixepoch" && p.validJD != 0 )
|
675
|
+
{
|
676
|
+
p.iJD = (long)( ( p.iJD + 43200 ) / 86400 + 210866760000000L );//p->iJD = p->iJD/86400 + 21086676*(i64)10000000;
|
677
|
+
clearYMD_HMS_TZ( p );
|
678
|
+
rc = 0;
|
679
|
+
}
|
680
|
+
#if !SQLITE_OMIT_LOCALTIME
|
681
|
+
else if ( z.ToString() == "utc" )
|
682
|
+
{
|
683
|
+
int c1;
|
684
|
+
computeJD( p );
|
685
|
+
c1 = localtimeOffset( p );
|
686
|
+
p.iJD -= (long)c1;
|
687
|
+
clearYMD_HMS_TZ( p );
|
688
|
+
p.iJD += (long)( c1 - localtimeOffset( p ) );
|
689
|
+
rc = 0;
|
690
|
+
}
|
691
|
+
#endif
|
692
|
+
break;
|
693
|
+
}
|
694
|
+
case 'w':
|
695
|
+
{
|
696
|
+
/*
|
697
|
+
** weekday N
|
698
|
+
**
|
699
|
+
** Move the date to the same time on the next occurrence of
|
700
|
+
** weekday N where 0==Sunday, 1==Monday, and so forth. If the
|
701
|
+
** date is already on the appropriate weekday, this is a no-op.
|
702
|
+
*/
|
703
|
+
if ( z.ToString().StartsWith( "weekday " ) && sqlite3AtoF( z.ToString().Substring( 8 ), ref r ) != 0 //getValue( z[8], ref r ) > 0
|
704
|
+
&& ( n = (int)r ) == r && n >= 0 && r < 7 )
|
705
|
+
{
|
706
|
+
sqlite3_int64 Z;
|
707
|
+
computeYMD_HMS( p );
|
708
|
+
p.validTZ = 0;
|
709
|
+
p.validJD = 0;
|
710
|
+
computeJD( p );
|
711
|
+
Z = ( ( p.iJD + 129600000 ) / 86400000 ) % 7;
|
712
|
+
if ( Z > n ) Z -= 7;
|
713
|
+
p.iJD += ( n - Z ) * 86400000;
|
714
|
+
clearYMD_HMS_TZ( p );
|
715
|
+
rc = 0;
|
716
|
+
}
|
717
|
+
break;
|
718
|
+
}
|
719
|
+
case 's':
|
720
|
+
{
|
721
|
+
/*
|
722
|
+
** start of TTTTT
|
723
|
+
**
|
724
|
+
** Move the date backwards to the beginning of the current day,
|
725
|
+
** or month or year.
|
726
|
+
*/
|
727
|
+
if ( z.Length <= 9 ) z.Length = 0; else z.Remove( 0, 9 );//z += 9;
|
728
|
+
computeYMD( p );
|
729
|
+
p.validHMS = 1;
|
730
|
+
p.h = p.m = 0;
|
731
|
+
p.s = 0.0;
|
732
|
+
p.validTZ = 0;
|
733
|
+
p.validJD = 0;
|
734
|
+
if ( z.ToString() == "month" )
|
735
|
+
{
|
736
|
+
p.D = 1;
|
737
|
+
rc = 0;
|
738
|
+
}
|
739
|
+
else if ( z.ToString() == "year" )
|
740
|
+
{
|
741
|
+
computeYMD( p );
|
742
|
+
p.M = 1;
|
743
|
+
p.D = 1;
|
744
|
+
rc = 0;
|
745
|
+
}
|
746
|
+
else if ( z.ToString() == "day" )
|
747
|
+
{
|
748
|
+
rc = 0;
|
749
|
+
}
|
750
|
+
break;
|
751
|
+
}
|
752
|
+
case '+':
|
753
|
+
case '-':
|
754
|
+
case '0':
|
755
|
+
case '1':
|
756
|
+
case '2':
|
757
|
+
case '3':
|
758
|
+
case '4':
|
759
|
+
case '5':
|
760
|
+
case '6':
|
761
|
+
case '7':
|
762
|
+
case '8':
|
763
|
+
case '9':
|
764
|
+
{
|
765
|
+
double rRounder;
|
766
|
+
n = sqlite3AtoF( z.ToString(), ref r );//getValue( z, ref r );
|
767
|
+
Debug.Assert( n >= 1 );
|
768
|
+
if ( z[n] == ':' )
|
769
|
+
{
|
770
|
+
/* A modifier of the form (+|-)HH:MM:SS.FFF adds (or subtracts) the
|
771
|
+
** specified number of hours, minutes, seconds, and fractional seconds
|
772
|
+
** to the time. The ".FFF" may be omitted. The ":SS.FFF" may be
|
773
|
+
** omitted.
|
774
|
+
*/
|
775
|
+
string z2 = z.ToString();
|
776
|
+
DateTime tx;
|
777
|
+
sqlite3_int64 day;
|
778
|
+
int z2Index = 0;
|
779
|
+
if ( !sqlite3Isdigit( z2[z2Index] ) ) z2Index++;// z2++;
|
780
|
+
tx = new DateTime();// memset( &tx, 0, sizeof(tx));
|
781
|
+
if ( parseHhMmSs( z2.Substring( z2Index ), tx ) != 0 ) break;
|
782
|
+
computeJD( tx );
|
783
|
+
tx.iJD -= 43200000;
|
784
|
+
day = tx.iJD / 86400000;
|
785
|
+
tx.iJD -= day * 86400000;
|
786
|
+
if ( z[0] == '-' ) tx.iJD = -tx.iJD;
|
787
|
+
computeJD( p );
|
788
|
+
clearYMD_HMS_TZ( p );
|
789
|
+
p.iJD += tx.iJD;
|
790
|
+
rc = 0;
|
791
|
+
break;
|
792
|
+
}
|
793
|
+
//z += n;
|
794
|
+
while ( sqlite3Isspace( z[n] ) ) n++;// z++;
|
795
|
+
z = z.Remove( 0, n );
|
796
|
+
n = sqlite3Strlen30( z );
|
797
|
+
if ( n > 10 || n < 3 ) break;
|
798
|
+
if ( z[n - 1] == 's' ) { z.Length = --n; }// z[n - 1] = '\0'; n--; }
|
799
|
+
computeJD( p );
|
800
|
+
rc = 0;
|
801
|
+
rRounder = r < 0 ? -0.5 : +0.5;
|
802
|
+
if ( n == 3 && z.ToString() == "day" )
|
803
|
+
{
|
804
|
+
p.iJD += (long)( r * 86400000.0 + rRounder );
|
805
|
+
}
|
806
|
+
else if ( n == 4 && z.ToString() == "hour" )
|
807
|
+
{
|
808
|
+
p.iJD += (long)( r * ( 86400000.0 / 24.0 ) + rRounder );
|
809
|
+
}
|
810
|
+
else if ( n == 6 && z.ToString() == "minute" )
|
811
|
+
{
|
812
|
+
p.iJD += (long)( r * ( 86400000.0 / ( 24.0 * 60.0 ) ) + rRounder );
|
813
|
+
}
|
814
|
+
else if ( n == 6 && z.ToString() == "second" )
|
815
|
+
{
|
816
|
+
p.iJD += (long)( r * ( 86400000.0 / ( 24.0 * 60.0 * 60.0 ) ) + rRounder );
|
817
|
+
}
|
818
|
+
else if ( n == 5 && z.ToString() == "month" )
|
819
|
+
{
|
820
|
+
int x, y;
|
821
|
+
computeYMD_HMS( p );
|
822
|
+
p.M += (int)r;
|
823
|
+
x = p.M > 0 ? ( p.M - 1 ) / 12 : ( p.M - 12 ) / 12;
|
824
|
+
p.Y += x;
|
825
|
+
p.M -= x * 12;
|
826
|
+
p.validJD = 0;
|
827
|
+
computeJD( p );
|
828
|
+
y = (int)r;
|
829
|
+
if ( y != r )
|
830
|
+
{
|
831
|
+
p.iJD += (long)( ( r - y ) * 30.0 * 86400000.0 + rRounder );
|
832
|
+
}
|
833
|
+
}
|
834
|
+
else if ( n == 4 && z.ToString() == "year" )
|
835
|
+
{
|
836
|
+
int y = (int)r;
|
837
|
+
computeYMD_HMS( p );
|
838
|
+
p.Y += y;
|
839
|
+
p.validJD = 0;
|
840
|
+
computeJD( p );
|
841
|
+
if ( y != r )
|
842
|
+
{
|
843
|
+
p.iJD += (sqlite3_int64)( ( r - y ) * 365.0 * 86400000.0 + rRounder );
|
844
|
+
}
|
845
|
+
}
|
846
|
+
else
|
847
|
+
{
|
848
|
+
rc = 1;
|
849
|
+
}
|
850
|
+
clearYMD_HMS_TZ( p );
|
851
|
+
break;
|
852
|
+
}
|
853
|
+
default:
|
854
|
+
{
|
855
|
+
break;
|
856
|
+
}
|
857
|
+
}
|
858
|
+
return rc;
|
859
|
+
}
|
860
|
+
|
861
|
+
/*
|
862
|
+
** Process time function arguments. argv[0] is a date-time stamp.
|
863
|
+
** argv[1] and following are modifiers. Parse them all and write
|
864
|
+
** the resulting time into the DateTime structure p. Return 0
|
865
|
+
** on success and 1 if there are any errors.
|
866
|
+
**
|
867
|
+
** If there are zero parameters (if even argv[0] is undefined)
|
868
|
+
** then assume a default value of "now" for argv[0].
|
869
|
+
*/
|
870
|
+
static int isDate(
|
871
|
+
sqlite3_context context,
|
872
|
+
int argc,
|
873
|
+
sqlite3_value[] argv,
|
874
|
+
ref DateTime p
|
875
|
+
)
|
876
|
+
{
|
877
|
+
int i;
|
878
|
+
string z;
|
879
|
+
int eType;
|
880
|
+
p = new DateTime();//memset(p, 0, sizeof(*p));
|
881
|
+
if ( argc == 0 )
|
882
|
+
{
|
883
|
+
setDateTimeToCurrent( context, p );
|
884
|
+
}
|
885
|
+
else if ( ( eType = sqlite3_value_type( argv[0] ) ) == SQLITE_FLOAT
|
886
|
+
|| eType == SQLITE_INTEGER )
|
887
|
+
{
|
888
|
+
p.iJD = (long)( sqlite3_value_double( argv[0] ) * 86400000.0 + 0.5 );
|
889
|
+
p.validJD = 1;
|
890
|
+
}
|
891
|
+
else
|
892
|
+
{
|
893
|
+
z = sqlite3_value_text( argv[0] );
|
894
|
+
if ( String.IsNullOrEmpty( z ) || parseDateOrTime( context, z, ref p ) != 0 )
|
895
|
+
{
|
896
|
+
return 1;
|
897
|
+
}
|
898
|
+
}
|
899
|
+
for ( i = 1; i < argc; i++ )
|
900
|
+
{
|
901
|
+
if ( String.IsNullOrEmpty( z = sqlite3_value_text( argv[i] ) ) || parseModifier( z, p ) != 0 )
|
902
|
+
{
|
903
|
+
return 1;
|
904
|
+
}
|
905
|
+
}
|
906
|
+
return 0;
|
907
|
+
}
|
908
|
+
|
909
|
+
|
910
|
+
/*
|
911
|
+
** The following routines implement the various date and time functions
|
912
|
+
** of SQLite.
|
913
|
+
*/
|
914
|
+
|
915
|
+
/*
|
916
|
+
** julianday( TIMESTRING, MOD, MOD, ...)
|
917
|
+
**
|
918
|
+
** Return the julian day number of the date specified in the arguments
|
919
|
+
*/
|
920
|
+
static void juliandayFunc(
|
921
|
+
sqlite3_context context,
|
922
|
+
int argc,
|
923
|
+
sqlite3_value[] argv
|
924
|
+
)
|
925
|
+
{
|
926
|
+
DateTime x = null;
|
927
|
+
if ( isDate( context, argc, argv, ref x ) == 0 )
|
928
|
+
{
|
929
|
+
computeJD( x );
|
930
|
+
sqlite3_result_double( context, x.iJD / 86400000.0 );
|
931
|
+
}
|
932
|
+
}
|
933
|
+
|
934
|
+
/*
|
935
|
+
** datetime( TIMESTRING, MOD, MOD, ...)
|
936
|
+
**
|
937
|
+
** Return YYYY-MM-DD HH:MM:SS
|
938
|
+
*/
|
939
|
+
static void datetimeFunc(
|
940
|
+
sqlite3_context context,
|
941
|
+
int argc,
|
942
|
+
sqlite3_value[] argv
|
943
|
+
)
|
944
|
+
{
|
945
|
+
DateTime x = null;
|
946
|
+
if ( isDate( context, argc, argv, ref x ) == 0 )
|
947
|
+
{
|
948
|
+
string zBuf = "";//[100];
|
949
|
+
computeYMD_HMS( x );
|
950
|
+
sqlite3_snprintf( 100, ref zBuf, "%04d-%02d-%02d %02d:%02d:%02d",
|
951
|
+
x.Y, x.M, x.D, x.h, x.m, (int)( x.s ) );
|
952
|
+
sqlite3_result_text( context, zBuf, -1, SQLITE_TRANSIENT );
|
953
|
+
}
|
954
|
+
}
|
955
|
+
|
956
|
+
/*
|
957
|
+
** time( TIMESTRING, MOD, MOD, ...)
|
958
|
+
**
|
959
|
+
** Return HH:MM:SS
|
960
|
+
*/
|
961
|
+
static void timeFunc(
|
962
|
+
sqlite3_context context,
|
963
|
+
int argc,
|
964
|
+
sqlite3_value[] argv
|
965
|
+
)
|
966
|
+
{
|
967
|
+
DateTime x = new DateTime();
|
968
|
+
if ( isDate( context, argc, argv, ref x ) == 0 )
|
969
|
+
{
|
970
|
+
string zBuf = "";//[100];
|
971
|
+
computeHMS( x );
|
972
|
+
sqlite3_snprintf( 100, ref zBuf, "%02d:%02d:%02d", x.h, x.m, (int)x.s );
|
973
|
+
sqlite3_result_text( context, zBuf, -1, SQLITE_TRANSIENT );
|
974
|
+
}
|
975
|
+
}
|
976
|
+
|
977
|
+
/*
|
978
|
+
** date( TIMESTRING, MOD, MOD, ...)
|
979
|
+
**
|
980
|
+
** Return YYYY-MM-DD
|
981
|
+
*/
|
982
|
+
static void dateFunc(
|
983
|
+
sqlite3_context context,
|
984
|
+
int argc,
|
985
|
+
sqlite3_value[] argv
|
986
|
+
)
|
987
|
+
{
|
988
|
+
DateTime x = null;
|
989
|
+
if ( isDate( context, argc, argv, ref x ) == 0 )
|
990
|
+
{
|
991
|
+
string zBuf = "";//[100];
|
992
|
+
computeYMD( x );
|
993
|
+
sqlite3_snprintf( 100, ref zBuf, "%04d-%02d-%02d", x.Y, x.M, x.D );
|
994
|
+
sqlite3_result_text( context, zBuf, -1, SQLITE_TRANSIENT );
|
995
|
+
}
|
996
|
+
}
|
997
|
+
|
998
|
+
/*
|
999
|
+
** strftime( FORMAT, TIMESTRING, MOD, MOD, ...)
|
1000
|
+
**
|
1001
|
+
** Return a string described by FORMAT. Conversions as follows:
|
1002
|
+
**
|
1003
|
+
** %d day of month
|
1004
|
+
** %f ** fractional seconds SS.SSS
|
1005
|
+
** %H hour 00-24
|
1006
|
+
** %j day of year 000-366
|
1007
|
+
** %J ** Julian day number
|
1008
|
+
** %m month 01-12
|
1009
|
+
** %M minute 00-59
|
1010
|
+
** %s seconds since 1970-01-01
|
1011
|
+
** %S seconds 00-59
|
1012
|
+
** %w day of week 0-6 sunday==0
|
1013
|
+
** %W week of year 00-53
|
1014
|
+
** %Y year 0000-9999
|
1015
|
+
** %% %
|
1016
|
+
*/
|
1017
|
+
static void strftimeFunc(
|
1018
|
+
sqlite3_context context,
|
1019
|
+
int argc,
|
1020
|
+
sqlite3_value[] argv
|
1021
|
+
)
|
1022
|
+
{
|
1023
|
+
{
|
1024
|
+
DateTime x = new DateTime();
|
1025
|
+
u64 n;
|
1026
|
+
int i, j;
|
1027
|
+
StringBuilder z;
|
1028
|
+
sqlite3 db;
|
1029
|
+
string zFmt = sqlite3_value_text( argv[0] );
|
1030
|
+
StringBuilder zBuf = new StringBuilder( 100 );
|
1031
|
+
sqlite3_value[] argv1 = new sqlite3_value[argc - 1];
|
1032
|
+
for ( i = 0; i < argc - 1; i++ ) { argv1[i] = new sqlite3_value(); argv[i + 1].CopyTo( argv1[i] ); }
|
1033
|
+
if ( String.IsNullOrEmpty( zFmt ) || isDate( context, argc - 1, argv1, ref x ) != 0 ) return;
|
1034
|
+
db = sqlite3_context_db_handle( context );
|
1035
|
+
for ( i = 0, n = 1; i < zFmt.Length; i++, n++ )
|
1036
|
+
{
|
1037
|
+
if ( zFmt[i] == '%' )
|
1038
|
+
{
|
1039
|
+
switch ( (char)zFmt[i + 1] )
|
1040
|
+
{
|
1041
|
+
case 'd':
|
1042
|
+
case 'H':
|
1043
|
+
case 'm':
|
1044
|
+
case 'M':
|
1045
|
+
case 'S':
|
1046
|
+
case 'W':
|
1047
|
+
n++;
|
1048
|
+
break;
|
1049
|
+
/* fall thru */
|
1050
|
+
case 'w':
|
1051
|
+
case '%':
|
1052
|
+
break;
|
1053
|
+
case 'f':
|
1054
|
+
n += 8;
|
1055
|
+
break;
|
1056
|
+
case 'j':
|
1057
|
+
n += 3;
|
1058
|
+
break;
|
1059
|
+
case 'Y':
|
1060
|
+
n += 8;
|
1061
|
+
break;
|
1062
|
+
case 's':
|
1063
|
+
case 'J':
|
1064
|
+
n += 50;
|
1065
|
+
break;
|
1066
|
+
default:
|
1067
|
+
return; /* ERROR. return a NULL */
|
1068
|
+
}
|
1069
|
+
i++;
|
1070
|
+
}
|
1071
|
+
}
|
1072
|
+
testcase( n == (u64)( zBuf.Length - 1 ) );
|
1073
|
+
testcase( n == (u64)zBuf.Length );
|
1074
|
+
testcase( n == (u64)db.aLimit[SQLITE_LIMIT_LENGTH] + 1 );
|
1075
|
+
testcase( n == (u64)db.aLimit[SQLITE_LIMIT_LENGTH] );
|
1076
|
+
if ( n < (u64)zBuf.Capacity )
|
1077
|
+
{
|
1078
|
+
z = zBuf;
|
1079
|
+
}
|
1080
|
+
else if ( n > (u64)db.aLimit[SQLITE_LIMIT_LENGTH] )
|
1081
|
+
{
|
1082
|
+
sqlite3_result_error_toobig( context );
|
1083
|
+
return;
|
1084
|
+
}
|
1085
|
+
else
|
1086
|
+
{
|
1087
|
+
z = new StringBuilder( (int)n );// sqlite3DbMallocRaw( db, n );
|
1088
|
+
//if ( z == 0 )
|
1089
|
+
//{
|
1090
|
+
// sqlite3_result_error_nomem( context );
|
1091
|
+
// return;
|
1092
|
+
//}
|
1093
|
+
}
|
1094
|
+
computeJD( x );
|
1095
|
+
computeYMD_HMS( x );
|
1096
|
+
for ( i = j = 0; i < zFmt.Length; i++ )
|
1097
|
+
{
|
1098
|
+
if ( zFmt[i] != '%' )
|
1099
|
+
{
|
1100
|
+
z.Append( (char)zFmt[i] );
|
1101
|
+
}
|
1102
|
+
else
|
1103
|
+
{
|
1104
|
+
i++;
|
1105
|
+
string zTemp = "";
|
1106
|
+
switch ( (char)zFmt[i] )
|
1107
|
+
{
|
1108
|
+
case 'd': sqlite3_snprintf( 3, ref zTemp, "%02d", x.D ); z.Append( zTemp ); j += 2; break;
|
1109
|
+
case 'f':
|
1110
|
+
{
|
1111
|
+
double s = x.s;
|
1112
|
+
if ( s > 59.999 ) s = 59.999;
|
1113
|
+
sqlite3_snprintf( 7, ref zTemp, "%06.3f", s ); z.Append( zTemp );
|
1114
|
+
j = sqlite3Strlen30( z );
|
1115
|
+
break;
|
1116
|
+
}
|
1117
|
+
case 'H': sqlite3_snprintf( 3, ref zTemp, "%02d", x.h ); z.Append( zTemp ); j += 2; break;
|
1118
|
+
case 'W': /* Fall thru */
|
1119
|
+
case 'j':
|
1120
|
+
{
|
1121
|
+
int nDay; /* Number of days since 1st day of year */
|
1122
|
+
DateTime y = new DateTime();
|
1123
|
+
x.CopyTo( y );
|
1124
|
+
y.validJD = 0;
|
1125
|
+
y.M = 1;
|
1126
|
+
y.D = 1;
|
1127
|
+
computeJD( y );
|
1128
|
+
nDay = (int)( ( x.iJD - y.iJD + 43200000 ) / 86400000 );
|
1129
|
+
if ( zFmt[i] == 'W' )
|
1130
|
+
{
|
1131
|
+
int wd; /* 0=Monday, 1=Tuesday, ... 6=Sunday */
|
1132
|
+
wd = (int)( ( ( x.iJD + 43200000 ) / 86400000 ) % 7 );
|
1133
|
+
sqlite3_snprintf( 3, ref zTemp, "%02d", ( nDay + 7 - wd ) / 7 ); z.Append( zTemp );
|
1134
|
+
j += 2;
|
1135
|
+
}
|
1136
|
+
else
|
1137
|
+
{
|
1138
|
+
sqlite3_snprintf( 4, ref zTemp, "%03d", nDay + 1 ); z.Append( zTemp );
|
1139
|
+
j += 3;
|
1140
|
+
}
|
1141
|
+
break;
|
1142
|
+
}
|
1143
|
+
case 'J':
|
1144
|
+
{
|
1145
|
+
sqlite3_snprintf( 20, ref zTemp, "%.16g", x.iJD / 86400000.0 ); z.Append( zTemp );
|
1146
|
+
j = sqlite3Strlen30( z );
|
1147
|
+
break;
|
1148
|
+
}
|
1149
|
+
case 'm': sqlite3_snprintf( 3, ref zTemp, "%02d", x.M ); z.Append( zTemp ); j += 2; break;
|
1150
|
+
case 'M': sqlite3_snprintf( 3, ref zTemp, "%02d", x.m ); z.Append( zTemp ); j += 2; break;
|
1151
|
+
case 's':
|
1152
|
+
{
|
1153
|
+
sqlite3_snprintf( 30, ref zTemp, "%lld",
|
1154
|
+
(i64)( x.iJD / 1000 - 21086676 * (i64)10000 ) ); z.Append( zTemp );
|
1155
|
+
j = sqlite3Strlen30( z );
|
1156
|
+
break;
|
1157
|
+
}
|
1158
|
+
case 'S': sqlite3_snprintf( 3, ref zTemp, "%02d", (int)x.s ); z.Append( zTemp ); j += 2; break;
|
1159
|
+
case 'w':
|
1160
|
+
{
|
1161
|
+
z.Append( ( ( ( x.iJD + 129600000 ) / 86400000 ) % 7 ) );
|
1162
|
+
break;
|
1163
|
+
}
|
1164
|
+
case 'Y':
|
1165
|
+
{
|
1166
|
+
sqlite3_snprintf( 5, ref zTemp, "%04d", x.Y ); z.Append( zTemp ); j = sqlite3Strlen30( z );
|
1167
|
+
break;
|
1168
|
+
}
|
1169
|
+
default: z.Append( '%' ); break;
|
1170
|
+
}
|
1171
|
+
}
|
1172
|
+
}
|
1173
|
+
//z[j] = 0;
|
1174
|
+
sqlite3_result_text( context, z.ToString(), -1,
|
1175
|
+
z == zBuf ? SQLITE_TRANSIENT : SQLITE_DYNAMIC );
|
1176
|
+
}
|
1177
|
+
}
|
1178
|
+
|
1179
|
+
/*
|
1180
|
+
** current_time()
|
1181
|
+
**
|
1182
|
+
** This function returns the same value as time('now').
|
1183
|
+
*/
|
1184
|
+
static void ctimeFunc(
|
1185
|
+
sqlite3_context context,
|
1186
|
+
int NotUsed,
|
1187
|
+
sqlite3_value[] NotUsed2
|
1188
|
+
)
|
1189
|
+
{
|
1190
|
+
UNUSED_PARAMETER2( NotUsed, NotUsed2 );
|
1191
|
+
timeFunc( context, 0, null );
|
1192
|
+
}
|
1193
|
+
|
1194
|
+
/*
|
1195
|
+
** current_date()
|
1196
|
+
**
|
1197
|
+
** This function returns the same value as date('now').
|
1198
|
+
*/
|
1199
|
+
static void cdateFunc(
|
1200
|
+
sqlite3_context context,
|
1201
|
+
int NotUsed,
|
1202
|
+
sqlite3_value[] NotUsed2
|
1203
|
+
)
|
1204
|
+
{
|
1205
|
+
UNUSED_PARAMETER2( NotUsed, NotUsed2 );
|
1206
|
+
dateFunc( context, 0, null );
|
1207
|
+
}
|
1208
|
+
|
1209
|
+
/*
|
1210
|
+
** current_timestamp()
|
1211
|
+
**
|
1212
|
+
** This function returns the same value as datetime('now').
|
1213
|
+
*/
|
1214
|
+
static void ctimestampFunc(
|
1215
|
+
sqlite3_context context,
|
1216
|
+
int NotUsed,
|
1217
|
+
sqlite3_value[] NotUsed2
|
1218
|
+
)
|
1219
|
+
{
|
1220
|
+
UNUSED_PARAMETER2( NotUsed, NotUsed2 );
|
1221
|
+
datetimeFunc( context, 0, null );
|
1222
|
+
}
|
1223
|
+
#endif // * !SQLITE_OMIT_DATETIME_FUNCS) */
|
1224
|
+
|
1225
|
+
#if SQLITE_OMIT_DATETIME_FUNCS
|
1226
|
+
/*
|
1227
|
+
** If the library is compiled to omit the full-scale date and time
|
1228
|
+
** handling (to get a smaller binary), the following minimal version
|
1229
|
+
** of the functions current_time(), current_date() and current_timestamp()
|
1230
|
+
** are included instead. This is to support column declarations that
|
1231
|
+
** include "DEFAULT CURRENT_TIME" etc.
|
1232
|
+
**
|
1233
|
+
** This function uses the C-library functions time(), gmtime()
|
1234
|
+
** and strftime(). The format string to pass to strftime() is supplied
|
1235
|
+
** as the user-data for the function.
|
1236
|
+
*/
|
1237
|
+
//static void currentTimeFunc(
|
1238
|
+
// sqlite3_context *context,
|
1239
|
+
// int argc,
|
1240
|
+
// sqlite3_value[] argv
|
1241
|
+
//){
|
1242
|
+
time_t t;
|
1243
|
+
char *zFormat = (char *)sqlite3_user_data(context);
|
1244
|
+
sqlite3 db;
|
1245
|
+
double rT;
|
1246
|
+
char zBuf[20];
|
1247
|
+
UNUSED_PARAMETER(argc);
|
1248
|
+
UNUSED_PARAMETER(argv);
|
1249
|
+
db = sqlite3_context_db_handle(context);
|
1250
|
+
sqlite3OsCurrentTime(db.pVfs, rT);
|
1251
|
+
#if !SQLITE_OMIT_FLOATING_POINT
|
1252
|
+
t = 86400.0*(rT - 2440587.5) + 0.5;
|
1253
|
+
#else
|
1254
|
+
/* without floating point support, rT will have
|
1255
|
+
** already lost fractional day precision.
|
1256
|
+
*/
|
1257
|
+
t = 86400 * (rT - 2440587) - 43200;
|
1258
|
+
#endif
|
1259
|
+
#if HAVE_GMTIME_R
|
1260
|
+
// {
|
1261
|
+
// struct tm sNow;
|
1262
|
+
// gmtime_r(&t, sNow);
|
1263
|
+
// strftime(zBuf, 20, zFormat, sNow);
|
1264
|
+
// }
|
1265
|
+
#else
|
1266
|
+
// {
|
1267
|
+
// struct tm pTm;
|
1268
|
+
// sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER));
|
1269
|
+
// pTm = gmtime(&t);
|
1270
|
+
// strftime(zBuf, 20, zFormat, pTm);
|
1271
|
+
// sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER));
|
1272
|
+
// }
|
1273
|
+
#endif
|
1274
|
+
|
1275
|
+
// sqlite3_result_text(context, zBuf, -1, SQLITE_TRANSIENT);
|
1276
|
+
//}
|
1277
|
+
#endif
|
1278
|
+
|
1279
|
+
|
1280
|
+
/*
|
1281
|
+
** This function registered all of the above C functions as SQL
|
1282
|
+
** functions. This should be the only routine in this file with
|
1283
|
+
** external linkage.
|
1284
|
+
*/
|
1285
|
+
static void sqlite3RegisterDateTimeFunctions()
|
1286
|
+
{
|
1287
|
+
FuncDef[] aDateTimeFuncs = new FuncDef[] {
|
1288
|
+
#if !SQLITE_OMIT_DATETIME_FUNCS
|
1289
|
+
FUNCTION("julianday", -1, 0, 0, (dxFunc)juliandayFunc ),
|
1290
|
+
FUNCTION("date", -1, 0, 0, (dxFunc)dateFunc ),
|
1291
|
+
FUNCTION("time", -1, 0, 0, (dxFunc)timeFunc ),
|
1292
|
+
FUNCTION("datetime", -1, 0, 0, (dxFunc)datetimeFunc ),
|
1293
|
+
FUNCTION("strftime", -1, 0, 0, (dxFunc)strftimeFunc ),
|
1294
|
+
FUNCTION("current_time", 0, 0, 0, (dxFunc)ctimeFunc ),
|
1295
|
+
FUNCTION("current_timestamp", 0, 0, 0, (dxFunc)ctimestampFunc),
|
1296
|
+
FUNCTION("current_date", 0, 0, 0, (dxFunc)cdateFunc ),
|
1297
|
+
#else
|
1298
|
+
STR_FUNCTION("current_time", 0, "%H:%M:%S", 0, currentTimeFunc),
|
1299
|
+
STR_FUNCTION("current_date", 0, "%Y-%m-%d", 0, currentTimeFunc),
|
1300
|
+
STR_FUNCTION("current_timestamp", 0, "%Y-%m-%d %H:%M:%S", 0, currentTimeFunc),
|
1301
|
+
#endif
|
1302
|
+
};
|
1303
|
+
int i;
|
1304
|
+
#if SQLITE_OMIT_WSD
|
1305
|
+
FuncDefHash pHash = GLOBAL( FuncDefHash, sqlite3GlobalFunctions );
|
1306
|
+
FuncDef[] aFunc = (FuncDef)GLOBAL( FuncDef, aDateTimeFuncs );
|
1307
|
+
#else
|
1308
|
+
FuncDefHash pHash = sqlite3GlobalFunctions;
|
1309
|
+
FuncDef[] aFunc = aDateTimeFuncs;
|
1310
|
+
#endif
|
1311
|
+
for ( i = 0; i < ArraySize( aDateTimeFuncs ); i++ )
|
1312
|
+
{
|
1313
|
+
sqlite3FuncDefInsert( pHash, aFunc[i] );
|
1314
|
+
}
|
1315
|
+
}
|
1316
|
+
}
|
1317
|
+
}
|