Pascal Data Objects

function TPDO.execute_now (sql: AnsiString): Int64;

TPDO.execute_now executes an SQL statement in a single function call, returning the number of rows affected by the statement.

TPDO::execute_now does not return results from a SELECT statement. For a SELECT statement that you only need to issue once during your program, consider issuing TPDO.query_as_is or TPDO.query_select. For a statement that you need to issue multiple times, prepare a IPDOStatement object with TPDO.prepare_as_is or TPDO.prepare_select and issue the statement with IPDOStatement.execute.

Parameters

sql: The SQL statement to prepare and execute.

Return Values

TPDO.execute_now returns the number of rows that were modified or deleted by the SQL statement you issued. If no rows were affected, TPDO.execute_now returns 0.

    count := db.execute_now ('DELETE FROM fruit WHERE colour = ''red''');
    writeln (format ('Deleted %d rows',[count]));

The above example will output:

Deleted 1 rows.