rhodes 1.5.5 → 2.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +5 -0
- data/Manifest.txt +214 -32
- data/Rakefile +33 -10
- data/bin/upgrade-rhodes-app +0 -1
- data/lib/build/compileERB/bb.rb +2 -2
- data/lib/build/compileERB/default.rb +7 -5
- data/lib/build/jake.rb +1 -1
- data/lib/extensions/digest-md5/ext.yml +1 -1
- data/lib/extensions/digest-md5/ext/Rakefile +35 -36
- data/lib/extensions/digest-md5/ext/build.bat +1 -0
- data/lib/extensions/digest-md5/ext/digest-md5.vcproj +203 -0
- data/lib/extensions/digest-sha1/ext.yml +1 -1
- data/lib/extensions/digest/ext.yml +1 -1
- data/lib/extensions/digest/ext/Rakefile +35 -39
- data/lib/extensions/digest/ext/build.bat +1 -2
- data/lib/extensions/digest/ext/digest.vcproj +203 -0
- data/lib/framework/rho/render.rb +79 -22
- data/lib/framework/rho/rho.rb +294 -56
- data/lib/framework/rho/rhoapplication.rb +10 -0
- data/lib/framework/rho/rhofsconnector.rb +2 -6
- data/lib/framework/rho/rhoutils.rb +56 -14
- data/lib/framework/rho/rhoviewhelpers.rb +2 -0
- data/lib/framework/rhodes.rb +2 -2
- data/lib/framework/rhom/rhom.rb +42 -15
- data/lib/framework/rhom/rhom_db_adapter.rb +165 -159
- data/lib/framework/rhom/rhom_object.rb +0 -1
- data/lib/framework/rhom/rhom_object_factory.rb +343 -166
- data/lib/framework/rhom/rhom_source.rb +28 -15
- data/lib/framework/version.rb +2 -2
- data/lib/rhodes.rb +2 -2
- data/platform/android/Rhodes/AndroidManifest.xml +2 -2
- data/platform/android/Rhodes/gen/com/rhomobile/rhodes/R.java +39 -44
- data/platform/android/Rhodes/jni/include/JNIRhodes.h +1 -1
- data/platform/android/Rhodes/jni/include/details/rhojava.inc +23 -20
- data/platform/android/Rhodes/jni/include/jni/com_rhomobile_rhodes_RhoMenu.h +61 -0
- data/platform/android/Rhodes/jni/include/jni/com_rhomobile_rhodes_Rhodes.h +16 -0
- data/platform/android/Rhodes/jni/include/jni/com_rhomobile_rhodes_alert_Alert.h +21 -0
- data/platform/android/Rhodes/jni/include/sslimpl.h +1 -1
- data/platform/android/Rhodes/jni/src/alert.cpp +32 -5
- data/platform/android/Rhodes/jni/src/callbacks.cpp +51 -21
- data/platform/android/Rhodes/jni/src/mapview.cpp +3 -8
- data/platform/android/Rhodes/jni/src/menu.cpp +70 -0
- data/platform/android/Rhodes/jni/src/navbar.cpp +16 -0
- data/platform/android/Rhodes/jni/src/rhodes.cpp +37 -0
- data/platform/android/Rhodes/jni/src/sslimpl.cpp +3 -3
- data/platform/android/Rhodes/jni/src/webview.cpp +21 -7
- data/platform/android/Rhodes/res/drawable/alert_alert.png +0 -0
- data/platform/android/Rhodes/res/drawable/alert_info.png +0 -0
- data/platform/android/Rhodes/res/drawable/alert_question.png +0 -0
- data/platform/android/Rhodes/res/drawable/camera.png +0 -0
- data/platform/android/Rhodes/res/layout/camera.xml +18 -3
- data/platform/android/Rhodes/res/menu/options.xml +0 -10
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/AndroidR.java +5 -10
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Capabilities.java +12 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhoMenu.java +105 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/Rhodes.java +157 -122
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/SplashScreen.java +7 -58
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/WebView.java +16 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/alert/Alert.java +220 -17
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/Camera.java +22 -4
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/camera/ImageCapture.java +44 -25
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/geolocation/GeoLocation.java +10 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/MainView.java +3 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/SimpleMainView.java +10 -21
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/mainview/TabbedMainView.java +15 -12
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/phonebook/Phonebook.java +44 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/socket/SSLImpl.java +47 -3
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/uri/MailUriHandler.java +13 -6
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/uri/TelUriHandler.java +11 -5
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/uri/UriHandler.java +1 -4
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/uri/VideoUriHandler.java +61 -0
- data/platform/android/build/RhodesSRC_build.files +3 -0
- data/platform/android/build/android.rake +173 -60
- data/platform/android/build/androidcommon.rb +1 -2
- data/platform/android/build/librhocommon_build.files +5 -0
- data/platform/android/build/librhodes_build.files +2 -0
- data/platform/android/build/libruby_build.files +2 -1
- data/platform/bb/Hsqldb/Hsqldb.jdp +0 -3
- data/platform/bb/Hsqldb/src/com/rho/db/FileUtilBB.java +1 -1
- data/platform/bb/Hsqldb/src/com/rho/db/HsqlDBResult.java +16 -1
- data/platform/bb/Hsqldb/src/com/rho/db/HsqlDBRowResult.java +5 -0
- data/platform/bb/Hsqldb/src/com/rho/db/HsqlDBStorage.java +25 -4
- data/platform/bb/Hsqldb/src/com/rho/db/Journal.java +1 -1
- data/platform/bb/Hsqldb/src/com/rho/file/FileAccessBB.java +0 -1
- data/platform/bb/Hsqldb/src/j2me/math/Number.java +6 -3
- data/platform/bb/Hsqldb/src/org/hsqldb/CompiledStatementExecutor.java +2 -1
- data/platform/bb/Hsqldb/src/org/hsqldb/Expression.java +1 -0
- data/platform/bb/Hsqldb/src/org/hsqldb/Parser.java +1 -0
- data/platform/bb/Hsqldb/src/org/hsqldb/Result.java +2 -0
- data/platform/bb/Hsqldb/src/org/hsqldb/Select.java +12 -6
- data/platform/bb/Hsqldb/src/org/hsqldb/Session.java +19 -12
- data/platform/bb/Hsqldb/src/org/hsqldb/Table.java +10 -4
- data/platform/bb/Hsqldb/src/org/hsqldb/Token.java +10 -2
- data/platform/bb/Hsqldb/src/org/hsqldb/Tokenizer.java +3 -3
- data/platform/bb/Hsqldb/src/org/hsqldb/lib/java/JavaSystem.java +1 -1
- data/platform/bb/Hsqldb/src/org/hsqldb/persist/HsqlProperties.java +2 -1
- data/platform/bb/Hsqldb/src/org/hsqldb/persist/ScaledRAFile.java +1 -1
- data/platform/bb/Hsqldb/src/org/hsqldb/scriptio/ScriptReaderText.java +1 -1
- data/platform/bb/Hsqldb/src/org/hsqldb/scriptio/ScriptWriterBase.java +1 -1
- data/platform/bb/RubyVM/RubyVM.jdp +9 -10
- data/platform/bb/build/RubyVM_build.files +9 -7
- data/platform/bb/build/bb.rake +13 -3
- data/platform/bb/build/hsqldb_build.files +0 -2
- data/platform/bb/build/rhodes_build.files +5 -2
- data/platform/bb/rhodes/platform/4.7/com/rho/RhoMainScreen.java +8 -0
- data/platform/bb/rhodes/platform/5.0/com/rho/BrowserAdapter5.java +154 -0
- data/platform/bb/rhodes/platform/5.0/com/rho/RhoMainScreen.java +8 -0
- data/platform/bb/rhodes/platform/common/com/rho/BrowserAdapter5.java +28 -0
- data/platform/bb/rhodes/rhodes.jdp +12 -7
- data/platform/bb/rhodes/src/com/rho/BrowserAdapter.java +331 -0
- data/platform/bb/rhodes/src/com/rho/BrowserAdapter5.java +28 -0
- data/platform/bb/rhodes/src/com/rho/IBrowserAdapter.java +10 -0
- data/platform/bb/rhodes/src/com/rho/RhoMainScreen.java +4 -0
- data/platform/bb/rhodes/src/com/rho/RhoRubyHelper.java +2 -4
- data/platform/bb/rhodes/src/com/rho/{Jsr75File.java → file/Jsr75File.java} +83 -36
- data/platform/bb/{Hsqldb → rhodes}/src/com/rho/file/Jsr75RAFileImpl.java +0 -1
- data/platform/bb/{Hsqldb → rhodes}/src/com/rho/file/PersistRAFileImpl.java +0 -2
- data/platform/bb/rhodes/src/com/rho/net/NetworkAccess.java +8 -10
- data/platform/bb/rhodes/src/com/rho/rubyext/Alert.java +1 -1
- data/platform/bb/rhodes/src/com/rho/rubyext/GeoLocation.java +39 -0
- data/platform/bb/rhodes/src/com/rho/rubyext/System.java +63 -2
- data/platform/bb/rhodes/src/com/rho/rubyext/WebView.java +100 -0
- data/platform/bb/rhodes/src/rhomobile/LogScreen.java +1 -1
- data/platform/bb/rhodes/src/rhomobile/PushListeningThread.java +13 -1
- data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +138 -492
- data/platform/bb/rhodes/src/rhomobile/SecondaryResourceFetchThread.java +11 -2
- data/platform/bb/rhodes/src/rhomobile/Utilities.java +14 -10
- data/platform/bb/rhodes/src/rhomobile/camera/CameraScreen.java +5 -14
- data/platform/bb/rhodes/src/rhomobile/camera/ImageBrowserScreen.java +1 -1
- data/platform/bb/rhodes/src/rhomobile/mapview/GoogleMapField.java +2 -2
- data/platform/iphone/Classes/AppManager/AppManager.m +37 -14
- data/platform/iphone/Classes/Camera/PickImageDelegate.h +15 -4
- data/platform/iphone/Classes/Camera/PickImageDelegate.m +53 -50
- data/platform/iphone/Classes/DateTimePicker.h +17 -0
- data/platform/iphone/Classes/DateTimePicker.m +35 -0
- data/platform/iphone/Classes/GeoLocation/LocationController.m +2 -3
- data/platform/iphone/Classes/LogOptionsController.m +3 -2
- data/platform/iphone/Classes/LogViewController.m +4 -2
- data/platform/iphone/Classes/MapView/GoogleGeocoder.m +12 -20
- data/platform/iphone/Classes/MapView/MapAnnotation.h +9 -13
- data/platform/iphone/Classes/MapView/MapAnnotation.m +17 -65
- data/platform/iphone/Classes/MapView/MapViewController.h +1 -7
- data/platform/iphone/Classes/MapView/MapViewController.m +51 -25
- data/platform/iphone/Classes/NativeBar.h +0 -12
- data/platform/iphone/Classes/NativeBar.m +121 -2
- data/platform/iphone/Classes/NavBar.h +16 -0
- data/platform/iphone/Classes/NavBar.m +115 -0
- data/platform/iphone/Classes/RhoAlert.h +19 -0
- data/platform/iphone/Classes/RhoAlert.m +258 -0
- data/platform/iphone/Classes/RhoDelegate.m +1 -0
- data/platform/iphone/Classes/RhoMainView.h +33 -0
- data/platform/iphone/Classes/Rhodes.h +56 -0
- data/platform/iphone/Classes/Rhodes.m +533 -0
- data/platform/iphone/Classes/RingtoneManager.h +17 -0
- data/platform/iphone/Classes/RingtoneManager.m +73 -0
- data/platform/iphone/Classes/SimpleMainView.h +30 -0
- data/platform/iphone/Classes/SimpleMainView.m +380 -0
- data/platform/iphone/Classes/TabbedMainView.h +24 -0
- data/platform/iphone/Classes/TabbedMainView.m +202 -0
- data/platform/iphone/Classes/WebView.m +123 -0
- data/platform/iphone/Classes/rho/net/NetRequestImpl.m +2 -2
- data/platform/iphone/Classes/rho/net/sslimpl.cpp +13 -1
- data/platform/iphone/Classes/rho/net/sslimpl.h +1 -1
- data/platform/iphone/Info.plist +1 -1
- data/platform/iphone/RhoLib/RhoLib.xcodeproj/project.pbxproj +44 -0
- data/platform/iphone/main.m +1 -2
- data/platform/iphone/rbuild/iphone.rake +8 -16
- data/platform/iphone/rhoextlib/dosyscall.c +1 -1
- data/platform/iphone/rhoextlib/rhoextlib.xcodeproj/project.pbxproj +6 -4
- data/platform/iphone/rhorubylib/rhorubylib.xcodeproj/project.pbxproj +12 -0
- data/platform/iphone/rhorunner.xcodeproj/project.pbxproj +97 -62
- data/platform/iphone/rhosynclib/rhosynclib.xcodeproj/project.pbxproj +12 -0
- data/platform/osx/Rhodes Launcher/launch.rb +14 -21
- data/platform/shared/common/AppMenu.cpp +122 -0
- data/platform/shared/common/AppMenu.h +46 -0
- data/platform/shared/common/PosixThreadImpl.cpp +1 -1
- data/platform/shared/common/RhoConf.cpp +27 -2
- data/platform/shared/common/RhoConf.h +5 -0
- data/platform/shared/common/RhoFilePath.h +21 -0
- data/platform/shared/common/RhoStd.h +44 -5
- data/platform/shared/common/RhoTime.h +20 -7
- data/platform/shared/common/RhodesApp.cpp +236 -177
- data/platform/shared/common/RhodesApp.h +36 -13
- data/platform/shared/common/SplashScreen.cpp +2 -2
- data/platform/shared/common/StringConverter.h +10 -11
- data/platform/shared/common/rhoparams.c +0 -6
- data/platform/shared/curl/lib/rhossl.c +3 -2
- data/platform/shared/curl/lib/url.c +0 -5
- data/platform/shared/db/DBAdapter.cpp +304 -81
- data/platform/shared/db/DBAdapter.h +24 -7
- data/platform/shared/db/DBAttrManager.cpp +83 -30
- data/platform/shared/db/DBAttrManager.h +6 -0
- data/platform/shared/db/DBResult.h +15 -4
- data/platform/shared/json/JSONIterator.cpp +100 -3
- data/platform/shared/json/JSONIterator.h +28 -3
- data/platform/shared/net/AsyncHttp.cpp +25 -22
- data/platform/shared/net/AsyncHttp.h +10 -6
- data/platform/shared/net/CURLNetRequest.cpp +115 -36
- data/platform/shared/net/CURLNetRequest.h +6 -0
- data/platform/shared/net/HttpServer.cpp +6 -4
- data/platform/shared/net/HttpServer.h +0 -1
- data/platform/shared/net/INetRequest.h +19 -3
- data/platform/shared/net/URI.cpp +2 -2
- data/platform/shared/net/ssl.cpp +2 -2
- data/platform/shared/net/ssl.h +2 -2
- data/platform/shared/ruby/ext/alert/alert.i +14 -2
- data/platform/shared/ruby/ext/alert/alert_wrap.c +40 -20
- data/platform/shared/ruby/ext/asynchttp/asynchttp.i +8 -8
- data/platform/shared/ruby/ext/asynchttp/asynchttp_wrap.c +112 -16
- data/platform/shared/ruby/ext/geolocation/geolocation.i +16 -12
- data/platform/shared/ruby/ext/geolocation/geolocation_wrap.c +481 -125
- data/platform/shared/ruby/ext/navbar/navbar.i +20 -0
- data/platform/shared/ruby/ext/navbar/navbar_wrap.c +1859 -0
- data/platform/shared/ruby/ext/rho/extensions.c +1 -1
- data/platform/shared/ruby/ext/rho/rhoruby.c +32 -2
- data/platform/shared/ruby/ext/rho/rhoruby.h +7 -2
- data/platform/shared/ruby/ext/rhoconf/rhoconf.i +4 -0
- data/platform/shared/ruby/ext/rhoconf/rhoconf_wrap.c +31 -0
- data/platform/shared/ruby/ext/sqlite3_api/sqlite3_api_wrap.c +188 -3226
- data/platform/shared/ruby/ext/syncengine/syncengine.i +14 -25
- data/platform/shared/ruby/ext/syncengine/syncengine_wrap.c +96 -104
- data/platform/shared/ruby/ext/system/system.i +12 -0
- data/platform/shared/ruby/ext/system/system_wrap.c +101 -7
- data/platform/shared/ruby/ext/webview/webview.i +20 -15
- data/platform/shared/ruby/ext/webview/webview_wrap.c +42 -16
- data/platform/shared/ruby/thread_pthread.c +4 -4
- data/platform/shared/ruby/thread_win32.c +4 -4
- data/platform/shared/ruby/wince/io_wce.c +0 -1
- data/platform/shared/rubyJVM/src/com/rho/FilePath.java +18 -2
- data/platform/shared/rubyJVM/src/com/rho/IRhoRubyHelper.java +1 -0
- data/platform/shared/rubyJVM/src/com/rho/Properties.java +9 -0
- data/platform/shared/rubyJVM/src/com/rho/RhoClassFactory.java +2 -3
- data/platform/shared/rubyJVM/src/com/rho/RhoConf.java +47 -8
- data/platform/shared/rubyJVM/src/com/rho/RhoLogConf.java +1 -0
- data/platform/shared/rubyJVM/src/com/rho/RhoLogFileSink.java +1 -0
- data/platform/shared/rubyJVM/src/com/rho/RhoRuby.java +43 -5
- data/platform/shared/rubyJVM/src/com/rho/RhodesApp.java +98 -3
- data/platform/shared/rubyJVM/src/com/rho/db/DBAdapter.java +460 -175
- data/platform/shared/rubyJVM/src/com/rho/db/DBAttrManager.java +81 -33
- data/platform/shared/rubyJVM/src/com/rho/db/IDBCallback.java +3 -5
- data/platform/shared/rubyJVM/src/com/rho/db/IDBResult.java +2 -0
- data/platform/shared/rubyJVM/src/com/rho/db/IDBStorage.java +2 -0
- data/platform/shared/rubyJVM/src/com/rho/{IFile.java → file/IFile.java} +1 -1
- data/platform/shared/rubyJVM/src/com/rho/{IFileAccess.java → file/IFileAccess.java} +1 -1
- data/platform/shared/rubyJVM/src/com/rho/{IRAFile.java → file/IRAFile.java} +1 -1
- data/platform/{bb/Hsqldb/src/com/rho/db → shared/rubyJVM/src/com/rho/file}/RandomAccessFile.java +1 -2
- data/platform/shared/rubyJVM/src/com/rho/{SimpleFile.java → file/SimpleFile.java} +5 -1
- data/platform/shared/rubyJVM/src/com/rho/net/AsyncHttp.java +23 -18
- data/platform/shared/rubyJVM/src/com/rho/net/NetRequest.java +167 -250
- data/platform/shared/rubyJVM/src/com/rho/net/RhoConnection.java +100 -30
- data/platform/shared/rubyJVM/src/com/rho/net/URI.java +0 -1
- data/platform/shared/rubyJVM/src/com/rho/sync/ClientRegister.java +30 -33
- data/platform/shared/rubyJVM/src/com/rho/sync/ISyncProtocol.java +20 -0
- data/platform/shared/rubyJVM/src/com/rho/sync/JSONEntry.java +5 -0
- data/platform/shared/rubyJVM/src/com/rho/sync/JSONStructIterator.java +74 -0
- data/platform/shared/rubyJVM/src/com/rho/sync/SyncEngine.java +486 -257
- data/platform/shared/rubyJVM/src/com/rho/sync/SyncNotify.java +89 -58
- data/platform/shared/rubyJVM/src/com/rho/sync/SyncProtocol_3.java +79 -0
- data/platform/shared/rubyJVM/src/com/rho/sync/SyncSource.java +634 -495
- data/platform/shared/rubyJVM/src/com/rho/sync/SyncThread.java +74 -90
- data/platform/shared/rubyJVM/src/com/xruby/GeneratedMethods/RubySymbol_Methods.java +1 -0
- data/platform/shared/rubyJVM/src/com/xruby/runtime/builtin/RubyThread.java +6 -0
- data/platform/shared/rubyJVM/src/com/xruby/runtime/lang/RubyRuntime.java +6 -2
- data/platform/shared/rubyJVM/src/com/xruby/runtime/lang/RubySymbol.java +17 -1
- data/platform/shared/rubyJVM/src/com/xruby/runtime/lang/RubyValue.java +1 -0
- data/platform/shared/rubyJVM/src/org/json/me/JSONObject.java +3 -0
- data/platform/shared/rubyext/GeoLocation.cpp +23 -0
- data/platform/shared/rubyext/GeoLocation.h +2 -0
- data/platform/shared/rubyext/RhoRuby.cpp +31 -0
- data/platform/shared/rubyext/RhoRuby.h +32 -0
- data/platform/shared/rubyext/System.cpp +14 -3
- data/platform/shared/rubyext/WebView.h +21 -0
- data/platform/shared/sync/ClientRegister.cpp +23 -28
- data/platform/shared/sync/ClientRegister.h +6 -2
- data/platform/shared/sync/ISyncProtocol.h +29 -0
- data/platform/shared/sync/SyncEngine.cpp +450 -190
- data/platform/shared/sync/SyncEngine.h +28 -38
- data/platform/shared/sync/SyncNotify.cpp +43 -41
- data/platform/shared/sync/SyncNotify.h +7 -7
- data/platform/shared/sync/SyncProtocol_3.h +86 -0
- data/platform/shared/sync/SyncSource.cpp +535 -371
- data/platform/shared/sync/SyncSource.h +48 -55
- data/platform/shared/sync/SyncThread.cpp +59 -103
- data/platform/shared/sync/SyncThread.h +10 -23
- data/platform/shared/unzip/unzip.cpp +3 -2
- data/platform/shared/unzip/unzip.h +5 -1
- data/platform/shared/wtl80/include/atlapp.h +10 -10
- data/platform/wm/RhoLib/RhoLib.vcproj +32 -0
- data/platform/wm/build/build_inf.js +40 -3
- data/platform/wm/build/wm.rake +95 -9
- data/platform/wm/rhodes/Alert.cpp +4 -0
- data/platform/wm/rhodes/DateTimePicker.cpp +183 -0
- data/platform/wm/rhodes/DateTimePicker.h +100 -0
- data/platform/wm/rhodes/MainWindow.cpp +222 -209
- data/platform/wm/rhodes/MainWindow.h +28 -35
- data/platform/wm/rhodes/Rhodes.cpp +20 -60
- data/platform/wm/rhodes/Rhodes.rc +41 -7
- data/platform/wm/rhodes/Utils.cpp +65 -0
- data/platform/wm/rhodes/Utils.h +9 -0
- data/platform/wm/rhodes/camera/Camera.cpp +2 -2
- data/platform/wm/rhodes/menubar.cpp +2 -33
- data/platform/wm/rhodes/menubar.h +0 -14
- data/platform/wm/rhodes/resource.h +13 -11
- data/platform/wm/rhodes/rho/net/NetRequest.cpp +16 -35
- data/platform/wm/rhodes/rho/net/NetRequest.h +8 -2
- data/platform/wm/rhodes/rho/net/NetRequestImpl.cpp +264 -46
- data/platform/wm/rhodes/rho/net/NetRequestImpl.h +14 -4
- data/platform/wm/rhodes/rho/rubyext/GeoLocationImpl.cpp +1 -1
- data/platform/wm/rhodes/rho/rubyext/GeoLocationImpl.h +1 -1
- data/platform/wm/rhodes/rho/rubyext/SystemImpl.cpp +77 -4
- data/platform/wm/rhodes/rho/rubyext/WebView.cpp +63 -0
- data/platform/wm/rhodes/rhodes.vcproj +20 -66
- data/platform/wm/rhodes/stdafx.h +22 -0
- data/platform/wm/rubylib/rubylib.vcproj +4 -0
- data/platform/wm/syncengine/syncengine.vcproj +8 -0
- data/platform/wm/tools/detool.sln +66 -0
- data/platform/wm/tools/detool/DEMComInterface.tlb +0 -0
- data/platform/wm/tools/detool/ReadMe.txt +33 -0
- data/platform/wm/tools/detool/detool.cpp +559 -0
- data/platform/wm/tools/detool/detool.h +5 -0
- data/platform/wm/tools/detool/detool.vcproj +233 -0
- data/platform/wm/tools/detool/stdafx.cpp +8 -0
- data/platform/wm/tools/detool/stdafx.h +15 -0
- data/platform/wm/tools/detool/targetver.h +24 -0
- data/platform/wm/tools/rhosetup/ReadMe.txt +41 -0
- data/platform/wm/tools/rhosetup/rhosetup.cpp +52 -0
- data/platform/wm/tools/rhosetup/rhosetup.vcproj +641 -0
- data/platform/wm/tools/rhosetup/stdafx.cpp +8 -0
- data/platform/wm/tools/rhosetup/stdafx.h +59 -0
- data/rakefile.rb +33 -10
- data/res/build-tools/db/syncdb.schema +25 -23
- data/res/build-tools/db/syncdb.triggers +1 -1
- data/res/build-tools/detool.exe +0 -0
- data/res/build-tools/rhosetup.dll +0 -0
- data/res/generators/rhogen.rb +27 -22
- data/res/generators/templates/application/app/Settings/controller.rb +3 -1
- data/res/generators/templates/application/app/Settings/home.bb.erb +17 -0
- data/res/generators/templates/application/app/Settings/home.erb +21 -12
- data/res/generators/templates/application/app/Settings/index.bb.erb +32 -0
- data/res/generators/templates/application/app/Settings/index.erb +44 -15
- data/res/generators/templates/application/app/Settings/login.bb.erb +35 -0
- data/res/generators/templates/application/app/Settings/login.erb +29 -30
- data/res/generators/templates/application/app/Settings/reset.bb.erb +15 -0
- data/res/generators/templates/application/app/Settings/reset.erb +16 -13
- data/res/generators/templates/application/app/Settings/wait.bb.erb +3 -0
- data/res/generators/templates/application/app/Settings/wait.erb +4 -4
- data/res/generators/templates/application/app/application.rb +8 -0
- data/res/generators/templates/application/app/helpers/browser_helper.rb +13 -0
- data/res/generators/templates/application/app/index.bb.erb +26 -0
- data/res/generators/templates/application/app/index.erb +21 -12
- data/res/generators/templates/application/app/layout.erb +9 -11
- data/res/generators/templates/application/public/css/android.css +285 -0
- data/res/generators/templates/application/public/css/blackberry.css +85 -78
- data/res/generators/templates/application/public/css/iphone.css +286 -296
- data/res/generators/templates/application/public/css/webkit.css +34 -0
- data/res/generators/templates/application/public/css/windows_mobile.css +208 -0
- data/res/generators/templates/application/public/icons/Read me first - license.txt +14 -0
- data/res/generators/templates/application/public/icons/about.png +0 -0
- data/res/generators/templates/application/public/icons/airplane.png +0 -0
- data/res/generators/templates/application/public/icons/baby.png +0 -0
- data/res/generators/templates/application/public/icons/badge.png +0 -0
- data/res/generators/templates/application/public/icons/bandaid.png +0 -0
- data/res/generators/templates/application/public/icons/bar-chart.png +0 -0
- data/res/generators/templates/application/public/icons/battery.png +0 -0
- data/res/generators/templates/application/public/icons/beaker.png +0 -0
- data/res/generators/templates/application/public/icons/beaker2.png +0 -0
- data/res/generators/templates/application/public/icons/beermug.png +0 -0
- data/res/generators/templates/application/public/icons/bird.png +0 -0
- data/res/generators/templates/application/public/icons/book.png +0 -0
- data/res/generators/templates/application/public/icons/bookmark.png +0 -0
- data/res/generators/templates/application/public/icons/brightness.png +0 -0
- data/res/generators/templates/application/public/icons/bug.png +0 -0
- data/res/generators/templates/application/public/icons/cabinet.png +0 -0
- data/res/generators/templates/application/public/icons/calendar.png +0 -0
- data/res/generators/templates/application/public/icons/camera.png +0 -0
- data/res/generators/templates/application/public/icons/changeName.rb +22 -0
- data/res/generators/templates/application/public/icons/chat2.png +0 -0
- data/res/generators/templates/application/public/icons/chicken.png +0 -0
- data/res/generators/templates/application/public/icons/clock.png +0 -0
- data/res/generators/templates/application/public/icons/cloud.png +0 -0
- data/res/generators/templates/application/public/icons/coffee.png +0 -0
- data/res/generators/templates/application/public/icons/compass.png +0 -0
- data/res/generators/templates/application/public/icons/contrast.png +0 -0
- data/res/generators/templates/application/public/icons/dashboard.png +0 -0
- data/res/generators/templates/application/public/icons/display.png +0 -0
- data/res/generators/templates/application/public/icons/dogpaw.png +0 -0
- data/res/generators/templates/application/public/icons/download.png +0 -0
- data/res/generators/templates/application/public/icons/dumbbell.png +0 -0
- data/res/generators/templates/application/public/icons/ekg.png +0 -0
- data/res/generators/templates/application/public/icons/envelope.png +0 -0
- data/res/generators/templates/application/public/icons/equalizer.png +0 -0
- data/res/generators/templates/application/public/icons/eye.png +0 -0
- data/res/generators/templates/application/public/icons/film-roll.png +0 -0
- data/res/generators/templates/application/public/icons/flag.png +0 -0
- data/res/generators/templates/application/public/icons/fork-and-knife.png +0 -0
- data/res/generators/templates/application/public/icons/fuel.png +0 -0
- data/res/generators/templates/application/public/icons/gameplan.png +0 -0
- data/res/generators/templates/application/public/icons/gear.png +0 -0
- data/res/generators/templates/application/public/icons/gear2.png +0 -0
- data/res/generators/templates/application/public/icons/gift.png +0 -0
- data/res/generators/templates/application/public/icons/heart.png +0 -0
- data/res/generators/templates/application/public/icons/house.png +0 -0
- data/res/generators/templates/application/public/icons/inbox.png +0 -0
- data/res/generators/templates/application/public/icons/index-cards.png +0 -0
- data/res/generators/templates/application/public/icons/iphone.png +0 -0
- data/res/generators/templates/application/public/icons/ipod.png +0 -0
- data/res/generators/templates/application/public/icons/key.png +0 -0
- data/res/generators/templates/application/public/icons/lifebuoy.png +0 -0
- data/res/generators/templates/application/public/icons/lightbulb.png +0 -0
- data/res/generators/templates/application/public/icons/line-chart.png +0 -0
- data/res/generators/templates/application/public/icons/location.png +0 -0
- data/res/generators/templates/application/public/icons/lock.png +0 -0
- data/res/generators/templates/application/public/icons/loopback.png +0 -0
- data/res/generators/templates/application/public/icons/magnifying-glass.png +0 -0
- data/res/generators/templates/application/public/icons/map-marker.png +0 -0
- data/res/generators/templates/application/public/icons/map.png +0 -0
- data/res/generators/templates/application/public/icons/medical-bag.png +0 -0
- data/res/generators/templates/application/public/icons/medical.png +0 -0
- data/res/generators/templates/application/public/icons/microphone.png +0 -0
- data/res/generators/templates/application/public/icons/movie1.png +0 -0
- data/res/generators/templates/application/public/icons/movie2.png +0 -0
- data/res/generators/templates/application/public/icons/network.png +0 -0
- data/res/generators/templates/application/public/icons/note.png +0 -0
- data/res/generators/templates/application/public/icons/outlet.png +0 -0
- data/res/generators/templates/application/public/icons/palette.png +0 -0
- data/res/generators/templates/application/public/icons/paperclip.png +0 -0
- data/res/generators/templates/application/public/icons/phone.png +0 -0
- data/res/generators/templates/application/public/icons/photos.png +0 -0
- data/res/generators/templates/application/public/icons/piano.png +0 -0
- data/res/generators/templates/application/public/icons/picture-frame.png +0 -0
- data/res/generators/templates/application/public/icons/pill.png +0 -0
- data/res/generators/templates/application/public/icons/pin.png +0 -0
- data/res/generators/templates/application/public/icons/pinetree.png +0 -0
- data/res/generators/templates/application/public/icons/planet.png +0 -0
- data/res/generators/templates/application/public/icons/puzzle.png +0 -0
- data/res/generators/templates/application/public/icons/radar.png +0 -0
- data/res/generators/templates/application/public/icons/redo.png +0 -0
- data/res/generators/templates/application/public/icons/refresh.png +0 -0
- data/res/generators/templates/application/public/icons/runner.png +0 -0
- data/res/generators/templates/application/public/icons/shoebox.png +0 -0
- data/res/generators/templates/application/public/icons/shopping-bag.png +0 -0
- data/res/generators/templates/application/public/icons/shopping-cart.png +0 -0
- data/res/generators/templates/application/public/icons/shuffle.png +0 -0
- data/res/generators/templates/application/public/icons/signpost.png +0 -0
- data/res/generators/templates/application/public/icons/skull-n-crossbones.png +0 -0
- data/res/generators/templates/application/public/icons/skull.png +0 -0
- data/res/generators/templates/application/public/icons/sliders.png +0 -0
- data/res/generators/templates/application/public/icons/spraycan.png +0 -0
- data/res/generators/templates/application/public/icons/squiggle.png +0 -0
- data/res/generators/templates/application/public/icons/star.png +0 -0
- data/res/generators/templates/application/public/icons/stopwatch.png +0 -0
- data/res/generators/templates/application/public/icons/suitcase.png +0 -0
- data/res/generators/templates/application/public/icons/tag.png +0 -0
- data/res/generators/templates/application/public/icons/tags.png +0 -0
- data/res/generators/templates/application/public/icons/target.png +0 -0
- data/res/generators/templates/application/public/icons/testtube.png +0 -0
- data/res/generators/templates/application/public/icons/thermometer.png +0 -0
- data/res/generators/templates/application/public/icons/toolbox.png +0 -0
- data/res/generators/templates/application/public/icons/trophy.png +0 -0
- data/res/generators/templates/application/public/icons/tshirt.png +0 -0
- data/res/generators/templates/application/public/icons/tv.png +0 -0
- data/res/generators/templates/application/public/icons/umbrella.png +0 -0
- data/res/generators/templates/application/public/icons/walk.png +0 -0
- data/res/generators/templates/application/public/icons/weather.png +0 -0
- data/res/generators/templates/application/public/icons/widescreen.png +0 -0
- data/res/generators/templates/application/public/icons/wineglass.png +0 -0
- data/res/generators/templates/application/public/icons/zap.png +0 -0
- data/res/generators/templates/application/public/images/android/btn_check_off.png +0 -0
- data/res/generators/templates/application/public/images/android/btn_check_on.png +0 -0
- data/res/generators/templates/application/public/images/android/btn_radio_off.png +0 -0
- data/res/generators/templates/application/public/images/android/btn_radio_on.png +0 -0
- data/res/generators/templates/application/public/images/android/ic_menu_more.png +0 -0
- data/res/generators/templates/application/public/images/iphone/disclosure.png +0 -0
- data/res/generators/templates/application/public/images/iphone/disclosure_detail.png +0 -0
- data/res/generators/templates/application/public/images/iphone/radiobutton.png +0 -0
- data/res/generators/templates/application/public/images/iphone/select.png +0 -0
- data/res/generators/templates/application/public/images/iphone/switch.png +0 -0
- data/res/generators/templates/application/public/images/listArrow.png +0 -0
- data/res/generators/templates/application/public/images/listArrowDown.png +0 -0
- data/res/generators/templates/model/controller.rb +2 -0
- data/res/generators/templates/model/edit.bb.erb +24 -0
- data/res/generators/templates/model/edit.erb +21 -25
- data/res/generators/templates/model/index.bb.erb +21 -0
- data/res/generators/templates/model/index.erb +28 -14
- data/res/generators/templates/model/new.bb.erb +24 -0
- data/res/generators/templates/model/new.erb +20 -20
- data/res/generators/templates/model/show.bb.erb +21 -0
- data/res/generators/templates/model/show.erb +15 -15
- data/rhobuild.yml +37 -0
- data/rhodes.gemspec +1 -1
- data/spec/framework_spec/app/Account/config.rb +57 -1
- data/spec/framework_spec/app/Case/config.rb +1 -1
- data/spec/framework_spec/app/Customer/config.rb +1 -1
- data/spec/framework_spec/app/Product/config.rb +15 -1
- data/spec/framework_spec/app/spec/fixtures/object_values.txt +90 -90
- data/spec/framework_spec/app/spec/pagination/fixtures/object_values.txt +91 -91
- data/spec/framework_spec/app/spec/rho_spec.rb +1 -1
- data/spec/framework_spec/app/spec/rhom_object_spec.rb +47 -28
- data/spec/framework_spec/app/spec/rhom_spec.rb +8 -8
- data/spec/framework_spec/app/spec/spec_helper.rb +13 -5
- data/spec/framework_spec/app/spec_runner.rb +5 -4
- data/spec/framework_spec/public/css/base.css +0 -1
- data/spec/framework_spec/public/css/iphone.css +0 -1
- data/spec/framework_spec/rhoconfig.txt +3 -1
- metadata +220 -37
- data/platform/bb/rhodes/src/rhomobile/WebView.java +0 -90
- data/platform/iphone/Classes/BarItem.h +0 -27
- data/platform/iphone/Classes/BarItem.m +0 -32
- data/platform/iphone/Classes/JSString.h +0 -12
- data/platform/iphone/Classes/JSString.m +0 -7
- data/platform/iphone/Classes/RhoRunnerAppDelegate.h +0 -48
- data/platform/iphone/Classes/RhoRunnerAppDelegate.m +0 -617
- data/platform/iphone/Classes/Server/ServerHost.h +0 -81
- data/platform/iphone/Classes/Server/ServerHost.m +0 -597
- data/platform/iphone/Classes/Server/WebViewUrl.h +0 -13
- data/platform/iphone/Classes/Server/WebViewUrl.m +0 -8
- data/platform/iphone/Classes/TabBarDelegate.h +0 -39
- data/platform/iphone/Classes/TabBarDelegate.m +0 -151
- data/platform/iphone/Classes/Utils/unzip.cpp +0 -4328
- data/platform/iphone/Classes/Utils/unzip.h +0 -234
- data/platform/iphone/Classes/WebViewController.h +0 -59
- data/platform/iphone/Classes/WebViewController.m +0 -472
- data/platform/wm/rhodes/GetURLDialog.cpp +0 -64
- data/platform/wm/rhodes/GetURLDialog.h +0 -39
- data/res/generators/templates/application/public/css/base.css +0 -39
- data/res/generators/templates/application/public/css/rho.css +0 -3
- data/res/generators/templates/application/public/css/xhtml.css +0 -114
- data/spec/framework_spec/app/Question/config.rb +0 -3
- data/spec/generator_spec/source_generator_spec.rb +0 -27
@@ -39,8 +39,18 @@ module Rho
|
|
39
39
|
|
40
40
|
def on_activate_app
|
41
41
|
end
|
42
|
+
|
43
|
+
# works for schema sources
|
44
|
+
def on_migrate_source(old_version, new_src)
|
45
|
+
puts "on_migrate_source; old_version :#{old_version}; new_src : #{new_src}"
|
46
|
+
db = ::Rho::RHO.get_src_db(new_src['name'])
|
47
|
+
if new_src['schema']
|
48
|
+
db.delete_table(new_src['name'])
|
49
|
+
end
|
50
|
+
end
|
42
51
|
|
43
52
|
def set_menu(menu=nil,back_action=nil)
|
53
|
+
@default_menu = {} if @default_menu.nil?
|
44
54
|
disp_menu = menu ? menu.dup : @default_menu.dup
|
45
55
|
disp_menu['Back'] = back_action if back_action
|
46
56
|
puts "RhoApplication: Using menu - #{disp_menu.inspect}"
|
@@ -24,12 +24,8 @@ module Rho
|
|
24
24
|
File.join(__rhoGetCurrentDir(), 'apps/'+appname+'/'+modelname+'/')
|
25
25
|
end
|
26
26
|
|
27
|
-
def get_db_fullpathname
|
28
|
-
|
29
|
-
File.join(SYNC_DB_FILE)
|
30
|
-
else
|
31
|
-
File.join(__rhoGetCurrentDir(), 'db/syncdb.sqlite')
|
32
|
-
end
|
27
|
+
def get_db_fullpathname(postfix)
|
28
|
+
File.join(__rhoGetCurrentDir(), 'db/syncdb' + postfix + '.sqlite')
|
33
29
|
end
|
34
30
|
end
|
35
31
|
end # RhoApplication
|
@@ -3,23 +3,31 @@ require 'rhom/rhom_source'
|
|
3
3
|
module Rho
|
4
4
|
class RhoUtils
|
5
5
|
@@mapSrc = nil
|
6
|
+
@@mapSrcByIdx = nil
|
6
7
|
def self.load_offline_data(tables=[], dir_prefix=nil)
|
7
8
|
columns = []
|
8
9
|
tables.each do |filename|
|
9
10
|
|
10
11
|
if @@mapSrc.nil?
|
11
12
|
@@mapSrc = {}
|
13
|
+
@@mapSrcByIdx = {}
|
12
14
|
arSrcs = Rhom::RhomSource.find(:all)
|
13
15
|
arSrcs.each do |src|
|
14
|
-
@@mapSrc[src.name()] = src
|
16
|
+
@@mapSrc[src.name()] = src
|
17
|
+
@@mapSrcByIdx[src.source_id()] = src
|
15
18
|
end
|
16
19
|
end
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
+
|
21
|
+
mapDeleted = {}
|
22
|
+
db = ::Rho::RHO.get_user_db()
|
23
|
+
db.delete_all_from_table(filename)
|
24
|
+
db.start_transaction
|
20
25
|
|
21
26
|
first_row=true
|
22
27
|
prefix = dir_prefix.nil? ? "" : dir_prefix
|
28
|
+
cur_src = nil
|
29
|
+
hashItem = {}
|
30
|
+
cur_objid = nil
|
23
31
|
File.open(File.join(Rho::RhoFSConnector.get_base_app_path,'app',prefix,'fixtures',filename+'.txt')).each do |line|
|
24
32
|
if first_row
|
25
33
|
columns = line.chomp.split('|'); first_row = false; next;
|
@@ -29,15 +37,48 @@ module Rho
|
|
29
37
|
row = {}
|
30
38
|
columns.each_with_index do |col,idx|
|
31
39
|
if col == 'source_name'
|
32
|
-
row['source_id'] = @@mapSrc[parts[idx]]
|
40
|
+
row['source_id'] = @@mapSrc[parts[idx]].source_id()
|
33
41
|
else
|
34
42
|
row[col] = parts[idx]
|
35
43
|
end
|
36
44
|
end
|
37
|
-
|
45
|
+
|
46
|
+
if ( cur_objid != row['object'] )
|
47
|
+
if cur_src && hashItem && hashItem.length() > 0
|
48
|
+
|
49
|
+
if !mapDeleted[cur_src.name()]
|
50
|
+
db.delete_all_from_table(cur_src.name())
|
51
|
+
mapDeleted[cur_src.name()] = 1
|
52
|
+
end
|
53
|
+
|
54
|
+
hashItem['object'] = cur_objid
|
55
|
+
db.insert_into_table(cur_src.name(),hashItem)
|
56
|
+
end
|
57
|
+
|
58
|
+
hashItem = {}
|
59
|
+
cur_objid = row['object']
|
60
|
+
end
|
61
|
+
|
62
|
+
cur_src = @@mapSrcByIdx[ row['source_id'].to_i ]
|
63
|
+
if ( cur_src && cur_src.schema() )
|
64
|
+
hashItem[ row['attrib'] ] = row['value'] if row['value']
|
65
|
+
else
|
66
|
+
db.insert_into_table(filename,row)
|
67
|
+
end
|
38
68
|
end
|
39
69
|
|
40
|
-
|
70
|
+
if cur_src && hashItem && hashItem.length() > 0
|
71
|
+
|
72
|
+
if !mapDeleted[cur_src.name()]
|
73
|
+
db.delete_all_from_table(cur_src.name())
|
74
|
+
mapDeleted[cur_src.name()] = 1
|
75
|
+
end
|
76
|
+
|
77
|
+
hashItem['object'] = cur_objid
|
78
|
+
db.insert_into_table(cur_src.name(),hashItem)
|
79
|
+
end
|
80
|
+
|
81
|
+
db.commit
|
41
82
|
columns = []
|
42
83
|
end
|
43
84
|
end
|
@@ -45,9 +86,10 @@ module Rho
|
|
45
86
|
def self.load_offline_data_ex(tables=[], dir_prefix=nil, commit_count=100000)
|
46
87
|
columns = []
|
47
88
|
tables.each do |filename|
|
48
|
-
|
49
|
-
|
50
|
-
|
89
|
+
|
90
|
+
db = ::Rho::RHO.get_user_db()
|
91
|
+
db.destroy_table(filename)
|
92
|
+
db.start_transaction
|
51
93
|
|
52
94
|
row_index=0
|
53
95
|
prefix = dir_prefix.nil? ? "" : dir_prefix
|
@@ -69,22 +111,22 @@ module Rho
|
|
69
111
|
parts = line.chomp.split('|')
|
70
112
|
|
71
113
|
begin
|
72
|
-
|
114
|
+
db.execute_sql query, parts
|
73
115
|
rescue Exception => e
|
74
116
|
#puts "load_offline_data : exception insert data: #{e}; data : #{parts}; line : #{row_index}"
|
75
117
|
end
|
76
118
|
|
77
119
|
if row_index%commit_count == 0
|
78
120
|
puts "commit start"
|
79
|
-
|
80
|
-
|
121
|
+
db.commit
|
122
|
+
db.start_transaction
|
81
123
|
puts "commit : #{row_index}"
|
82
124
|
end
|
83
125
|
|
84
126
|
row_index += 1
|
85
127
|
end
|
86
128
|
|
87
|
-
|
129
|
+
db.commit
|
88
130
|
puts "commit : #{row_index}"
|
89
131
|
columns = []
|
90
132
|
end
|
@@ -102,6 +102,8 @@ module Rho
|
|
102
102
|
model = params[:controller] || params[:model] || @request['model']
|
103
103
|
action = params[:action].nil? ? nil : params[:action].to_s
|
104
104
|
id = params[:id].nil? ? nil : params[:id].to_s
|
105
|
+
id = "{#{id}}" if id and not ( id =~ /^{/ and id =~ /}$/ )
|
106
|
+
|
105
107
|
if params[:query_s]
|
106
108
|
query = params[:query_s]
|
107
109
|
else
|
data/lib/framework/rhodes.rb
CHANGED
data/lib/framework/rhom/rhom.rb
CHANGED
@@ -24,11 +24,9 @@ require 'rhom/rhom_object'
|
|
24
24
|
require 'rhom/rhom_db_adapter'
|
25
25
|
|
26
26
|
module Rhom
|
27
|
-
UPDATE_TYPES = ["'create'","'query'","'ask'"]
|
28
|
-
|
29
27
|
class RecordNotFound < StandardError
|
30
28
|
end
|
31
|
-
|
29
|
+
|
32
30
|
class Rhom
|
33
31
|
attr_accessor :factory
|
34
32
|
|
@@ -38,31 +36,60 @@ module Rhom
|
|
38
36
|
|
39
37
|
class << Rhom
|
40
38
|
def client_id
|
41
|
-
c_id = ::
|
39
|
+
c_id = ::Rho::RHO.get_user_db().select_from_table('client_info','client_id')[0]
|
42
40
|
c_id.nil? ? nil : c_id['client_id']
|
43
41
|
end
|
44
42
|
|
45
43
|
def database_full_reset
|
46
44
|
SyncEngine.stop_sync
|
47
45
|
|
48
|
-
::
|
49
|
-
::
|
46
|
+
::Rho::RHO.get_user_db().execute_sql("UPDATE client_info SET reset=1")
|
47
|
+
if ( Rho::RhoConfig.exists?('bulksync_state') )
|
48
|
+
Rho::RhoConfig.bulksync_state='0'
|
49
|
+
end
|
50
|
+
::Rho::RHO.get_user_db().execute_sql("UPDATE sources SET token=0")
|
50
51
|
|
51
|
-
::
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
# else
|
57
|
-
# ::Rhom::RhomDbAdapter.delete_all_from_table('object_values')
|
58
|
-
# ::Rhom::RhomDbAdapter.execute_sql("VACUUM")
|
59
|
-
# end
|
52
|
+
::Rho::RHO.get_db_partitions().each_value do |db|
|
53
|
+
db.destroy_tables(:exclude => ['sources','client_info'])
|
54
|
+
end
|
55
|
+
|
56
|
+
::Rho::RHO.init_schema_sources
|
60
57
|
end
|
61
58
|
|
62
59
|
def database_full_reset_and_logout
|
63
60
|
database_full_reset
|
64
61
|
SyncEngine.logout
|
65
62
|
end
|
63
|
+
|
64
|
+
def search(args)
|
65
|
+
searchParams = ""
|
66
|
+
|
67
|
+
searchParams += '&offset=' + Rho::RhoSupport.url_encode(args[:offset]) if args[:offset]
|
68
|
+
searchParams += '&max_results=' + Rho::RhoSupport.url_encode(args[:max_results]) if args[:max_results]
|
69
|
+
|
70
|
+
callbackParams = args[:callback_param] ? args[:callback_param] : ""
|
71
|
+
|
72
|
+
if args[:search_params]
|
73
|
+
args[:search_params].each do |key,value|
|
74
|
+
searchParams += '&' + "conditions[#{Rho::RhoSupport.url_encode(key)}]" + '=' + Rho::RhoSupport.url_encode(value)
|
75
|
+
callbackParams += '&' + "search_params[#{Rho::RhoSupport.url_encode(key)}]" + '=' + Rho::RhoSupport.url_encode(value)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
#set_notification(args[:callback], args[:callback_param]) if args[:callback]
|
80
|
+
src_ar = args[:sources]
|
81
|
+
|
82
|
+
#check sources
|
83
|
+
raise ArgumentError, "no sources on search" if src_ar.nil? or src_ar.length == 0
|
84
|
+
src_ar.each do |src_name|
|
85
|
+
raise ArgumentError, "no sources on search" if Rho::RhoConfig::sources[src_name].nil?
|
86
|
+
end
|
87
|
+
|
88
|
+
SyncEngine.dosearch_source(src_ar, args[:from] ? args[:from] : 'search',
|
89
|
+
searchParams, args[:sync_changes] ? args[:sync_changes] : false, args[:progress_step] ? args[:progress_step] : -1,
|
90
|
+
args[:callback], callbackParams )
|
91
|
+
end
|
92
|
+
|
66
93
|
end #class methods
|
67
94
|
end # Rhom
|
68
95
|
end # Rhom
|
@@ -20,90 +20,93 @@
|
|
20
20
|
require 'rhodes'
|
21
21
|
|
22
22
|
module Rhom
|
23
|
-
|
23
|
+
class RhomDbAdapter
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
class << self
|
25
|
+
@database = nil
|
28
26
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
# closes the database if and only if it is open
|
37
|
-
def close
|
38
|
-
if @@database
|
39
|
-
@@database.close
|
40
|
-
@@database = nil
|
41
|
-
else
|
42
|
-
return false
|
43
|
-
end
|
44
|
-
return true
|
45
|
-
end
|
27
|
+
# maintains a single database connection
|
28
|
+
def initialize(dbfile, partition)
|
29
|
+
unless @database
|
30
|
+
@database = SQLite3::Database.new(dbfile,partition)
|
31
|
+
end
|
32
|
+
end
|
46
33
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
34
|
+
# closes the database if and only if it is open
|
35
|
+
#def close
|
36
|
+
# if @database
|
37
|
+
# @database.close
|
38
|
+
# @database = nil
|
39
|
+
# else
|
40
|
+
# return false
|
41
|
+
# end
|
42
|
+
# return true
|
43
|
+
#end
|
44
|
+
|
45
|
+
def is_ui_waitfordb
|
46
|
+
@database.is_ui_waitfordb
|
47
|
+
end
|
48
|
+
|
49
|
+
def start_transaction
|
50
|
+
begin
|
51
|
+
@database.start_transaction
|
52
|
+
rescue Exception => e
|
53
|
+
puts "exception when start_transaction: #{e}"
|
54
|
+
raise
|
57
55
|
end
|
56
|
+
end
|
58
57
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
58
|
+
def commit
|
59
|
+
begin
|
60
|
+
@database.commit
|
61
|
+
rescue Exception => e
|
62
|
+
puts "exception when commit transaction : #{e}"
|
63
|
+
raise
|
65
64
|
end
|
65
|
+
end
|
66
66
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
67
|
+
def rollback
|
68
|
+
begin
|
69
|
+
@database.rollback
|
70
|
+
rescue Exception => e
|
71
|
+
puts "exception when rollback transaction : #{e}"
|
72
|
+
raise
|
73
73
|
end
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
74
|
+
end
|
75
|
+
|
76
|
+
# execute a sql statement
|
77
|
+
# optionally, disable the factory processing
|
78
|
+
# which returns the result array directly
|
79
|
+
def execute_sql(sql, *args)
|
80
|
+
_execute_sql(sql, false, args)
|
81
|
+
end
|
82
|
+
def execute_batch_sql(sql, *args)
|
83
|
+
_execute_sql(sql, true, args)
|
84
|
+
end
|
85
|
+
|
86
|
+
def _execute_sql(sql, is_batch, args)
|
87
|
+
result = []
|
88
|
+
if sql
|
89
|
+
#puts "RhomDbAdapter: Executing query - #{sql}"
|
90
|
+
begin
|
91
|
+
result = @database.execute( sql, is_batch, args )
|
92
|
+
rescue Exception => e
|
93
|
+
puts "exception when running query: #{e}"
|
94
|
+
raise
|
94
95
|
end
|
96
|
+
end
|
97
|
+
#puts "result is: #{result.inspect}"
|
98
|
+
result
|
99
|
+
end
|
95
100
|
|
101
|
+
class << self
|
96
102
|
# generates where clause based on hash
|
97
|
-
def where_str(condition
|
103
|
+
def where_str(condition)
|
98
104
|
where_str = ""
|
99
105
|
if condition
|
100
106
|
where_str += string_from_key_vals(condition,"and")
|
101
107
|
where_str = where_str[0..where_str.length - 5]
|
102
108
|
end
|
103
109
|
|
104
|
-
if select_arr and select_arr.length > 0
|
105
|
-
where_str += " and attrib in (#{select_str(select_arr)})"
|
106
|
-
end
|
107
110
|
where_str
|
108
111
|
end
|
109
112
|
|
@@ -152,100 +155,103 @@ module Rhom
|
|
152
155
|
"'#{s}'"
|
153
156
|
end
|
154
157
|
end
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
elsif table and columns
|
175
|
-
query = "select #{columns} from #{table}"
|
176
|
-
end
|
177
|
-
execute_sql query
|
178
|
-
end
|
179
|
-
|
180
|
-
# inserts a single row into the database
|
181
|
-
# takes the table name and values (hash) as arguments
|
182
|
-
# exmaple usage is the following:
|
183
|
-
# insert_into_table('object_values, {"source_id"=>1,"object"=>"some-object","update_type"=>'delete'})
|
184
|
-
# this would execute the following sql:
|
185
|
-
# insert into object_values (source_id,object,update_type) values (1,'some-object','delete');
|
186
|
-
def insert_into_table(table=nil,values=nil)
|
187
|
-
query = nil
|
188
|
-
cols = ""
|
189
|
-
vals = ""
|
190
|
-
if table and values
|
191
|
-
values.each do |key,val|
|
192
|
-
value = get_value_for_sql_stmt(val)+","
|
193
|
-
cols << "#{key},"
|
194
|
-
vals << value
|
195
|
-
end
|
196
|
-
cols = cols[0..cols.length - 2]
|
197
|
-
vals = vals[0..vals.length - 2]
|
198
|
-
query = "insert into #{table} (#{cols}) values (#{vals})"
|
199
|
-
end
|
200
|
-
execute_sql query
|
201
|
-
end
|
202
|
-
|
203
|
-
# deletes rows from a table which satisfy condition (hash)
|
204
|
-
# example usage is the following:
|
205
|
-
# delete_from_table('object_values',{"object"=>"some-object"})
|
206
|
-
# this would execute the following sql:
|
207
|
-
# delete from object_values where object="some-object"
|
208
|
-
def delete_from_table(table=nil,condition=nil)
|
209
|
-
query = nil
|
210
|
-
if table and condition
|
211
|
-
query = "delete from #{table} where #{where_str(condition)}"
|
212
|
-
end
|
213
|
-
execute_sql query
|
158
|
+
end #self
|
159
|
+
|
160
|
+
# support for select statements
|
161
|
+
# this function takes table name, columns (as a comma-separated list),
|
162
|
+
# condition (as a hash), and params (as a hash)
|
163
|
+
# example usage is the following:
|
164
|
+
# select_from_table('object_values', '*', {"source_id"=>2,"update_type"=>'query'},
|
165
|
+
# {"order by"=>'object'})
|
166
|
+
# this would return all columns where source_id = 2 and update_type = 'query' ordered
|
167
|
+
# by the "object" column
|
168
|
+
def select_from_table(table=nil,columns=nil,condition=nil,params=nil)
|
169
|
+
query = nil
|
170
|
+
if table and columns and condition
|
171
|
+
if params and params['distinct']
|
172
|
+
query = "select distinct #{columns} from #{table} where #{RhomDbAdapter.where_str(condition)}"
|
173
|
+
elsif params and params['order by']
|
174
|
+
query = "select #{columns} from #{table} where #{RhomDbAdapter.where_str(condition)} order by #{params['order by']}"
|
175
|
+
else
|
176
|
+
query = "select #{columns} from #{table} where #{RhomDbAdapter.where_str(condition)}"
|
214
177
|
end
|
178
|
+
elsif table and columns
|
179
|
+
query = "select #{columns} from #{table}"
|
180
|
+
end
|
215
181
|
|
216
|
-
|
217
|
-
|
218
|
-
query = nil
|
219
|
-
if table
|
220
|
-
query = "delete from #{table}"
|
221
|
-
end
|
222
|
-
execute_sql query
|
223
|
-
end
|
182
|
+
execute_sql query
|
183
|
+
end
|
224
184
|
|
225
|
-
|
226
|
-
|
227
|
-
|
185
|
+
# inserts a single row into the database
|
186
|
+
# takes the table name and values (hash) as arguments
|
187
|
+
# exmaple usage is the following:
|
188
|
+
# insert_into_table('object_values, {"source_id"=>1,"object"=>"some-object","update_type"=>'delete'})
|
189
|
+
# this would execute the following sql:
|
190
|
+
# insert into object_values (source_id,object,update_type) values (1,'some-object','delete');
|
191
|
+
def insert_into_table(table=nil,values=nil)
|
192
|
+
query = nil
|
193
|
+
cols = ""
|
194
|
+
vals = ""
|
195
|
+
if table and values
|
196
|
+
values.each do |key,val|
|
197
|
+
value = RhomDbAdapter.get_value_for_sql_stmt(val)+","
|
198
|
+
cols << "#{key},"
|
199
|
+
vals << value
|
228
200
|
end
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
def update_into_table(table=nil,values=nil,condition=nil)
|
236
|
-
query = nil
|
237
|
-
vals = values.nil? ? nil : vals_str(values)
|
238
|
-
if table and condition and vals
|
239
|
-
query = "update #{table} set #{vals} where #{where_str(condition)}"
|
240
|
-
elsif table and vals
|
241
|
-
query = "update #{table} set #{vals}"
|
242
|
-
end
|
243
|
-
execute_sql query
|
244
|
-
end
|
245
|
-
end # class methods
|
246
|
-
end # RhomDbAdapter
|
247
|
-
end # Rhom
|
201
|
+
cols = cols[0..cols.length - 2]
|
202
|
+
vals = vals[0..vals.length - 2]
|
203
|
+
query = "insert into #{table} (#{cols}) values (#{vals})"
|
204
|
+
end
|
205
|
+
execute_sql query
|
206
|
+
end
|
248
207
|
|
249
|
-
|
250
|
-
|
251
|
-
|
208
|
+
# deletes rows from a table which satisfy condition (hash)
|
209
|
+
# example usage is the following:
|
210
|
+
# delete_from_table('object_values',{"object"=>"some-object"})
|
211
|
+
# this would execute the following sql:
|
212
|
+
# delete from object_values where object="some-object"
|
213
|
+
def delete_from_table(table,condition)
|
214
|
+
execute_sql "delete from #{table} where #{RhomDbAdapter.where_str(condition)}"
|
215
|
+
end
|
216
|
+
|
217
|
+
# deletes all rows from a given table
|
218
|
+
def delete_all_from_table(table)
|
219
|
+
execute_sql "delete from #{table}"
|
220
|
+
end
|
221
|
+
|
222
|
+
def table_exist?(table_name)
|
223
|
+
@database.table_exist?(table_name)
|
224
|
+
end
|
225
|
+
|
226
|
+
def delete_table(table)
|
227
|
+
execute_sql "DROP TABLE IF EXISTS #{table}"
|
228
|
+
end
|
229
|
+
|
230
|
+
#destroy one table
|
231
|
+
def destroy_table(name)
|
232
|
+
destroy_tables(:include => [name])
|
233
|
+
end
|
234
|
+
|
235
|
+
# deletes all rows from all tables, except list of given tables by recreating db-file and save all other tables
|
236
|
+
# arguments - :include, :exclude
|
237
|
+
def destroy_tables(*args)
|
238
|
+
@database.destroy_tables args.first[:include], args.first[:exclude]
|
239
|
+
end
|
240
|
+
|
241
|
+
# updates values (hash) in a given table which satisfy condition (hash)
|
242
|
+
# example usage is the following:
|
243
|
+
# update_into_table('object_values',{"value"=>"Electronics"},{"object"=>"some-object", "attrib"=>"industry"})
|
244
|
+
# this executes the following sql:
|
245
|
+
# update table object_values set value='Electronics' where object='some-object' and attrib='industry';
|
246
|
+
def update_into_table(table=nil,values=nil,condition=nil)
|
247
|
+
query = nil
|
248
|
+
vals = values.nil? ? nil : RhomDbAdapter.vals_str(values)
|
249
|
+
if table and condition and vals
|
250
|
+
query = "update #{table} set #{vals} where #{RhomDbAdapter.where_str(condition)}"
|
251
|
+
elsif table and vals
|
252
|
+
query = "update #{table} set #{vals}"
|
253
|
+
end
|
254
|
+
execute_sql query
|
255
|
+
end
|
256
|
+
end # RhomDbAdapter
|
257
|
+
end # Rhom
|