activerecord-sqlanywhere-adapter 0.1.2 → 0.1.3

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/CHANGELOG CHANGED
@@ -1,23 +1,27 @@
1
- =CHANGE LOG
2
-
3
- =====0.1.2 -- 2008/12/30
4
- - Fixed bug in ActiveRecord::ConnectionAdapters::SQLAnywhereAdapter#table_structure SQL (Paul Smith)
5
- - Added options for :commlinks and :connection_name to database.yml configuration (Paul Smith)
6
- - Fixed ActiveRecord::ConnectionAdapters::SQLAnywhereColumn.string_to_binary and binary_to_string (Paul Smith)
7
- - Added :time as a native datatype (Paul Smith)
8
- - Override SQLAnywhereAdapter#active? to prevent stale connections (Paul Smith)
9
- - 'Fixed' coding style to match Rails standards (Paul Smith)
10
- - Added temporary option for timestamp_format
11
- - Fixed bug to let migrations drop columns with indexes
12
- - Formatted code
13
- - Fixed bug to raise proper exceptions when a query with a bad column in executed
14
-
15
- =====0.1.1 -- 2008/11/06
16
- - Changed file permissions on archives
17
- - Changed archives to be specific to platform (.zip on windows, .tar.gz
18
- otherwise)
19
- - Removed the default rake task
20
-
21
- =====0.1.0 -- 2008/10/15
22
- - Initial Release
23
-
1
+ =CHANGE LOG
2
+
3
+ =====0.1.3 -- 2010/02/01
4
+ - Added :encoding option to connection string
5
+ - Fixed bug associated with dangling connections in development mode (http://groups.google.com/group/sql-anywhere-web-development/browse_thread/thread/79fa81bdfcf84c13/e29074e5b8b7ad6a?lnk=gst&q=activerecord#e29074e5b8b7ad6a)
6
+
7
+ =====0.1.2 -- 2008/12/30
8
+ - Fixed bug in ActiveRecord::ConnectionAdapters::SQLAnywhereAdapter#table_structure SQL (Paul Smith)
9
+ - Added options for :commlinks and :connection_name to database.yml configuration (Paul Smith)
10
+ - Fixed ActiveRecord::ConnectionAdapters::SQLAnywhereColumn.string_to_binary and binary_to_string (Paul Smith)
11
+ - Added :time as a native datatype (Paul Smith)
12
+ - Override SQLAnywhereAdapter#active? to prevent stale connections (Paul Smith)
13
+ - 'Fixed' coding style to match Rails standards (Paul Smith)
14
+ - Added temporary option for timestamp_format
15
+ - Fixed bug to let migrations drop columns with indexes
16
+ - Formatted code
17
+ - Fixed bug to raise proper exceptions when a query with a bad column in executed
18
+
19
+ =====0.1.1 -- 2008/11/06
20
+ - Changed file permissions on archives
21
+ - Changed archives to be specific to platform (.zip on windows, .tar.gz
22
+ otherwise)
23
+ - Removed the default rake task
24
+
25
+ =====0.1.0 -- 2008/10/15
26
+ - Initial Release
27
+
data/LICENSE CHANGED
@@ -1,23 +1,23 @@
1
- /*====================================================
2
- *
3
- * Copyright 2008-2009 iAnywhere Solutions, Inc.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- *
10
- * http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software
13
- * distributed under the License is distributed on an "AS IS" BASIS,
14
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- *
16
- * See the License for the specific language governing permissions and
17
- * limitations under the License.
18
- *
19
- * While not a requirement of the license, if you do modify this file, we
20
- * would appreciate hearing about it. Please email sqlany_interfaces@sybase.com
21
- *
22
- *
23
- *====================================================*/
1
+ /*====================================================
2
+ *
3
+ * Copyright 2008-2009 iAnywhere Solutions, Inc.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ *
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ *
19
+ * While not a requirement of the license, if you do modify this file, we
20
+ * would appreciate hearing about it. Please email sqlany_interfaces@sybase.com
21
+ *
22
+ *
23
+ *====================================================*/
data/README CHANGED
@@ -1,125 +1,126 @@
1
- =SQL Anywhere ActiveRecord Driver
2
-
3
- This is a SQL Anywhere driver for Ruby ActiveRecord. This driver requires the
4
- native SQL Anywhere Ruby driver. To get the native driver, use:
5
-
6
- gem install sqlanywhere
7
-
8
- This driver is designed for use with ActiveRecord 2.0.2 and greater.
9
-
10
- This driver is licensed under the Apache License, Version 2.
11
-
12
- ==Making a Connection
13
-
14
- The following code is a sample database configuration object.
15
-
16
- ActiveRecord::Base.configurations = {
17
- 'arunit' => {
18
- :adapter => 'sqlanywhere',
19
- :database => 'arunit', #equivalent to the "DatabaseName" parameter
20
- :server => 'arunit', #equivalent to the "ServerName" parameter
21
- :username => 'dba', #equivalent to the "UserID" parameter
22
- :password => 'sql', #equivalent to the "Password" parameter
23
- :commlinks => 'TCPIP()', #equivalent to the "Commlinks" parameter
24
- :connection_name => 'Rails' #equivalent to the "ConnectionName" parameter
25
- }
26
-
27
- ==Running the ActiveRecord Unit Test Suite
28
-
29
- 1. Open <tt><ACTIVERECORD_INSTALL_DIR>/rakefile</tt> and modify the line:
30
-
31
- for adapter in %w( mysql postgresql sqlite sqlite3 firebird db2 oracle sybase openbase frontbase )
32
-
33
- to include <tt>sqlanywhere</tt>. It should now look like:
34
-
35
- for adapter in %w( mysql postgresql sqlite sqlite3 firebird db2 oracle sybase openbase frontbase sqlanywhere )
36
-
37
- 2. Create directory to hold the connection definition:
38
-
39
- mkdir <ACTIVERECORD_INSTALL_DIR>/test/connections/native_sqlanywhere
40
-
41
- 3. Copy <tt>test/connection.rb</tt> into the newly created directory.
42
-
43
- NOTE: If using ActiveRecord 2.0.2, change the second line of the file from:
44
-
45
- require_dependency 'models/course'
46
-
47
- to:
48
-
49
- require_dependency 'fixtures/course'
50
-
51
- 4. Create the two test databases. These can be created in any directory.
52
-
53
- dbinit -c arunit
54
- dbinit -c arunit2
55
- dbsrv11 arunit arunit2
56
-
57
- <b>If the commands cannot be found, make sure you have set up the SQL Anywhere environment variables correctly.</b> For more information review the online documentation here[http://dcx.sybase.com/index.php#http%3A%2F%2Fdcx.sybase.com%2F1100en%2Fdbadmin_en11%2Fda-envvar-sect1-3672410.html].
58
-
59
- 5. If you are using ActiveRecord 2.0.2, you must load the test tables.
60
-
61
- dbisql -c "eng=arunit;dbn=arunit;uid=dba;pwd=sql" sqlanywhere.sql
62
- dbisql -c "eng=arunit;dbn=arunit2;uid=dba;pwd=sql" sqlanywhere2.sql
63
-
64
- If you are using a newer version of ActiveRecord, this schema is automatically
65
- migrated for you.
66
-
67
- 6. Run the unit test suite from the ActiveRecord install directory:
68
-
69
- rake test_sqlanywhere
70
-
71
- <b>If the migration tests fail, make sure you have set up the SQL Anywhere environment variables correctly.</b> For more information review the online documentation here[http://dcx.sybase.com/index.php#http%3A%2F%2Fdcx.sybase.com%2F1100en%2Fdbadmin_en11%2Fda-envvar-sect1-3672410.html].
72
-
73
- ==Explaination of Test Results
74
-
75
- As of ActiveRecord 2.2.2., it is expected that 6 tests will fail. The failed tests, along with an explaination, are identified below:
76
-
77
- 1. (CalculationsTest) - test_should_sum_expression
78
-
79
- Explaination: Appears to be an error in the test.
80
-
81
- This tests checks the results of the following statement:
82
-
83
- assert_equal '636', Account.sum("2 * credit_limit")
84
-
85
- According to the ActiveRecord documentation, the summation of a column should return a value of the same type as the column. In this case, <tt>credit_limit</tt> is an integer, and so the result should be a number type, not a string.
86
-
87
- 2. (MigrationTest) - test_add_table_with_decimals
88
-
89
- Explaination: Requires special case.
90
-
91
- From the comments regarding this test:
92
-
93
- # This one is fun. The 'value_of_e' field is defined as 'DECIMAL' with
94
- # precision/scale explicitly left out. By the SQL standard, numbers
95
- # assigned to this field should be truncated but that's seldom respected.
96
-
97
- There are already three special cases of this test. SQL Anywhere would require another special case to pass this test.
98
-
99
- 3. (NamedScopeTest) - test_should_use_where_in_query_for_named_scope
100
-
101
- Explaination: Appears to be an error in the test.
102
-
103
- This test issues a query that returns two rows. Because there is no ORDER BY in the query, the order that that rows are returned in is non-deterministic. SQL Anywhere returns the correct rows, but in a different order.
104
-
105
- 4. (QueryCacheTest) - test_cache_does_not_wrap_string_results_in_arrays
106
-
107
- Explaination: Appears to be an error in the test.
108
-
109
- This tests checks that the cached value of the following query is a string:
110
-
111
- SELECT count(*) AS count_all FROM tasks
112
-
113
- However, SQL Anywhere treats the values of a <tt>COUNT(*)</tt> opration as a fixnum, not a string. It would appear that the real intent of this test is to test that the value is NOT an array, rather than testing that the value is a string.
114
-
115
- 5. (SchemaDumperTest) - test_schema_dump_includes_limit_constraint_for_integer_columns
116
-
117
- Explaination: SQL Anywhere does not have a 'limitless' integer type.
118
-
119
- Any integer type will be given an implicit limit when instantiated. It would be possible to use another type such as <tt>NUMERIC</tt> to mimic this type, however this seems like a bad idea.
120
-
121
- 6. (ValidationsTest) - test_validate_case_sensitive_uniqueness
122
-
123
- Explaination: By default, SQL Anywhere is case insensitive.
124
-
125
- If a case sensitive database is required (as in this test), ensure the database is created with the <tt>-c</tt> switch to make it case sensitive.
1
+ =SQL Anywhere ActiveRecord Driver
2
+
3
+ This is a SQL Anywhere driver for Ruby ActiveRecord. This driver requires the
4
+ native SQL Anywhere Ruby driver. To get the native driver, use:
5
+
6
+ gem install sqlanywhere
7
+
8
+ This driver is designed for use with ActiveRecord 2.0.2 and greater.
9
+
10
+ This driver is licensed under the Apache License, Version 2.
11
+
12
+ ==Making a Connection
13
+
14
+ The following code is a sample database configuration object.
15
+
16
+ ActiveRecord::Base.configurations = {
17
+ 'arunit' => {
18
+ :adapter => 'sqlanywhere',
19
+ :database => 'arunit', #equivalent to the "DatabaseName" parameter
20
+ :server => 'arunit', #equivalent to the "ServerName" parameter
21
+ :username => 'dba', #equivalent to the "UserID" parameter
22
+ :password => 'sql', #equivalent to the "Password" parameter
23
+ :encoding => 'Windows-1252', #equivalent to the "CharSet" parameter
24
+ :commlinks => 'TCPIP()', #equivalent to the "Commlinks" parameter
25
+ :connection_name => 'Rails' #equivalent to the "ConnectionName" parameter
26
+ }
27
+
28
+ ==Running the ActiveRecord Unit Test Suite
29
+
30
+ 1. Open <tt><ACTIVERECORD_INSTALL_DIR>/rakefile</tt> and modify the line:
31
+
32
+ for adapter in %w( mysql postgresql sqlite sqlite3 firebird db2 oracle sybase openbase frontbase )
33
+
34
+ to include <tt>sqlanywhere</tt>. It should now look like:
35
+
36
+ for adapter in %w( mysql postgresql sqlite sqlite3 firebird db2 oracle sybase openbase frontbase sqlanywhere )
37
+
38
+ 2. Create directory to hold the connection definition:
39
+
40
+ mkdir <ACTIVERECORD_INSTALL_DIR>/test/connections/native_sqlanywhere
41
+
42
+ 3. Copy <tt>test/connection.rb</tt> into the newly created directory.
43
+
44
+ NOTE: If using ActiveRecord 2.0.2, change the second line of the file from:
45
+
46
+ require_dependency 'models/course'
47
+
48
+ to:
49
+
50
+ require_dependency 'fixtures/course'
51
+
52
+ 4. Create the two test databases. These can be created in any directory.
53
+
54
+ dbinit -c arunit
55
+ dbinit -c arunit2
56
+ dbsrv11 arunit arunit2
57
+
58
+ <b>If the commands cannot be found, make sure you have set up the SQL Anywhere environment variables correctly.</b> For more information review the online documentation here[http://dcx.sybase.com/index.php#http%3A%2F%2Fdcx.sybase.com%2F1100en%2Fdbadmin_en11%2Fda-envvar-sect1-3672410.html].
59
+
60
+ 5. If you are using ActiveRecord 2.0.2, you must load the test tables.
61
+
62
+ dbisql -c "eng=arunit;dbn=arunit;uid=dba;pwd=sql" sqlanywhere.sql
63
+ dbisql -c "eng=arunit;dbn=arunit2;uid=dba;pwd=sql" sqlanywhere2.sql
64
+
65
+ If you are using a newer version of ActiveRecord, this schema is automatically
66
+ migrated for you.
67
+
68
+ 6. Run the unit test suite from the ActiveRecord install directory:
69
+
70
+ rake test_sqlanywhere
71
+
72
+ <b>If the migration tests fail, make sure you have set up the SQL Anywhere environment variables correctly.</b> For more information review the online documentation here[http://dcx.sybase.com/index.php#http%3A%2F%2Fdcx.sybase.com%2F1100en%2Fdbadmin_en11%2Fda-envvar-sect1-3672410.html].
73
+
74
+ ==Explaination of Test Results
75
+
76
+ As of ActiveRecord 2.2.2., it is expected that 6 tests will fail. The failed tests, along with an explaination, are identified below:
77
+
78
+ 1. (CalculationsTest) - test_should_sum_expression
79
+
80
+ Explaination: Appears to be an error in the test.
81
+
82
+ This tests checks the results of the following statement:
83
+
84
+ assert_equal '636', Account.sum("2 * credit_limit")
85
+
86
+ According to the ActiveRecord documentation, the summation of a column should return a value of the same type as the column. In this case, <tt>credit_limit</tt> is an integer, and so the result should be a number type, not a string.
87
+
88
+ 2. (MigrationTest) - test_add_table_with_decimals
89
+
90
+ Explaination: Requires special case.
91
+
92
+ From the comments regarding this test:
93
+
94
+ # This one is fun. The 'value_of_e' field is defined as 'DECIMAL' with
95
+ # precision/scale explicitly left out. By the SQL standard, numbers
96
+ # assigned to this field should be truncated but that's seldom respected.
97
+
98
+ There are already three special cases of this test. SQL Anywhere would require another special case to pass this test.
99
+
100
+ 3. (NamedScopeTest) - test_should_use_where_in_query_for_named_scope
101
+
102
+ Explaination: Appears to be an error in the test.
103
+
104
+ This test issues a query that returns two rows. Because there is no ORDER BY in the query, the order that that rows are returned in is non-deterministic. SQL Anywhere returns the correct rows, but in a different order.
105
+
106
+ 4. (QueryCacheTest) - test_cache_does_not_wrap_string_results_in_arrays
107
+
108
+ Explaination: Appears to be an error in the test.
109
+
110
+ This tests checks that the cached value of the following query is a string:
111
+
112
+ SELECT count(*) AS count_all FROM tasks
113
+
114
+ However, SQL Anywhere treats the values of a <tt>COUNT(*)</tt> opration as a fixnum, not a string. It would appear that the real intent of this test is to test that the value is NOT an array, rather than testing that the value is a string.
115
+
116
+ 5. (SchemaDumperTest) - test_schema_dump_includes_limit_constraint_for_integer_columns
117
+
118
+ Explaination: SQL Anywhere does not have a 'limitless' integer type.
119
+
120
+ Any integer type will be given an implicit limit when instantiated. It would be possible to use another type such as <tt>NUMERIC</tt> to mimic this type, however this seems like a bad idea.
121
+
122
+ 6. (ValidationsTest) - test_validate_case_sensitive_uniqueness
123
+
124
+ Explaination: By default, SQL Anywhere is case insensitive.
125
+
126
+ If a case sensitive database is required (as in this test), ensure the database is created with the <tt>-c</tt> switch to make it case sensitive.