sqlanywhere 0.1.1-i386-mswin32 → 0.1.2-i386-mswin32

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,5 +1,10 @@
1
1
  =CHANGE LOG
2
2
 
3
+ =====0.1.2 -- 2008/12/18
4
+ - Fixed bug when trying to read input value from OUTPUT parameter
5
+ - Added error checking to C2RB
6
+ - Fixed Rake to handle .bundle on OSX
7
+
3
8
  =====0.1.1 -- 2008/11/06
4
9
  - Created a source gem rake task
5
10
  - Created a 'hint' file if the source gem is used directly
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  /*====================================================
2
2
  *
3
- * Copyright 2008 iAnywhere Solutions, Inc.
3
+ * Copyright 2008-2009 iAnywhere Solutions, Inc.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
6
6
  * you may not use this file except in compliance with the License.
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
1
  #====================================================
2
2
  #
3
- # Copyright 2008 iAnywhere Solutions, Inc.
3
+ # Copyright 2008-2009 iAnywhere Solutions, Inc.
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
6
6
  # you may not use this file except in compliance with the License.
@@ -43,6 +43,8 @@ ARCH=Config::CONFIG['arch']
43
43
 
44
44
  pkg_version = ""
45
45
 
46
+ library_file = ARCH =~ /darwin/ ? "sqlanywhere.bundle" : "sqlanywhere.so"
47
+
46
48
  # The package version of determined by parsing the c source file. This ensures the version is
47
49
  # only ever specified ins a single place.
48
50
  File.open(File.join("ext", "sqlanywhere.c") ) do |f|
@@ -86,7 +88,7 @@ end
86
88
 
87
89
  # The default task is to build the library (.dll or .so)
88
90
  desc "Build the library"
89
- task :default => ["lib/sqlanywhere.so"]
91
+ task :default => [File.join("lib", library_file)]
90
92
 
91
93
  # Builds the binary gem for this platform
92
94
  desc "Build the gem"
@@ -98,7 +100,7 @@ file "sqlanywhere-#{pkg_version}-#{spec.platform}.gem" => ["Rakefile",
98
100
  "README",
99
101
  "CHANGELOG",
100
102
  "LICENSE",
101
- "lib/sqlanywhere.so"] do
103
+ File.join("lib", library_file)] do
102
104
  # Get the updated list of files to include in the gem
103
105
  spec.files = Dir['ext/**/*'] + Dir['lib/**/*'] + Dir['test/**/*'] + Dir['CHANGELOG'] + Dir['LICENSE'] + Dir['README'] + Dir['Rakefile']
104
106
  # Set the gem to be platform specific since it includes compiled binaries
@@ -130,13 +132,13 @@ file "sqlanywhere-#{pkg_version}.gem" => ["Rakefile",
130
132
  end
131
133
 
132
134
 
133
- file "lib/sqlanywhere.so" => ["ext/sqlanywhere.so"] do
135
+ file File.join("lib", library_file) => [File.join("ext", library_file)] do
134
136
  # If the hint file exists, delete it
135
137
  File.unlink(File.join("lib", "sqlanywhere.rb")) if File.exists?(File.join("lib", "sqlanywhere.rb"))
136
- File.copy(File.join("ext", "sqlanywhere.so"), "lib")
138
+ File.copy(File.join("ext", library_file), "lib")
137
139
  end
138
140
 
139
- file "ext/sqlanywhere.so" => ["ext/sqlanywhere.c"] do
141
+ file File.join("ext", library_file) => ["ext/sqlanywhere.c"] do
140
142
  sh "cd ext && ruby extconf.rb"
141
143
  sh "cd ext && #{MAKE}"
142
144
  sh "cd ext && mt -outputresource:sqlanywhere.so;2 -manifest sqlanywhere.so.manifest" if APPLY_MANIFEST
@@ -204,4 +206,4 @@ task :publish_rdoc => ["html/index.html"] do
204
206
  system "pscp -r html/* efarrar@rubyforge.org:/var/www/gforge-projects/sqlanywhere/sqlanywhere"
205
207
  end
206
208
 
207
- CLOBBER.include("sqlanywhere-#{pkg_version}-#{spec.platform}.gem", "sqlanywhere-#{pkg_version}.gem", "lib/*", "ext/*.obj", "ext/*.def", "ext/*.so", "ext/*.log", "ext/*.exp", "ext/*.lib", "ext/*.pdb", "ext/Makefile", "ext/*.so.manifest", "ext/*.o", "build/**/*", "build")
209
+ CLOBBER.include("sqlanywhere-#{pkg_version}-#{spec.platform}.gem", "sqlanywhere-#{pkg_version}.gem", "lib/*", "ext/*.obj", "ext/*.def", "ext/*.so", "ext/*.bundle", "ext/*.log", "ext/*.exp", "ext/*.lib", "ext/*.pdb", "ext/Makefile", "ext/*.so.manifest", "ext/*.o", "build/**/*", "build")
data/ext/extconf.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  #====================================================
2
2
  #
3
- # Copyright 2008 iAnywhere Solutions, Inc.
3
+ # Copyright 2008-2009 iAnywhere Solutions, Inc.
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
6
6
  # you may not use this file except in compliance with the License.
data/ext/sacapi.h CHANGED
@@ -1,6 +1,6 @@
1
1
  /* ====================================================
2
2
  *
3
- * Copyright 2008 iAnywhere Solutions, Inc.
3
+ * Copyright 2008-2009 iAnywhere Solutions, Inc.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
6
6
  * you may not use this file except in compliance with the License.
@@ -32,7 +32,6 @@
32
32
  * such as PHP, Perl, Python, Ruby, and others. This API layer sits on top of DBLIB and was implemented
33
33
  * using Embedded SQL. This API is not a replacement of DBLIB. It is just a way to simplify creating applications
34
34
  * from C/C++ code without having to learn all the details of Embedded SQL.
35
- * For more information on the implementation, please refer to the file sqlany_imp.sqc.
36
35
  *
37
36
  * \section distribution Distribution of the API
38
37
  * The API is built as a DLL (shared object on UNIX). The name of the DLL is \b dbcapi.dll
data/ext/sacapidll.c CHANGED
@@ -1,6 +1,6 @@
1
1
  //====================================================
2
2
  //
3
- // Copyright 2008 iAnywhere Solutions, Inc.
3
+ // Copyright 2008-2009 iAnywhere Solutions, Inc.
4
4
  //
5
5
  // Licensed under the Apache License, Version 2.0 (the "License");
6
6
  // you may not use this file except in compliance with the License.
@@ -30,13 +30,18 @@
30
30
  #else
31
31
  #include <dlfcn.h>
32
32
  /* assume we are running on a UNIX platform */
33
+ #if defined( __APPLE__ )
34
+ #define LIB_EXT "dylib"
35
+ #else
36
+ #define LIB_EXT "so"
37
+ #endif
33
38
  #if defined( _REENTRANT ) || defined( _THREAD_SAFE ) \
34
39
  || defined( __USE_REENTRANT )
35
40
  /* if building a thread-safe library, we need to load
36
41
  the thread-safe dbcapi library */
37
- #define DEFAULT_LIBRARY_NAME "libdbcapi_r.so"
42
+ #define DEFAULT_LIBRARY_NAME "libdbcapi_r." LIB_EXT
38
43
  #else
39
- #define DEFAULT_LIBRARY_NAME "libdbcapi.so"
44
+ #define DEFAULT_LIBRARY_NAME "libdbcapi." LIB_EXT
40
45
  #endif
41
46
  #endif
42
47
 
data/ext/sacapidll.h CHANGED
@@ -1,6 +1,6 @@
1
1
  /* ====================================================
2
2
  *
3
- * Copyright 2008 iAnywhere Solutions, Inc.
3
+ * Copyright 2008-2009 iAnywhere Solutions, Inc.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
6
6
  * you may not use this file except in compliance with the License.
data/ext/sacapidll.obj CHANGED
Binary file
Binary file
Binary file
Binary file
data/ext/sqlanywhere.c CHANGED
@@ -1,6 +1,6 @@
1
1
  /*====================================================
2
2
  *
3
- * Copyright 2008 iAnywhere Solutions, Inc.
3
+ * Copyright 2008-2009 iAnywhere Solutions, Inc.
4
4
  *
5
5
  * Licensed under the Apache License, Version 2.0 (the "License");
6
6
  * you may not use this file except in compliance with the License.
@@ -24,7 +24,7 @@
24
24
  #include "ruby.h"
25
25
  #include "sacapidll.h"
26
26
 
27
- const char* VERSION = "0.1.1";
27
+ const char* VERSION = "0.1.2";
28
28
 
29
29
  // Defining the Ruby Modules
30
30
  static VALUE mSQLAnywhere;
@@ -59,6 +59,12 @@ static_SQLAnywhereInterface_sqlany_init(VALUE class);
59
59
  static VALUE
60
60
  static_SQLAnywhereInterface_sqlany_new_connection(VALUE class);
61
61
 
62
+ static VALUE
63
+ static_SQLAnywhereInterface_sqlany_client_version(VALUE api);
64
+
65
+ static VALUE
66
+ static_SQLAnywhereInterface_sqlany_connect(VALUE api, VALUE sqlany_conn, VALUE str);
67
+
62
68
  static VALUE
63
69
  static_SQLAnywhereInterface_sqlany_disconnect(VALUE api, VALUE sqlany_conn);
64
70
 
@@ -119,8 +125,15 @@ static_SQLAnywhereInterface_sqlany_describe_bind_param(VALUE api, VALUE sqlany_s
119
125
  static VALUE C2RB(a_sqlany_data_value* value)
120
126
  {
121
127
  VALUE tdata;
122
-
123
- switch( value->type ) {
128
+
129
+ if( value == NULL || value->buffer == NULL || value->is_null == NULL ) {
130
+ rb_raise(rb_eTypeError, "Operation not allowed. Has no value.");
131
+ }
132
+ else if ( *value->is_null ) {
133
+ tdata = Qnil;
134
+ }
135
+ else {
136
+ switch( value->type ) {
124
137
  case A_BINARY:
125
138
  tdata = rb_str_new(value->buffer, *value->length);
126
139
  break;
@@ -158,6 +171,7 @@ static VALUE C2RB(a_sqlany_data_value* value)
158
171
  rb_raise(rb_eTypeError, "Invalid Data Type");
159
172
  tdata = Qnil;
160
173
  break;
174
+ }
161
175
  }
162
176
 
163
177
  return tdata;
@@ -305,6 +319,36 @@ static_SQLAnywhereInterface_sqlany_new_connection(VALUE api)
305
319
  return (tdata);
306
320
  }
307
321
 
322
+ /*
323
+ * call-seq:
324
+ * sqlany_client_version(VALUE api) -> [VALUE verstr]
325
+ *
326
+ * Retrieves the client version as a string.
327
+ *
328
+ * This function can be used to retrieve the client version.
329
+ *
330
+ * <b>Parameters</b>:
331
+ * - <tt>VALUE api</tt> -- an initialized API structure to finalize
332
+ *
333
+ * <b>Returns</b>:
334
+ * - <tt>VALUE verstr</tt>: The client version string.
335
+ *
336
+ */
337
+
338
+ static VALUE
339
+ static_SQLAnywhereInterface_sqlany_client_version(VALUE api)
340
+ {
341
+ SQLAnywhereInterface* s_api;
342
+ size_t s_size;
343
+ char s_buffer[255];
344
+
345
+ Data_Get_Struct(api, SQLAnywhereInterface, s_api);
346
+
347
+ s_api->sqlany_client_version(s_buffer, 255);
348
+
349
+ return (rb_str_new2(s_buffer));
350
+ }
351
+
308
352
  /*
309
353
  * call-seq:
310
354
  * sqlany_connect(VALUE api, VALUE sqlany_conn, VALUE str) -> VALUE result
@@ -1562,14 +1606,7 @@ static_Bind_get_info_output(VALUE bind)
1562
1606
  {
1563
1607
  a_sqlany_bind_param_info* s_bind;
1564
1608
  Data_Get_Struct(bind, a_sqlany_bind_param_info, s_bind);
1565
-
1566
- if( *s_bind->output_value.is_null ) {
1567
- return( Qnil );
1568
- }
1569
- else
1570
- {
1571
- return(C2RB(&s_bind->output_value));
1572
- }
1609
+ return(C2RB(&s_bind->output_value));
1573
1610
  }
1574
1611
 
1575
1612
  /*
@@ -1597,6 +1634,7 @@ void Init_sqlanywhere()
1597
1634
  // Define all of the DBCAPI functions as methods under an interface instance
1598
1635
  rb_define_method(cSQLAnywhereInterface, "sqlany_init", static_SQLAnywhereInterface_sqlany_init, 0);
1599
1636
  rb_define_method(cSQLAnywhereInterface, "sqlany_new_connection", static_SQLAnywhereInterface_sqlany_new_connection, 0);
1637
+ rb_define_method(cSQLAnywhereInterface, "sqlany_client_version", static_SQLAnywhereInterface_sqlany_client_version, 0);
1600
1638
  rb_define_method(cSQLAnywhereInterface, "sqlany_connect", static_SQLAnywhereInterface_sqlany_connect, 2);
1601
1639
  rb_define_method(cSQLAnywhereInterface, "sqlany_disconnect", static_SQLAnywhereInterface_sqlany_disconnect, 1);
1602
1640
  rb_define_method(cSQLAnywhereInterface, "sqlany_free_connection", static_SQLAnywhereInterface_sqlany_free_connection, 1);
data/ext/sqlanywhere.obj CHANGED
Binary file
data/ext/sqlanywhere.so CHANGED
Binary file
data/ext/vc60.pdb CHANGED
Binary file
data/lib/sqlanywhere.so CHANGED
Binary file
@@ -1,6 +1,6 @@
1
1
  #====================================================
2
2
  #
3
- # Copyright 2008 iAnywhere Solutions, Inc.
3
+ # Copyright 2008-2009 iAnywhere Solutions, Inc.
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
6
6
  # you may not use this file except in compliance with the License.
data/test/test.sql CHANGED
@@ -1,8 +1,8 @@
1
- IF EXISTS( SELECT * FROM "systab" WHERE "table_name" = 'test') THEN
1
+ IF EXISTS( SELECT * FROM "SYS"."SYSTAB" WHERE "table_name" = 'test') THEN
2
2
  DROP TABLE "test";
3
3
  END IF;
4
4
 
5
- IF EXISTS( SELECT * FROM "systab" WHERE "table_name" = 'types') THEN
5
+ IF EXISTS( SELECT * FROM "SYS"."SYSTAB" WHERE "table_name" = 'types') THEN
6
6
  DROP TABLE "types";
7
7
  END IF;
8
8
 
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: sqlanywhere
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.1.1
7
- date: 2008-11-07 00:00:00 -05:00
6
+ version: 0.1.2
7
+ date: 2008-12-18 00:00:00 -05:00
8
8
  summary: SQL Anywhere library for Ruby
9
9
  require_paths:
10
10
  - lib