Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inserting binary data into BLOB column in sqlite fails with "unhandled exception: unrecognized token" #235

Closed
sgmihai opened this issue Jun 10, 2023 · 4 comments · Fixed by #252
Assignees

Comments

@sgmihai
Copy link
Contributor

sgmihai commented Jun 10, 2023

Just like the error here: nim-lang/db_connector#12
Code to reproduce:

import asyncdispatch, httpclient, json
import allographer/[connection, schema_builder, query_builder]

proc createTable(myDb: Rdb) {.async.} =
  myDb.create([
    table("mytable", [
      Column.uuid("id"),
      Column.binary("blob").nullable()
    ])
  ])

proc main() {.async.} =
  let myDb = dbOpen(Sqlite3, "mydb.db", maxConnections=10, timeout=30)
  await createTable(myDb)

  let binFile = newHttpClient().getContent("https://cdimage.debian.org/debian-cd/current/amd64/bt-cd/debian-11.7.0-amd64-netinst.iso.torrent")
  let data = %*{
    "id": 1,
    "blob": binFile
    }
  
  myDb.table("mytable").insert(data).await

waitFor main()
@sgmihai
Copy link
Contributor Author

sgmihai commented Jun 10, 2023

I found this commit that was not merged for some reason. 6 year old problem, very sad for nim:
nim-lang/Nim@6fa82a5

@itsumura-h itsumura-h self-assigned this Jul 17, 2023
@sgmihai
Copy link
Contributor Author

sgmihai commented Jul 18, 2023

Thank you, I will try to implement it.
But what about fixing it in allographer ?

@itsumura-h
Copy link
Owner

@sgmihai
I have not yet made changes to allogrpher itself. I will work on it later. Please wait for a few days.

itsumura-h added a commit that referenced this issue Aug 5, 2023
itsumura-h added a commit that referenced this issue Sep 25, 2023
…dled exception unrecognized token (#252)

* wip

* wip

* fix sqlite query #235

* sqlite create table

* sqlite alter table

* wip postgre insert binary

* postgres query

* postgres schema builder

* wip test query

* sqlite test_query

* wip postgres test query

* fix update placeholder

* postgres update delete

* postgres test query

* fix sqlite test query

* fix postgres

* wip mariadb

* wip mariadb

* wip

* wip mariadb binary insert

* wip test.c

* success mysql query

* mariadb test

* aggregate test

* rm test_query

* wip mysql test query

* mysql test query

* delete not used import

* wip test surreal query

* wip surrealdb get test success

* surrealdb insert test success

* surrealdb update test success

* surrealdb delete test success

* surrealdb raw test success

* wip surreal aggregate test

* success surreal query test

* delete unused surreal import

* success surreal test

* sqlite schema test

* postgres schema test

* mariadb schema test

* wip mysql schema

* mysql schema test

* fix test run code

* fix rm binary code

* postgres transaction test

* sqlite transaction test

* mariadb transaction test

* mysql transaction test

* rm unused code

* postgres return type test

* sqlite return type test

* mariadb return type test

* mysql return type test

* fix surreal autoincrement

* remove unused

* delete old backups

* compile for only uses database

* delete unnecessary isExists

* fix warning

* nimble docs

* insert binary test

* fix

* fix test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants