The object value sent is a JSON object:
{"userID":6ce3ef04cb2cb750d4ce0d0f9648066f"}
Whenever the hash begins with a number, the value is converted to a number. If the hash begins with a letter, ie. "a6ce..." Then it stores as a string correctly. Sometimes it even stores as a date.
The value should only be converted into a number if not wrapped in quotes and contains only numbers. Or if a field is set to numeric. Am I right?
The regex in OrientDB used to recognize the "c" after the "6" is making it look like a number is the value. And in my case it is a hash.
OrientDB should look at the whole value instead of a number and the first character after.
Hopefully it is an easy fix. We are using the latest version from git.
Thanks!!
Hi,
Why the value isn't between quotes?
Sent from Mobile device
--
---
You received this message because you are subscribed to the Google Groups "OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to orient-databa...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
The value is wrapped with quotes. It is with a SQL INSERT command. Haven't tested with UPDATE.
Try it with the exact value I sent. I was able to recreate each time.
When I insert the hash, only "6" is actually inserted, not the full hash.
I believe it is the formatting of the BigDecimal. Since this example starts off with "6c...". It only inserts "6".
You received this message because you are subscribed to a topic in the Google Groups "OrientDB" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/orient-database/KYwZrXaL_LE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to orient-databa...@googlegroups.com.
Typo in my initial email. The actual object sent is:
{"userID":"6ce3ef04cb2cb750d4ce0d0f9648066f"}
I'm trying to find the number formatting in the source code. I think if it is temporarily turned off, it will fix the insert.
As a permanent fix, if the number formatting is fixed it should recognize a value of "6c" is different than "6ce3ef04cb2cb750d4ce0d0f9648066f"
Now that I think of it, the numbers shouldn't be formatted unless a schema is specified and a number field is set.
What if I wanted to insert a string of, "6c"? OrientDB will insert it as "6" even though I specified the field as string. Or what if I don't even specify a string field property, a schema-less case? I wouldn't want OrientDB to format "6c" as a number if I actually wanted it as a string value (for whatever reason).
Thanks Luca!
| @rid | @version | @class | id |
|---|---|---|---|
| #14:0 | 1 | Users | 6ce3ef04cb2cb750d4ce0d0f9648066f |
Sure.It works perfectly when placing the value in the SQL directly. Where it inserts it incorrectly is when used with a prepared query. So in the GratefulDeadConcerts database, try:INSERT INTO V SET id=:idThen add the params:{"id":"6ce3ef04cb2cb750d4ce0d0f9648066f"}Then get the resulting record:SELECT * FROM V WHERE id ="6"You'll get back the incorrect record. Which is why I'm assuming it has something to do with the parsing of the prepared query.
ODatabaseDocument db = ODatabaseDocumentPool.global().acquire("remote:localhost/test", "admin", "admin");
Map<String,Object> parms = new HashMap<>();
parms.put("hash", "6ce3ef04cb2cb750d4ce0d0f9648066f");
Object result = db.command(new OCommandSQL("insert into test set hash=:hash")).execute(parms);
System.out.println(result);
I can get it working if I try:params:{"id":"\"6ce3ef04cb2cb750d4ce0d0f9648066f\""}