Date only parses when you trace it

(Luke) #1

Hi all,

I had a blog that I backed up in JSON format and I also had create a small command line application to generate all the blog posts into a custom database I had installed locally on my Windows machine. It had all imported successfully with no errors.

Building the same application on Linux (elementary OS to be more specific), and I end up with the following error:

'Date') Incorrect datetime value: 'Date' for column 'dateposted' at row 1

The code used to generate the date value is as follows:

var date = Date.fromString(post.updated_at);
news.dateposted = date;

news.dateposted is a type SDateTime but when I use the insert function on the SPOD object, the error as above occurs.

However, adding the following trace call as below:

var date = Date.fromString(post.updated_at);
news.dateposted = date;

Works, as if for some reason in C++ context, the date is not valid until it’s value is used at runtime in that specific circumstance. I’m wondering if there may be a bug in hxcpp or if it’s a bug in Haxe. I shouldn’t have to trace the date value in order that the SPOD macro successfully inserts Mysql records, that seems very unusual.