You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Something goes wrong when trying to bind text to a prepared statement. I'm not sure if the binding is wrong or the language needs to patch something for it to work, but I couldn't get it working. I have confirmed that the arguments for the binding look right, they make sense according to documentation and examples I could find.
Reproduction:
Create a file with this code:
# Experimental!
Sqlite ~ "lib"
Sqlite~Open "test.db"
$ CREATE TABLE IF NOT EXISTS test (id INTEGER PRIMARY KEY, text TEXT);
Sqlite~Exec ⊙.
$ INSERT INTO test (text) VALUES (?);
Sqlite~Prepare ⊙.
Sqlite~BindText 1 "Hello world" . # yes, indexing into bindings starts at 1
Sqlite~ExecuteInsert
Sqlite~Close
Run the code. A file named "test.db" should be created without any errors.
Open the file in any sqlite viewer and view the "test" table. The one entry will have gibberish text. If you run the code multiple times, the table will have multiple rows with different gibberish text.
The same thing happens with blobs. I assume text eventually becomes a byte array and blobs are also just bytes, so the issue is probably the same. Consider this code:
# Experimental!
Sqlite ~ "lib"
Sqlite~Open "test.db"
$ CREATE TABLE IF NOT EXISTS test (id INTEGER PRIMARY KEY, blob BLOB);
Sqlite~Exec ⊙.
$ INSERT INTO test (blob) VALUES (?);
Sqlite~Prepare ⊙.
Sqlite~BindBlob 1 [1 2 3] .
Sqlite~ExecuteInsert
Sqlite~Close
Running this multiple times results in different bogus values getting inserted:
The text was updated successfully, but these errors were encountered:
Something goes wrong when trying to bind text to a prepared statement. I'm not sure if the binding is wrong or the language needs to patch something for it to work, but I couldn't get it working. I have confirmed that the arguments for the binding look right, they make sense according to documentation and examples I could find.
Reproduction:
The same thing happens with blobs. I assume text eventually becomes a byte array and blobs are also just bytes, so the issue is probably the same. Consider this code:
Running this multiple times results in different bogus values getting inserted:
![image](https://private-user-images.githubusercontent.com/1730245/330114889-7ee91928-265a-4640-a7e1-7fccf372fa4e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ3OTYxOTgsIm5iZiI6MTcyNDc5NTg5OCwicGF0aCI6Ii8xNzMwMjQ1LzMzMDExNDg4OS03ZWU5MTkyOC0yNjVhLTQ2NDAtYTdlMS03ZmNjZjM3MmZhNGUucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDgyNyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA4MjdUMjE1ODE4WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZDY2YWU1ZDRjYzAwNmE5ZmYxNDEyZDEzNjgxYjFkOTQ1ODc0MWE3NmNhOGY4ZGIzMDRmM2E0ZmNjNmE5NDNhYiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.I0QEqc-lj_PdQHFLLVE2_Ubva9P1KZEnho99eAEwDIo)
The text was updated successfully, but these errors were encountered: