1. Alexis Colon Lugo
  2. Valentina Server
  3. 金, 7月 12 2019, 01:54 PM
  4.  メールで購読
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.
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.
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.
Sergey Pashkov 承諾済みの回答
Hi Alexis,

That is correct.

If you get an error about insert command you can erase and retype " Insert" part with quotes.
コメント
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.
  • ページ :
  • 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. 2 subcategories
BETA Testing
  1. 0 subcategories
Education & Research
  1. 0 subcategories