Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Small cleanup for pull request #95 work.

  • Loading branch information...
commit 57442f9b760f5d42be1c522409f6f48733ef2d69 1 parent 695c880
@metaskills metaskills authored
View
6 ext/tiny_tds/client.c
@@ -309,11 +309,11 @@ static VALUE rb_tinytds_connect(VALUE self, VALUE opts) {
VALUE transposed_encoding = rb_funcall(cTinyTdsClient, intern_transpose_iconv_encoding, 1, charset);
cwrap->encoding = rb_enc_find(StringValuePtr(transposed_encoding));
#endif
-
- if (dbtds(cwrap->client) <= 7)
+ if (dbtds(cwrap->client) <= 7) {
cwrap->identity_insert_sql = "SELECT CAST(@@IDENTITY AS bigint) AS Ident";
- else
+ } else {
cwrap->identity_insert_sql = "SELECT CAST(SCOPE_IDENTITY() AS bigint) AS Ident";
+ }
}
return self;
}
View
2  test/client_test.rb
@@ -26,7 +26,7 @@ class ClientTest < TinyTds::TestCase
it 'has getters for the tds version information (brittle since conf takes precedence)' do
if sybase_ase?
- assert_equal 7, @client.tds_version # FIXME this depends on ENV['TINYTDS_UNIT_VERSION']
+ assert_equal 7, @client.tds_version
assert_equal 'DBTDS_5_0 - 5.0 SQL Server', @client.tds_version_info
else
assert_equal 9, @client.tds_version
View
11 test/result_test.rb
@@ -174,6 +174,9 @@ class ResultTest < TinyTds::TestCase
it 'returns bigint for #insert when needed' do
return if sqlserver_azure? # We can not alter clustered index like this test does.
+ return if sybase_ase? # On Sybase, sp_helpindex cannot be used inside a transaction since it does a
+ # 'CREATE TABLE' command is not allowed within a multi-statement transaction
+ # and and sp_helpindex creates a temporary table #spindtab.
rollback_transaction(@client) do
seed = 9223372036854775805
@client.execute("DELETE FROM [datatypes]").do
@@ -185,13 +188,7 @@ class ResultTest < TinyTds::TestCase
identity = @client.execute("INSERT INTO [datatypes] ([varchar_50]) VALUES ('something')").insert
assert_equal seed, identity
end
- end unless sybase_ase?
- # On Sybase, sp_helpindex cannot be used inside a transaction, as
- # The 'CREATE TABLE' command is not allowed within a multi-statement
- # transaction in the 'tempdb' database.
- #
- # ...and sp_helpindex creates a temporary table #spindtab
- #
+ end
it 'must be able to begin/commit transactions with raw sql' do
rollback_transaction(@client) do
View
4 test/schema/sybase_ase.sql
@@ -100,7 +100,7 @@ INSERT INTO [datatypes] ([id], [nchar_10]) VALUES ( 171, N'1234567890'
INSERT INTO [datatypes] ([id], [nchar_10]) VALUES ( 172, N'123456åå' )
INSERT INTO [datatypes] ([id], [nchar_10]) VALUES ( 173, N'abc123' )
-- INSERT INTO [datatypes] ([id], [ntext]) VALUES ( 181, N'test ntext' )
--- INSERT INTO [datatypes] ([id], [ntext]) VALUES ( 182, N'test ntext' ) -- utf-8 chars in comments make sybase choke
+-- INSERT INTO [datatypes] ([id], [ntext]) VALUES ( 182, N'test ntext' ) -- Removed UTF-8 chars. They make sybase choke in comments.
INSERT INTO [datatypes] ([id], [numeric_18_0]) VALUES ( 191, 191 )
INSERT INTO [datatypes] ([id], [numeric_18_0]) VALUES ( 192, 123456789012345678 )
INSERT INTO [datatypes] ([id], [numeric_36_2]) VALUES ( 193, 12345678901234567890.01 )
@@ -108,7 +108,7 @@ INSERT INTO [datatypes] ([id], [numeric_36_2]) VALUES ( 194, 123.46 )
INSERT INTO [datatypes] ([id], [nvarchar_50]) VALUES ( 201, N'test nvarchar_50' )
INSERT INTO [datatypes] ([id], [nvarchar_50]) VALUES ( 202, N'test nvarchar_50 åå' )
-- INSERT INTO [datatypes] ([id], [nvarchar_max]) VALUES ( 211, N'test nvarchar_max' )
--- INSERT INTO [datatypes] ([id], [nvarchar_max]) VALUES ( 212, N'test nvarchar_max' ) -- see 182
+-- INSERT INTO [datatypes] ([id], [nvarchar_max]) VALUES ( 212, N'test nvarchar_max' ) -- Removed UTF-8 chars. They make sybase choke in comments.
INSERT INTO [datatypes] ([id], [real]) VALUES ( 221, 123.45 )
INSERT INTO [datatypes] ([id], [real]) VALUES ( 222, 0.0 )
INSERT INTO [datatypes] ([id], [real]) VALUES ( 223, 0.00001 )
Please sign in to comment.
Something went wrong with that request. Please try again.