this.getLogger().debug("Connection is up, preparing some statements ..."); //NOI18N
// Set prepared statement
- this.totalRows = connection.prepareStatement("SELECT COUNT(`?`) AS `cnt` FROM `?` LIMIT 1");
-
- // Set values in prepared statement
- this.totalRows.setObject(1, this.getFrontend().getIdName());
- this.totalRows.setObject(2, this.getTableName());
+ this.totalRows = connection.prepareStatement(String.format("SELECT COUNT(`%s`) AS `cnt` FROM `%s` LIMIT 1", this.getFrontend().getIdName(), this.getTableName()));
// Trace message
this.getLogger().trace("EXIT!"); //NOI18N
Object value = valueIterator.next();
//Debug message
- this.getLogger().debug(MessageFormat.format("value={0} at index={1}", value, index));
+ this.getLogger().debug(MessageFormat.format("index={1} has value={0}", value, index));
// Detect type again
if (value instanceof Boolean) {
// Found ineteger
statement.setInt(index, (int) value);
+ } else if (value instanceof Long) {
+ // Debug message
+ this.getLogger().debug(MessageFormat.format("Setting long value={0} for index={1}", value, index));
+
+ // Found ineteger
+ statement.setLong(index, (long) value);
} else if (value instanceof Float) {
// Debug message
this.getLogger().debug(MessageFormat.format("Setting float value={0} for index={1}", value, index));
// Found ineteger
statement.setFloat(index, (float) value);
+ } else if (value == null) {
+ // Debug message
+ this.getLogger().warn(MessageFormat.format("Null value in index={0} is not supported (yet)", index));
} else {
// Not parseable type
- throw new SQLException(MessageFormat.format("Cannot handle value={0} for index={1} in table {2}", value, index, this.getTableName()));
+ throw new SQLException(MessageFormat.format("Cannot handle value({0})={1} for index={2} in table {3}", value.getClass().getSimpleName(), value, index, this.getTableName()));
}
// Increment index