Lapo:
I changed all the date fields to varchar, just to be able to continue working until you explain how to use the date functions in h2.
but now I have an error in the extension that I cannot find. This is the code:
Code: Select all
function iniciarSesion(nombre){
trace("iniciar sesion")
var ver = 1
sql = "SELECT * FROM SESIONES WHERE NAME ='"+_server.escapeQuotes(nombre)+"'"
sql += " AND VIVA='" +_server.escapeQuotes(ver)+ "'"
trace ("SQL+ "+sql)
queryRes = dbase.executeQuery(sql)
if(queryRes != null && queryRes.size()>0) {
trace("size>0")
var indice = (queryRes.size() - 1)
var tempRow = queryRes.get(indice);
var fecha = tempRow.getItem("FECHA");
var hora = tempRow.getItem("STARTTIME");
trace("indice "+ indice + " fecha "+fecha);
ya = ("you are still logged in since "+hora);
}
else
{
trace("208 ===================");
//===================================
var fechaStr:String = "29-04-2009";
var tStamp:String = "1234567890";
trace("211 Not size >0 " + fechaStr +" "+tStamp);
sql = "INSERT INTO SESIONES (NAME,FECHA STARTTIME,STOPTIME,USOLINK,VIVA) VALUES ("
sql += "'" + _server.escapeQuotes(nombre) + "', "
sql += "'" + _server.escapeQuotes(fechaStr) + "', "
sql += "'" + _server.escapeQuotes(tStamp) + "', "
sql += "'" + _server.escapeQuotes(null) + "', "
sql += "'" + _server.escapeQuotes(null) + "', "
sql += "'" + _server.escapeQuotes(ver) + "')"
var success = dbase.executeCommand(sql);
if (success)
{
trace("224 success Sesion"+ nombre)
} else
{
trace("227 failure Sesion"+ nombre)
error = "database error Sesion"
}//===============================
}
}
when I save the extension, the server says
Error in extension [ mandalogin.as ]: missing ; before statement (mandalogin.as#1693) Internal:210 -- Line number: 209 in file mandalogin.as
and does not start the extension.
when I comment out the part between the two //=====================
the error message disappears and the extension starts, but of course, I cannot create the "SESIONES" record
Can you see what ; I am missing?
Thank you