Android Question Timestamp in MS Mysql problem

valekuatro

Member
Licensed User
I have a mysql db with a timestamp field named ultimaact. I can´t even get a "SELECT * from db" If i only delete this field the query is ok. Tried in other tables too, same result.
Any clue or workaround to store date & time in MySQL with MSMysql?
B4A 7.30
MSMysql 1.09
 

valekuatro

Member
Licensed User
MSMysql is a library of DonManfred to connect to a MySQL db
I´m running MySQL 5.5.50 in a Ubuntu server
Is this the right place to ask?
 
Upvote 0

valekuatro

Member
Licensed User
I don´t have it, i changed the code several times since then. However the problem persist. Check this code:
B4X:
db.ExecuteASync("UPDATE trm SET id ='"& PhoneMac &"',latitud ="& Latitud &",longitud ="& Longitud &",estado ="& "'ON'" &",ultimaact ="& "FROM_UNIXTIME("& dt &")" &" WHERE id = " & OldID &";","")
Log("UPDATE trm SET id ='"& PhoneMac &"',latitud ="& Latitud &",longitud ="& Longitud &",estado ="& "'ON'" &",ultimaact ="& "FROM_UNIXTIME("& dt &")" &" WHERE id = " & OldID &";")

This code throws :
SqlException: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '',-26.812326666666664,-65.20693666666666,FROM_UNIXTIME(1503853983))' at line 1

However, with PHPMyAdmin i copy and paste the command generated in the log and it works.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
How does the generated sqlquery looks like? . put it in a string and do a log before sending the query
 
Upvote 0

valekuatro

Member
Licensed User
Solved! after few days my code is a mess. Cleaning in depth and checking syntax all is working now. Thanks.
By the way, to solve the timestamp original problem I changed to datetime field and using FROM_UNIXTIME function and is working.

Regards
 
Upvote 0
Top