rubyfb 0.5.4 → 0.5.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +9 -0
- data/Manifest +5 -0
- data/Rakefile +2 -2
- data/ext/AddUser.c +21 -16
- data/ext/Backup.c +12 -10
- data/ext/Common.c +1 -1
- data/ext/Connection.c +7 -3
- data/ext/DataArea.c +1 -9
- data/ext/Database.c +11 -7
- data/ext/FireRuby.c +1 -1
- data/ext/FireRubyException.c +1 -1
- data/ext/Generator.c +6 -12
- data/ext/RemoveUser.c +6 -4
- data/ext/Restore.c +6 -6
- data/ext/ResultSet.c +2 -2
- data/ext/Row.c +7 -7
- data/ext/ServiceManager.c +6 -6
- data/ext/Services.c +2 -1
- data/ext/Statement.c +3 -1
- data/ext/TypeMap.c +37 -40
- data/ext/extconf.rb +5 -0
- data/ext/rfbint.h +14 -0
- data/ext/rfbsleep.h +15 -0
- data/lib/active_record/connection_adapters/rubyfb_adapter.rb +13 -6
- data/lib/arel/visitors/rubyfb.rb +21 -0
- data/lib/rubyfb.rb +5 -5
- data/lib/rubyfb_lib.so +0 -0
- data/mswin32fb/fbclient_mingw.def +86 -0
- data/mswin32fb/fbclient_mingw.lib +0 -0
- data/rubyfb.gemspec +5 -5
- data/test/AddRemoveUserTest.rb +3 -3
- data/test/BackupRestoreTest.rb +3 -3
- data/test/BlobTest.rb +3 -3
- data/test/CharacterSetTest.rb +7 -6
- data/test/ConnectionTest.rb +7 -7
- data/test/DDLTest.rb +3 -3
- data/test/DatabaseTest.rb +3 -3
- data/test/GeneratorTest.rb +3 -3
- data/test/KeyTest.rb +3 -3
- data/test/ResultSetTest.rb +3 -3
- data/test/RoleTest.rb +3 -3
- data/test/RowCountTest.rb +3 -3
- data/test/RowTest.rb +3 -3
- data/test/SQLTest.rb +3 -3
- data/test/SQLTypeTest.rb +3 -3
- data/test/ServiceManagerTest.rb +3 -3
- data/test/StatementTest.rb +3 -3
- data/test/TransactionTest.rb +5 -5
- data/test/TypeTest.rb +3 -3
- metadata +14 -4
data/ext/TypeMap.c
CHANGED
@@ -34,14 +34,7 @@
|
|
34
34
|
#include "ResultSet.h"
|
35
35
|
#include "Statement.h"
|
36
36
|
#include "FireRuby.h"
|
37
|
-
|
38
|
-
#ifdef OS_UNIX
|
39
|
-
#include <inttypes.h>
|
40
|
-
#else
|
41
|
-
typedef short int16_t;
|
42
|
-
typedef long int32_t;
|
43
|
-
typedef long long int64_t;
|
44
|
-
#endif
|
37
|
+
#include "rfbint.h"
|
45
38
|
|
46
39
|
/* Function prototypes. */
|
47
40
|
VALUE createDate(const struct tm *);
|
@@ -553,30 +546,30 @@ VALUE createSafeTime(const struct tm *datetime)
|
|
553
546
|
*/
|
554
547
|
VALUE getConstant(const char *name, VALUE module)
|
555
548
|
{
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
549
|
+
VALUE owner = module,
|
550
|
+
constants,
|
551
|
+
exists,
|
552
|
+
entry = Qnil,
|
553
|
+
symbol = ID2SYM(rb_intern(name));
|
554
|
+
|
555
|
+
/* Check that we've got somewhere to look. */
|
556
|
+
if(owner == Qnil)
|
557
|
+
{
|
558
|
+
owner = rb_cModule;
|
559
|
+
}
|
560
|
+
|
561
|
+
constants = rb_funcall(owner, rb_intern("constants"), 0),
|
562
|
+
exists = rb_funcall(constants, rb_intern("include?"), 1, symbol);
|
563
|
+
if(exists == Qfalse)
|
564
|
+
{
|
565
|
+
/* 1.8 style lookup */
|
566
|
+
exists = rb_funcall(constants, rb_intern("include?"), 1, rb_str_new2(name));
|
567
|
+
}
|
568
|
+
if(exists != Qfalse)
|
569
|
+
{
|
570
|
+
entry = rb_funcall(owner, rb_intern("const_get"), 1, symbol);
|
571
|
+
}
|
572
|
+
return(entry);
|
580
573
|
}
|
581
574
|
|
582
575
|
|
@@ -755,13 +748,17 @@ VALUE toDateTime(VALUE value)
|
|
755
748
|
*/
|
756
749
|
VALUE rescueConvert(VALUE arguments, VALUE error)
|
757
750
|
{
|
758
|
-
VALUE message
|
751
|
+
VALUE message,
|
752
|
+
tmp_str1 = Qnil,
|
753
|
+
tmp_str2 = Qnil;
|
759
754
|
char text[512];
|
760
755
|
|
756
|
+
tmp_str1 = rb_ary_entry(arguments, 1);
|
757
|
+
tmp_str2 = rb_ary_entry(arguments, 2);
|
761
758
|
sprintf(text, "Error converting input column %d from a %s to a %s.",
|
762
759
|
FIX2INT(rb_ary_entry(arguments, 0)),
|
763
|
-
|
764
|
-
|
760
|
+
StringValuePtr(tmp_str1),
|
761
|
+
StringValuePtr(tmp_str2));
|
765
762
|
message = rb_str_new2(text);
|
766
763
|
|
767
764
|
return(rb_funcall(rb_eException, rb_intern("exception"), 1, &message));
|
@@ -792,7 +789,7 @@ void storeBlob(VALUE info,
|
|
792
789
|
ISC_QUAD *blobId = (ISC_QUAD *)field->sqldata;
|
793
790
|
VALUE number = rb_funcall(info, rb_intern("length"), 0);
|
794
791
|
long length = 0;
|
795
|
-
char *data =
|
792
|
+
char *data = StringValuePtr(info);
|
796
793
|
|
797
794
|
length = TYPE(number) == T_FIXNUM ? FIX2INT(number) : NUM2INT(number);
|
798
795
|
field->sqltype = SQL_BLOB;
|
@@ -877,7 +874,7 @@ void populateDateField(VALUE value, XSQLVAR *field)
|
|
877
874
|
if(TYPE(value) != T_ARRAY)
|
878
875
|
{
|
879
876
|
VALUE message = rb_funcall(value, rb_intern("message"), 0);
|
880
|
-
rb_fireruby_raise(NULL,
|
877
|
+
rb_fireruby_raise(NULL, StringValuePtr(message));
|
881
878
|
}
|
882
879
|
datetime.tm_year = FIX2INT(rb_ary_entry(value, 0));
|
883
880
|
datetime.tm_mon = FIX2INT(rb_ary_entry(value, 1));
|
@@ -1107,7 +1104,7 @@ void populateTextField(VALUE value, XSQLVAR *field)
|
|
1107
1104
|
actual = rb_funcall(value, rb_intern("to_s"), 0);
|
1108
1105
|
}
|
1109
1106
|
|
1110
|
-
text =
|
1107
|
+
text = StringValuePtr(actual);
|
1111
1108
|
length = strlen(text) > field->sqllen ? field->sqllen : strlen(text);
|
1112
1109
|
|
1113
1110
|
if((field->sqltype & ~1) == SQL_TEXT)
|
@@ -1142,7 +1139,7 @@ void populateTimeField(VALUE value, XSQLVAR *field)
|
|
1142
1139
|
if(TYPE(value) != T_ARRAY)
|
1143
1140
|
{
|
1144
1141
|
VALUE message = rb_funcall(value, rb_intern("message"), 0);
|
1145
|
-
rb_fireruby_raise(NULL,
|
1142
|
+
rb_fireruby_raise(NULL, StringValuePtr(message));
|
1146
1143
|
}
|
1147
1144
|
datetime.tm_hour = FIX2INT(rb_ary_entry(value, 3));
|
1148
1145
|
datetime.tm_min = FIX2INT(rb_ary_entry(value, 4));
|
@@ -1169,7 +1166,7 @@ void populateTimestampField(VALUE value, XSQLVAR *field)
|
|
1169
1166
|
if(TYPE(value) != T_ARRAY)
|
1170
1167
|
{
|
1171
1168
|
VALUE message = rb_funcall(value, rb_intern("message"), 0);
|
1172
|
-
rb_fireruby_raise(NULL,
|
1169
|
+
rb_fireruby_raise(NULL, StringValuePtr(message));
|
1173
1170
|
}
|
1174
1171
|
datetime.tm_year = FIX2INT(rb_ary_entry(value, 0));
|
1175
1172
|
datetime.tm_mon = FIX2INT(rb_ary_entry(value, 1));
|
data/ext/extconf.rb
CHANGED
@@ -18,6 +18,11 @@ elsif RUBY_PLATFORM.include?("win32")
|
|
18
18
|
dir_config("dotnet")
|
19
19
|
firebird_include="../mswin32fb"
|
20
20
|
firebird_lib="../mswin32fb"
|
21
|
+
elsif RUBY_PLATFORM.include?("mingw32")
|
22
|
+
$LIBS = $LIBS + " ../mswin32fb/fbclient_mingw.def -lfbclient_mingw"
|
23
|
+
$DLDFLAGS = "--enable-stdcall-fixup,"+$DLDFLAGS
|
24
|
+
firebird_include="../mswin32fb"
|
25
|
+
firebird_lib="../mswin32fb"
|
21
26
|
elsif RUBY_PLATFORM.include?("linux")
|
22
27
|
$LDFLAGS = $LDFLAGS + " -lfbclient -lpthread"
|
23
28
|
$CFLAGS = $CFLAGS + " -DOS_UNIX"
|
data/ext/rfbint.h
ADDED
data/ext/rfbsleep.h
ADDED
@@ -1,5 +1,8 @@
|
|
1
1
|
# Author: Ken Kunz <kennethkunz@gmail.com>
|
2
2
|
require 'active_record/connection_adapters/abstract_adapter'
|
3
|
+
if defined?(Arel) then
|
4
|
+
require 'arel/visitors/rubyfb'
|
5
|
+
end
|
3
6
|
|
4
7
|
module Rubyfb # :nodoc: all
|
5
8
|
NON_EXISTENT_DOMAIN_ERROR = "335544569"
|
@@ -476,6 +479,16 @@ module ActiveRecord
|
|
476
479
|
select_rows(sql, name).collect { |row| row[0].rstrip.downcase }
|
477
480
|
end
|
478
481
|
|
482
|
+
def table_exists?(table_name)
|
483
|
+
super(table_name.to_s.downcase)
|
484
|
+
end
|
485
|
+
|
486
|
+
def primary_key(table_name)
|
487
|
+
if pk_row = index_metadata(table_name, true).to_a.first
|
488
|
+
pk_row[2].rstrip.downcase
|
489
|
+
end
|
490
|
+
end
|
491
|
+
|
479
492
|
def indexes(table_name, name = nil) # :nodoc:
|
480
493
|
index_metadata(table_name, false, name).inject([]) do |indexes, row|
|
481
494
|
if indexes.empty? or indexes.last.name != row[0]
|
@@ -696,12 +709,6 @@ module ActiveRecord
|
|
696
709
|
return fields, rows
|
697
710
|
end
|
698
711
|
|
699
|
-
def primary_key(table_name)
|
700
|
-
if pk_row = index_metadata(table_name, true).to_a.first
|
701
|
-
pk_row[2].rstrip.downcase
|
702
|
-
end
|
703
|
-
end
|
704
|
-
|
705
712
|
def index_metadata(table_name, pk, name = nil)
|
706
713
|
sql = <<-end_sql
|
707
714
|
SELECT i.rdb$index_name, i.rdb$unique_flag, s.rdb$field_name
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Arel
|
2
|
+
module Visitors
|
3
|
+
class RubyFB < Arel::Visitors::ToSql
|
4
|
+
Arel::Visitors::VISITORS['rubyfb'] = Arel::Visitors::RubyFB
|
5
|
+
private
|
6
|
+
def visit_Arel_Nodes_SelectStatement o
|
7
|
+
limit = o.limit; o.limit = nil;
|
8
|
+
offset = o.offset; o.offset = nil;
|
9
|
+
limit || offset ? "SELECT #{fb_limit(limit)} #{fb_offset(offset)} * FROM (#{super})" : super
|
10
|
+
end
|
11
|
+
|
12
|
+
def fb_limit limit
|
13
|
+
"first #{limit}" if limit
|
14
|
+
end
|
15
|
+
|
16
|
+
def fb_offset offset
|
17
|
+
"skip #{offset}" if offset
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/rubyfb.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
require 'rubyfb_lib'
|
2
|
-
require 'SQLType'
|
3
|
-
require 'ProcedureCall'
|
4
|
-
require 'Connection'
|
5
|
-
|
1
|
+
require 'rubyfb_lib'
|
2
|
+
require 'SQLType'
|
3
|
+
require 'ProcedureCall'
|
4
|
+
require 'Connection'
|
5
|
+
|
data/lib/rubyfb_lib.so
CHANGED
Binary file
|
@@ -0,0 +1,86 @@
|
|
1
|
+
LIBRARY fbclient.dll
|
2
|
+
EXPORTS
|
3
|
+
isc_encode_timestamp
|
4
|
+
isc_encode_sql_time
|
5
|
+
isc_encode_sql_date
|
6
|
+
isc_close_blob
|
7
|
+
isc_put_segment
|
8
|
+
isc_decode_timestamp
|
9
|
+
isc_put_segment
|
10
|
+
isc_decode_sql_date
|
11
|
+
isc_decode_sql_date
|
12
|
+
isc_decode_sql_time
|
13
|
+
isc_create_blob
|
14
|
+
isc_start_multiple
|
15
|
+
isc_rollback_transaction
|
16
|
+
isc_commit_transaction
|
17
|
+
isc_dsql_free_statement
|
18
|
+
isc_dsql_execute
|
19
|
+
isc_vax_integer
|
20
|
+
isc_dsql_sql_info
|
21
|
+
isc_dsql_execute2
|
22
|
+
isc_dsql_describe_bind
|
23
|
+
isc_dsql_prepare
|
24
|
+
isc_dsql_allocate_statement
|
25
|
+
isc_service_query
|
26
|
+
isc_service_attach
|
27
|
+
isc_service_detach
|
28
|
+
isc_dsql_fetch
|
29
|
+
isc_service_start
|
30
|
+
isc_dsql_exec_immed2
|
31
|
+
isc_start_transaction
|
32
|
+
isc_sql_interprete
|
33
|
+
fb_interpret
|
34
|
+
isc_sqlcode
|
35
|
+
isc_detach_database
|
36
|
+
isc_attach_database
|
37
|
+
isc_dsql_execute_immediate
|
38
|
+
isc_drop_database
|
39
|
+
isc_dsql_describe
|
40
|
+
isc_get_segment
|
41
|
+
isc_blob_info
|
42
|
+
isc_open_blob2
|
43
|
+
isc_blob_default_desc
|
44
|
+
LIBRARY fbclient.dll
|
45
|
+
EXPORTS
|
46
|
+
isc_encode_timestamp
|
47
|
+
isc_encode_sql_time
|
48
|
+
isc_encode_sql_date
|
49
|
+
isc_close_blob
|
50
|
+
isc_put_segment
|
51
|
+
isc_decode_timestamp
|
52
|
+
isc_put_segment
|
53
|
+
isc_decode_sql_date
|
54
|
+
isc_decode_sql_date
|
55
|
+
isc_decode_sql_time
|
56
|
+
isc_create_blob
|
57
|
+
isc_start_multiple
|
58
|
+
isc_rollback_transaction
|
59
|
+
isc_commit_transaction
|
60
|
+
isc_dsql_free_statement
|
61
|
+
isc_dsql_execute
|
62
|
+
isc_vax_integer
|
63
|
+
isc_dsql_sql_info
|
64
|
+
isc_dsql_execute2
|
65
|
+
isc_dsql_describe_bind
|
66
|
+
isc_dsql_prepare
|
67
|
+
isc_dsql_allocate_statement
|
68
|
+
isc_service_query
|
69
|
+
isc_service_attach
|
70
|
+
isc_service_detach
|
71
|
+
isc_dsql_fetch
|
72
|
+
isc_service_start
|
73
|
+
isc_dsql_exec_immed2
|
74
|
+
isc_start_transaction
|
75
|
+
isc_sql_interprete
|
76
|
+
fb_interpret
|
77
|
+
isc_sqlcode
|
78
|
+
isc_detach_database
|
79
|
+
isc_attach_database
|
80
|
+
isc_dsql_execute_immediate
|
81
|
+
isc_drop_database
|
82
|
+
isc_dsql_describe
|
83
|
+
isc_get_segment
|
84
|
+
isc_blob_info
|
85
|
+
isc_open_blob2
|
86
|
+
isc_blob_default_desc
|
Binary file
|
data/rubyfb.gemspec
CHANGED
@@ -2,28 +2,28 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{rubyfb}
|
5
|
-
s.version = "0.5.
|
5
|
+
s.version = "0.5.5"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["George Georgiev"]
|
9
|
-
s.date = %q{
|
9
|
+
s.date = %q{2011-01-06}
|
10
10
|
s.description = %q{Firebird SQL access library}
|
11
11
|
s.email = %q{georgiev@heatbs.com}
|
12
12
|
s.extensions = ["ext/extconf.rb"]
|
13
13
|
s.extra_rdoc_files = ["CHANGELOG", "LICENSE", "README", "examples/example01.rb", "ext/extconf.rb", "lib/Connection.rb", "lib/ProcedureCall.rb", "lib/SQLType.rb", "lib/rubyfb.rb", "lib/src.rb"]
|
14
|
-
s.files = ["CHANGELOG", "LICENSE", "Manifest", "README", "Rakefile", "examples/example01.rb", "ext/AddUser.c", "ext/AddUser.h", "ext/Backup.c", "ext/Backup.h", "ext/Blob.c", "ext/Blob.h", "ext/Common.c", "ext/Common.h", "ext/Connection.c", "ext/Connection.h", "ext/DataArea.c", "ext/DataArea.h", "ext/Database.c", "ext/Database.h", "ext/FireRuby.c", "ext/FireRuby.h", "ext/FireRubyException.c", "ext/FireRubyException.h", "ext/Generator.c", "ext/Generator.h", "ext/RemoveUser.c", "ext/RemoveUser.h", "ext/Restore.c", "ext/Restore.h", "ext/ResultSet.c", "ext/ResultSet.h", "ext/Row.c", "ext/Row.h", "ext/ServiceManager.c", "ext/ServiceManager.h", "ext/Services.c", "ext/Services.h", "ext/Statement.c", "ext/Statement.h", "ext/Transaction.c", "ext/Transaction.h", "ext/TypeMap.c", "ext/TypeMap.h", "ext/extconf.rb", "lib/Connection.rb", "lib/ProcedureCall.rb", "lib/SQLType.rb", "lib/active_record/connection_adapters/rubyfb_adapter.rb", "lib/mkdoc", "lib/rubyfb.rb", "lib/rubyfb_lib.so", "lib/src.rb", "mswin32fb/fbclient_ms.lib", "mswin32fb/ibase.h", "mswin32fb/iberror.h", "test/AddRemoveUserTest.rb", "test/BackupRestoreTest.rb", "test/BlobTest.rb", "test/CharacterSetTest.rb", "test/ConnectionTest.rb", "test/DDLTest.rb", "test/DatabaseTest.rb", "test/GeneratorTest.rb", "test/KeyTest.rb", "test/ResultSetTest.rb", "test/RoleTest.rb", "test/RowCountTest.rb", "test/RowTest.rb", "test/SQLTest.rb", "test/SQLTypeTest.rb", "test/ServiceManagerTest.rb", "test/StatementTest.rb", "test/TestSetup.rb", "test/TransactionTest.rb", "test/TypeTest.rb", "test/UnitTest.rb", "rubyfb.gemspec"]
|
14
|
+
s.files = ["CHANGELOG", "LICENSE", "Manifest", "README", "Rakefile", "examples/example01.rb", "ext/AddUser.c", "ext/AddUser.h", "ext/Backup.c", "ext/Backup.h", "ext/Blob.c", "ext/Blob.h", "ext/Common.c", "ext/Common.h", "ext/Connection.c", "ext/Connection.h", "ext/DataArea.c", "ext/DataArea.h", "ext/Database.c", "ext/Database.h", "ext/FireRuby.c", "ext/FireRuby.h", "ext/FireRubyException.c", "ext/FireRubyException.h", "ext/Generator.c", "ext/Generator.h", "ext/RemoveUser.c", "ext/RemoveUser.h", "ext/Restore.c", "ext/Restore.h", "ext/ResultSet.c", "ext/ResultSet.h", "ext/Row.c", "ext/Row.h", "ext/ServiceManager.c", "ext/ServiceManager.h", "ext/Services.c", "ext/Services.h", "ext/Statement.c", "ext/Statement.h", "ext/Transaction.c", "ext/Transaction.h", "ext/TypeMap.c", "ext/TypeMap.h", "ext/extconf.rb", "ext/rfbint.h", "ext/rfbsleep.h", "lib/Connection.rb", "lib/ProcedureCall.rb", "lib/SQLType.rb", "lib/active_record/connection_adapters/rubyfb_adapter.rb", "lib/arel/visitors/rubyfb.rb", "lib/mkdoc", "lib/rubyfb.rb", "lib/rubyfb_lib.so", "lib/src.rb", "mswin32fb/fbclient_mingw.def", "mswin32fb/fbclient_mingw.lib", "mswin32fb/fbclient_ms.lib", "mswin32fb/ibase.h", "mswin32fb/iberror.h", "test/AddRemoveUserTest.rb", "test/BackupRestoreTest.rb", "test/BlobTest.rb", "test/CharacterSetTest.rb", "test/ConnectionTest.rb", "test/DDLTest.rb", "test/DatabaseTest.rb", "test/GeneratorTest.rb", "test/KeyTest.rb", "test/ResultSetTest.rb", "test/RoleTest.rb", "test/RowCountTest.rb", "test/RowTest.rb", "test/SQLTest.rb", "test/SQLTypeTest.rb", "test/ServiceManagerTest.rb", "test/StatementTest.rb", "test/TestSetup.rb", "test/TransactionTest.rb", "test/TypeTest.rb", "test/UnitTest.rb", "rubyfb.gemspec"]
|
15
15
|
s.homepage = %q{http://rubyforge.org/projects/rubyfb}
|
16
16
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Rubyfb", "--main", "README"]
|
17
17
|
s.require_paths = ["lib", "ext"]
|
18
18
|
s.rubyforge_project = %q{rubyfb}
|
19
|
-
s.rubygems_version = %q{1.3.
|
19
|
+
s.rubygems_version = %q{1.3.7}
|
20
20
|
s.summary = %q{Firebird SQL access library}
|
21
21
|
|
22
22
|
if s.respond_to? :specification_version then
|
23
23
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
24
24
|
s.specification_version = 3
|
25
25
|
|
26
|
-
if Gem::Version.new(Gem::
|
26
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
27
27
|
else
|
28
28
|
end
|
29
29
|
else
|
data/test/AddRemoveUserTest.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require 'TestSetup'
|
3
|
+
require './TestSetup'
|
4
4
|
require 'test/unit'
|
5
5
|
require 'rubygems'
|
6
|
-
require '
|
6
|
+
require 'rubyfb'
|
7
7
|
|
8
|
-
include
|
8
|
+
include Rubyfb
|
9
9
|
|
10
10
|
class AddRemoveUserTest < Test::Unit::TestCase
|
11
11
|
CURDIR = "#{Dir.getwd}"
|
data/test/BackupRestoreTest.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require 'TestSetup'
|
3
|
+
require './TestSetup'
|
4
4
|
require 'test/unit'
|
5
5
|
require 'rubygems'
|
6
|
-
require '
|
6
|
+
require 'rubyfb'
|
7
7
|
|
8
|
-
include
|
8
|
+
include Rubyfb
|
9
9
|
|
10
10
|
class BackupRestoreTest < Test::Unit::TestCase
|
11
11
|
CURDIR = "#{Dir.getwd}"
|
data/test/BlobTest.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require 'TestSetup'
|
3
|
+
require './TestSetup'
|
4
4
|
require 'test/unit'
|
5
5
|
require 'rubygems'
|
6
|
-
require '
|
6
|
+
require 'rubyfb'
|
7
7
|
|
8
|
-
include
|
8
|
+
include Rubyfb
|
9
9
|
|
10
10
|
class BlobTest < Test::Unit::TestCase
|
11
11
|
CURDIR = "#{Dir.getwd}"
|
data/test/CharacterSetTest.rb
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# encoding: windows-1251
|
2
3
|
|
3
|
-
require 'TestSetup'
|
4
|
+
require './TestSetup'
|
4
5
|
require 'test/unit'
|
5
6
|
require 'rubygems'
|
6
|
-
require '
|
7
|
+
require 'rubyfb'
|
7
8
|
|
8
|
-
include
|
9
|
+
include Rubyfb
|
9
10
|
|
10
11
|
class CharacterSetTest < Test::Unit::TestCase
|
11
12
|
CURDIR = "#{Dir.getwd}"
|
@@ -39,10 +40,10 @@ class CharacterSetTest < Test::Unit::TestCase
|
|
39
40
|
end
|
40
41
|
|
41
42
|
def test02
|
42
|
-
text = "�?����"
|
43
43
|
db = Database.new(DB_FILE, CHAR_SET)
|
44
44
|
|
45
45
|
begin
|
46
|
+
win1251_str = '���������'
|
46
47
|
db.connect("SYSDBA", "masterkey") do |cxn|
|
47
48
|
cxn.start_transaction do |tr|
|
48
49
|
cxn.execute("CREATE TABLE SAMPLE_TABLE(SAMPLE_FIELD VARCHAR(100))",tr)
|
@@ -56,8 +57,8 @@ class CharacterSetTest < Test::Unit::TestCase
|
|
56
57
|
end
|
57
58
|
end
|
58
59
|
end
|
59
|
-
rescue => error
|
60
|
-
assert("Character set unit test failure.", false)
|
60
|
+
# rescue => error
|
61
|
+
# assert("Character set unit test failure.", false)
|
61
62
|
end
|
62
63
|
end
|
63
64
|
end
|
data/test/ConnectionTest.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require 'TestSetup'
|
3
|
+
require './TestSetup'
|
4
4
|
require 'test/unit'
|
5
5
|
require 'rubygems'
|
6
|
-
require '
|
6
|
+
require 'rubyfb'
|
7
7
|
|
8
|
-
include
|
8
|
+
include Rubyfb
|
9
9
|
|
10
10
|
class ConnectionTest < Test::Unit::TestCase
|
11
11
|
CURDIR = "#{Dir.getwd}"
|
@@ -79,17 +79,17 @@ class ConnectionTest < Test::Unit::TestCase
|
|
79
79
|
@connections.push(@database.connect(DB_USER_NAME, DB_PASSWORD))
|
80
80
|
tx = @connections[0].start_transaction
|
81
81
|
total = 0
|
82
|
-
@connections[0].execute("SELECT
|
82
|
+
@connections[0].execute("SELECT * FROM RDB$DATABASE", tx) do |row|
|
83
83
|
total = total + 1
|
84
84
|
end
|
85
|
-
assert(total ==
|
85
|
+
assert(total == 1)
|
86
86
|
tx.commit
|
87
87
|
|
88
88
|
total = 0
|
89
|
-
@connections[0].execute_immediate("SELECT
|
89
|
+
@connections[0].execute_immediate("SELECT * FROM RDB$DATABASE") do |row|
|
90
90
|
total = total + 1
|
91
91
|
end
|
92
|
-
assert(total ==
|
92
|
+
assert(total == 1)
|
93
93
|
end
|
94
94
|
|
95
95
|
def test04
|
data/test/DDLTest.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require 'TestSetup'
|
3
|
+
require './TestSetup'
|
4
4
|
require 'test/unit'
|
5
5
|
require 'rubygems'
|
6
|
-
require '
|
6
|
+
require 'rubyfb'
|
7
7
|
|
8
|
-
include
|
8
|
+
include Rubyfb
|
9
9
|
|
10
10
|
class DDLTest < Test::Unit::TestCase
|
11
11
|
CURDIR = "#{Dir.getwd}"
|
data/test/DatabaseTest.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require 'TestSetup'
|
3
|
+
require './TestSetup'
|
4
4
|
require 'test/unit'
|
5
5
|
require 'rubygems'
|
6
|
-
require '
|
6
|
+
require 'rubyfb'
|
7
7
|
|
8
|
-
include
|
8
|
+
include Rubyfb
|
9
9
|
|
10
10
|
class DatabaseTest < Test::Unit::TestCase
|
11
11
|
CURDIR = "#{Dir.getwd}"
|
data/test/GeneratorTest.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require 'TestSetup'
|
3
|
+
require './TestSetup'
|
4
4
|
require 'test/unit'
|
5
5
|
require 'rubygems'
|
6
|
-
require '
|
6
|
+
require 'rubyfb'
|
7
7
|
|
8
|
-
include
|
8
|
+
include Rubyfb
|
9
9
|
|
10
10
|
class GeneratorTest < Test::Unit::TestCase
|
11
11
|
CURDIR = "#{Dir.getwd}"
|
data/test/KeyTest.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require 'TestSetup'
|
3
|
+
require './TestSetup'
|
4
4
|
require 'test/unit'
|
5
5
|
require 'rubygems'
|
6
|
-
require '
|
6
|
+
require 'rubyfb'
|
7
7
|
|
8
|
-
include
|
8
|
+
include Rubyfb
|
9
9
|
|
10
10
|
class KeyTest < Test::Unit::TestCase
|
11
11
|
CURDIR = "#{Dir.getwd}"
|
data/test/ResultSetTest.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require 'TestSetup'
|
3
|
+
require './TestSetup'
|
4
4
|
require 'test/unit'
|
5
5
|
require 'rubygems'
|
6
|
-
require '
|
6
|
+
require 'rubyfb'
|
7
7
|
|
8
|
-
include
|
8
|
+
include Rubyfb
|
9
9
|
|
10
10
|
class ResultSetTest < Test::Unit::TestCase
|
11
11
|
CURDIR = "#{Dir.getwd}"
|
data/test/RoleTest.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require 'TestSetup'
|
3
|
+
require './TestSetup'
|
4
4
|
require 'test/unit'
|
5
5
|
require 'rubygems'
|
6
|
-
require '
|
6
|
+
require 'rubyfb'
|
7
7
|
|
8
|
-
include
|
8
|
+
include Rubyfb
|
9
9
|
|
10
10
|
class RoleTest < Test::Unit::TestCase
|
11
11
|
CURDIR = "#{Dir.getwd}"
|
data/test/RowCountTest.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require 'TestSetup'
|
3
|
+
require './TestSetup'
|
4
4
|
require 'test/unit'
|
5
5
|
require 'rubygems'
|
6
|
-
require '
|
6
|
+
require 'rubyfb'
|
7
7
|
|
8
|
-
include
|
8
|
+
include Rubyfb
|
9
9
|
|
10
10
|
class RowCountTest < Test::Unit::TestCase
|
11
11
|
CURDIR = "#{Dir.getwd}"
|
data/test/RowTest.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require 'TestSetup'
|
3
|
+
require './TestSetup'
|
4
4
|
require 'test/unit'
|
5
5
|
require 'rubygems'
|
6
|
-
require '
|
6
|
+
require 'rubyfb'
|
7
7
|
|
8
|
-
include
|
8
|
+
include Rubyfb
|
9
9
|
|
10
10
|
class RowTest < Test::Unit::TestCase
|
11
11
|
CURDIR = "#{Dir.getwd}"
|
data/test/SQLTest.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require 'TestSetup'
|
3
|
+
require './TestSetup'
|
4
4
|
require 'test/unit'
|
5
5
|
require 'rubygems'
|
6
|
-
require '
|
6
|
+
require 'rubyfb'
|
7
7
|
|
8
|
-
include
|
8
|
+
include Rubyfb
|
9
9
|
|
10
10
|
class SQLTest < Test::Unit::TestCase
|
11
11
|
CURDIR = "#{Dir.getwd}"
|
data/test/SQLTypeTest.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require 'TestSetup'
|
3
|
+
require './TestSetup'
|
4
4
|
require 'test/unit'
|
5
5
|
require 'rubygems'
|
6
|
-
require '
|
6
|
+
require 'rubyfb'
|
7
7
|
|
8
|
-
include
|
8
|
+
include Rubyfb
|
9
9
|
|
10
10
|
class SQLTypeTest < Test::Unit::TestCase
|
11
11
|
CURDIR = "#{Dir.getwd}"
|