1. Jochen Peters
  2. Valentina Reports ADK
  3. Wednesday, February 17 2016, 05:56 PM
  4.  Subscribe via email
I just upgraded to V6 of Studio and adk using Xojo.

When I run my application from Xojo it throws an exception when I go to print a report that was created with version 5 this is the error message:

***************************
Exception Message: Datasource error: "Error( 1064 ) 42000: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '䕓䕌呃琠汢数灯敬倮牥潳䥮ⱄ䌠乏䅃⡔扴灬潥汰⹥楆獲乴浡' at line 1"".
Exception Error Number: 611604
***************************

I have no idea why the Chinese characters are showing. Also the SQL statement is not the problem it works fine.

Please this is very urgent!
Comment
There are no comments made yet.
Beatrix Willius Accepted Answer
Been there, done that, have the scars to prove it.

Before Valentina 6 the default encoding was UTF8. With Valentina 6 it became UTF16. Check your code for anything with Nil encoding going into Valentina. Use a DefineEncoding and everything should work.

There should be warnings when Valentina encounters a Nil encoding with the latest versions. This cost me a lot of time.
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Reports ADK
  3. # 1
Jochen Peters Accepted Answer
This is a problem. What about all my other apps that were done with version 5. If a version 6 app gets installed will it cause this in other apps.

Could you be more specific as to what I need to do.

If I have to change code everywhere I send a SQL to Valentino then I'm going to be pretty upset, I have hundreds in several apps!

Hey Roslin, What about it!

Thanks for your input.
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Reports ADK
  3. # 2
Beatrix Willius Accepted Answer
I already has a nice discussion with Ruslan about this little issue.

If you do

theSQL = "select something from table"

then the SQL is fine. But concatenating strings where one string has Nil encoding is causing the problem. In the code below the variable theRecIDs didn't have an encoding because it was from drop data. And yes you have to check all your SQL.

if obj.RawDataAvailable("MAXX";) and me.NodeDropped <> nil and RowCanBeDroppedOn(me.NodeDropped) then
dim theRecIDs as String = obj.RawData("MAXX";)
theRecIDs = DefineEncoding(theRecIDs, Encodings.UTF8)
dim MailboxPath as String = me.NodeDropped.Tag
me.NodeDropped = nil
try
dim theSQL as string = "update Message set MailboxID = (select Mailbox.recid from Mailbox where Mailbox.MailboxPath = '" + Valentina.EscapeString(MailboxPath) + "') where RecID in " + theRecIDs
call theDatabase.SqlExecute theSQL

me.ReloadDependendData
catch err as VException
globals.theErrorLog.DialogErrorProceed kErrorDrop + " " + str(VException(err).ErrorNumber) + " " + VException(err).Message
end try

end if
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Reports ADK
  3. # 3
Jochen Peters Accepted Answer
This blows!

Hey Serge what about it????

So your saying a statement such as:
SELECT
tblpeople.PersonID ,
CONCAT(
tblpeople.FirstName ,
' ' ,

IF(
tblpeople.Middle <> '' ,
tblpeople.Middle ,
''
) ,
' ' ,
tblpeople.LastName ,

IF(
tblpeople.NameSuffix <> '' ,
Concat(', ' , tblpeople.NameSuffix) ,
''
)
) AS `Name` ,

Could cause the problem?

In the code above you are using UTF8 Not UTF16?

I don't really understand Encoding that well.

What about my other apps that are on Ver 5 of the adk?
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Reports ADK
  3. # 4
Ruslan Zasukhin Accepted Answer
[2/17/16, 10:47:27 PM] Richard S Albrecht: You think the select string could be causing it
[2/17/16, 10:47:34 PM] Richard S Albrecht: and not the data

[2/17/16, 10:47:40 PM] Ruslan Zasukhin: yes
[2/17/16, 10:47:48 PM] Ruslan Zasukhin: trouble is in Xojo Strings
[2/17/16, 10:47:56 PM] Ruslan Zasukhin: check them in debugger

[2/17/16, 10:47:57 PM] Richard S Albrecht: That's easy to test

[2/17/16, 10:47:59 PM] Ruslan Zasukhin: pelase ask Beatrix
[2/17/16, 10:48:11 PM] Ruslan Zasukhin: to show you snapshot in debuger

[2/17/16, 10:50:01 PM] Richard S Albrecht: Debugger shows it as nil! That's it.
[2/17/16, 10:54:41 PM] Richard S Albrecht: It's fixed
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Reports ADK
  3. # 5
Sergey Pashkov Accepted Answer
As it's a quite often problem, I'll add a detailed description.

Such problematic strings have Encoding property equals to Nil, and it is clearly visible in the debugger (see nil-encoding.png).

It is also possible to check it programmatically:

If broken_string.Encoding = Nil Then
stdout.WriteLine( "Encoding is Nil" )
End if


Internally in V4RB we use Xojo-provided conversion method, which relies on this encoding (not necessarily UTF16, it should have correct data encoding, but not Nil), and when encoding is not set, or set wrong - it produces weird results.

Two ways to resolve:
1. (Preferable) Find places where strings become nil-encoded and define an encoding.
2. Define an encoding before passing to V4RB.

A demonstration:

Dim m As New MemoryBlock(13)
m.Byte(1) = 72
m.Byte(2) = 101
m.Byte(3) = 108
m.Byte(4) = 108
m.Byte(5) = 111
m.Byte(6) = 32
m.Byte(7) = 87
m.Byte(8) = 111
m.Byte(9) = 114
m.Byte(10) = 108
m.Byte(11) = 100
m.Byte(12) = 33

// Create broken string, Encoding = Nil
Dim broken_string As String = m.StringValue(1,8)

// Create normal string, Encoding = UTF8
Dim good_string As String = "Good String"

// Concatenation produces broken string, Encoding = Nil
Dim concatenated_string String = good_string + broken_string

// Encoding fixed, using DefineEncoding( str, Encodings.UTF8 )
broken_string = DefineEncoding( broken_string, Encodings.UTF8 )
concatenated_string = DefineEncoding( concatenated_string, Encodings.UTF8 )
Attachments (1)
Comment
There are no comments made yet.
  1. more than a month ago
  2. Valentina Reports ADK
  3. # 6
  • Page :
  • 1


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