![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » DBISAM Technical Support » Product Manuals » DBISAM Version 4 Manual for Developer Studio 2005 (Delphi) » Using DBISAM » Executing SQL Queries |
begin with MyDatabase do begin DatabaseName:='AccountingDB'; Directory:='c:\acctdata'; Connected:=True; end; with MyQuery do begin DatabaseName:='AccountingDB'; SQL.Clear; SQL.Add('SELECT * FROM ledger'); Active:=True; end; end;
begin with MySession do begin SessionName:='Remote'; SessionType:=stRemote; RemoteAddress:='192.168.0.2'; Active:=True; end; with MyQuery do begin SessionName:='Remote'; DatabaseName:='AccountingDB'; SQL.Clear; SQL.Add('SELECT * FROM ledger'); Active:=True; end; end;
This is a test
MyDBISAMQuery.SQL.Text:='INSERT INTO MyTable '+ '(MyMemoField) VALUES ('+ Engine.QuotedSQLStr(MyMemo.Lines.Text)+')';
Method | Usage |
ExecSQL | Use this method when the SQL statement or statements specified in the SQL property may or may not return a result set. The ExecSQL method can handle both situations. |
Open | Use this method only when you know that the SQL statement or statements specified in the SQL property will return a result set. Using the Open method with an SQL statement that does not return a result set will result in an EDatabaseError exception being raised with an error message "Error creating table handle". |
begin with MyDatabase do begin DatabaseName:='AccountingDB'; Directory:='c:\acctdata'; Connected:=True; end; with MyQuery do begin DatabaseName:='AccountingDB'; SQL.Clear; SQL.Add('UPDATE ledger SET AccountNo=100'); SQL.Add('WHERE AccountNo=300'); ExecSQL; end; end;
Property | Description |
SQLStatementType | Indicates the type of SQL statement currently ready for execution. If the TDBISAMQuery SQL property contains multiple SQL statements (a script), then this property represents the type of the current SQL statement about to be executed. You can assign an event handler to the TDBISAMQuery BeforeExecute event to interrogate the SQLStatementType property before each SQL statement is executed in the script. |
TableName | Indicates the target table of the SQL statement currently ready for execution. If the TDBISAMQuery SQL property contains multiple SQL statements (a script), then this property represents the target table of the current SQL statement about to be executed. You can assign an event handler to the TDBISAMQuery BeforeExecute event to interrogate the TableName property before each SQL statement is executed in the script. |
Property | Description |
Plan | Contains information about how the current query was executed, including any optimizations performed by DBISAM. This information is very useful in determining how to optimize a query further or to simply figure out what DBISAM is doing behind the scenes. If there is more than one SQL statement specified in the TDBISAMQuery SQL property (a script) then this property indicates the query plan for the last SQL statement executed. You can assign an event handler to the TDBISAMQuery AfterExecute event to interrogate the Plan property after each SQL statement is executed in the script. The Plan property is cleared before each new SQL statement is executed. |
RowsAffected | Indicates the number of rows affected by the current query. If there is more than one SQL statement specified in the TDBISAMQuery SQL property (a script) then this property indicates the cumulative number of rows affected for all SQL statements executed so far. You can assign an event handler to the TDBISAMQuery BeforeExecute and/or AfterExecute events to interrogate the RowsAffected property before and/or after each SQL statement is executed in the script. |
ExecutionTime | Indicates the amount of execution time in seconds consumed by the current query. If there is more than one SQL statement specified in the TDBISAMQuery SQL property (a script) then this property indicates the cumulative execution time for all SQL statements executed so far. You can assign an event handler to the TDBISAMQuery BeforeExecute and/or AfterExecute events to interrogate the ExecutionTime property before and/or after each SQL statement is executed in the script. |
begin with MyDatabase do begin DatabaseName:='AccountingDB'; Directory:='c:\acctdata'; Connected:=True; end; with MyQuery do begin DatabaseName:='AccountingDB'; SQL.Clear; SQL.Add('UPDATE ledger SET AccountNo=100'); SQL.Add('WHERE AccountNo=300'); ExecSQL; ShowMessage(IntToStr(RowsAffected)+ ' rows updated in '+ FloatToStr(ExecutionTime)+' seconds'); end; end;
SQL Statement | Events |
This web page was last updated on Thursday, November 16, 2023 at 10:39 AM | Privacy Policy![]() © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |