Documentation Home
MySQL 9.0 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 40.0Mb
PDF (A4) - 40.1Mb
Man Pages (TGZ) - 258.8Kb
Man Pages (Zip) - 365.9Kb
Info (Gzip) - 4.0Mb
Info (Zip) - 4.0Mb


27.3.6.3 SqlResult Object

An SqlResult is produced whenever a query is executed using sqlExecute.execute(), PreparedStatement.execute(), or Session.runSql().

Note

No SqlResult is produced if passResultsToClient is used.

Methods supported by SqlResult are listed here:

  • close(): Closes the result set. The value returned is undefined.

  • fetchAll(): Retrieves a list of all rows in the result set.

  • fetchOne(): Retrieves the next Row in the result set.

  • getAffectedItemsCount(): Retrieves the number of rows affected by the most recent operation.

  • getAutoIncrementValue(): Retrieves the autogenerated ID used for the most recent insert operation.

    Calling this method is equivalent to executing LAST_INSERT_ID() in the mysql client.

  • getColumnCount(): Gets the number of columns in the result set.

  • getColumnNames(): Retrieves the names of the columns in the current result set.

  • getColumns(): Retrieves the columns metadata in the current result set.

  • getExecutionTime(): Retrieves the time spent executing this query, to the nearest whole second.

  • getWarnings(): Retrieves any warnings (as a list of Warning objects) raised by the operation most recently executed.

  • getWarningsCount(): Retrieves the number of warnings raised by the operation last executed.

  • hasData(): Returns true if the most recently executed statement yielded a result set, false otherwise.

  • nextResult(): Moves to the next result set if available. Returns true if the result set is available and contains data.