… | |
… | |
44 | |
44 | |
45 | typedef SV SV8; /* byte-sv, used for argument-checking */ |
45 | typedef SV SV8; /* byte-sv, used for argument-checking */ |
46 | typedef char *octetstring; |
46 | typedef char *octetstring; |
47 | |
47 | |
48 | static SV *prepare_cb; |
48 | static SV *prepare_cb; |
|
|
49 | |
|
|
50 | static void |
|
|
51 | debug_errcall (const DB_ENV *dbenv, const char *errpfx, const char *msg) |
|
|
52 | { |
|
|
53 | printf ("err[%s]\n", msg); |
|
|
54 | } |
|
|
55 | |
|
|
56 | static void |
|
|
57 | debug_msgcall (const DB_ENV *dbenv, const char *msg) |
|
|
58 | { |
|
|
59 | printf ("msg[%s]\n", msg); |
|
|
60 | } |
49 | |
61 | |
50 | static char * |
62 | static char * |
51 | strdup_ornull (const char *s) |
63 | strdup_ornull (const char *s) |
52 | { |
64 | { |
53 | return s ? strdup (s) : 0; |
65 | return s ? strdup (s) : 0; |
… | |
… | |
1018 | const_iv (LOCK_YOUNGEST) |
1030 | const_iv (LOCK_YOUNGEST) |
1019 | |
1031 | |
1020 | const_iv (SEQ_DEC) |
1032 | const_iv (SEQ_DEC) |
1021 | const_iv (SEQ_INC) |
1033 | const_iv (SEQ_INC) |
1022 | const_iv (SEQ_WRAP) |
1034 | const_iv (SEQ_WRAP) |
|
|
1035 | |
|
|
1036 | const_iv (BUFFER_SMALL) |
|
|
1037 | const_iv (DONOTINDEX) |
|
|
1038 | const_iv (KEYEMPTY ) |
|
|
1039 | const_iv (KEYEXIST ) |
|
|
1040 | const_iv (LOCK_DEADLOCK) |
|
|
1041 | const_iv (LOCK_NOTGRANTED) |
|
|
1042 | const_iv (LOG_BUFFER_FULL) |
|
|
1043 | const_iv (NOSERVER) |
|
|
1044 | const_iv (NOSERVER_HOME) |
|
|
1045 | const_iv (NOSERVER_ID) |
|
|
1046 | const_iv (NOTFOUND) |
|
|
1047 | const_iv (OLD_VERSION) |
|
|
1048 | const_iv (PAGE_NOTFOUND) |
|
|
1049 | const_iv (REP_DUPMASTER) |
|
|
1050 | const_iv (REP_HANDLE_DEAD) |
|
|
1051 | const_iv (REP_HOLDELECTION) |
|
|
1052 | const_iv (REP_IGNORE) |
|
|
1053 | const_iv (REP_ISPERM) |
|
|
1054 | const_iv (REP_JOIN_FAILURE) |
|
|
1055 | const_iv (REP_LOCKOUT) |
|
|
1056 | const_iv (REP_NEWMASTER) |
|
|
1057 | const_iv (REP_NEWSITE) |
|
|
1058 | const_iv (REP_NOTPERM) |
|
|
1059 | const_iv (REP_UNAVAIL) |
|
|
1060 | const_iv (RUNRECOVERY) |
|
|
1061 | const_iv (SECONDARY_BAD) |
|
|
1062 | const_iv (VERIFY_BAD) |
|
|
1063 | const_iv (VERSION_MISMATCH) |
|
|
1064 | |
|
|
1065 | const_iv (VERB_DEADLOCK) |
|
|
1066 | const_iv (VERB_RECOVERY) |
|
|
1067 | const_iv (VERB_REGISTER) |
|
|
1068 | const_iv (VERB_REPLICATION) |
|
|
1069 | const_iv (VERB_WAITSFOR) |
|
|
1070 | |
|
|
1071 | const_iv (VERSION_MAJOR) |
|
|
1072 | const_iv (VERSION_MINOR) |
|
|
1073 | const_iv (VERSION_PATCH) |
1023 | #if DB_VERSION_MINOR >= 5 |
1074 | #if DB_VERSION_MINOR >= 5 |
1024 | const_iv (MULTIVERSION) |
1075 | const_iv (MULTIVERSION) |
1025 | const_iv (TXN_SNAPSHOT) |
1076 | const_iv (TXN_SNAPSHOT) |
1026 | #endif |
1077 | #endif |
1027 | }; |
1078 | }; |
1028 | |
1079 | |
1029 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) |
1080 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) |
1030 | newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
1081 | newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
|
|
1082 | |
|
|
1083 | newCONSTSUB (stash, "DB_VERSION", newSVnv (DB_VERSION_MAJOR + DB_VERSION_MINOR * .1)); |
|
|
1084 | newCONSTSUB (stash, "DB_VERSION_STRING", newSVpv (DB_VERSION_STRING, 0)); |
1031 | |
1085 | |
1032 | create_pipe (respipe); |
1086 | create_pipe (respipe); |
1033 | |
1087 | |
1034 | X_THREAD_ATFORK (atfork_prepare, atfork_parent, atfork_child); |
1088 | X_THREAD_ATFORK (atfork_prepare, atfork_parent, atfork_child); |
1035 | #ifdef _WIN32 |
1089 | #ifdef _WIN32 |
… | |
… | |
1178 | PROTOTYPE: & |
1232 | PROTOTYPE: & |
1179 | CODE: |
1233 | CODE: |
1180 | SvREFCNT_dec (prepare_cb); |
1234 | SvREFCNT_dec (prepare_cb); |
1181 | prepare_cb = newSVsv (cb); |
1235 | prepare_cb = newSVsv (cb); |
1182 | |
1236 | |
|
|
1237 | char * |
|
|
1238 | strerror (int errorno = errno) |
|
|
1239 | PROTOTYPE: ;$ |
|
|
1240 | CODE: |
|
|
1241 | RETVAL = db_strerror (errorno); |
|
|
1242 | OUTPUT: |
|
|
1243 | RETVAL |
1183 | |
1244 | |
1184 | DB_ENV * |
1245 | DB_ENV * |
1185 | db_env_create (U32 env_flags = 0) |
1246 | db_env_create (U32 env_flags = 0) |
1186 | CODE: |
1247 | CODE: |
1187 | { |
1248 | { |
1188 | errno = db_env_create (&RETVAL, env_flags); |
1249 | errno = db_env_create (&RETVAL, env_flags); |
1189 | if (errno) |
1250 | if (errno) |
1190 | croak ("db_env_create: %s", db_strerror (errno)); |
1251 | croak ("db_env_create: %s", db_strerror (errno)); |
|
|
1252 | |
|
|
1253 | if (0) |
|
|
1254 | { |
|
|
1255 | RETVAL->set_errcall (RETVAL, debug_errcall); |
|
|
1256 | RETVAL->set_msgcall (RETVAL, debug_msgcall); |
|
|
1257 | } |
1191 | } |
1258 | } |
1192 | OUTPUT: |
1259 | OUTPUT: |
1193 | RETVAL |
1260 | RETVAL |
1194 | |
1261 | |
1195 | void |
1262 | void |
1196 | db_env_open (DB_ENV *env, octetstring db_home, U32 open_flags, int mode, SV *callback = &PL_sv_undef) |
1263 | db_env_open (DB_ENV *env, octetstring db_home, U32 open_flags, int mode, SV *callback = &PL_sv_undef) |
1197 | CODE: |
1264 | CODE: |
1198 | { |
1265 | { |
1199 | dREQ (REQ_ENV_OPEN); |
1266 | dREQ (REQ_ENV_OPEN); |
1200 | |
1267 | |
1201 | env->set_thread_count (env, get_nthreads ()); |
1268 | env->set_thread_count (env, wanted + 2); |
1202 | |
1269 | |
1203 | req->env = env; |
1270 | req->env = env; |
1204 | req->uint1 = open_flags | DB_THREAD; |
1271 | req->uint1 = open_flags | DB_THREAD; |
1205 | req->int1 = mode; |
1272 | req->int1 = mode; |
1206 | req->buf1 = strdup_ornull (db_home); |
1273 | req->buf1 = strdup_ornull (db_home); |
… | |
… | |
1599 | CODE: |
1666 | CODE: |
1600 | RETVAL = env->set_flags (env, flags, onoff); |
1667 | RETVAL = env->set_flags (env, flags, onoff); |
1601 | OUTPUT: |
1668 | OUTPUT: |
1602 | RETVAL |
1669 | RETVAL |
1603 | |
1670 | |
|
|
1671 | void set_errfile (DB_ENV *env, FILE *errfile) |
|
|
1672 | CODE: |
|
|
1673 | env->set_errfile (env, errfile); |
|
|
1674 | |
|
|
1675 | void set_msgfile (DB_ENV *env, FILE *msgfile) |
|
|
1676 | CODE: |
|
|
1677 | env->set_msgfile (env, msgfile); |
|
|
1678 | |
|
|
1679 | int set_verbose (DB_ENV *env, U32 which, int onoff = 1) |
|
|
1680 | CODE: |
|
|
1681 | RETVAL = env->set_verbose (env, which, onoff); |
|
|
1682 | OUTPUT: |
|
|
1683 | RETVAL |
|
|
1684 | |
1604 | int set_encrypt (DB_ENV *env, const char *password, U32 flags = 0) |
1685 | int set_encrypt (DB_ENV *env, const char *password, U32 flags = 0) |
1605 | CODE: |
1686 | CODE: |
1606 | RETVAL = env->set_encrypt (env, password, flags); |
1687 | RETVAL = env->set_encrypt (env, password, flags); |
1607 | OUTPUT: |
1688 | OUTPUT: |
1608 | RETVAL |
1689 | RETVAL |