vapor-community / sqlite-driver

SQLite driver for Fluent
MIT License
10 stars 15 forks source link

Add fix for SQLite strings being coerced to numbers internally #12

Closed harlanhaskins closed 8 years ago

harlanhaskins commented 8 years ago

SQLite has a neat "feature" where any data type that does not contain TEXT, CLOB, or CHAR will be treated with NUMERIC affinity. All SQLite STRING fields should instead be declared with TEXT

This also adds a test that ensures that a string containing a large number will remain encoded as a string and not get coerced to a number internally.

More information: https://www.sqlite.org/datatype3.html

This new test fails miserably (the data is returned as "Inf" instead of the long string of 1s) with the old behavior, and passes with the new.

codecov-io commented 8 years ago

Current coverage is 83.87% (diff: 87.50%)

Merging #12 into master will increase coverage by 7.87%

@@             master        #12   diff @@
==========================================
  Files             1          8     +7   
  Lines            50        217   +167   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits             38        182   +144   
- Misses           12         35    +23   
  Partials          0          0          

Powered by Codecov. Last update e7763a2...1da764e

tanner0101 commented 8 years ago

Thanks!