openbase 0.8.1 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +9 -0
- data/ext/Headers/platform.h +6 -2
- data/ext/NetClient.c +0 -6
- data/ext/openbase.c +45 -4
- data/lib/ruby-openbase/version.rb +1 -1
- data/test/test_helper.rb +1 -1
- data/test/test_openbase.rb +25 -7
- data/website/index.html +1 -1
- metadata +2 -2
data/History.txt
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
=== 0.8.2
|
2
|
+
|
3
|
+
* Added new class level administrative functions to the OpenBase class object
|
4
|
+
* OpenBase#new_database(host, database_name, host_password)
|
5
|
+
* OpenBase#delete_database(host, database_name, host_password)
|
6
|
+
* OpenBase#start_database(host, database_name, host_password)
|
7
|
+
* OpenBase#stop_database(host, database_name, host_password)
|
8
|
+
|
9
|
+
|
1
10
|
=== 0.8.1
|
2
11
|
|
3
12
|
* Converted the project to a rubygem using hoe & newgem
|
data/ext/Headers/platform.h
CHANGED
@@ -4,8 +4,12 @@
|
|
4
4
|
// All rights reserved.
|
5
5
|
//
|
6
6
|
// ------------------------------------------------------------------------------
|
7
|
-
#
|
8
|
-
#define
|
7
|
+
#ifndef YES
|
8
|
+
#define YES 1
|
9
|
+
#endif
|
10
|
+
#ifndef NO
|
11
|
+
#define NO 0
|
12
|
+
#endif
|
9
13
|
|
10
14
|
#ifndef MOSUNIX
|
11
15
|
#define MOSX_UNIX 1
|
data/ext/NetClient.c
CHANGED
data/ext/openbase.c
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
#include <OpenBaseConnection.h>
|
3
3
|
#include <CommAPI.h>
|
4
4
|
#include <NetClient.h>
|
5
|
+
#include <OpenBaseAdmin.h>
|
5
6
|
#include <stdio.h>
|
6
7
|
|
7
8
|
// Ruby Classes Declared by this Library
|
@@ -401,6 +402,41 @@ static VALUE openbase_fetch_blob( VALUE self, VALUE blob_key )
|
|
401
402
|
/* End OpenBase Query & Transaction Methods */
|
402
403
|
|
403
404
|
|
405
|
+
/*** OpenBase: Class level server administration functions ***/
|
406
|
+
static VALUE openbase_new_database( VALUE self, VALUE host, VALUE database_name, VALUE password )
|
407
|
+
{
|
408
|
+
OpenBaseAdminConnection* conn = oba_newAdminConnection(RSTRING(host)->ptr);
|
409
|
+
int result = oba_newDatabase(conn,RSTRING(database_name)->ptr,RSTRING(password)->ptr);
|
410
|
+
oba_deallocAdminConnection(conn);
|
411
|
+
return result ? Qtrue : Qfalse;
|
412
|
+
}
|
413
|
+
|
414
|
+
static VALUE openbase_delete_database( VALUE self, VALUE host, VALUE database_name, VALUE password )
|
415
|
+
{
|
416
|
+
OpenBaseAdminConnection* conn = oba_newAdminConnection(RSTRING(host)->ptr);
|
417
|
+
int result = oba_deleteDatabase(conn,RSTRING(database_name)->ptr,RSTRING(password)->ptr);
|
418
|
+
oba_deallocAdminConnection(conn);
|
419
|
+
return result ? Qtrue : Qfalse;
|
420
|
+
}
|
421
|
+
|
422
|
+
static VALUE openbase_start_database( VALUE self, VALUE host, VALUE database_name, VALUE password )
|
423
|
+
{
|
424
|
+
OpenBaseAdminConnection* conn = oba_newAdminConnection(RSTRING(host)->ptr);
|
425
|
+
int result = oba_startDatabase(conn,RSTRING(database_name)->ptr,RSTRING(password)->ptr);
|
426
|
+
oba_deallocAdminConnection(conn);
|
427
|
+
return result ? Qtrue : Qfalse;
|
428
|
+
}
|
429
|
+
|
430
|
+
static VALUE openbase_stop_database( VALUE self, VALUE host, VALUE database_name, VALUE password )
|
431
|
+
{
|
432
|
+
OpenBaseAdminConnection* conn = oba_newAdminConnection(RSTRING(host)->ptr);
|
433
|
+
int result = oba_stopDatabase(conn,RSTRING(database_name)->ptr,RSTRING(password)->ptr);
|
434
|
+
oba_deallocAdminConnection(conn);
|
435
|
+
return result ? Qtrue : Qfalse;
|
436
|
+
}
|
437
|
+
/* END OpenBase class level server administration functions */
|
438
|
+
|
439
|
+
|
404
440
|
/*** OpenBaseResult: Construction/Destruction ***/
|
405
441
|
|
406
442
|
static void result_mark( OpenBaseResult *result )
|
@@ -891,11 +927,10 @@ static VALUE columninfo_table( VALUE self )
|
|
891
927
|
//typedef VALUE (ruby_method)(...);
|
892
928
|
//#define CALLBACK(method_name) (ruby_method*)&method_name
|
893
929
|
#define CALLBACK(method_name) method_name
|
894
|
-
|
930
|
+
#define VARIABLE_C_ARRAY -1
|
931
|
+
#define VARIABLE_RB_ARRAY -2
|
895
932
|
void Init_openbase() {
|
896
|
-
|
897
|
-
const int VARIABLE_RB_ARRAY = -2;
|
898
|
-
|
933
|
+
|
899
934
|
rb_gsub_bang_id = rb_intern("gsub!");
|
900
935
|
rb_date_regex = rb_reg_new("\\.",2,0);
|
901
936
|
rb_replacement_str = rb_str_new("-",1);
|
@@ -915,6 +950,12 @@ void Init_openbase() {
|
|
915
950
|
rb_define_alloc_func(rb_cOpenBase, openbase_alloc);
|
916
951
|
rb_define_method(rb_cOpenBase, "initialize", CALLBACK(openbase_initialize), VARIABLE_C_ARRAY);
|
917
952
|
|
953
|
+
// OpenBase: Class Level Server Administration Functions
|
954
|
+
rb_define_singleton_method(rb_cOpenBase, "new_database", CALLBACK(openbase_new_database),3);
|
955
|
+
rb_define_singleton_method(rb_cOpenBase, "delete_database", CALLBACK(openbase_delete_database),3);
|
956
|
+
rb_define_singleton_method(rb_cOpenBase, "start_database", CALLBACK(openbase_start_database),3);
|
957
|
+
rb_define_singleton_method(rb_cOpenBase, "stop_database", CALLBACK(openbase_stop_database),3);
|
958
|
+
|
918
959
|
// OpenBase: Connection Related Methods
|
919
960
|
rb_define_method(rb_cOpenBase, "connect", CALLBACK(openbase_connect), VARIABLE_C_ARRAY);
|
920
961
|
rb_define_method(rb_cOpenBase, "connected?", CALLBACK(openbase_isConnected), 0);
|
data/test/test_helper.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
require 'test/unit'
|
2
|
-
require File.dirname(__FILE__) + '/../
|
2
|
+
require File.dirname(__FILE__) + '/../ext/openbase'
|
data/test/test_openbase.rb
CHANGED
@@ -10,13 +10,14 @@ require 'openbase'
|
|
10
10
|
class TestOpenBase < Test::Unit::TestCase
|
11
11
|
|
12
12
|
DATABASE = 'OBMovies'
|
13
|
-
HOST = '
|
13
|
+
HOST = '127.0.0.1'
|
14
|
+
HOST_PASSWORD = ''
|
14
15
|
LOGIN = 'admin'
|
15
|
-
|
16
|
+
DB_PASSWORD = ''
|
16
17
|
ENCODING = 'ISO 8859-1 (Latin 1)'
|
17
18
|
|
18
19
|
def setup
|
19
|
-
@ob_OBMovies = OpenBase.new(DATABASE, HOST, LOGIN,
|
20
|
+
@ob_OBMovies = OpenBase.new(DATABASE, HOST, LOGIN, DB_PASSWORD)
|
20
21
|
@ob_OBOrderDatabase = OpenBase.new('OBOrderDatabase', HOST, 'admin', '')
|
21
22
|
@ob_WORealEstate = OpenBase.new('WORealEstate', HOST, 'admin', '')
|
22
23
|
end
|
@@ -27,14 +28,31 @@ class TestOpenBase < Test::Unit::TestCase
|
|
27
28
|
#@ob_WORealEstate.invalidate
|
28
29
|
end
|
29
30
|
|
31
|
+
def test_new_database
|
32
|
+
assert OpenBase.respond_to?(:new_database)
|
33
|
+
assert OpenBase.new_database(HOST,"new_db_#{Time.now.to_i}",HOST_PASSWORD);
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_delete_database
|
37
|
+
assert OpenBase.respond_to?(:delete_database)
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_start_database
|
41
|
+
assert OpenBase.respond_to?(:start_database)
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_stop_database
|
45
|
+
assert OpenBase.respond_to?(:stop_database)
|
46
|
+
end
|
47
|
+
|
30
48
|
def test_connect
|
31
49
|
assert_nothing_raised do
|
32
|
-
ob = OpenBase.new(DATABASE, HOST, LOGIN,
|
50
|
+
ob = OpenBase.new(DATABASE, HOST, LOGIN, DB_PASSWORD)
|
33
51
|
ob.invalidate
|
34
52
|
end
|
35
53
|
|
36
54
|
assert_raise(OpenBaseError) do
|
37
|
-
OpenBase.new('NotFoundDatabaseName', HOST, LOGIN,
|
55
|
+
OpenBase.new('NotFoundDatabaseName', HOST, LOGIN, DB_PASSWORD)
|
38
56
|
end
|
39
57
|
end
|
40
58
|
|
@@ -48,7 +66,7 @@ class TestOpenBase < Test::Unit::TestCase
|
|
48
66
|
assert_equal(false, @ob_OBMovies.connected?)
|
49
67
|
assert_raise(OpenBaseError) { @ob_OBMovies.database }
|
50
68
|
|
51
|
-
@ob_OBMovies.connect(DATABASE, HOST, LOGIN,
|
69
|
+
@ob_OBMovies.connect(DATABASE, HOST, LOGIN, DB_PASSWORD)
|
52
70
|
assert_nothing_raised { @ob_OBMovies.database }
|
53
71
|
end
|
54
72
|
|
@@ -57,7 +75,7 @@ class TestOpenBase < Test::Unit::TestCase
|
|
57
75
|
assert_equal(DATABASE, @ob_OBMovies.database)
|
58
76
|
assert_equal(HOST, @ob_OBMovies.host)
|
59
77
|
assert_equal(LOGIN, @ob_OBMovies.login)
|
60
|
-
assert_equal(
|
78
|
+
assert_equal(DB_PASSWORD, @ob_OBMovies.password)
|
61
79
|
end
|
62
80
|
|
63
81
|
def test_unique_row_id
|
data/website/index.html
CHANGED
@@ -33,7 +33,7 @@
|
|
33
33
|
<h1>Ruby/OpenBase</h1>
|
34
34
|
<div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/ruby-openbase"; return false'>
|
35
35
|
<p>Get Version</p>
|
36
|
-
<a href="http://rubyforge.org/projects/ruby-openbase" class="numbers">0.8.
|
36
|
+
<a href="http://rubyforge.org/projects/ruby-openbase" class="numbers">0.8.2</a>
|
37
37
|
</div>
|
38
38
|
<h2>What</h2>
|
39
39
|
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
|
|
3
3
|
specification_version: 1
|
4
4
|
name: openbase
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.8.
|
7
|
-
date: 2007-
|
6
|
+
version: 0.8.2
|
7
|
+
date: 2007-07-22 00:00:00 -04:00
|
8
8
|
summary: Provides access to OpenBase databases from Ruby.
|
9
9
|
require_paths:
|
10
10
|
- lib
|