FireDAC.Comp.Client.TFDCustomConnection.Messages
Delphi
property Messages: EFDDBEngineException read GetMessages;
C++
__property Firedac::Stan::Error::EFDDBEngineException* Messages = {read=GetMessages};
Contents
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
property | public | FireDAC.Comp.Client.pas FireDAC.Comp.Client.hpp |
FireDAC.Comp.Client | TFDCustomConnection |
Description
Returns a list of messages returned by the DBMS after a recent database operation.
Read the Messages property to get a list of the messages, hints, or warnings, returned by a DBMS after a recent DBMS call. The property is of type EFDDBEngineException. The content definition depends on the DBMS kind.
DBMS |
Description |
---|---|
Advantage Database Server |
None |
Microsoft Access Database |
None |
DataSnap server |
None |
IBM DB2 |
None |
InterBase |
None |
Firebird 3.0 |
Output produced by the FB$OUT package |
MySQL Server |
Output produced by the SHOW WARNINGS command |
Oracle Server |
Output produced by the DBMS_OUTPUT package |
PostgreSQL |
Notice and warning messages |
SQLite |
None |
Sybase SQL Anywhere |
|
Microsoft SQL Server |
|
Not all supported DBMSs return non-error messages automatically. For example, for Oracle, MySQL, and FireBird it needs to call an additional DBMS API to bring the messages to a client. That requires additional server round trips. But for SQL Server and Sybase SQL Anywhere, the messages are always returned automatically. Setting ResourceOptions.ServerOutput to True guarantees that, for any DBMS, the messages will automatically be returned to the client. The messages are stored in the Messages list until the next DBMS call (Open, ExecSQL, StartTransaction, and so on).
Example
var
i: Integer;
begin
FDConnection1.ResourceOptions.ServerOutput := True;
FDQuery1.ExecSQL;
for i := 0 to FDConnection1.ConnectionIntf.Messages.ErrorCount - 1 do
Memo1.Lines.Add(FDConnection1.ConnectionIntf.Messages[i].Message);
end;