firedac

Firedac Query Field list not updated after Schema change

送分小仙女□ 提交于 2019-12-06 11:33:53
I am creating a temp table in SQL and then adding a new field to it. It seems Firedac is caching the field list for this temp table. The following code gives me "FDQuery5: Field 'Available' not found." FDQuery5.Connection := FDConnection1; FDConnection1.ExecSQL('Select StockNo into #Temp from Stock'); FDQuery5.SQL.Text := 'Select * From #Temp'; FDQuery5.open; FDConnection1.ExecSQL('Alter Table #Temp add Available Char(1)'); FDQuery5.Close; FDQuery5.open; ShowMessage(FDQuery5.FieldByName('Available').AsString); using XE5 with Firedac. I have tried Connection.RefreshMetadataCache and I have

Create table with firedac without SQL Script

偶尔善良 提交于 2019-12-06 07:53:46
问题 Firedac library centralizes database behavior and have a lot of methods which works fine without care about the Database Type. Actually, using native drivers for most common databases, Firedac hides subtle differences on syntax allowing very flexible changes of database platform. For example, generators and autoinc fields are easily detectable, CAST and parameters works fine allowing easy migration between databases. How to use Firedac power to create New Table without instantiate FDQuery,

Insufficient memory when opening TClientDataSet with a REPLACE in the underlying query

不羁的心 提交于 2019-12-06 03:51:39
My Delphi code opens a TFDQuery (FireDAC), then opens the TClientDataSet connected to it via a TDataSetProvider : ClientDataSetData.Close; with QueryData do begin Close; SQL.Clear; SQL.Add(ASelectSQL); Open; end; ClientDataSetData.Open; ASelectSQL contains this SQL: SELECT TT_NIV_ID, TT_NIV, REPLACE(TT_NIV_NAME, '|', '!') as TT_NIV_NAME2 FROM TT_SYS_PRJ_NIV The ClientDataSetData.Open gives an insufficient memory error on a dataset with 42200 records. If I inspect the result data (in the Delphi code) I see that TT_NIV_NAME2 is a string of length 8000! From the REPLACE() documentation : If

When PostgreSQL stops TFDConnection.Connected remains True

我只是一个虾纸丫 提交于 2019-12-06 01:59:40
I am connecting to PostgreSQL 9.5 x64 using Delphi 10 and FireDAC. There is a reconnect feature in my software which relies on TFDConnection.Connected flag: if not _conn.Connected then if _autoConnect then _conn.Connected := True else raise Exception.Create('Not connected to database'); After I connect my software to PostgreSQL and start executing queries, I go to Windows services control panel and stop-start PostgreSQL server in order to test the reconnect feature. After starting PostgreSQL server I continue to get following errors: [FireDAC][Phys][PG][libpq] no connection to the server and

Create table with firedac without SQL Script

放肆的年华 提交于 2019-12-04 11:49:29
Firedac library centralizes database behavior and have a lot of methods which works fine without care about the Database Type. Actually, using native drivers for most common databases, Firedac hides subtle differences on syntax allowing very flexible changes of database platform. For example, generators and autoinc fields are easily detectable, CAST and parameters works fine allowing easy migration between databases. How to use Firedac power to create New Table without instantiate FDQuery, which runs a SQL Script CREATE TABLE ? I hope to create any Object and, calling specific FieldByName for

FireDAC mapping rules do not apply to parameters?

左心房为你撑大大i 提交于 2019-12-04 05:32:04
问题 I have a TFDConnection to a FireBird database for which I apply Data type mapping for backward compatibility with a previous data access technology (SQLDirect): with FormatOptions.MapRules.Add do // TIMESTAMP will be ftDateTime instead of ftTimeStamp begin SourceDataType := dtDateTimeStamp; TargetDataType := dtDateTime; end; with FormatOptions.MapRules.Add do // FLOAT will be ftFloat instead of ftSingle begin SourceDataType := dtSingle; TargetDataType := dtDouble; end; FormatOptions

Opening a Firebird database file on a network share

人盡茶涼 提交于 2019-12-02 08:43:17
问题 I thought converting a mapped drive letter to a UNC path would be enough to be able to open a .GDB file, but alas: function ConvertToUNCPath(AMappedDrive: string) : string; var lRemoteString : array[0..255] of char; lpRemote : PChar; lStringLen : Cardinal; begin lpRemote := @lRemoteString; lStringLen := 255; If WNetGetConnection(Pchar(ExtractFileDrive(AMappedDrive)) , lpRemote, lStringLen) = NO_ERROR Then Result := lRemoteString else Result := ''; // No mapping found end; function

FireDAC mapping rules do not apply to parameters?

喜欢而已 提交于 2019-12-02 07:25:10
I have a TFDConnection to a FireBird database for which I apply Data type mapping for backward compatibility with a previous data access technology (SQLDirect): with FormatOptions.MapRules.Add do // TIMESTAMP will be ftDateTime instead of ftTimeStamp begin SourceDataType := dtDateTimeStamp; TargetDataType := dtDateTime; end; with FormatOptions.MapRules.Add do // FLOAT will be ftFloat instead of ftSingle begin SourceDataType := dtSingle; TargetDataType := dtDouble; end; FormatOptions.OwnMapRules := true; At runtime I create a TFDQuery that I link to that TFDConnection. I can see that it

Opening a Firebird database file on a network share

丶灬走出姿态 提交于 2019-12-02 04:02:24
I thought converting a mapped drive letter to a UNC path would be enough to be able to open a .GDB file, but alas: function ConvertToUNCPath(AMappedDrive: string) : string; var lRemoteString : array[0..255] of char; lpRemote : PChar; lStringLen : Cardinal; begin lpRemote := @lRemoteString; lStringLen := 255; If WNetGetConnection(Pchar(ExtractFileDrive(AMappedDrive)) , lpRemote, lStringLen) = NO_ERROR Then Result := lRemoteString else Result := ''; // No mapping found end; function TDataModuleData.OpenGDBDatabase(AGDBName: string) : Boolean; var lDlgLogin: TFrmLogin; p : Integer; lUNC, lErrMsg

SQLite FireDAC trailing spaces

女生的网名这么多〃 提交于 2019-12-01 21:14:46
I'm using Delphi XE7 with FireDAC to access SQLite. When I put data into a TEXT field, any trailing spaces or #0 characters get truncated. Is there something I can change in either SQLite or FireDAC to have it preserve the trailing white space? // The trailing spaces after Command don't come back from SQLite. fFireDACQuery.ParamByName(kSQLFieldScriptCommands).AsString := 'Command '; Disable the StrsTrim property. This property is described as: TFDFormatOptions.StrsTrim Controls the removing of trailing spaces from string values and zero bytes from binary values. And it seems that you want to