FireDAC.Comp.Client.TFDCustomConnection.Messages

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

property Messages: EFDDBEngineException read GetMessages;

C++

__property Firedac::Stan::Error::EFDDBEngineException* Messages = {read=GetMessages};

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 

None 

MySQL Server 

Output of the SHOW WARNINGS command

Oracle Server 

Output produced by the DBMS_OUTPUT package

PostgreSQL 

Notice and warning messages 

SQLite 

None 

Sybase SQL Anywhere 

  • ODBC warnings
  • Output of a MESSAGE command

Microsoft SQL Server 

  • ODBC warnings
  • Messages from RAISERROR with severity <= 16, for example the output of an EXEC sp_configure call

 

Not all supported DBMSs return non-error messages automatically. For example, for Oracle and MySQL, FireDAC 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;

See Also