1. Alexis Colon Lugo
  2. Valentina Server
  3. Friday, July 12 2019, 01:54 PM
  4.  Subscribe via email
Dim sqlLocation As Text = App.mSessionURL + "/sql_fast"
mSQLSocket.Start( App.mHost, App.mSessionID, sqlLocation, "SQLite", "ipadcrnew.db", " Insert into main(socionum,name,last_name,cell,address) value ( '2' , 'jose' , 'lugo' , 'abc' , 'jajaj' );";)
Comment
There are no comments made yet.
Alexis Colon Lugo Accepted Answer
thanks
now works it was the database extension was missing
Comment
There are no comments made yet.
Sergey Pashkov Accepted Answer
Does the call to this socket look like

mSQLSocket.Start( App.mHost, App.mSessionID, sqlLocation, "SQLite", "ipadcrnew.db"

?
Comment
There are no comments made yet.
Alexis Colon Lugo Accepted Answer
Same error


// Set the request authentication headers
RequestHeader("Accept";) = "application/json"
RequestHeader("Content-Type";) = "application/json"
RequestHeader("Cookie";) = inSessionID

Dim url As Text = inHost + inSQLURL

// Prepare data
Dim dict As New Dictionary
dict.Value("vendor";) = inSQLVendor.ReplaceAll(Text.FromUnicodeCodepoint(&hFEFF ),"";)
dict.Value("database";) = inSQLDatabase.ReplaceAll(Text.FromUnicodeCodepoint(&hFEFF ),"";)
dict.Value("query";) = inQuery.ReplaceAll(Text.FromUnicodeCodepoint(&hFEFF ),"";)

Dim json As Text = Xojo.Data.GenerateJSON(dict)
Dim data As MemoryBlock = Xojo.Core.TextEncoding.UTF8.ConvertTextToData(json)

SetRequestContent(data,"application/json";)

// Send the POST request
Send("POST",url)
Attachments (1)
Comment
There are no comments made yet.
Sergey Pashkov Accepted Answer
The error is in database name again, please add ReplaceAll to vendor and database
Comment
There are no comments made yet.
Alexis Colon Lugo Accepted Answer
// Set the request authentication headers
RequestHeader("Accept";) = "application/json"
RequestHeader("Content-Type";) = "application/json"
RequestHeader("Cookie";) = inSessionID

Dim url As Text = inHost + inSQLURL

// Prepare data
Dim dict As New Dictionary
dict.Value("vendor";) = inSQLVendor
dict.Value("database";) = inSQLDatabase
dict.Value("query";) = inQuery.ReplaceAll(Text.FromUnicodeCodepoint(&hFEFF ),"";)

Dim json As Text = Xojo.Data.GenerateJSON(dict)
Dim data As MemoryBlock = Xojo.Core.TextEncoding.UTF8.ConvertTextToData(json)

SetRequestContent(data,"application/json";)

// Send the POST request
Send("POST",url)
Attachments (1)
Comment
There are no comments made yet.
Sergey Pashkov Accepted Answer
Hello Alexis,

It's easy to fix query in Xojo code, just modify DoSQLSocket Start method:
...
dict.Value( "query" ) = inQuery.ReplaceAll( Text.FromUnicodeCodepoint(&hFEFF ), "" )
...

It removes all BOM characters, both for SQLite and Valentina DBs.
Comment
There are no comments made yet.
Sergey Pashkov Accepted Answer
Unfortunately, it can cause problems for Valentina DB, too. It is really unexpected to get Byte Order Mark from Xojo source code.
So, until we start to filter it, the best way is to clear BOM in the HEX editor (backup Xojo project before modification!).

Another option is to filter it in your application code. I'll try to add an example tomorrow.
Comment
There are no comments made yet.
Alexis Colon Lugo Accepted Answer
Ok
If I use Valentina DB and no SQLite can this works without problems
Comment
There are no comments made yet.
Sergey Pashkov Accepted Answer
Yes, should not be a problem with Valentina.

In case you want to see how to fix Xojo project removing these characters:
https://www.dropbox.com/s/ln23dm602iexo48/xojo_remove_bom.mp4?dl=0

Hex Fiend editor was used:
https://github.com/ridiculousfish/HexFiend/releases/download/v2.8.0/Hex_Fiend_2.8.dmg
Comment
There are no comments made yet.
Alexis Colon Lugo Accepted Answer
Ok
If I use Valentina and not Sqlite the rest API shut works without these problems
Comment
There are no comments made yet.
Sergey Pashkov Accepted Answer
It is SQLite problem, but I don't think they will change anything, so we have to erase Byte Order Mark characters either in code or on the server side.

Is the error again about "socionum" column?
If you can send me the project, even clearing sensitive data (password, login), I'll fix it in code.

In the future versions, I think we'll add BOM erasing on the Valentina Server specifically for SQLite.
Comment
There are no comments made yet.
Alexis Colon Lugo Accepted Answer
Ok
so this is an error from XOJO or Valentina SQLite Rest.

thanks
Comment
There are no comments made yet.
Sergey Pashkov Accepted Answer
Then invisible characters were inserted again.
I created an issue in mantis to remove these characters for SQLite.
If you wish you can send me the project, I'll check it with the HEX editor and remove them.
Comment
There are no comments made yet.
Alexis Colon Lugo Accepted Answer
so 2019r1 no works or what is the problem i retype all select and insert statement
Comment
There are no comments made yet.
Alexis Colon Lugo Accepted Answer
Comment
There are no comments made yet.
Sergey Pashkov Accepted Answer
The same problem - invisible characters (Byte Order Mark) before the "socionum".
It is necessary to retype the query including quotes.

Still not sure where these characters come from to the Xojo source, maybe we can get rid of them.
Actually, Valentina engine just ignores them, but SQLite recognizes them as ordinary characters.
Attachments (1)
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Server
  3. # 16
Alexis Colon Lugo Accepted Answer
my last rest log
Attachments (1)
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Server
  3. # 17
Sergey Pashkov Accepted Answer
Please try to execute INSERT statement using the REST interface and attach a log with an error about it.
It is necessary to check the query in this log.
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Server
  3. # 18
Alexis Colon Lugo Accepted Answer
VS logs
Attachments (1)
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Server
  3. # 19
Sergey Pashkov Accepted Answer
Not copy-pasting the terminal output, please attach the file vserver_20190712_090517.log itself.
Copy-paste doesn't preserve invisible characters we're interested in.
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Server
  3. # 20
  • Page :
  • 1
  • 2


There are no replies made for this post yet.
However, you are not allowed to reply to this post.

Categories

Announcements & News
  1. 0 subcategories
Valentina Studio
  1. 2 subcategories
Valentina Server
  1. 4 subcategories
Valentina Database ADK
  1. 0 subcategories
Valentina Reports ADK
  1. 0 subcategories
Other Discussions
  1. 0 subcategories
BETA Testing
  1. 0 subcategories
Education & Research
  1. 0 subcategories
Omegabundle
  1. 0 subcategories