MariaDB query Error

image

Try this instead:

cData = cData.Trim.Left(10)

Report What happens

If cData still breaks, look at its binary representation (gremlins?)

It could be something to do with this ?

See the Encoding. It seems that it is encoded as US-ASCII ?

Here is the binary version of it

Easy to test now.

Same error with the Left(10) and i still don’t get it why it sees the Type as 9 and not 8

There’s something wrong at your end. Here it works.

What OS?

XOJO 2023R1.1
MacOS Ventura 13.4.1(c)

Server
Debian 11
MariaDB 10.11.4 - updated to the latest 10 stable

Stated on the first post

On Windows, this works:


Var d As Datetime

Var s As String = "1992-03-29"
s = s.DefineEncoding(Encodings.ASCII)

d = DateTime.FromString(s)

break

As said the weird part is that i Deleted that date from the database and add it manually again, so it should not happen but still it did the same thing .

Run this sample. Does it crash?

yeap,

same crash , but just for this date

@Aurelian_N Can you change that to 1992-03-28 and see if it crashes?

Do something change if:

Var d As Datetime

Var s As String = "1992-03-29"
s = s.DefineEncoding(Encodings.ASCII)

d = DateTime.FromString(s , Locale.Raw)

break

By the way, that’s a Xojo bug. If some people can’t reproduce it, it may be related to your locale.

28 works

So the issue is 1992-03-29 for some reasons

I told you is your Time Zone and Daylight saving time. You need to change the hour to 01:00:00 for example.

Have you tried the suggestion?

but WHY ? i mean it’s not like it’s February and in that year there is no 29 for god sake and again, original data does not have 00:00:00, and i delete it after so it should not even be there

Xojo Bug

Great, i’ll file a bug report , thanks again for all the help

But please, Check if those workarounds can work at your side:

First try:

d = DateTime.FromString(s , Locale.Raw)

Second:

d = DateTime.FromString(s , Locale.Raw, New TimeZone(0))

Using my crashing sample, but changing that line.

Same error “Parse error: date needs to be in the format of YYYY-MM-DD HH:MM or YYYY-MM-DD”