00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #define PERL_NO_GET_CONTEXT
00026 #include "EXTERN.h"
00027 #include "perl.h"
00028 #include "XSUB.h"
00029
00030 #include <db.h>
00031
00032 void
00033 #ifdef CAN_PROTOTYPE
00034 __getBerkeleyDBInfo(void)
00035 #else
00036 __getBerkeleyDBInfo()
00037 #endif
00038 {
00039 #ifdef dTHX
00040 dTHX;
00041 #endif
00042 SV * version_sv = perl_get_sv("DB_File::db_version", GV_ADD|GV_ADDMULTI) ;
00043 SV * ver_sv = perl_get_sv("DB_File::db_ver", GV_ADD|GV_ADDMULTI) ;
00044 SV * compat_sv = perl_get_sv("DB_File::db_185_compat", GV_ADD|GV_ADDMULTI) ;
00045
00046 #ifdef DB_VERSION_MAJOR
00047 int Major, Minor, Patch ;
00048
00049 (void)db_version(&Major, &Minor, &Patch) ;
00050
00051
00052 if (Major != DB_VERSION_MAJOR || Minor != DB_VERSION_MINOR
00053 || Patch != DB_VERSION_PATCH)
00054 croak("\nDB_File needs compatible versions of libdb & db.h\n\tyou have db.h version %d.%d.%d and libdb version %d.%d.%d\n",
00055 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
00056 Major, Minor, Patch) ;
00057
00058
00059 if (Major == 2 && (Minor < 3 || (Minor == 3 && Patch < 4)))
00060 croak("DB_File needs Berkeley DB 2.3.4 or greater, you have %d.%d.%d\n",
00061 Major, Minor, Patch) ;
00062
00063 {
00064 char buffer[40] ;
00065 sprintf(buffer, "%d.%d", Major, Minor) ;
00066 sv_setpv(version_sv, buffer) ;
00067 sprintf(buffer, "%d.%03d%03d", Major, Minor, Patch) ;
00068 sv_setpv(ver_sv, buffer) ;
00069 }
00070
00071 #else
00072 sv_setiv(version_sv, 1) ;
00073 sv_setiv(ver_sv, 1) ;
00074 #endif
00075
00076 #ifdef COMPAT185
00077 sv_setiv(compat_sv, 1) ;
00078 #else
00079 sv_setiv(compat_sv, 0) ;
00080 #endif
00081
00082 }