I’ve written a time clock routine to keep track of clock-in/out times for employees:
function Clock_In_Out(event)
{
//Declare Variables
var query;
var dataset;
var date = new Array(stamp_in) + "%";
// var date = stamp_in + "%";
var user = userName;
var uid = security.getUserUID(user);
var pass = password;
if(security.checkPassword(uid, pass))
{
query = "Select timeclock_id from timeclock where account_name = ? and stamp_in like ?";
dataset = databaseManager.getDataSetByQuery(databaseManager.getDataSourceServerName(controller.getDataSource()),query,[user,date],1);
if(dataset.getMaxRowIndex() > 0)
{
controller.loadRecords(dataset);
controller.find();
account_name = user;
stamp_out = "^=";
controller.search();
if(controller.getMaxRecordIndex() > 0)
{
//If a record is found, run clock out routine
Clock_Out();
}
else
{
//If not, run clock in routine
Clock_In(user,uid)
}
}
else
{
Clock_In(user,uid);
}
}
else
{
Close(event);
application.beep();
plugins.dialogs.showErrorDialog('Error','That is not a valid username/password combination.','OK');
}
}
This routine worked in Sybase before we upgraded to 5.2 with PostgreSQL. I’m now getting this error: ERROR: operator does not exist: timestamp without time zone ~~ character varying . Here is part of the log file:```
2010-10-11 16:53 AWT-EventQueue-0 ERROR com.servoy.j2db.util.Debug Select timeclock_id from timeclock where account_name = ? and stamp_in like ? parameters: [‘nicholas’ ,type: java.lang.String, ‘[Wed Apr 21 10:19:41 CDT 2010]%’ ,type: java.lang.String]
Stamp_in is set in the function Clock_In() like so: stamp_in = new Date(). When I look at the column stamp_in using pgAdmin I see: 2010-04-21 10:19:41.386. It also says that the column stamp_in is **timestamp without time zone**.
Aside from the "timestamp without time zone" error, I'm also having trouble with the "like" operator. In pgAdmin I tried this query:
Select timeclock_id from timeclock where account_name = ‘nicholas’ and
stamp_in like ‘2010-04-21%’
and got this error:
ERROR: operator does not exist: timestamp without time zone ~~ unknown
LINE 2: stamp_in like ‘2010-04-21%’
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
The help is appreciated!