firebird

Firebird Query- Return first row each group

旧巷老猫 提交于 2019-12-01 23:13:19
In a firebird database with a table "Sales", I need to select the first sale of all customers. See below a sample that show the table and desired result of query. --------------------------------------- SALES --------------------------------------- ID CUSTOMERID DTHRSALE 1 25 01/04/16 09:32 2 30 02/04/16 11:22 3 25 05/04/16 08:10 4 31 07/03/16 10:22 5 22 01/02/16 12:30 6 22 10/01/16 08:45 Result: only first sale, based on sale date. ID CUSTOMERID DTHRSALE 1 25 01/04/16 09:32 2 30 02/04/16 11:22 4 31 07/03/16 10:22 6 22 10/01/16 08:45 I've already tested following code " Select first row in

SetThreadLocale for the entire Delphi application

丶灬走出姿态 提交于 2019-12-01 22:50:39
My Delphi (XE 10) program uses nonunicode (single byte) legacy Firebird database (character set NONE) and therefore its data (that are read from or saved into database) depends on the windows Locale for the nonunicode programs. Depending on this Windows setting the same database character can be displayed in the program as \u0101 (that is correct) or \u0432 (that is not correct). IBX serves as DB access technology. My program works only for the specificed local for nonunicode programs and that is acceptable for the client. The question is - how can I make program to feel the specific

Binary stream '0' does not contain a valid BinaryHeader. Occurs randomly

倾然丶 夕夏残阳落幕 提交于 2019-12-01 21:09:45
I'm working on c# windows service that handles firebird database requests. My problem occurs at random moments (sometimes after 5 minutes, sometimes after just 4 calls to database), when I try to deserialize object on client application. It happens though only at specific position (stops at 18th byte in 54 byte array). Rest of the time the function returns a proper result. I'm using this function to serialize single object public byte[] ObjectToByteArray(Object obj) { if (obj == null) return null; MemoryStream fs = new MemoryStream(); BinaryFormatter formatter = new BinaryFormatter();

“Unknown data type” error with Firebird embedded and Entity Framework 6

时光毁灭记忆、已成空白 提交于 2019-12-01 20:19:33
I'm using an embedded Firebird database with code first (Entity Framework 6). The first time the application runs, it works fine: the database gets created and the data gets inserted. But every time it runs after that, it throws the following exception: An exception of type 'System.NotSupportedException' occurred in FirebirdSql.Data.FirebirdClient.dll but was not handled in user code Additional information: Unknown data type The project includes the following NuGet packages: EntityFramework [6.0.2] Firebird ADO.NET Data provider (Entity Framework 6) [4.1.0.0] I added the DbProviderFactories

Views and Entity Framework

痴心易碎 提交于 2019-12-01 15:40:32
I've created a view in my database which I would like to include in my entity model. However, when I try to update the entity model through VS 2008, a warning message informs me that the TABLE OR VIEW I'm trying to add doesn't have a primary key. It seems that in order to add a view to the model, this must have a key field! How can I add this view to my model if views are not permitted to have key field, at least in firebird which is the DBMRS I’m using. Any idea of how to solve this? Greg Jackman There's a great answer to that here: Entity Framework and SQL Server View (see accepted answer:

Why do I get an unsupported on-disk structure error when openining a Firebird database?

≯℡__Kan透↙ 提交于 2019-12-01 14:45:23
问题 I'm trying to open a .fdb (Firebird) database using FlameRobin but it is giving me the following error message: *** IBPP::SQLException *** Context: Database::Connect Message: isc_attach_database_failed SQL Message: -820 wrong or obsolete version Engine Code:335544379 Engine Message: unsupported on-disk structure for file c:\ccmb\cm.fdb; found 11.2, support 11.1 Now it looks like it is telling me the .fdb is an older version (I assume it is referring to the database file and not FlameRobin!)

Select only rows with last modified timestamp, without duplicate rows with same ID and older timestamp

落花浮王杯 提交于 2019-12-01 14:26:21
I could not find solution for my problem. I have two tables Order and OrderDetail. Order table (simple version) | ID | modified | | 1 | 7.1.2018. | | 2 | 10.1.2018.| | 3 | 15.1.2018.| | 4 | 20.1.2018.| | 5 | 25.1.2018.| OrderDetails (simple version) | order_id | detail_id | base_price | buy_price | sell_price| | 1 | 1 | 99.00 | 111.00 | 122.00 | | 1 | 2 | 82.00 | 95.00 | 117.00 | | 1 | 3 | 82.00 | 95.00 | 117.00 | | 2 | 4 | 95.00 | 108.00 | 119.00 | | 2 | 5 | 86.00 | 94.00 | 115.00 | | 2 | 1 | 82.00 | 95.00 | 117.00 | | 3 | 1 | 92.00 | 106.00 | 116.00 | | 3 | 4 | 90.00 | 100.00 | 120.00 | | 3

Firebird select from table distinct one field

浪尽此生 提交于 2019-12-01 14:23:35
The question I asked yesterday was simplified but I realize that I have to report the whole story. I have to extract the data of 4 from 4 different tables into a Firebird 2.5 database and the following query works: SELECT PRODUZIONE_T t.CODPRODUZIONE, PRODUZIONE_T.NUMEROCOMMESSA as numeroco, ANGCLIENTIFORNITORI.RAGIONESOCIALE1, PRODUZIONE_T.DATACONSEGNA, PRODUZIONE_T.REVISIONE, ANGUTENTI.NOMINATIVO, ORDINI.T_DATA, FROM PRODUZIONE_T LEFT OUTER JOIN ORDINI_T ON PRODUZIONE_T.CODORDINE=ORDINI_T.CODORDINE INNER JOIN ANGCLIENTIFORNITORI ON ANGCLIENTIFORNITORI.CODCLIFOR=ORDINI_T.CODCLIFOR LEFT OUTER

Views and Entity Framework

守給你的承諾、 提交于 2019-12-01 13:44:29
问题 I've created a view in my database which I would like to include in my entity model. However, when I try to update the entity model through VS 2008, a warning message informs me that the TABLE OR VIEW I'm trying to add doesn't have a primary key. It seems that in order to add a view to the model, this must have a key field! How can I add this view to my model if views are not permitted to have key field, at least in firebird which is the DBMRS I’m using. Any idea of how to solve this? 回答1:

Firebird select from table distinct one field

坚强是说给别人听的谎言 提交于 2019-12-01 12:34:29
问题 The question I asked yesterday was simplified but I realize that I have to report the whole story. I have to extract the data of 4 from 4 different tables into a Firebird 2.5 database and the following query works: SELECT PRODUZIONE_T t.CODPRODUZIONE, PRODUZIONE_T.NUMEROCOMMESSA as numeroco, ANGCLIENTIFORNITORI.RAGIONESOCIALE1, PRODUZIONE_T.DATACONSEGNA, PRODUZIONE_T.REVISIONE, ANGUTENTI.NOMINATIVO, ORDINI.T_DATA, FROM PRODUZIONE_T LEFT OUTER JOIN ORDINI_T ON PRODUZIONE_T.CODORDINE=ORDINI_T