sqlanywhere 0.1.4 → 0.1.6

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.
@@ -1,6 +1,6 @@
1
1
  #====================================================
2
2
  #
3
- # Copyright 2008-2009 iAnywhere Solutions, Inc.
3
+ # Copyright 2008-2010 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.
@@ -27,7 +27,6 @@ require 'date'
27
27
 
28
28
  begin
29
29
  require 'rubygems'
30
- gem 'sqlanywhere'
31
30
  unless defined? SQLAnywhere
32
31
  require 'sqlanywhere'
33
32
  end
@@ -123,7 +122,8 @@ class SQLAnywhere_Test < Test::Unit::TestCase
123
122
  end
124
123
 
125
124
  def test_column_info
126
- rs = exec_direct_with_test("SELECT TOP 2 * FROM \"types\" ORDER BY \"id\"")
125
+ is_iq = is_iq_table?("types")
126
+ rs = exec_direct_with_test("SELECT TOP 2 * FROM \"types\" ORDER BY \"id\"")
127
127
  assert_equal 22, @api.sqlany_num_cols(rs)
128
128
  assert_column_info(rs, 0, "id", Types::A_VAL32, 4)
129
129
  assert_column_info(rs, 1, "_binary_", Types::A_BINARY, 8)
@@ -136,10 +136,10 @@ class SQLAnywhere_Test < Test::Unit::TestCase
136
136
  assert_column_info(rs, 8, "_signed_int_", Types::A_VAL32, 4)
137
137
  assert_column_info(rs, 9, "_unsigned_int_", Types::A_UVAL32, 4)
138
138
  assert_column_info(rs, 10, "_signed_smallint_", Types::A_VAL16, 2)
139
- assert_column_info(rs, 11, "_unsigned_smallint_", Types::A_UVAL16, 2)
140
- assert_column_info(rs, 12, "_signed_tinyint_", Types::A_VAL8, 1)
141
- assert_column_info(rs, 13, "_unsigned_tinyint_", Types::A_VAL8, 1)
142
- assert_column_info(rs, 14, "_bit_", Types::A_UVAL8, 1)
139
+ assert_column_info(rs, 11, "_unsigned_smallint_", Types::A_UVAL16, 2) unless is_iq #IQ Does not have an unsigned small int datatype
140
+ assert_column_info(rs, 12, "_signed_tinyint_", Types::A_UVAL8, 1)
141
+ assert_column_info(rs, 13, "_unsigned_tinyint_", Types::A_UVAL8, 1)
142
+ assert_column_info(rs, 14, "_bit_", Types::A_VAL8, 1)
143
143
  assert_column_info(rs, 15, "_date_", Types::A_STRING, 10)
144
144
  assert_column_info(rs, 16, "_datetime_", Types::A_STRING, 23)
145
145
  assert_column_info(rs, 17, "_smalldatetime_", Types::A_STRING, 23)
@@ -151,7 +151,8 @@ class SQLAnywhere_Test < Test::Unit::TestCase
151
151
  end
152
152
 
153
153
  def test_bounds_on_types
154
- rs = exec_direct_with_test("SELECT TOP 2 * FROM \"types\" ORDER BY \"id\"")
154
+ is_iq = is_iq_table?("types")
155
+ rs = exec_direct_with_test("SELECT TOP 2 * FROM \"types\" ORDER BY \"id\"")
155
156
  assert_succeeded @api.sqlany_fetch_next(rs)
156
157
  assert_class_and_value(rs, String, 1, "x")
157
158
  assert_class_and_value(rs, String, 2, "1.1")
@@ -163,7 +164,7 @@ class SQLAnywhere_Test < Test::Unit::TestCase
163
164
  assert_class_and_value(rs, Bignum, 8, 2147483647)
164
165
  assert_class_and_value(rs, Bignum, 9, 4294967295)
165
166
  assert_class_and_value(rs, Fixnum, 10, 32767)
166
- assert_class_and_value(rs, Fixnum, 11, 65535)
167
+ assert_class_and_value(rs, Fixnum, 11, 65535) unless is_iq #IQ Does not have an unsigned small int datatype
167
168
  assert_class_and_value(rs, Fixnum, 12, 255)
168
169
  assert_class_and_value(rs, Fixnum, 13, 255)
169
170
  assert_class_and_value(rs, Fixnum, 14, 1)
@@ -186,7 +187,7 @@ class SQLAnywhere_Test < Test::Unit::TestCase
186
187
  assert_class_and_value(rs, Bignum, 8, -2147483648)
187
188
  assert_class_and_value(rs, Fixnum, 9, 0)
188
189
  assert_class_and_value(rs, Fixnum, 10, -32768)
189
- assert_class_and_value(rs, Fixnum, 11, 0)
190
+ assert_class_and_value(rs, Fixnum, 11, 0) unless is_iq #IQ Does not have an unsigned small int datatype
190
191
  assert_class_and_value(rs, Fixnum, 12, 0)
191
192
  assert_class_and_value(rs, Fixnum, 13, 0)
192
193
  assert_class_and_value(rs, Fixnum, 14, 0)
@@ -201,9 +202,10 @@ class SQLAnywhere_Test < Test::Unit::TestCase
201
202
  end
202
203
 
203
204
  def test_prepared_stmt
204
- stmt = @api.sqlany_prepare(@conn, "SELECT * FROM \"types\" WHERE \"id\" = ?")
205
+ is_iq = is_iq_table?("types")
206
+ stmt = @api.sqlany_prepare(@conn, "SELECT * FROM \"types\" WHERE \"id\" = ?")
205
207
  assert_not_nil stmt
206
- assert_failed @api.sqlany_execute(stmt)
208
+ assert_failed @api.sqlany_execute(stmt) unless is_iq #IQ does not throw an error here
207
209
  assert_equal 1, @api.sqlany_num_params(stmt)
208
210
  res, param = @api.sqlany_describe_bind_param(stmt, 0)
209
211
  assert_not_equal 0, res
@@ -271,8 +273,9 @@ class SQLAnywhere_Test < Test::Unit::TestCase
271
273
  end
272
274
 
273
275
  def test_insert_uint16
274
- assert_insert("_unsigned_smallint_", 65535, Fixnum)
275
- assert_insert("_unsigned_smallint_", 0, Fixnum)
276
+ is_iq = is_iq_table?("types") #IQ Does not have an unsigned small int datatype
277
+ assert_insert("_unsigned_smallint_", 65535, Fixnum) unless is_iq
278
+ assert_insert("_unsigned_smallint_", 0, Fixnum) unless is_iq
276
279
  end
277
280
 
278
281
  def test_insert_int8
@@ -281,8 +284,9 @@ class SQLAnywhere_Test < Test::Unit::TestCase
281
284
  end
282
285
 
283
286
  def test_insert_uint8
284
- assert_insert("_unsigned_smallint_", 255, Fixnum)
285
- assert_insert("_unsigned_smallint_", 0, Fixnum)
287
+ is_iq = is_iq_table?("types") #IQ Does not have an unsigned small int datatype
288
+ assert_insert("_unsigned_smallint_", 255, Fixnum) unless is_iq
289
+ assert_insert("_unsigned_smallint_", 0, Fixnum) unless is_iq
286
290
  end
287
291
 
288
292
  def test_insert_date
@@ -311,7 +315,13 @@ class SQLAnywhere_Test < Test::Unit::TestCase
311
315
 
312
316
  def test_insert_real
313
317
  assert_insert("_real_", 3.402823e+38, Float, 1e+32)
314
- end
318
+ end
319
+
320
+ def is_iq_table?(table_name)
321
+ rs = @api.sqlany_execute_direct(@conn, "SELECT server_type FROM SYS.SYSTABLE WHERE table_name = '#{table_name}'")
322
+ @api.sqlany_fetch_next(rs)
323
+ return @api.sqlany_get_column(rs, 0)[1] == 'IQ'
324
+ end
315
325
 
316
326
  def assert_insert(column_name, value, type, delta = nil)
317
327
  stmt = @api.sqlany_prepare(@conn, 'INSERT INTO "types"("id", "' + column_name + '", "_bit_") VALUES(3, ?, 1)')
@@ -1,3 +1,8 @@
1
+ // *****************************************************
2
+ // Copyright (c) 2008-2010 iAnywhere Solutions, Inc.
3
+ // Portions copyright (c) 1988-2010 Sybase, Inc.
4
+ // All rights reserved. All unpublished rights reserved.
5
+ // *****************************************************
1
6
  IF EXISTS( SELECT * FROM "SYS"."SYSTAB" WHERE "table_name" = 'test') THEN
2
7
  DROP TABLE "test";
3
8
  END IF;
metadata CHANGED
@@ -1,34 +1,29 @@
1
- --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.4
3
- specification_version: 1
1
+ --- !ruby/object:Gem::Specification
4
2
  name: sqlanywhere
5
- version: !ruby/object:Gem::Version
6
- version: 0.1.4
7
- date: 2009-03-25 00:00:00 -04:00
8
- summary: SQL Anywhere library for Ruby
9
- require_paths:
10
- - lib
11
- email: eric.farrar@ianywhere.com
12
- homepage: http://sqlanywhere.rubyforge.org
13
- rubyforge_project: sqlanywhere
14
- description: SQL Anywhere Driver for Ruby
15
- autorequire: sqlanywhere
16
- default_executable:
17
- bindir: bin
18
- has_rdoc: true
19
- required_ruby_version: !ruby/object:Gem::Version::Requirement
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: 1.8.6
24
- version:
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.6
5
+ prerelease:
25
6
  platform: ruby
26
- signing_key:
27
- cert_chain:
28
- post_install_message:
29
- authors:
7
+ authors:
30
8
  - Eric Farrar
31
- files:
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-12-14 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: ! ' SQL Anywhere Driver for Ruby
15
+
16
+ '
17
+ email: eric.farrar@ianywhere.com
18
+ executables: []
19
+ extensions:
20
+ - ext/extconf.rb
21
+ extra_rdoc_files:
22
+ - README
23
+ - CHANGELOG
24
+ - LICENSE
25
+ - ext/sqlanywhere.c
26
+ files:
32
27
  - ext/extconf.rb
33
28
  - ext/sacapi.h
34
29
  - ext/sacapidll.c
@@ -40,24 +35,34 @@ files:
40
35
  - LICENSE
41
36
  - README
42
37
  - Rakefile
43
- test_files:
44
- - test/sqlanywhere_test.rb
45
- rdoc_options:
38
+ homepage: http://sqlanywhere.rubyforge.org
39
+ licenses: []
40
+ post_install_message:
41
+ rdoc_options:
46
42
  - --title
47
43
  - SQL Anywhere Ruby Driver
48
44
  - --main
49
45
  - README
50
46
  - --line-numbers
51
- extra_rdoc_files:
52
- - README
53
- - CHANGELOG
54
- - LICENSE
55
- - ext/sqlanywhere.c
56
- executables: []
57
-
58
- extensions:
59
- - ext/extconf.rb
47
+ require_paths:
48
+ - lib
49
+ required_ruby_version: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: 1.8.6
55
+ required_rubygems_version: !ruby/object:Gem::Requirement
56
+ none: false
57
+ requirements:
58
+ - - ! '>='
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
60
61
  requirements: []
61
-
62
- dependencies: []
63
-
62
+ rubyforge_project: sqlanywhere
63
+ rubygems_version: 1.8.12
64
+ signing_key:
65
+ specification_version: 3
66
+ summary: SQL Anywhere library for Ruby
67
+ test_files:
68
+ - test/sqlanywhere_test.rb