You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implement very clean national/unicode column quoting by creating a #quoted_utf8_value method hooked into #quote. Add many tests for making sure sql types are correct with correct limiting in columns for all different types. Bump to first release version 2.2.0.
Copy file name to clipboardExpand all lines: README.rdoc
+40-10Lines changed: 40 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,43 @@ The SQL Server adapter for rails is back for ActiveRecord 2.2 and up! We are cur
14
14
* Enabled #case_sensitive_equality_operator used by unique validations.
15
15
* Unicode character support for nchar, nvarchar and ntext data types.
16
16
17
-
==== Native Text Data Type Accessor
17
+
==== Date/Time Data Type Hinting
18
+
19
+
Both SQL Server 2000 and 2005 do not have native data types for just 'date' or 'time', it only has 'datetime'. To pass the ActiveRecord tests we implemented two simple class methods that can teach your models to coerce column information to be cast correctly. Simply past a list of symbols to either the <tt>coerce_sqlserver_date</tt> or <tt>coerce_sqlserver_time</tt> methods that correspond to 'datetime' columns that need to be cast correctly.
20
+
21
+
class Topic < ActiveRecord::Base
22
+
coerce_sqlserver_date :last_read
23
+
coerce_sqlserver_time :bonus_time
24
+
end
25
+
26
+
This implementation has some limitations. To date we can only coerce date/time types for models that conform to the expected ActiveRecord class to table naming convention. So a table of 'foo_bar_widgets' will look for coerced types in the FooBarWidget class if it exists.
27
+
28
+
==== Native Data Type Support
29
+
30
+
Currently the following custom data types have been tested for schema definitions.
31
+
32
+
* char
33
+
* nchar
34
+
* nvarchar
35
+
* ntext
36
+
* varchar(max) for SQL Server 2005 only.
37
+
* nvarchar(max) for SQL Server 2005 only.
38
+
39
+
For example:
40
+
41
+
create_table :sql_server_custom_types, :force => true do |t|
Manually creating a varchar(max) on SQL Server 2005 is not necessary since this is the default type created when specifying a :text field. As time goes on we will be testing other SQL Server specific data types are handled correctly when created in a migration.
51
+
52
+
53
+
==== Native Text/Binary Data Type Accessor
18
54
19
55
To pass the ActiveRecord tests we had to implement an class accessor for the native type created for :text columns. By default any :text column created by migrations will create these native types.
20
56
@@ -25,16 +61,10 @@ During testing this type is set to 'varchar(8000)' for both versions. The reason
Both SQL Server 2000 and 2005 do not have native data types for just 'date' or 'time', it only has 'datetime'. To pass the ActiveRecord tests we implemented two simple class methods that can teach your models to coerce column information to be cast correctly. Simply past a list of symbols to either the <tt>coerce_sqlserver_date</tt> or <tt>coerce_sqlserver_time</tt> methods that correspond to 'datetime' columns that need to be cast correctly.
64
+
By default any :binary column created by migrations will create these native types
31
65
32
-
class Topic < ActiveRecord::Base
33
-
coerce_sqlserver_date :last_read
34
-
coerce_sqlserver_time :bonus_time
35
-
end
36
-
37
-
This implementation has some limitations. To date we can only coerce date/time types for models that conform to the expected ActiveRecord class to table naming convention. So a table of 'foo_bar_widgets' will look for coerced types in the FooBarWidget class if it exists.
0 commit comments