Bah.dbmysql and datetime

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

johnnyfreak(Posted 2009) [#1]
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?


Brucey(Posted 2009) [#2]
The most likely reason is - I have not fully implemented Date/time support in all the database modules yet... :-/


Brucey(Posted 2009) [#3]
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 :-)


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


johnnyfreak(Posted 2009) [#5]
Tanks! Now it works :)


Brucey(Posted 2009) [#6]
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... :-/