Tips and Frequently Asked Questions
Executing SQL statements directly with IDBConnection
You might have some situations where you want to execute an SQL statement directly in the database, bypassing the object manager. Of course you could use the database access component directly (FireDac, dbExpress, ADO, etc.). But in case you want to keep the code abstract when it comes to the database access layer, and benefit from existing Aurelius connection, you can use IDBConnection to do so.
Here is how you would do it:
uses {...}, Aurelius.Drivers.Interfaces; var Statement: IDBStatement; Statement := Manager.Connection.CreateStatement; Statement.SetSQLCommand(TheSQLStatement); Statement.Execute;
If the statement is queryable, you can retrieve results using ExecuteQuery method which returns an IDBResultSet interface:
var Statement: IDBStatement; ResultSet: IDBResultSet; Statement := Manager.Connection.CreateStatement; Statement.SetSQLCommand(TheSQLStatement); ResultSet := Statement.ExecuteQuery; while ResultSet.Next do Value := ResultSet.GetFieldValue(SomeFieldName); Finally, for both types of commands you can set parameter values: {...} Params := TObjectList<TDBParam>.Create; try Statement := Manager.Connection.CreateStatement; Params.Add(TDBParam.Create('id', ftInteger, 15)); Statement.SetSQLCommand('Delete from Customer Where Id = :id'); Statement.SetParams(Params); Statement.Execute; finally Params.Free; end;
Pricing
Single Developer License
Small Team License
Site License
TMS Aurelius
€ 190
€
60
yearly renewal
license for 1 developer
MOST POPULAR
BEST VALUE
All prices excl. VAT. Renewal price is subject to change and only valid up to 30 days after license has expired. After renewal period a discount price is offered to renew the license.