crystal-lang / crystal-mysql

MySQL connector for Crystal
MIT License
107 stars 36 forks source link

added tinyint and smallint as int8 and int16 #15

Closed crisward closed 7 years ago

crisward commented 7 years ago

Hopefully fixes #12

crisward commented 7 years ago

I've noticed with both these Int8, Int16 and Time types, they needed to be added here too, https://github.com/crystal-lang/crystal-db/blob/master/src/db.cr#L72

otherwise I get the following errror

in src/app/pages/page-repository.cr:105: instantiating 'DB::Database#exec(String, (String | Nil), (Int32 | Nil), (String | Nil), (String | Nil), (String | Nil), (Int8 | Nil), (Int8 | Nil), (Int32 | Nil), (String | Nil), String, String, Int32)'

      res = @db.exec("
                ^~~~

I'm using db v.0.2.0

crisward commented 7 years ago

The failing tests seem to have nothing to do with the code pushed. Any idea when travis will be fixed and if this change will be merged. Working from by own fork at the moment but it's not ideal.

bcardiff commented 7 years ago

squashed/merged at a1db0df999cd6247b946745893ed98979cc113a9. I added some missing specs for covering the params binding of the last commit

diff --git a/spec/driver_spec.cr b/spec/driver_spec.cr
index 36a7a9b..24164b7 100644
--- a/spec/driver_spec.cr
+++ b/spec/driver_spec.cr
@@ -96,7 +96,7 @@ describe Driver do
     end
   end

-  {% for value in [1, 1_i64, "hello", 1.5, 1.5_f32] %}
+  {% for value in [54_i16, 1_i8, 5_i8, 1, 1_i64, "hello", 1.5, 1.5_f32] %}
     it "executes and select nil as type of {{value.id}}" do
       with_db do |db|
         db.scalar("select null").should be_nil

Thanks!

crisward commented 7 years ago

Cool, many thanks.