rhodes 3.0.0 → 3.0.1.beta.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +4 -0
- data/Rakefile +9 -2
- data/doc/application.txt +1 -1
- data/doc/build.txt +49 -70
- data/doc/device-caps.txt +22 -97
- data/doc/extensions.txt +1 -1
- data/doc/nfc.txt +542 -0
- data/doc/rhom.txt +7 -5
- data/doc/simulator.txt +116 -0
- data/doc/ui.txt +1 -1
- data/lib/build/jake.rb +5 -5
- data/lib/extensions/debugger/debugger.rb +63 -35
- data/lib/extensions/nfc/ext/nfc/platform/android/AndroidManifest.xml +8 -6
- data/lib/extensions/nfc/ext/nfc/platform/android/jni/src/nfc.cpp +1070 -249
- data/lib/extensions/nfc/ext/nfc/platform/android/res/xml/filter_nfc.xml +1 -5
- data/lib/extensions/nfc/ext/nfc/platform/android/src/com/rhomobile/nfc/Nfc.java +894 -72
- data/lib/extensions/nfc/ext/nfc/platform/android/src/com/rhomobile/nfc/NfcActivity.java +82 -18
- data/lib/extensions/nfc/ext/nfc/platform/android/src/com/rhomobile/nfc/NfcMessage.java +65 -0
- data/lib/extensions/nfc/ext/nfc/platform/android/src/com/rhomobile/nfc/NfcRecord.java +88 -24
- data/lib/extensions/nfc/ext/nfc/platform/android/src/com/rhomobile/nfc/NfcTechActivity.java +3 -0
- data/lib/extensions/nfc/ext/nfc/shared/ruby/nfc.i +204 -3
- data/lib/extensions/nfc/ext/nfc/shared/ruby/nfc_wrap.c +1047 -5
- data/lib/extensions/nfc/nfc.rb +635 -91
- data/lib/extensions/rhoxml/rexml/encodings/CP-1252.rb +103 -0
- data/lib/extensions/rhoxml/rexml/encodings/ISO-8859-1.rb +7 -0
- data/lib/framework/dateME.rb +26 -0
- data/lib/framework/rho/render.rb +21 -9
- data/lib/framework/rho/rho.rb +12 -0
- data/lib/framework/rho/rhoevent_bb.rb +3 -0
- data/lib/framework/rho/rhoevent_c.rb +3 -0
- data/lib/framework/rhodes.rb +1 -1
- data/lib/framework/rhom/rhom_db_adapter.rb +9 -9
- data/lib/framework/rhosystem.rb +17 -0
- data/lib/framework/stringio.rb +18 -0
- data/lib/framework/version.rb +1 -1
- data/lib/rhodes.rb +1 -1
- data/platform/android/Rhodes/AndroidManifest.xml +2 -2
- data/platform/android/Rhodes/res/xml/filter_nfc.xml +1 -5
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/BaseActivity.java +0 -2
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/PushReceiver.java +10 -6
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhoCryptImpl.java +29 -18
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivity.java +67 -12
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesActivityListener.java +14 -0
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesApplication.java +102 -28
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/RhodesService.java +35 -66
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/WebView.java +5 -5
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/alert/Alert.java +69 -41
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/alert/PopupActivity.java +7 -5
- data/platform/android/Rhodes/src/com/rhomobile/rhodes/util/PerformOnUiThread.java +68 -35
- data/platform/android/build/RhodesSRC_build.files +1 -0
- data/platform/android/build/android.rake +2 -2
- data/platform/bb/RubyVM/src/com/rho/RhoConf.java +1 -0
- data/platform/bb/RubyVM/src/com/rho/db/DBAdapter.java +18 -6
- data/platform/bb/build/bb.rake +1 -1
- data/platform/bb/rhodes/src/rhomobile/RhodesApplication.java +5 -4
- data/platform/iphone/Classes/SimpleMainView.m +1 -1
- data/platform/iphone/Info.plist +1 -1
- data/platform/shared/common/RhodesApp.cpp +9 -3
- data/platform/shared/curl/lib/rhossl.c +5 -2
- data/platform/shared/db/DBAdapter.cpp +9 -0
- data/platform/shared/net/CURLNetRequest.cpp +8 -3
- data/platform/shared/net/iphone/sslimpl.cpp +3 -2
- data/platform/shared/net/ssl.cpp +8 -0
- data/platform/shared/ruby/ext/rho/rhoruby.c +10 -0
- data/platform/shared/ruby/ext/rho/rhoruby.h +1 -0
- data/platform/shared/ruby/ext/sqlite3_api/sqlite3_api_wrap.c +3 -4
- data/platform/win32/RhoSimulator/QtCore4.dll +0 -0
- data/platform/win32/RhoSimulator/QtGui4.dll +0 -0
- data/platform/win32/RhoSimulator/QtNetwork4.dll +0 -0
- data/platform/win32/RhoSimulator/QtWebKit4.dll +0 -0
- data/platform/win32/RhoSimulator/RhoSimulator.exe +0 -0
- data/platform/win32/RhoSimulator/imageformats/qgif4.dll +0 -0
- data/platform/win32/RhoSimulator/imageformats/qico4.dll +0 -0
- data/platform/win32/RhoSimulator/imageformats/qjpeg4.dll +0 -0
- data/platform/win32/RhoSimulator/imageformats/qmng4.dll +0 -0
- data/platform/win32/RhoSimulator/imageformats/qsvg4.dll +0 -0
- data/platform/win32/RhoSimulator/imageformats/qtiff4.dll +0 -0
- data/platform/win32/RhoSimulator/libeay32.dll +0 -0
- data/platform/win32/RhoSimulator/ssleay32.dll +0 -0
- data/platform/wm/build/wm.rake +27 -3
- data/platform/wm/rhodes/Rhodes.cpp +4 -0
- data/platform/wm/rhodes/emulator/MainWindowCallback.h +1 -0
- data/platform/wm/rhodes/emulator/MainWindowProxy.cpp +3 -1
- data/platform/wm/rhodes/emulator/MainWindowQt.cpp +23 -12
- data/platform/wm/rhodes/emulator/MainWindowQt.h +5 -1
- data/platform/wm/rhodes/emulator/QtMainWindow.cpp +39 -6
- data/platform/wm/rhodes/emulator/QtMainWindow.h +1 -1
- data/platform/wm/rhodes/rho/rubyext/SystemImpl.cpp +5 -0
- data/platform/wp7/IronRuby/{Bin → bin}/Silverlight3Release/IronRuby.Libraries.dll +0 -0
- data/platform/wp7/IronRuby/{Bin → bin}/Silverlight3Release/IronRuby.dll +0 -0
- data/platform/wp7/IronRuby/bin/Silverlight3Release/Microsoft.Dynamic.dll +0 -0
- data/platform/wp7/IronRuby/{Bin → bin}/Silverlight3Release/Microsoft.Scripting.Core.dll +0 -0
- data/platform/wp7/IronRuby/{Bin → bin}/Silverlight3Release/Microsoft.Scripting.dll +0 -0
- data/platform/wp7/RhoAppRunner/Program.cs +2 -2
- data/platform/wp7/RhoRubyLib/RhoRuby.cs +8 -0
- data/platform/wp7/RhoRubyLib/common/RhodesApp.cs +29 -7
- data/platform/wp7/RhoRubyLib/db/DBAdapter.cs +5 -2
- data/platform/wp7/RhoRubyLib/logging/RhoLogger.cs +12 -0
- data/platform/wp7/RhoRubyLib/net/HttpServer.cs +2 -0
- data/platform/wp7/RhoRubyLib/net/NetRequest.cs +1 -1
- data/platform/wp7/RhoRubyLib/rubyext/RhoAsyncHttp.cs +52 -7
- data/platform/wp7/RhoRubyLib/rubyext/RhoDatabase.cs +85 -18
- data/platform/wp7/RhoRubyLib/rubyext/RhoJSON.cs +38 -3
- data/platform/wp7/RhoRubyLib/rubyext/RhoKernelOps.cs +27 -2
- data/platform/wp7/RhoRubyLib/rubyext/RhoNativeBar.cs +111 -15
- data/platform/wp7/RhoRubyLib/rubyext/RhoSyncEngine.cs +330 -55
- data/platform/wp7/RhoRubyLib/rubyext/RhoWebView.cs +61 -4
- data/platform/wp7/build/wp.rake +89 -72
- data/platform/wp7/rhodes/App.xaml.cs +1 -1
- data/rakefile.rb +9 -2
- data/rhodes.gemspec +1 -3
- data/spec/phone_spec/app/spec/asynchttp_spec.rb +7 -9
- data/spec/phone_spec/app/spec/uri_spec.rb +75 -0
- data/spec/phone_spec/app/spec_runner.rb +4 -0
- metadata +21 -15
- data/Manifest.txt +0 -6403
- data/platform/win32/RhoSimulator/codecs/qcncodecs4.dll +0 -0
- data/platform/win32/RhoSimulator/codecs/qjpcodecs4.dll +0 -0
- data/platform/win32/RhoSimulator/codecs/qkrcodecs4.dll +0 -0
- data/platform/win32/RhoSimulator/codecs/qtwcodecs4.dll +0 -0
- data/platform/wp7/IronRuby/Bin/Silverlight3Release/Microsoft.Dynamic.dll +0 -0
@@ -389,6 +389,11 @@ int rho_sysimpl_get_property(char* szPropName, VALUE* resValue)
|
|
389
389
|
return 1;
|
390
390
|
}
|
391
391
|
|
392
|
+
#ifdef RHODES_EMULATOR
|
393
|
+
if (strcasecmp("main_window_closed",szPropName) == 0)
|
394
|
+
{*resValue = rho_ruby_create_boolean(CMainWindow::mainWindowClosed); return 1;}
|
395
|
+
#endif
|
396
|
+
|
392
397
|
if (strcasecmp("has_camera",szPropName) == 0)
|
393
398
|
{*resValue = rho_ruby_create_boolean(has_camera()); return 1;}
|
394
399
|
|
Binary file
|
Binary file
|
Binary file
|
File without changes
|
File without changes
|
@@ -23,9 +23,9 @@ namespace RhoAppRunner
|
|
23
23
|
useEmulator = false;
|
24
24
|
|
25
25
|
if (useEmulator)
|
26
|
-
WP7Device = WP7SDK.GetDevices().
|
26
|
+
WP7Device = WP7SDK.GetDevices().First(d => d.Name.StartsWith("Windows Phone 7 Emulator"));
|
27
27
|
else
|
28
|
-
WP7Device = WP7SDK.GetDevices().
|
28
|
+
WP7Device = WP7SDK.GetDevices().First(d => d.Name.StartsWith("Windows Phone 7 Device"));
|
29
29
|
|
30
30
|
Console.WriteLine("Connecting to Windows Phone 7 Emulator/Device...");
|
31
31
|
WP7Device.Connect();
|
@@ -28,6 +28,7 @@ namespace rho
|
|
28
28
|
private ScriptRuntime m_runtime;
|
29
29
|
private ScriptEngine m_engine;
|
30
30
|
RubyContext m_context;
|
31
|
+
public RubyContext rubyContext { get { return m_context; } }
|
31
32
|
private object m_rhoframework;
|
32
33
|
|
33
34
|
public WebBrowser WebBrowser{ get { return m_webBrowser; } }
|
@@ -175,6 +176,8 @@ namespace rho
|
|
175
176
|
//m_engine.Execute("def test; while false; end; end; test();");
|
176
177
|
//m_engine.Execute("class RecordNotFound < StandardError;end; raise RecordNotFound;");
|
177
178
|
//m_engine.Execute("test = {}; test.__id__;");
|
179
|
+
//m_engine.Execute("module GeoLocation; end; def test; begin; eval(\"GeoLocation.non_exist_method();\"); rescue Exception => e; puts \"exc: #{e}\"; end; end; test();");
|
180
|
+
//m_engine.Execute("module GeoLocation; end; def test; GeoLocation.non_exist_method(); 123; end; begin; res = {}; res['a'] = test(); rescue Exception => e; puts \"exc: #{e}\"; end;");
|
178
181
|
|
179
182
|
StreamResourceInfo sr = Application.GetResourceStream(new Uri("lib/rhoframework.rb", UriKind.Relative));
|
180
183
|
|
@@ -200,6 +203,11 @@ namespace rho
|
|
200
203
|
m_engine.Operations.InvokeMember(m_rhoframework, "ui_created");
|
201
204
|
}
|
202
205
|
|
206
|
+
public void callUIDestroyed()
|
207
|
+
{
|
208
|
+
m_engine.Operations.InvokeMember(m_rhoframework, "ui_destroyed");
|
209
|
+
}
|
210
|
+
|
203
211
|
public void Stop()
|
204
212
|
{
|
205
213
|
m_runtime.Shutdown();
|
@@ -35,6 +35,7 @@ namespace rho.common
|
|
35
35
|
String[] m_currentUrls = new String[5];
|
36
36
|
private String m_strBlobsDirPath, m_strDBDirPath;
|
37
37
|
private String m_strHomeUrl;
|
38
|
+
private String m_strAppBackUrl;
|
38
39
|
ManualResetEvent m_UIWaitEvent = new ManualResetEvent(false);
|
39
40
|
Vector<Object> m_arCallbackObjects = new Vector<Object>();
|
40
41
|
|
@@ -87,19 +88,26 @@ namespace rho.common
|
|
87
88
|
RHOCONF().conflictsResolved();
|
88
89
|
}
|
89
90
|
|
91
|
+
public void closeApp()
|
92
|
+
{
|
93
|
+
m_httpServer.stop(10);
|
94
|
+
|
95
|
+
RhoLogger.close();
|
96
|
+
m_UIWaitEvent.Close();
|
97
|
+
}
|
98
|
+
|
90
99
|
public void stopApp()
|
91
100
|
{
|
92
|
-
string[] ar1 = CRhoFile.enumDirectory("db");
|
101
|
+
//string[] ar1 = CRhoFile.enumDirectory("db");
|
102
|
+
|
103
|
+
RhoRuby.callUIDestroyed();
|
93
104
|
|
94
|
-
RhoRuby.Stop();
|
95
105
|
SyncThread.getInstance().Destroy();
|
96
|
-
m_httpServer.stop(2);
|
97
106
|
CAsyncHttp.Destroy();
|
98
107
|
|
99
|
-
|
100
|
-
m_UIWaitEvent.Close();
|
108
|
+
RhoRuby.Stop();
|
101
109
|
|
102
|
-
string[] ar2 = CRhoFile.enumDirectory("db");
|
110
|
+
//string[] ar2 = CRhoFile.enumDirectory("db");
|
103
111
|
//int i = 0;
|
104
112
|
//net::CAsyncHttp::Destroy();
|
105
113
|
}
|
@@ -298,7 +306,10 @@ namespace rho.common
|
|
298
306
|
if (m_appMainPage.ApplicationBar == null)
|
299
307
|
createEmptyToolBar();
|
300
308
|
else
|
309
|
+
{
|
301
310
|
m_appMainPage.ApplicationBar.MenuItems.Clear();
|
311
|
+
setAppBackUrl("");
|
312
|
+
}
|
302
313
|
|
303
314
|
m_menuItems = menuItems;
|
304
315
|
|
@@ -314,6 +325,8 @@ namespace rho.common
|
|
314
325
|
|
315
326
|
if (action == "close") continue;
|
316
327
|
|
328
|
+
if (item.Text.toLowerCase() == "back" && action.toLowerCase() != "back") setAppBackUrl(action);
|
329
|
+
|
317
330
|
item.Click += delegate(object sender, EventArgs e) { processToolBarCommand(sender, e, action); };
|
318
331
|
|
319
332
|
m_appMainPage.ApplicationBar.MenuItems.Add(item);
|
@@ -327,6 +340,7 @@ namespace rho.common
|
|
327
340
|
m_appMainPage.ApplicationBar.IsMenuEnabled = true;
|
328
341
|
m_appMainPage.ApplicationBar.IsVisible = true;
|
329
342
|
m_appMainPage.ApplicationBar.Opacity = 1.0;
|
343
|
+
setAppBackUrl("");
|
330
344
|
}
|
331
345
|
|
332
346
|
public void createToolBar(int barType, Object barParams)
|
@@ -406,7 +420,9 @@ namespace rho.common
|
|
406
420
|
boolean callback = false;
|
407
421
|
if (strAction == "back")
|
408
422
|
{
|
409
|
-
if (
|
423
|
+
if (m_strAppBackUrl.length() > 0)
|
424
|
+
processToolBarCommand(this, e, m_strAppBackUrl);
|
425
|
+
else if (m_backHistory.Count > 0)
|
410
426
|
{
|
411
427
|
Uri destination = m_backHistory.Peek();
|
412
428
|
m_webBrowser.Navigate(destination);
|
@@ -500,5 +516,11 @@ namespace rho.common
|
|
500
516
|
m_arCallbackObjects[nIndex] = null;
|
501
517
|
return res;
|
502
518
|
}
|
519
|
+
|
520
|
+
public void setAppBackUrl(String url)
|
521
|
+
{
|
522
|
+
m_strAppBackUrl = url;
|
523
|
+
m_backHistory.Clear();
|
524
|
+
}
|
503
525
|
}
|
504
526
|
}
|
@@ -89,8 +89,11 @@ namespace rho.db
|
|
89
89
|
public void close()
|
90
90
|
{
|
91
91
|
try{
|
92
|
-
|
93
|
-
|
92
|
+
if (m_dbStorage != null)
|
93
|
+
{
|
94
|
+
m_dbStorage.close();
|
95
|
+
m_dbStorage = null;
|
96
|
+
}
|
94
97
|
}catch(Exception exc)
|
95
98
|
{
|
96
99
|
LOG.ERROR("DB close failed.", exc);
|
@@ -1,5 +1,7 @@
|
|
1
1
|
using System;
|
2
2
|
using rho.logging;
|
3
|
+
using IronRuby.Runtime;
|
4
|
+
using IronRuby.Builtins;
|
3
5
|
|
4
6
|
namespace rho.common
|
5
7
|
{
|
@@ -290,6 +292,16 @@ namespace rho.common
|
|
290
292
|
getLogConf().clearLog();
|
291
293
|
}
|
292
294
|
}
|
295
|
+
|
296
|
+
public void HandleRubyException(Exception ex, Exception rubyEx, String message)
|
297
|
+
{
|
298
|
+
if (rubyEx == null)
|
299
|
+
{
|
300
|
+
rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
|
301
|
+
}
|
302
|
+
logMessage(L_ERROR, message);
|
303
|
+
throw rubyEx;
|
304
|
+
}
|
293
305
|
|
294
306
|
public static void InitRhoLog()
|
295
307
|
{
|
@@ -3,6 +3,7 @@ using Microsoft.Scripting.Runtime;
|
|
3
3
|
using IronRuby.Runtime;
|
4
4
|
using IronRuby.Builtins;
|
5
5
|
using System;
|
6
|
+
using System.Collections.Generic;
|
6
7
|
using System.Runtime.InteropServices;
|
7
8
|
using rho.common;
|
8
9
|
using rho.net;
|
@@ -18,6 +19,9 @@ namespace rho.rubyext
|
|
18
19
|
|
19
20
|
#region Private Implementation Details
|
20
21
|
|
22
|
+
private static RhoLogger LOG = RhoLogger.RHO_STRIP_LOG ? new RhoEmptyLogger() :
|
23
|
+
new RhoLogger("RhoAsyncHttp");
|
24
|
+
|
21
25
|
#endregion
|
22
26
|
|
23
27
|
#region Private Instance & Singleton Methods
|
@@ -25,23 +29,64 @@ namespace rho.rubyext
|
|
25
29
|
[RubyMethodAttribute("cancel", RubyMethodAttributes.PublicSingleton)]
|
26
30
|
public static void Cancel(RubyModule/*!*/ self, [NotNull]String cancelCallback)
|
27
31
|
{
|
28
|
-
|
29
|
-
|
32
|
+
try
|
33
|
+
{
|
34
|
+
if (CAsyncHttp.getInstance() != null)
|
35
|
+
CAsyncHttp.getInstance().cancelRequest(cancelCallback);
|
36
|
+
}
|
37
|
+
catch (Exception ex)
|
38
|
+
{
|
39
|
+
Exception rubyEx = self.Context.CurrentException;
|
40
|
+
if (rubyEx == null)
|
41
|
+
{
|
42
|
+
rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
|
43
|
+
}
|
44
|
+
LOG.ERROR("cancel", ex);
|
45
|
+
throw rubyEx;
|
46
|
+
}
|
30
47
|
}
|
31
48
|
|
32
49
|
[RubyMethodAttribute("cancel", RubyMethodAttributes.PublicSingleton)]
|
33
50
|
public static void Cancel(RubyModule/*!*/ self)
|
34
51
|
{
|
35
|
-
|
36
|
-
|
52
|
+
try
|
53
|
+
{
|
54
|
+
if (CAsyncHttp.getInstance() != null)
|
55
|
+
CAsyncHttp.getInstance().cancelRequest("*");
|
56
|
+
}
|
57
|
+
catch (Exception ex)
|
58
|
+
{
|
59
|
+
Exception rubyEx = self.Context.CurrentException;
|
60
|
+
if (rubyEx == null)
|
61
|
+
{
|
62
|
+
rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
|
63
|
+
}
|
64
|
+
LOG.ERROR("cancel", ex);
|
65
|
+
throw rubyEx;
|
66
|
+
}
|
37
67
|
}
|
38
68
|
|
39
69
|
[RubyMethodAttribute("do_request", RubyMethodAttributes.PublicSingleton)]
|
40
70
|
public static MutableString doRequest(RubyModule/*!*/ self, [NotNull]String command, Hash args)
|
41
71
|
{
|
42
|
-
|
43
|
-
|
44
|
-
|
72
|
+
MutableString res = null;
|
73
|
+
try
|
74
|
+
{
|
75
|
+
CAsyncHttp.Create();
|
76
|
+
RhoParams p = new RhoParams(args);
|
77
|
+
res = CAsyncHttp.getInstance().addHttpCommand(new CAsyncHttp.HttpCommand(command, p));
|
78
|
+
}
|
79
|
+
catch (Exception ex)
|
80
|
+
{
|
81
|
+
Exception rubyEx = self.Context.CurrentException;
|
82
|
+
if (rubyEx == null)
|
83
|
+
{
|
84
|
+
rubyEx = RubyExceptionData.InitializeException(new RuntimeError(ex.Message.ToString()), ex.Message);
|
85
|
+
}
|
86
|
+
LOG.ERROR("do_request", ex);
|
87
|
+
throw rubyEx;
|
88
|
+
}
|
89
|
+
return res;
|
45
90
|
}
|
46
91
|
|
47
92
|
#endregion
|
@@ -17,6 +17,9 @@ namespace rho.rubyext
|
|
17
17
|
{
|
18
18
|
static CRhoRuby RhoRuby { get { return CRhoRuby.Instance; } }
|
19
19
|
|
20
|
+
static RhoLogger LOG = RhoLogger.RHO_STRIP_LOG ? new RhoEmptyLogger() :
|
21
|
+
new RhoLogger("RhoDatabase");
|
22
|
+
|
20
23
|
DBAdapter m_db;
|
21
24
|
RhoDatabase() { }
|
22
25
|
|
@@ -39,27 +42,43 @@ namespace rho.rubyext
|
|
39
42
|
[RubyMethod("close")]
|
40
43
|
public static void Close(RhoDatabase/*!*/ self)
|
41
44
|
{
|
42
|
-
|
45
|
+
try
|
46
|
+
{
|
47
|
+
self.m_db.close();
|
48
|
+
}
|
49
|
+
catch (Exception ex)
|
50
|
+
{
|
51
|
+
LOG.HandleRubyException(ex, RhoRuby.rubyContext.CurrentException, "close");
|
52
|
+
}
|
43
53
|
}
|
44
54
|
|
45
55
|
[RubyMethod("commit")]
|
46
56
|
public static void Commit(RhoDatabase/*!*/ self)
|
47
57
|
{
|
48
|
-
|
49
|
-
|
58
|
+
try
|
59
|
+
{
|
60
|
+
self.m_db.commit();
|
61
|
+
}
|
62
|
+
catch (Exception ex)
|
63
|
+
{
|
64
|
+
LOG.HandleRubyException(ex, RhoRuby.rubyContext.CurrentException, "commit");
|
65
|
+
}
|
50
66
|
}
|
51
67
|
|
52
68
|
[RubyMethod("destroy_tables")]
|
53
69
|
public static void destroyTables(RhoDatabase/*!*/ self, RubyArray arInclude, RubyArray arExclude)
|
54
70
|
{
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
//throw (e instanceof RubyException ? (RubyException)e : new RubyException(e.getMessage()));
|
61
|
-
//TODO: threw ruby exception
|
71
|
+
try
|
72
|
+
{
|
73
|
+
Vector<String> vecIncludes = RhoRuby.makeVectorStringFromArray(arInclude);
|
74
|
+
Vector<String> vecExcludes = RhoRuby.makeVectorStringFromArray(arExclude);
|
62
75
|
|
76
|
+
self.m_db.rb_destroy_tables(vecIncludes, vecExcludes);
|
77
|
+
}
|
78
|
+
catch (Exception ex)
|
79
|
+
{
|
80
|
+
LOG.HandleRubyException(ex, RhoRuby.rubyContext.CurrentException, "destroy_tables");
|
81
|
+
}
|
63
82
|
}
|
64
83
|
|
65
84
|
[RubyMethod("execute")]
|
@@ -117,45 +136,93 @@ namespace rho.rubyext
|
|
117
136
|
return retArr;
|
118
137
|
}catch (Exception exc)
|
119
138
|
{
|
120
|
-
|
121
|
-
|
139
|
+
LOG.HandleRubyException(exc, RhoRuby.rubyContext.CurrentException, "execute");
|
140
|
+
return null;
|
122
141
|
}
|
123
142
|
}
|
124
143
|
|
125
144
|
[RubyMethod("is_ui_waitfordb")]
|
126
145
|
public static Boolean isUiWaitForDb(RhoDatabase/*!*/ self)
|
127
146
|
{
|
128
|
-
|
147
|
+
Boolean res = false;
|
148
|
+
try
|
149
|
+
{
|
150
|
+
res = self.m_db.isUIWaitDB();
|
151
|
+
}
|
152
|
+
catch (Exception ex)
|
153
|
+
{
|
154
|
+
LOG.HandleRubyException(ex, RhoRuby.rubyContext.CurrentException, "is_ui_waitfordb");
|
155
|
+
}
|
156
|
+
|
157
|
+
return res;
|
129
158
|
}
|
130
159
|
|
131
160
|
[RubyMethod("lock_db")]
|
132
161
|
public static void Lock(RhoDatabase/*!*/ self)
|
133
162
|
{
|
134
|
-
|
163
|
+
try
|
164
|
+
{
|
165
|
+
self.m_db.Lock();
|
166
|
+
}
|
167
|
+
catch (Exception ex)
|
168
|
+
{
|
169
|
+
LOG.HandleRubyException(ex, RhoRuby.rubyContext.CurrentException, "lock_db");
|
170
|
+
}
|
135
171
|
}
|
136
172
|
|
137
173
|
[RubyMethod("rollback")]
|
138
174
|
public static void Rollback(RhoDatabase/*!*/ self)
|
139
175
|
{
|
140
|
-
|
176
|
+
try
|
177
|
+
{
|
178
|
+
self.m_db.rollback();
|
179
|
+
}
|
180
|
+
catch (Exception ex)
|
181
|
+
{
|
182
|
+
LOG.HandleRubyException(ex, RhoRuby.rubyContext.CurrentException, "rollback");
|
183
|
+
}
|
141
184
|
}
|
142
185
|
|
143
186
|
[RubyMethod("start_transaction")]
|
144
187
|
public static void startTransaction(RhoDatabase/*!*/ self)
|
145
188
|
{
|
146
|
-
|
189
|
+
try
|
190
|
+
{
|
191
|
+
self.m_db.startTransaction();
|
192
|
+
}
|
193
|
+
catch (Exception ex)
|
194
|
+
{
|
195
|
+
LOG.HandleRubyException(ex, RhoRuby.rubyContext.CurrentException, "start_transaction");
|
196
|
+
}
|
147
197
|
}
|
148
198
|
|
149
199
|
[RubyMethod("table_exist?")]
|
150
200
|
public static Boolean isTableExist(RhoDatabase/*!*/ self, MutableString/*!*/ tblName)
|
151
201
|
{
|
152
|
-
|
202
|
+
Boolean res = false;
|
203
|
+
try
|
204
|
+
{
|
205
|
+
res = self.m_db.isTableExist(tblName.ToString());
|
206
|
+
}
|
207
|
+
catch (Exception ex)
|
208
|
+
{
|
209
|
+
LOG.HandleRubyException(ex, RhoRuby.rubyContext.CurrentException, "table_exist?");
|
210
|
+
}
|
211
|
+
|
212
|
+
return res;
|
153
213
|
}
|
154
214
|
|
155
215
|
[RubyMethod("unlock_db")]
|
156
216
|
public static void Unlock(RhoDatabase/*!*/ self)
|
157
217
|
{
|
158
|
-
|
218
|
+
try
|
219
|
+
{
|
220
|
+
self.m_db.Unlock();
|
221
|
+
}
|
222
|
+
catch (Exception ex)
|
223
|
+
{
|
224
|
+
LOG.HandleRubyException(ex, RhoRuby.rubyContext.CurrentException, "unlock_db");
|
225
|
+
}
|
159
226
|
}
|
160
227
|
|
161
228
|
#endregion
|