Bah.dbmysql and datetime

BlitzMax Modules Forums/Brucey's Modules/Bah.dbmysql and datetime

I'm testing this module on a local database.
The table is a simple one with a DATETIME field.

Each record has 8 fields, i can get without errors all fields except the 7th (starting from 0) -> the datetime.

i try to get a string from the datetime field with:
Local dataReg:String =  TDBDateTime(record.value(7)).format("%Y-%m-%d %H:%M:%S")


No compile errors.

At runtime "Unhandled Exception: Attemp to access field or method of Null object" at that line.

Why is there this error?

The most likely reason is - I have not fully implemented Date/time support in all the database modules yet... :-/

I've added support for retrieving date/time fields now.

Your above example should work. You can also use .format(), since it has a default formatting if you want to use that.

Still got to sort out bindings, but one step at a time :-)

Awesome, i've been waiting on this one as well for a good while now (Cough: along with blob =p). Cheers

Tanks! Now it works :)

Been having issues with datetimes and prepared statements. Everything seems to be set up properly, but the "year" part is always zero after running execute() on a prepared statement.
It's all a bit strange. All the debug indicates that the structures are populated properly...

Otherwise, I've coded the full date/time implementation for MySQL.

Ho hum... :-/