Search in sources :

Example 1 with ResultSet

use of com.gamebuster19901.excite.bot.database.sql.ResultSet in project ExciteBot by TheGameCommunity.

the class Audit method addAudit.

@Deprecated
@SuppressWarnings("rawtypes")
protected static Audit addAudit(MessageContext executor, MessageContext context, AuditType type, String description, Instant dateIssued) {
    PreparedStatement ps;
    try {
        ps = Insertion.insertInto(AUDITS).setColumns(AUDIT_TYPE, ISSUER_ID, ISSUER_NAME, DESCRIPTION, DATE_ISSUED).to(type, context.getAuthor().getID(), context.getAuthor().getName(), description, Instant.now()).prepare(executor, true);
        ps.execute();
        ResultSet results = ps.getGeneratedKeys();
        results.next();
        long auditID = results.getLong(GENERATED_KEY);
        Row row = Table.selectAllFromWhere(executor, AUDITS, new Comparison(AUDIT_ID, EQUALS, auditID)).getRow(true);
        return new Audit(row, type);
    } catch (SQLException e) {
        throw new IOError(e);
    }
}
Also used : Comparison(com.gamebuster19901.excite.bot.database.Comparison) SQLException(java.sql.SQLException) IOError(java.io.IOError) ResultSet(com.gamebuster19901.excite.bot.database.sql.ResultSet) PreparedStatement(com.gamebuster19901.excite.bot.database.sql.PreparedStatement) Row(com.gamebuster19901.excite.bot.database.Row)

Aggregations

Comparison (com.gamebuster19901.excite.bot.database.Comparison)1 Row (com.gamebuster19901.excite.bot.database.Row)1 PreparedStatement (com.gamebuster19901.excite.bot.database.sql.PreparedStatement)1 ResultSet (com.gamebuster19901.excite.bot.database.sql.ResultSet)1 IOError (java.io.IOError)1 SQLException (java.sql.SQLException)1