Skip to content

Commit

Permalink
Added support to read numeric and decimal columns
Browse files Browse the repository at this point in the history
  • Loading branch information
naqvis committed Jul 17, 2023
1 parent 647e995 commit 110ef92
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion shard.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: odbc
version: 0.2.0
version: 0.2.1
description: |
ODBC connector for Crystal
Expand Down
2 changes: 1 addition & 1 deletion spec/db_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ DB::DriverSpecs(DB::Any).run do |ctx|
db.exec %(insert into a (i, str) values (23, "bai bai");)

2.times do |i|
DB.open db.uri do |db|
DB.open ctx.connection_string do |db|
begin
db.query("SELECT i, str FROM a WHERE i = ?", 23) do |rs|
rs.move_next
Expand Down
2 changes: 1 addition & 1 deletion src/odbc.cr
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ require "db"
require "./odbc/**"

module ODBC
VERSION = "0.1.6"
VERSION = {{ `shards version "#{__DIR__}"`.chomp.stringify }}
end
2 changes: 1 addition & 1 deletion src/odbc/result_set.cr
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class ODBC::ResultSet < DB::ResultSet
ival = uninitialized Int64
check LibODBC.sql_get_data(@stmt_handle, col, LibODBC::SQL_C_SBIGINT, pointerof(ival), 0, pointerof(ind_ptr))
ind_ptr == LibODBC::SQL_NULL_DATA ? nil : ival
when LibODBC::SQL_REAL, LibODBC::SQL_FLOAT, LibODBC::SQL_DOUBLE
when LibODBC::SQL_REAL, LibODBC::SQL_FLOAT, LibODBC::SQL_DOUBLE, LibODBC::SQL_NUMERIC, LibODBC::SQL_DECIMAL
fval = uninitialized Float64
check LibODBC.sql_get_data(@stmt_handle, col, LibODBC::SQL_C_DOUBLE, pointerof(fval), 0, pointerof(ind_ptr))
ind_ptr == LibODBC::SQL_NULL_DATA ? nil : fval
Expand Down

0 comments on commit 110ef92

Please sign in to comment.