rendered paste body private SQLResult internalQuery(String sql) throws SQLException
{
// Create a statement
Statement stmt = this.dbConnection.createStatement();
// Execute the query
stmt.execute(sql);
ResultSet rs = stmt.getResultSet();
if (sql.matches("^INSERT.*$") || sql.matches("^REPLACE.*$"))
{
stmt.execute("SELECT LAST_INSERT_ID() as lastID");
ResultSet lastIDR = stmt.getResultSet();
int lastID = lastIDR.getInt(0);
System.out.println("LastID = "+lastID);
return new SQLResult(rs, lastID);
}
else
{
return new SQLResult(rs);
}
}