problem with dbmysql mod

BlitzMax Modules Forums/Brucey's Modules/problem with dbmysql mod

Hi Brucey
I've been using your dbmysql module. Mostly it works great and it is a fantastic addition to BMax!

I've run into the following 2 problems. I'm not sure if they are bugs or me just being stupid ;-)

1) TDatabaseQuery.lastInsertedID() creates an memory access error
2) a Date field doesn't get returned in a SELECT query.

here is some testing code:
SuperStrict

Framework BaH.DBMySQL

Local db:TDBConnection = LoadDatabase("MYSQL", "maxtest", Null, 0, "????", "????") 

If Not db Then
	DebugLog("Didn't work...")
	End
End If

If db.hasError() Then
	errorAndClose(db)
End If

If db.isOpen() Then

	db.executeQuery("DROP TABLE if exists person")
'DebugStop
	' Create a new table
	Local sQ:String = "CREATE TABLE if not exists person (id integer primary key AUTO_INCREMENT, " + ..
	  " forename varchar(30), surname varchar(30), age integer, date_added date)"
	db.executeQuery(sQ) 

	If db.hasError() Then
		DebugLog sQ
		errorAndClose(db) 
	End If
	
	sQ = "INSERT INTO person SET id=NULL"
	sQ = sQ + ", forename='James'"
	sQ = sQ + ", surname='Smith'"
	sQ = sQ + ", age=28"
	sQ = sQ + ", date_added=NOW()"
	DebugLog sQ
	Local query:TDatabaseQuery = db.executeQuery(sQ) 

	If db.hasError() Then
		
		errorAndClose(db) 
	End If
	
	' get the last ID
	DebugLog "last insterted ID = " + query.lastInsertedId()  '<-------this causes memory access error!?
		
	' prepare select
	sQ = "SELECT * FROM person"

	query = db.executeQuery(sQ) 
	If db.hasError() Then
		errorAndClose(db)
	End If

	While query.nextRow() 
		Local record:TQueryRecord = query.rowRecord()
		
'DebugStop
		DebugLog(" ID: " + record.getInt(0) + ", FName: " + record.getString(1) + ..
			", Surname: " + record.getInt(2) + ", Age: " + record.getInt(3) + ..
			", Date added: " + record.getString(4)) '<<<------ this date field returns empty ???
	Wend
			
	db.close()
End If

Function errorAndClose(db:TDBConnection)
	DebugLog(db.error().toString())
	db.close()
	End
End Function