Skip to content

Commit 7009b5c

Browse files
committed
Mssql, pass type casted binds for select queries
1 parent 1cdb9d0 commit 7009b5c

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

lib/arjdbc/mssql/database_statements.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ def internal_exec_query(sql, name = 'SQL', binds = [], prepare: false, async: fa
102102
# binds = convert_legacy_binds_to_attributes(binds) if binds.first.is_a?(Array)
103103

104104
# puts "internal----->sql: #{sql}, binds: #{binds}"
105+
type_casted_binds = type_casted_binds(binds)
106+
105107
if without_prepared_statement?(binds)
106108
log(sql, name) do
107109
with_raw_connection do |conn|
@@ -113,13 +115,13 @@ def internal_exec_query(sql, name = 'SQL', binds = [], prepare: false, async: fa
113115
end
114116
end
115117
else
116-
log(sql, name, binds) do
118+
log(sql, name, type_casted_binds) do
117119
with_raw_connection do |conn|
118120
# this is different from normal AR that always caches
119121
cached_statement = fetch_cached_statement(sql) if prepare && @jdbc_statement_cache_enabled
120122

121123
result = conditional_indentity_insert(sql) do
122-
conn.execute_prepared_query(sql, binds, cached_statement)
124+
conn.execute_prepared_query(sql, type_casted_binds, cached_statement)
123125
end
124126
verified!
125127
result

0 commit comments

Comments
 (0)