Closed Balrog994 closed 1 year ago
Ok, looks like I have an update.
It turns out the problem was a \n
in a string. Looks like I cannot use \n
as an escape sequence in a string and the server returns an error, but the client library does not handle nor throws the error and just hangs there.
BTW, anyone knows how to encode a newline in a string? 😄
My temporary fix was to replace all \n and \t characters with a space " " and split queries by the ;
seperator.
This issue is also in surrealdb/surrealdb https://github.com/surrealdb/surrealdb/issues/90
I think the library should at least throw an error in this case instead of just hanging indefinitely, even if the error is due to a bug in the server parser. The REST API correctly returns an error (not really useful to "debug" the problem but at least you get an error).
Hi @LeoDog896 , @Balrog994 , there is a fix coming to the database for this, and a new beta release coming this weekend!
It will support escaped characters like in JSON strings (\b
, \n
, \f
, \r
, \t
) and unicode characters \u1234
.
@tobiemh That's exciting to hear! am I correct in assuming the new release would also fix the problem of not being able to insert objects that have been JSON.stringify
'd more than twice? (ex : '{"foo":"{\\"bar\\":\\"baz\\"}"}'
)
Absolutely @abdoufma 👍
@Balrog994 fixed with surreal 1.0.0-beta.8. @tobiemh close this.
I'm trying to import 17652 rows from SQL Server to SurrealDB to make some tests. I wrote a small nodejs script that connects to SQL Server, reads the contents of a table and then calls
db.create
for each row (maybe a bulk insert method in the future? :D)After exactly 9360 rows, every time I tested it, the script just hangs on a
db.create
and never returns. I'm using the standard docker container version of SurrealDB running on Docker Desktop.The script is pretty simple as shown above. After it hangs, selecting from SurrealDB shows that exactly 9360 rows where created, on a total of 17652 to be created.
Am I doing something wrong?
Thanks!