** FDConnection **
1,
FDConnection.FetchOptions.Cache = [fiBlobs,fiDetails], 如果里面包含 fiMeta, 在不断开连接的情况下, FDStoredProc 的参数在刷新后,如果有修改存储过程的参数, 则再执行 FDStoredProc.Prepare ;时,还是取得的原来的参数, 原因在于:将此存储过程原有的参数已经进行了缓存
2.
FDConnection.FetchOptions.Items.Cache = [fiBlobs,fiDetails], 如果里面 不 包含 fiMeta,则 FDStoredProc.Prepare 后, 取不到存储过程参数
******************** 代码 ****************************
mParam : TFDParam ;
i: Integer ;
begin
if NOT FDCon.Connected then
begin
FDCon.ConnectionString := edt_FDConStr.Text ;
FDCon.Connected := true ;
end ;
FDSP.Params.Clear ;
FDSP.StoredProcName := '' ;
FDSP.StoredProcName := 'Z_USP_WicherTest' ;
mParam := FDSP.Params.Add ;
with mParam do
begin
Name := '@T1' ;
DataType := ftString ;
//FDDataType := dtString ;
ParamType := ptInput ;
Size := 50 ;
Precision := 0 ;
NumericScale := 0 ;
Value := 'A' ;
end;
while NOT FDSp.Eof do
begin
mm_XECode.Lines.Add('记录: ' + FDSp.RecNo.ToString()) ;
for i := 0 to FDSp.FieldCount - 1 do
begin
mm_XECode.Lines.Add(FDSp.Fields[i].FieldName+ ':' + VarToStr(FDSp.Fields[i].Value)) ;
end;
end;
// FDSP.Close ; -- B
FDSP.Params.ParamByName('@T1').Value := 'B' ;
FDSP.Open();
while NOT FDSp.Eof do
begin
mm_XECode.Lines.Add('记录: ' + FDSp.RecNo.ToString()) ;
for i := 0 to FDSp.FieldCount - 1 do
begin
mm_XECode.Lines.Add(FDSp.Fields[i].FieldName+ ':' + VarToStr(FDSp.Fields[i].Value)) ;
end;
end;
function TODBCConnection.DriverConnect(const AConnString: String;
ADriverCompletion: SQLUSmallint; AParentWnd: SQLHWnd): String;
begin
...
Check(Lib.SQLDriverConnect(FHandle, AParentWnd, PSQLChar(AConnString), SQL_NTS,
PSQLChar(Result), C_RETURNED_STRING_MAXLEN, iOutConnStrLen, ADriverCompletion));
...
end;
HDbc: SQLHDbc;
hwnd: SQLHWnd;
szConnStrIn: PSQLChar;
cbConnStrIn: SQLSmallint;
szConnStrOut: PSQLChar;
cbConnStrOutMax: SQLSmallint;
var pcbConnStrOut: SQLSmallint;
fDriverCompletion: SQLUSmallint
): SQLReturn; {$IFDEF MSWINDOWS} stdcall {$ELSE} cdecl {$ENDIF};
oStmt.Open(1, 'SELECT SCHEMA_NAME(), ' + sCollProp)
else
oStmt.Open(1, 'SELECT USER_NAME(), ' + sCollProp);
fmAll
mode. But the total amount of time of fetching all the records will be higher than in the
fmAll
mode. For example, on the Microsoft SQL Server, the server side static cursor will be used .
All result set records are fetched automatically by FireDAC at the dataset Open call. On a big result set, it may take some time, but the navigation through a dataset will be fast, because all records will be stored in a FireDAC internal data storage. For many DBMSs, such as a Microsoft SQL Server, MySQL Server, Sybase SQL Anywhere:
- It releases a client result set buffer and allows you to execute the next command returning result sets.
- Gives maximum fetch performance. For example, on Microsoft SQL Server, the fast forward-only cursor will be used