firebird

Load and save image from blob field in delphi using firebird

血红的双手。 提交于 2019-11-29 07:51:23
In my Firebird database I have a Blob field that contain a Bitmap. I'll have to load and display in a TImage located on my Form. Subsequently I'll have to save in the same field the image selected by a OpenDialog. Procedure LoadBitmapFromBlob(Bitmap: TBitmap; Blob: TBlobField); var ms, ms2: TMemoryStream; begin ms := TMemoryStream.Create; try Blob.SaveToStream(ms); ms.Position := 0; Bitmap.LoadFromStream(ms); finally ms.Free; end; end; example usage procedure TForm4.Button1Click(Sender: TObject); var bmp: TBitmap; begin bmp := TBitmap.Create; try LoadBitmapFromBlob(bmp, TBlobField(Dataset

Firebird 2.5 CHARACTER SET WIN1252 is not installed

梦想与她 提交于 2019-11-29 07:51:12
I've installed Firebird-Server 2.5 on FreeBsd 9.1 using: pkg install firebird-server-2.5.2_1 It's working ok, since I can connect using FlameRobin from an external PC. Now, when I try to restore a database using gbak, I got this: ... gbak: ERROR: CHARACTER SET WIN1252 is not installed gbak:Exiting before completion due to errors Should I install something more server side?. The database was created on a Windows machine, that's why its character set is WIN1252. EDIT: after some trouble I deinstalled firebird and reinstalled WITHOUT USING SUDO. Now I can connect using isql-fb and do "show system

How to get all the fields of a row using the SQL MAX function?

大憨熊 提交于 2019-11-29 00:14:55
Consider this table (from http://www.tizag.com/mysqlTutorial/mysqlmax.php ): Id name type price 123451 Park's Great Hits Music 19.99 123452 Silly Puddy Toy 3.99 123453 Playstation Toy 89.95 123454 Men's T-Shirt Clothing 32.50 123455 Blouse Clothing 34.97 123456 Electronica 2002 Music 3.99 123457 Country Tunes Music 21.55 123458 Watermelon Food 8.73 This SQL query returns the most expensive item from each type: SELECT type, MAX(price) FROM products GROUP BY type Clothing $34.97 Food $8.73 Music $21.55 Toy $89.95 I also want to get the fields id and name that belong to the above max price, for

How can I get only one row per record in master table?

南楼画角 提交于 2019-11-28 14:32:31
it is possible to get only one row per record in a multitable query? I have this three tables: APPLES ID | APPLE ---------- 1 | RED 2 | YELLOW 3 | GREEN FARMS ID | FARM -------------------- B1 | GEORGE'S FARM B2 | JOHN'S FARM FARM_APPLES FARM | APPLE --------------- B1 | 1 B1 | 2 B1 | 3 B2 | 1 B3 | 3 With this tables I need this result: FARM_NAME | APPLE_1 | APPLE_2 | APPLE_3 ---------------------------------------- B1 | 1 | 2 | 3 B2 |1 | | 3 Any help is much appreciated, thanks in advance. EDIT Thanks both OMG Ponies and Bill, I'll try both of your solutions, just one last thing, its possible

How do INSERT INTO Firebird, with autoincrement for the primary key?

天涯浪子 提交于 2019-11-28 11:25:45
问题 How do INSERT INTO Firebird, with autoincrement for the primary key? For the table fields I have: fstPriority VARCHAR(30), fstInfo VARCHAR(100), fstDateCreated VARCHAR(30), fstDateModified VARCHAR(30), fiKeyID INTEGER PRIMARY KEY For the INSERT INTO I have: FbConnection fbConn = new FbConnection(stOpenConn)) fbConn.Open(); ... FbTransaction fbTransaction = fbConn.BeginTransaction(); FbCommand fbCmd = new FbCommand("INSERT INTO " + stTableName + "(" + stFieldNames + ") VALUES ( @p0, @p1, @p2,

How to redirect binary gbak output to a Delphi stream?

给你一囗甜甜゛ 提交于 2019-11-28 07:52:25
I want the Firebird backup tool gbak to write its output to a Delphi stream (with no intermediate file). There is a command line parameter to write to stdout rather than a file. I then use the Execute method in JEDI's JclSysUtils to launch gbak and process that output. It looks like this: procedure DoBackup; var LBackupAbortFlag: Boolean; LBackupStream: TStringStream; begin LBackupAbortFlag := False; LBackupStream := TStringStream.Create; try Execute('"C:\path to\gbak.exe" -b -t -v -user SYSDBA -pas "pw" <db> stdout', LBackupStream.WriteString, // Should process stdout (backup) SomeMemo.Lines

How to use GROUP BY in firebird

时间秒杀一切 提交于 2019-11-28 07:32:18
问题 The structure of T_TABLE2 is ID INT TBL1_ID INT TESTER VARCHAR LOT_ID VARCHAR GRP VARCHAR SITE_NUM INT TEST_NUM VARCHAR TEST_DESC VARCHAR MEASUREMENT DOUBLE PRECISION UNIT VARCHAR LL DOUBLE PRECISION UL DOUBLE PRECISION STATUS VARCHAR and I use SQL editor in firebird the test my query. Th query is SELECT TEST_DESC, MEASUREMENT, LL, UL FROM T_TABLE2 GROUP BY TEST_DESC but I got this error in group by. Invalid token. Dynamic SQL Error. SQL error code = -104. Invalid expression in the select

Select Varchar as Date

旧时模样 提交于 2019-11-28 06:59:05
问题 I want to select a varchar field as a date field For example a field has this value "30.12.2011 21:15:03" and when i select this select DATE from TABLE where DATE = '30.12.2011' i get no result. 回答1: You ask about getting the date part of a timestamp field, but what your question is actually about is filtering on the date of a timestamp field. There is a much simpler method of accomplishing that: you can use the knowledge that all the possible timestamps on a specific date won't have any

Creating a Database using DBExpress in Delphi?

那年仲夏 提交于 2019-11-28 06:14:32
问题 I need to create a Firebird Database programmatically using DBExpress. I have done this for SQL server, by first connecting to Master, then passing in the script for Create to a query, but with Firebird I have a little chicken and egg problem. 回答1: I got a good tip from a collegue that created some code for the Freepascal project. It doesn't use DB express, but according to him it is the only way to create a database with code. This code is based on the InterBase manual, and uses a call from

PHP Startup: Unable to load dynamic library

狂风中的少年 提交于 2019-11-28 03:41:05
问题 I am trying to use Firebird 2.5.2.26539 with: Windows 8 Apache 2.2.22 PHP 5.4.10 When i enable the extensions of firebird in php: - extension=php_interbase.dll - extension=php_pdo_firebird.dll I get these errors: [26-Dec-2012 12:08:11 UTC] PHP Warning: PHP Startup: Unable to load dynamic library 'C:\Program Files (x86)\PHP\ext\php_interbase.dll' - Impossible to locate the specified module. in Unknown on line 0 [26-Dec-2012 12:08:13 UTC] PHP Warning: PHP Startup: Unable to load dynamic library