fb embedded2 Laz: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: fb embedded2 Laz
| Old | New | Line | |
|---|---|---|---|
| 1 | + | ## About | |
| 2 | + | ||
| 3 | + | `Fb_embedded2.pas` is a Pascal unit that can be included in a Lazarus project to enable embedding of [[Firebird]] (version 2.0.3) [[Databases|database]] server (a.k.a. [DBMS](http://en.wikipedia.org/wiki/DBMS)) into an `.exe` file, without need for distributing any DLL. The original code for Delphi was created by Fikret Hasovic and Samir Ribic, modified by Zlatko Matic (<matalab@gmail.com>) for FPC/Lazarus. | |
| 4 | + | ||
| 5 | + | > **Note:** You do **not** need this to use the "regular" embedded Firebird database. | |
| 6 | + | ||
| 7 | + | ## Download | |
| 8 | + | ||
| 9 | + | @ [Lazurus CCR SourceForge repository](http://sourceforge.net/projects/lazarus-ccr/files/Firebird%20Embedded/Firebird%20Embedded%202%20-%2020080124/) (file: `fb_embedded2_Laz_1_0.zip`). | |
| 10 | + | ||
| 11 | + | ## Introduction | |
| 12 | + | ||
| 13 | + | Currently, `fb_embedded2.pas` works only on Windows. It reads lib from memory stream. When you unpack the zipped file `fb_embedded2_Laz_1_0.zip`, you will see it contains everything needed for embedding Firebird 2.0.3 into your `.exe`: | |
| 14 | + | ||
| 15 | + | - Firebird embedded 2.0.3: all required DLLs, | |
| 16 | + | - `fb_embedded2.pas`: unit to be included into your Lazarus project, | |
| 17 | + | - `FB_Embedded.rc`:\> textual file to be converted to Windows resource file, | |
| 18 | + | - `FB_Embedded.res`: Windows resource file, used by `fb_embedded2.pas`, | |
| 19 | + | - windres utility: used to create `FB_Embedded.res` from `FB_Embedded.rc`, | |
| 20 | + | - `fb_embedded.bat`: creates `FB_Embedded.res`, | |
| 21 | + | - several other `.pas` and `.pp` files that should be included into your project. | |
| 22 | + | ||
| 23 | + | ||
| 24 | + | These are files from `C:\lazarus\debugger\windebug` folder. `winddwarf.pas` needed small modification, regarding overloaded `Min()` function. I included modified `winddwarf.pas` in this distribution, so you can either include modified `winddwarf.pas`, `winddwarfconst.pas` and `windsymbols.pas` into your project or you can modify the original source code. In that case, you need only `fb_embedded2.pas` and resource file to be included in your project. | |
| 25 | + | ||
| 26 | + | The change to be done in `winddwarf.pas` is the following: | |
| 27 | + | ||
| 28 | + | the **for** cycle in line 2511 | |
| 29 | + | ||
| 30 | + | ``` pascal | |
| 31 | + | for n := 1 to Min(80, count) do | |
| 32 | + | ``` | |
| 33 | + | ||
| 34 | + | must be changed to | |
| 35 | + | ||
| 36 | + | ``` pascal | |
| 37 | + | for n := 1 to Min(80, LongInt(count)) do | |
| 38 | + | ``` | |
| 39 | + | ||
| 40 | + | ## Installation and usage | |
| 41 | + | ||
| 42 | + | No installation is required. Just copy the content of this folder into your project directory and include `fb_embedded2.pas` and, optionally, other `.pas` and `.pp` files from this folder into your application. You can check paths in `FB_Embedded.rc`. If you change paths, recreate `FB_Embedded.res` by double clicking the `fb_embedded.bat`. Then recompile your application. The Firebird embedded server will be included in your `.exe`, without need for external DLLs. The good thing is that your data-access components will work with embedded database, without change. For example, I use [[ZeosDBO|Zeoslib]]. Compiled `.exe` works without DLLs distributed. | |
| 43 | + | ||
| 44 | + | *Since Wine 0.9.60, you can run Windows `.exe` files compiled with Windows version of Lazarus and `fb_embedded.pas`. I have tested it on OpenSuse 10.3, Wine 0.9.60. This is an interesting possibility for cross-platform programming.* | |
| 45 | + | ||
| 46 | + | ## Contribution | |
| 47 | + | ||
| 48 | + | Everybody is welcome to improve this code. Currently it works only in Windows. I hope somebody will rewrite it to be cross-platform. | |
| 49 | + | ||
| 50 | + | ## See also | |
| 51 | + | ||
| 52 | + | - [[Firebird embedded]] "Regular" Firebird embedded (i.e. not bundled as a resource) | |
| 53 | + | ||
| 54 | + | --- | |
| 55 | + | *From the Free Pascal wiki, page "fb embedded2 Laz", as it stood on 2015-10-26 after a change by FTurtle, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).* | |
| 56 | + | Category: Components | |
| 57 | + | Category: Databases | |
| 58 | + | Category: Lazarus-CCR |
