1. Alexis Colon Lugo
  2. Valentina Server
  3. Пятница, Июль 12 2019, 01:54 PM
  4.  Подписаться через 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' );";)
Комментарий
There are no comments made yet.
Alexis Colon Lugo Ответ принят
thanks
now works it was the database extension was missing
Комментарий
There are no comments made yet.
Sergey Pashkov Ответ принят
Does the call to this socket look like

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

?
Комментарий
There are no comments made yet.
Alexis Colon Lugo Ответ принят
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)
Вложения
Комментарий
There are no comments made yet.
Sergey Pashkov Ответ принят
The error is in database name again, please add ReplaceAll to vendor and database
Комментарий
There are no comments made yet.
Alexis Colon Lugo Ответ принят
// 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)
Вложения
Комментарий
There are no comments made yet.
Sergey Pashkov Ответ принят
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.
Комментарий
There are no comments made yet.
Sergey Pashkov Ответ принят
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.
Комментарий
There are no comments made yet.
Alexis Colon Lugo Ответ принят
Ok
If I use Valentina DB and no SQLite can this works without problems
Комментарий
There are no comments made yet.
Sergey Pashkov Ответ принят
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
Комментарий
There are no comments made yet.
Alexis Colon Lugo Ответ принят
Ok
If I use Valentina and not Sqlite the rest API shut works without these problems
Комментарий
There are no comments made yet.
Sergey Pashkov Ответ принят
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.
Комментарий
There are no comments made yet.
Alexis Colon Lugo Ответ принят
Ok
so this is an error from XOJO or Valentina SQLite Rest.

thanks
Комментарий
There are no comments made yet.
Sergey Pashkov Ответ принят
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.
Комментарий
There are no comments made yet.
Alexis Colon Lugo Ответ принят
so 2019r1 no works or what is the problem i retype all select and insert statement
Комментарий
There are no comments made yet.
Alexis Colon Lugo Ответ принят
logs
Вложения
Комментарий
There are no comments made yet.
Sergey Pashkov Ответ принят
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.
Вложения
Комментарий
There are no comments made yet.
Alexis Colon Lugo Ответ принят
my last rest log
Вложения
Комментарий
There are no comments made yet.
Sergey Pashkov Ответ принят
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.
Комментарий
There are no comments made yet.
Alexis Colon Lugo Ответ принят
VS logs
Вложения
Комментарий
There are no comments made yet.
Sergey Pashkov Ответ принят
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.
Комментарий
There are no comments made yet.
  • Страница :
  • 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