summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamyan Ivanov <dmn@debian.org>2017-11-24 15:35:47 +0000
committerDamyan Ivanov <dmn@debian.org>2017-11-24 15:35:47 +0000
commit6ef7464c7eab6d1a0439995c9ef118b3b1877d04 (patch)
tree26d64952b3e1938e52bf861024c1ab2acb9a12a6
parent028059453a821b216a60bd3f759d43cff2e48b42 (diff)
more constants for client version (major/minor/full version string)
-rw-r--r--Firebird.xs15
-rw-r--r--t/00-base.t6
-rw-r--r--t/001-client-version.t28
3 files changed, 42 insertions, 7 deletions
diff --git a/Firebird.xs b/Firebird.xs
index 5be29e9..ce5af53 100644
--- a/Firebird.xs
+++ b/Firebird.xs
@@ -146,8 +146,6 @@ short length, char ISC_FAR *updated
MODULE = DBD::Firebird PACKAGE = DBD::Firebird
-INCLUDE: Firebird.xsi
-
#ifndef FB_API_VER
#define FB_API_VER 0
#endif
@@ -155,6 +153,19 @@ INCLUDE: Firebird.xsi
BOOT:
HV *stash = gv_stashpv( "DBD::Firebird", TRUE );
newCONSTSUB( stash, "fb_api_ver", newSViv(FB_API_VER) );
+ newCONSTSUB( stash, "client_major_version", newSViv( isc_get_client_major_version() ) );
+ newCONSTSUB( stash, "client_minor_version", newSViv( isc_get_client_minor_version() ) );
+ {
+ char version_string[1024];
+ isc_get_client_version(version_string);
+ int len = strlen(version_string);
+ if (len > 1023)
+ die("Version string buffer overflow detected");
+ SV *ver = newSVpv(version_string, len);
+ newCONSTSUB( stash, "client_version", ver );
+ }
+
+INCLUDE: Firebird.xsi
MODULE = DBD::Firebird PACKAGE = DBD::Firebird::db
diff --git a/t/00-base.t b/t/00-base.t
index 08f9e7c..42d03f9 100644
--- a/t/00-base.t
+++ b/t/00-base.t
@@ -11,7 +11,7 @@ BEGIN {
$^W = 1;
}
-use Test::More tests => 8;
+use Test::More tests => 7;
use_ok('DBI');
@@ -22,8 +22,4 @@ use_ok('DBD::Firebird::TableInfo::Basic');
use_ok('DBD::Firebird::TableInfo::Firebird21');
use_ok('DBD::Firebird::TypeInfo');
-can_ok( 'DBD::Firebird' => 'fb_api_ver' );
-
-diag( "Firebird API version is " . DBD::Firebird->fb_api_ver );
-
# diag("\$DBI::VERSION=$DBI::VERSION");
diff --git a/t/001-client-version.t b/t/001-client-version.t
new file mode 100644
index 0000000..c6b658b
--- /dev/null
+++ b/t/001-client-version.t
@@ -0,0 +1,28 @@
+# Test that everything compiles, so the rest of the test suite can
+# load modules without having to check if it worked.
+#
+# 2011-01-29 stefan(s.bv.)
+# Stolen from DBD::SQLite ;)
+#
+
+use strict;
+BEGIN {
+ $| = 1;
+ $^W = 1;
+}
+
+use Test::More tests => 4;
+
+use DBD::Firebird;
+
+can_ok( 'DBD::Firebird' => 'fb_api_ver' );
+can_ok( 'DBD::Firebird' => 'client_major_version' );
+can_ok( 'DBD::Firebird' => 'client_minor_version' );
+can_ok( 'DBD::Firebird' => 'client_version' );
+
+note( "Firebird API version is " . DBD::Firebird->fb_api_ver );
+note( "Firebird client major version is " . DBD::Firebird->client_major_version );
+note( "Firebird client minor version is " . DBD::Firebird->client_minor_version );
+note( "Firebird client version is " . DBD::Firebird->client_version );
+
+# diag("\$DBI::VERSION=$DBI::VERSION");