detect_firebird_api_version

Reads ibase.h (in the directory stored in $FB::INC) and tries to extract the firebird API version value from the FB_API_VER define.

locate_firebird

On *nix like systems try different standard paths.

check_and_set_devlibs

Check and set global variables for home, inc and lib (?...).

alternative_locations

Search lib and inc in alternative locations.

search_fb_home_dirs

Common places for the Firebird home dir.

search_fb_inc_dirs

Common places for the Firebird include dir.

search_fb_lib_dirs

Common places for the Firebird lib dir.

locate_firebird_ms

On Windows use the Registry to locate Firebird.

read_data

Read various default settings from the DATA section of this script.

prompt_for

Show prompt.

prompt_new_file

Because we can't make difference between a simple path and a path with a file name without extension, the fdb extension is required for the test database.

Username/password

These should be unset. Both in the DBI->connection(...) call and in the environment (ISC_USER, ISC_PASSWORD, DBI_USER, DBI_PASSWORD variables).

Firebird lock directory

The FIREBIRD_LOCK environment variable should be set to some place where the process can write. Note that if you plan for several processes to access the database file directly, they all should have FIREBIRD_LOCK set to the same directory, or else database corruption will occur.

No host in the DSN

Obviously, do not set any host when calling DBI->connection(...), not even localhost.

Permissions to read/write the database

Obviously, the process needs to be able to read/write the database file.

COMPARISON WITH DBD::FIREBIRD

DBD::FirebirdEmbedded provides exactly the same functionality as the Firebird server of the same version as the libfbembed library. It still can work with remote datases, in which case the use is exactly the same (DSN, environment) as with the regular DBD::Firebird.

Pros

Standalone work with Firebird databases

No need to setup/administer a Firebird server. All the server functionality is available via the libfbembed library. Shared access to databases is still possible (but read "Firebird lock directory" above).

No network latency

Working directly with the database file eliminates possible network delays (even if the server is on the local host).

Cons

Memory footprint

The libfbembed library contains a fully functional Firebird server and is therefore bigger than the ordinary client library, libfbclient.

Setup complexity

It is very important to make sure that all processes that access a given database use the same lock directory. See "Firebird lock directory" above.

SEE ALSO

DBD::Firebird

EOT } return 0; }, mangle => sub { $_[0] =~ s/DBD::Firebird - DBI driver for.+/DBD::FirebirdEmbedded - embedded Firebird server (and client)/; $_[0] =~ s/dbi:Firebird:.+/dbi:FirebirdEmbedded:db=\$dbname", undef, undef);/g; $_[0] =~ s/(?<!L\<)DBD::Firebird\b(?!::(?:Get|Type|Table)Info)/DBD::FirebirdEmbedded/g; $_[0] =~ s/'Firebird'/'FirebirdEmbedded'/g; }, }, );

copy_mangled(
    'Firebird.xs' => {
        name => 'FirebirdEmbedded.xs',
        mangle => sub {
            $_[0] =~ s/Firebird.h/FirebirdEmbedded.h/;
            $_[0] =~ s/DBD::Firebird/DBD::FirebirdEmbedded/g;
            $_[0] =~ s/(?<=^INCLUDE: Firebird).xsi/Embedded.xsi/;
        },
    },
);

for my $f ( glob('t/*.t') ) {
    next if $f =~ 't/embed';
    ( my $n = $f ) =~ s,t/,t/embed-,;
    copy_mangled(
        $f => {
            new_path => $n,
            mangle => sub {
                $_[0] =~ s/DBD::Firebird\b(?!::(?:Get|Type|Table)Info)/DBD::FirebirdEmbedded/g;
                $_[0] =~ s/TestFirebird\b/TestFirebirdEmbedded/g;
            },
        }
    );
}
}

1;

#-- Known registry keys

__DATA__ fb:DefaultInstance:HKEY_LOCAL_MACHINE\SOFTWARE\Firebird Project\Firebird Server\Instances vc:ProductDir:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\6.0\Setup\Microsoft Visual C++ vc:ProductDir:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\7.0\Setup\VC vc:ProductDir:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\9.0\Setup\VC vc:ProductDir:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0\Setup\VC vc:ProductDir:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\11.0\Setup\VC pv:CurrentVersion:HKEY_LOCAL_MACHINE\SOFTWARE\ActiveState\ActivePerl pl::HKEY_LOCAL_MACHINE\SOFTWARE\ActiveState\ActivePerl\1203