sqlanywhere-ffi 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/test/test.sql ADDED
@@ -0,0 +1,92 @@
1
+ // *****************************************************
2
+ // Copyright (c) 2008-2012 iAnywhere Solutions, Inc.
3
+ // Portions copyright (c) 2008-2012 Sybase, Inc.
4
+ // All rights reserved. All unpublished rights reserved.
5
+ // *****************************************************
6
+ IF EXISTS( SELECT * FROM "SYS"."SYSTAB" WHERE "table_name" = 'test') THEN
7
+ DROP TABLE "test";
8
+ END IF;
9
+
10
+ IF EXISTS( SELECT * FROM "SYS"."SYSTAB" WHERE "table_name" = 'types') THEN
11
+ DROP TABLE "types";
12
+ END IF;
13
+
14
+ CREATE TABLE "test" (
15
+ "id" INTEGER NOT NULL DEFAULT AUTOINCREMENT,
16
+ PRIMARY KEY("id")
17
+ );
18
+
19
+ CREATE TABLE "types" (
20
+ "id" INTEGER PRIMARY KEY,
21
+ "_binary_" BINARY(8) DEFAULT NULL,
22
+ "_numeric_" NUMERIC(2,1),
23
+ "_decimal_" DECIMAL(2,1),
24
+ "_bounded_string_" CHAR(255) DEFAULT NULL,
25
+ "_unbounded_string_" LONG VARCHAR DEFAULT NULL,
26
+ "_signed_bigint_" BIGINT DEFAULT NULL,
27
+ "_unsigned_bigint_" UNSIGNED BIGINT DEFAULT NULL,
28
+ "_signed_int_" INTEGER DEFAULT NULL,
29
+ "_unsigned_int_" UNSIGNED INTEGER DEFAULT NULL,
30
+ "_signed_smallint_" SMALLINT DEFAULT NULL,
31
+ "_unsigned_smallint_" UNSIGNED SMALLINT DEFAULT NULL,
32
+ "_signed_tinyint_" TINYINT DEFAULT NULL,
33
+ "_unsigned_tinyint_" UNSIGNED TINYINT DEFAULT NULL,
34
+ "_bit_" BIT,
35
+ "_date_" DATE DEFAULT NULL,
36
+ "_datetime_" DATETIME DEFAULT NULL,
37
+ "_smalldatetime_" SMALLDATETIME DEFAULT NULL,
38
+ "_timestamp_" TIMESTAMP DEFAULT NULL,
39
+ "_double_" DOUBLE DEFAULT NULL,
40
+ "_float_" FLOAT DEFAULT NULL,
41
+ "_real_" REAL DEFAULT NULL
42
+ );
43
+
44
+ INSERT INTO types VALUES
45
+ ( 0,
46
+ CAST ( 0x78 AS BINARY ),
47
+ 1.1,
48
+ 1.1,
49
+ 'Bounded String Test',
50
+ 'Unbounded String Test',
51
+ 9223372036854775807,
52
+ 18446744073709551615,
53
+ 2147483647,
54
+ 4294967295,
55
+ 32767,
56
+ 65535,
57
+ 255,
58
+ 255,
59
+ 1,
60
+ DATE( '1999-01-02 21:20:53' ),
61
+ DATETIME( '1999-01-02 21:20:53' ),
62
+ DATETIME( '1999-01-02 21:20:53' ),
63
+ DATETIME( '1999-01-02 21:20:53' ),
64
+ 1.79769313486231e+308,
65
+ 3.402823e+38,
66
+ 3.402823e+38
67
+ )
68
+
69
+ INSERT INTO types VALUES
70
+ ( 1,
71
+ CAST ( 0xFF AS BINARY ),
72
+ -1.1,
73
+ -1.1,
74
+ '',
75
+ '',
76
+ -9223372036854775808,
77
+ 0,
78
+ -2147483648,
79
+ 0,
80
+ -32768,
81
+ 0,
82
+ 0,
83
+ 0,
84
+ 0,
85
+ NULL,
86
+ NULL,
87
+ NULL,
88
+ NULL,
89
+ -1.79769313486231e+308,
90
+ -3.402823e+38,
91
+ -3.402823e+38
92
+ )
data/test/test_iq.sql ADDED
@@ -0,0 +1,92 @@
1
+ // *****************************************************
2
+ // Copyright (c) 2010-2012 iAnywhere Solutions, Inc.
3
+ // Portions copyright (c) 2010-2012 Sybase, Inc.
4
+ // All rights reserved. All unpublished rights reserved.
5
+ // *****************************************************
6
+ IF EXISTS( SELECT * FROM "SYS"."SYSTAB" WHERE "table_name" = 'test') THEN
7
+ DROP TABLE "test";
8
+ END IF;
9
+
10
+ IF EXISTS( SELECT * FROM "SYS"."SYSTAB" WHERE "table_name" = 'types') THEN
11
+ DROP TABLE "types";
12
+ END IF;
13
+
14
+ CREATE TABLE "test" (
15
+ "id" INTEGER NOT NULL DEFAULT AUTOINCREMENT,
16
+ PRIMARY KEY("id")
17
+ );
18
+
19
+ CREATE TABLE "types" (
20
+ "id" INTEGER PRIMARY KEY,
21
+ "_binary_" VARBINARY(8) DEFAULT NULL,
22
+ "_numeric_" NUMERIC(2,1),
23
+ "_decimal_" DECIMAL(2,1),
24
+ "_bounded_string_" VARCHAR(255) DEFAULT NULL,
25
+ "_unbounded_string_" LONG VARCHAR DEFAULT NULL,
26
+ "_signed_bigint_" BIGINT DEFAULT NULL,
27
+ "_unsigned_bigint_" UNSIGNED BIGINT DEFAULT NULL,
28
+ "_signed_int_" INTEGER DEFAULT NULL,
29
+ "_unsigned_int_" UNSIGNED INTEGER DEFAULT NULL,
30
+ "_signed_smallint_" SMALLINT DEFAULT NULL,
31
+ "_unused_for_iq_" UNSIGNED INT DEFAULT NULL,
32
+ "_signed_tinyint_" TINYINT DEFAULT NULL,
33
+ "_unsigned_tinyint_" UNSIGNED TINYINT DEFAULT NULL,
34
+ "_bit_" BIT,
35
+ "_date_" DATE DEFAULT NULL,
36
+ "_datetime_" DATETIME DEFAULT NULL,
37
+ "_smalldatetime_" SMALLDATETIME DEFAULT NULL,
38
+ "_timestamp_" TIMESTAMP DEFAULT NULL,
39
+ "_double_" DOUBLE DEFAULT NULL,
40
+ "_float_" FLOAT DEFAULT NULL,
41
+ "_real_" REAL DEFAULT NULL
42
+ );
43
+
44
+ INSERT INTO types VALUES
45
+ ( 0,
46
+ CAST ( 0x78 AS VARBINARY ),
47
+ 1.1,
48
+ 1.1,
49
+ 'Bounded String Test',
50
+ 'Unbounded String Test',
51
+ 9223372036854775807,
52
+ 18446744073709551615,
53
+ 2147483647,
54
+ 4294967295,
55
+ 32767,
56
+ 65535,
57
+ 255,
58
+ 255,
59
+ 1,
60
+ DATE( '1999-01-02 21:20:53' ),
61
+ DATETIME( '1999-01-02 21:20:53' ),
62
+ DATETIME( '1999-01-02 21:20:53' ),
63
+ DATETIME( '1999-01-02 21:20:53' ),
64
+ 1.79769313486231e+308,
65
+ 3.402823e+38,
66
+ 3.402823e+38
67
+ )
68
+
69
+ INSERT INTO types VALUES
70
+ ( 1,
71
+ CAST ( 0xFF AS VARBINARY ),
72
+ -1.1,
73
+ -1.1,
74
+ '',
75
+ '',
76
+ -9223372036854775808,
77
+ 0,
78
+ -2147483648,
79
+ 0,
80
+ -32768,
81
+ 0,
82
+ 0,
83
+ 0,
84
+ 0,
85
+ NULL,
86
+ NULL,
87
+ NULL,
88
+ NULL,
89
+ -1.79769313486231e+308,
90
+ -3.402823e+38,
91
+ -3.402823e+38
92
+ )
metadata ADDED
@@ -0,0 +1,106 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sqlanywhere-ffi
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Chris Couzens
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-01-21 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: ffi
16
+ version_requirements: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ! '>='
19
+ - !ruby/object:Gem::Version
20
+ version: 1.3.1
21
+ none: false
22
+ requirement: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ! '>='
25
+ - !ruby/object:Gem::Version
26
+ version: 1.3.1
27
+ none: false
28
+ prerelease: false
29
+ type: :runtime
30
+ description: "SQL Anywhere Ruby Driver\n------------------------\nThis is a native\
31
+ \ SQL Anywhere driver for Ruby. This library wraps the \nfunctionality provided\
32
+ \ by the SQL Anywhere DBCAPI library. This driver\nis intended to be a base-level\
33
+ \ library to be used by interface libraries\nsuch as Ruby-DBI and ActiveRecord.\n\
34
+ \nThis driver can be used with SQL Anywhere 10 and later versions.\n\nThis driver\
35
+ \ is licensed under the Apache License, Version 2.\n\nThe official code repository\
36
+ \ is located on GitHub. The repository can be cloned with:\n\n git clone git://github.com/sqlanywhere/sqlanywhere.git\n\
37
+ \n==Running Unit Tests==\n\n1. Change to the the <tt>test</tt> directory\n\n \
38
+ \ cd test\n\n2. Create a testing database:\n\n dbinit test\n\n3. Start the testing\
39
+ \ database:\n\n dbeng12 test.db\n \n4. Create the test schema:\n\n dbisql\
40
+ \ -c \"eng=test;uid=dba;pwd=sql\" test.sql\n\n5. Run the unit tests:\n\n ruby\
41
+ \ sqlanywhere_test.rb\n\n<b>If the tests fail to run, make sure you have set up\
42
+ \ the SQL Anywhere environment variables correctly.</b> For more information,\n\
43
+ review the online documentation here [http://dcx.sybase.com/index.html#1200/en/dbadmin/da-envvar.html].\n\
44
+ \nSample\n------\n\nThis script makes a connection, prints <tt>Successful Ruby Connection</tt>\
45
+ \ to the SQL\nAnywhere console, then disconnects.\n \n # load the SQLAnywhere\
46
+ \ gem\n\n begin\n\n require 'rubygems'\n\n gem 'sqlanywhere'\n\n unless\
47
+ \ defined? SQLAnywhere\n\n require 'sqlanywhere'\n\n end\n\n end\n\n\
48
+ \ # create an interface\n\n api = SQLAnywhere::SQLAnywhereInterface.new()\n\n\
49
+ \ # initialize the interface (loads the DLL/SO)\n\n SQLAnywhere::API.sqlany_initialize_interface(\
50
+ \ api )\n\n # initialize our api object\n\n api.sqlany_init()\n\n # create\
51
+ \ a connection\n\n conn = api.sqlany_new_connection()\n\n # establish a connection\n\
52
+ \n api.sqlany_connect(conn, \"uid=dba;pwd=sql\")\n\n # execute a query without\
53
+ \ a result set\n\n api.sqlany_execute_immediate(conn, \"MESSAGE 'Successful Ruby\
54
+ \ Connection'\")\n\n # disconnect from the database\n\n api.sqlany_disconnect(conn)\n\
55
+ \n # free the connection resources\n\n api.sqlany_free_connection(conn)\n\n\
56
+ \ # free resources the api object uses\n\n api.sqlany_fini()\n\n # close the\
57
+ \ interface\n \n SQLAnywhere::API.sqlany_finalize_interface( api )\n\n"
58
+ email: ccouzens@gmail.com
59
+ executables: []
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - CHANGELOG
64
+ - Gemfile
65
+ - README.md
66
+ - sqlanywhere-ffi.gemspec
67
+ - LICENSE
68
+ - lib/column_info.rb
69
+ - lib/bind_param.rb
70
+ - lib/sqlanywhere.rb
71
+ - lib/api.rb
72
+ - lib/sql_anywhere_interface.rb
73
+ - lib/data_value.rb
74
+ - lib/bind_param_info.rb
75
+ - lib/bool.rb
76
+ - lib/data_info.rb
77
+ - test/test.sql
78
+ - test/test_iq.sql
79
+ - test/sqlanywhere_test.rb
80
+ homepage: https://github.com/in4systems/sqlanywhere
81
+ licenses: []
82
+ post_install_message:
83
+ rdoc_options: []
84
+ require_paths:
85
+ - lib
86
+ required_ruby_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ! '>='
89
+ - !ruby/object:Gem::Version
90
+ version: !binary |-
91
+ MA==
92
+ none: false
93
+ required_rubygems_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ! '>='
96
+ - !ruby/object:Gem::Version
97
+ version: !binary |-
98
+ MA==
99
+ none: false
100
+ requirements: []
101
+ rubyforge_project:
102
+ rubygems_version: 1.8.24
103
+ signing_key:
104
+ specification_version: 3
105
+ summary: A low-lever driver that allows Ruby code to interface with SQL Anywhere databases
106
+ test_files: []