TFDConnection:
FetchOptions.Mode 設置為fmAll, 返回全部結果, 否則默認只返回前50條, 效果與open以后再執行FetchAll一樣
Specifies how the result set records must be fetched into FireDAC internal data storage.
Name Description fmManual The records are not fetched automatically by FireDAC. A programmer must write code to fetch records at appropriate times, using the following methods:
- TFDDataSet.FetchAll to fetch all records.
- TFDDataSet.GetNextPacket to fetch the next record set (packet) containing RowsetSize records.
- IADPhysCommand.Fetch to fetch all records or the next record set.
fmOnDemand The records are fetched automatically by FireDAC when they are required by the navigation or other dataset methods. At each request FireDAC fetches one or more record sets, containing RowsetSize records. This mode allows to open large result sets without a significant delay, similarly to the
fmAllmode. However, the total time of fetching all records is higher than infmAllmode. For example, the server-side static cursor is used on Microsoft SQL Server.fmAll All result set records are fetched automatically by FireDAC at the dataset Open call or at the first IADPhysCommand.Fetch call. On a large result set it may take some time, but navigation through a dataset is fast because all records are stored in a FireDAC internal data storage. For many DBMSs, such as Microsoft SQL Server, MySQL Server, Sybase SQL Anywhere:
- It releases client result set buffer and allows to execute the next command returning result sets.
- It gives maximum fetch performance. For example, the fast forward-only cursor is used on Microsoft SQL Server.
ResourceOptions.SilentMode 設置為True, 就不需要FDGUIxWaitCursor之類的東西了, 同樣也不再會自動改變鼠標樣式, 默認是需要的
Controls the dataset GUI feedback.
Use the SilentMode property to control whether the dataset shows the SQL-hourglass mouse cursor when the dataset performs potentially long running actions. The dataset will show the SQL-hourglass if it is set to False. Otherwise, it is set to True. By default, it is set to False. For TFDCustomMemTable, it is set to True.
Setting SilentMode to True allows you to speed up the dataset processing algorithms.
TFDQuery:
ResourceOptions.DirectExecute 設置為True, 直接執行SQL, 默認是False, 在某些數據庫(比如Postgre) 如果設置為False那么在執行多條SQL的時候會報錯....
Controls the preparation of SQL statements.
Use the DirectExecute property to specify whether FireDAC should prepare an SQL statement before its execution (False) or execute it directly (True). The default value is False.
This property was introduced at first for MS SQL Server support. The prepared and the direct execution may have different effects, and even the prepared execution may fail. If you will get peculiar errors, then try to set DirectExecute to True.
FetchOptions.AutoClose := False; 不要自動關閉連接...這個如果不設置的話, 多結果集返回的時候會出問題....
Controls the automatic closing of a dataset cursor after fetching the last record.
Use the AutoClose property value to control the automatic closing of a dataset cursor. If AutoClose is set to True and the last record is fetched from the current result set, then the underlying cursor is closed, all additional result sets that have not been yet processed are discarded, and the resources associated with the cursors are released. The dataset (TFDDataSet descendant) itself is closed, but its internal command object is closed. This allows the release of DBMS resources associated with a cursor as fast as possible.
If your SQL command returns several result sets and you need to process all of them, then you must set AutoClose to False. Otherwise, after processing the first result set, all other result sets are discarded.
The default value is True.
FDPhysMSSQLDriverLink:
ODBCDriver 連接SQL Server的驅動, 如果系統里有多個版本的SQL Server, 默認會使用最高版本的那個
ODBCDriver := FindBestDriver([C_2012_NC, C_2012_ODBC, C_2008, C_2005, C_2000])
但是, 如果你要使用的數據庫是2000, 而機器里有更高版本的數據庫, 那么使用Native連接2000的時候就會出現各種奇怪的問題(比如無法同時edit2個超過1024k的二進制字段等)
所以如果有可能, 最好在創建連接的時候指定ODBCDriver
----暫時這些, 想到或遇到時再增加----
