in contribs/ThomasFenner/JDBCLogger.java [303:375]
public boolean ready()
{
if(ready) return true;
if(!isconfigured){ errormsg = "Not ready to append ! Call configure() first !"; return false;}
//No need to doing the whole rest...
if(sql != null)
{
ready = true;
return true;
}
boolean msgcol_defined = false;
LogColumn logcol;
for(int i=0; i<num; i++)
{
logcol = (LogColumn)logcols.get(i);
if(logcol.ignore || !logcol.isWritable) continue;
if(!logcol.nullable && logcol.logtype == LogType.EMPTY)
{
errormsg = "Not ready to append ! Column " + logcol.name + " is not nullable, and must be specified by setLogType() !";
return false;
}
if(logcol.logtype == LogType.ID && logcol.idhandler == null)
{
errormsg = "Not ready to append ! Column " + logcol.name + " is specified as an ID-column, and a JDBCIDHandler has to be set !";
return false;
}
else if(logcol.logtype == LogType.STATIC && logcol.value == null)
{
errormsg = "Not ready to append ! Column " + logcol.name + " is specified as a static field, and a value has to be set !";
return false;
}
else if(logcol.logtype == LogType.MSG) msgcol_defined = true;
}
if(!msgcol_defined) return false;
//create the column_list
for(int i=0; i<num; i++)
{
logcol = (LogColumn)logcols.get(i);
if(logcol.ignore || !logcol.isWritable) continue;
if(logcol.logtype != LogType.EMPTY)
{
if(column_list == null)
{
column_list = logcol.name;
}
else column_list += ", " + logcol.name;
}
}
try
{
rs = stmt.executeQuery("SELECT " + column_list + " FROM " + table + " WHERE 1 = 2");
}
catch(Exception e)
{
errormsg = "Not ready to append ! Cannot select columns '" + column_list + "' of table " + table + " !";
return false;
}
ready = true;
return true;
}