nim-lang / db_connector

Unified db connector in Nim
MIT License
18 stars 5 forks source link

mysql wrapper doesn't support row with NULL column. #10

Open ekarlso opened 9 years ago

ekarlso commented 9 years ago
home/karlsone/projects/nim-lang/packages/test 
@[1, mysql, aaa, mit, http://vg.no, ekarlso]
@[2, amqp, 1, MIT, http://github.com/ekarlso/nim-amqp, ekarlso@gh]
Traceback (most recent call last)
test.nim(6)              test
system.nim(1979)         $
system.nim(1961)         collectionToString
SIGSEGV: Illegal storage access. (Try to compile with -d:useSysAssert -d:useGcAssert for details.)
Error: execution of an external program failed
dom96 commented 9 years ago

Duplicate of nim-lang/Nim#1359 and nim-lang/Nim#1477

dom96 commented 7 years ago

This is IMO still an issue and since nim-lang/Nim#1477 has been closed I will reopen this. We need to figure out a way to support NULL columns in the db* modules.

dom96 commented 6 years ago

@Araq Maybe we should change the API to use Option[T]?

Araq commented 6 years ago

No, let's add overloads that accept Json. It can be more efficient this way for integers etc. Option[T] would be Option[string] which is just as weird.

dom96 commented 6 years ago

Couldn't we come up with some sort of simple type-safe API using a macro? Abusing JSON for this seems odd.

Araq commented 6 years ago

Hmm, ok. So it would be varargs[typed]? Nice idea, could work.

dom96 commented 6 years ago

Marking as high priority so that we do this soon.

dom96 commented 6 years ago

This doesn't require breaking changes so I'm demoting it.

Stuffe commented 4 years ago

Any suggested temporary work around to this? This has got me quite stuck at the moment

Araq commented 4 years ago

Tried https://github.com/Senketsu/nim-db-ex ?

Stuffe commented 4 years ago

Araq, I ended up setting the last bit in every byte to 1 and putting those lost bits in an extra byte every 8 bytes. Insanely disgusting but avoids null bytes and I had to come up with something fast

jfilby commented 3 years ago

I have this problem constructing complex inserts with db_postgres. I would say the solution is to use Option[T] as it is the most straightforward and the concept of options map to null/not null quite well.