ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/BDB/BDB.xs
(Generate patch)

Comparing BDB/BDB.xs (file contents):
Revision 1.13 by root, Sun Jul 8 11:12:12 2007 UTC vs.
Revision 1.16 by root, Mon Aug 13 12:01:45 2007 UTC

44 44
45typedef SV SV8; /* byte-sv, used for argument-checking */ 45typedef SV SV8; /* byte-sv, used for argument-checking */
46typedef char *octetstring; 46typedef char *octetstring;
47 47
48static SV *prepare_cb; 48static SV *prepare_cb;
49
50#if DB_VERSION_MINOR >= 6
51# define c_close close
52# define c_count count
53# define c_del del
54# define c_dup dup
55# define c_get get
56# define c_pget pget
57# define c_put put
58#endif
59
60static void
61debug_errcall (const DB_ENV *dbenv, const char *errpfx, const char *msg)
62{
63 printf ("err[%s]\n", msg);
64}
65
66static void
67debug_msgcall (const DB_ENV *dbenv, const char *msg)
68{
69 printf ("msg[%s]\n", msg);
70}
49 71
50static char * 72static char *
51strdup_ornull (const char *s) 73strdup_ornull (const char *s)
52{ 74{
53 return s ? strdup (s) : 0; 75 return s ? strdup (s) : 0;
1018 const_iv (LOCK_YOUNGEST) 1040 const_iv (LOCK_YOUNGEST)
1019 1041
1020 const_iv (SEQ_DEC) 1042 const_iv (SEQ_DEC)
1021 const_iv (SEQ_INC) 1043 const_iv (SEQ_INC)
1022 const_iv (SEQ_WRAP) 1044 const_iv (SEQ_WRAP)
1045
1046 const_iv (BUFFER_SMALL)
1047 const_iv (DONOTINDEX)
1048 const_iv (KEYEMPTY )
1049 const_iv (KEYEXIST )
1050 const_iv (LOCK_DEADLOCK)
1051 const_iv (LOCK_NOTGRANTED)
1052 const_iv (LOG_BUFFER_FULL)
1053 const_iv (NOSERVER)
1054 const_iv (NOSERVER_HOME)
1055 const_iv (NOSERVER_ID)
1056 const_iv (NOTFOUND)
1057 const_iv (OLD_VERSION)
1058 const_iv (PAGE_NOTFOUND)
1059 const_iv (REP_DUPMASTER)
1060 const_iv (REP_HANDLE_DEAD)
1061 const_iv (REP_HOLDELECTION)
1062 const_iv (REP_IGNORE)
1063 const_iv (REP_ISPERM)
1064 const_iv (REP_JOIN_FAILURE)
1065 const_iv (REP_LOCKOUT)
1066 const_iv (REP_NEWMASTER)
1067 const_iv (REP_NEWSITE)
1068 const_iv (REP_NOTPERM)
1069 const_iv (REP_UNAVAIL)
1070 const_iv (RUNRECOVERY)
1071 const_iv (SECONDARY_BAD)
1072 const_iv (VERIFY_BAD)
1073 const_iv (VERSION_MISMATCH)
1074
1075 const_iv (VERB_DEADLOCK)
1076 const_iv (VERB_RECOVERY)
1077 const_iv (VERB_REGISTER)
1078 const_iv (VERB_REPLICATION)
1079 const_iv (VERB_WAITSFOR)
1080
1081 const_iv (VERSION_MAJOR)
1082 const_iv (VERSION_MINOR)
1083 const_iv (VERSION_PATCH)
1023#if DB_VERSION_MINOR >= 5 1084#if DB_VERSION_MINOR >= 5
1024 const_iv (MULTIVERSION) 1085 const_iv (MULTIVERSION)
1025 const_iv (TXN_SNAPSHOT) 1086 const_iv (TXN_SNAPSHOT)
1026#endif 1087#endif
1088#if DB_VERSION_MINOR >= 6
1089 const_iv (PREV_DUP)
1090# if 0
1091 const_iv (PRIORITY_UNCHANGED)
1092 const_iv (PRIORITY_VERY_LOW)
1093 const_iv (PRIORITY_LOW)
1094 const_iv (PRIORITY_DEFAULT)
1095 const_iv (PRIORITY_HIGH)
1096 const_iv (PRIORITY_VERY_HIGH)
1097# endif
1098#endif
1027 }; 1099 };
1028 1100
1029 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) 1101 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; )
1030 newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); 1102 newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv));
1103
1104 newCONSTSUB (stash, "DB_VERSION", newSVnv (DB_VERSION_MAJOR + DB_VERSION_MINOR * .1));
1105 newCONSTSUB (stash, "DB_VERSION_STRING", newSVpv (DB_VERSION_STRING, 0));
1031 1106
1032 create_pipe (respipe); 1107 create_pipe (respipe);
1033 1108
1034 X_THREAD_ATFORK (atfork_prepare, atfork_parent, atfork_child); 1109 X_THREAD_ATFORK (atfork_prepare, atfork_parent, atfork_child);
1035#ifdef _WIN32 1110#ifdef _WIN32
1178 PROTOTYPE: & 1253 PROTOTYPE: &
1179 CODE: 1254 CODE:
1180 SvREFCNT_dec (prepare_cb); 1255 SvREFCNT_dec (prepare_cb);
1181 prepare_cb = newSVsv (cb); 1256 prepare_cb = newSVsv (cb);
1182 1257
1258char *
1259strerror (int errorno = errno)
1260 PROTOTYPE: ;$
1261 CODE:
1262 RETVAL = db_strerror (errorno);
1263 OUTPUT:
1264 RETVAL
1183 1265
1184DB_ENV * 1266DB_ENV *
1185db_env_create (U32 env_flags = 0) 1267db_env_create (U32 env_flags = 0)
1186 CODE: 1268 CODE:
1187{ 1269{
1188 errno = db_env_create (&RETVAL, env_flags); 1270 errno = db_env_create (&RETVAL, env_flags);
1189 if (errno) 1271 if (errno)
1190 croak ("db_env_create: %s", db_strerror (errno)); 1272 croak ("db_env_create: %s", db_strerror (errno));
1273
1274 if (0)
1275 {
1276 RETVAL->set_errcall (RETVAL, debug_errcall);
1277 RETVAL->set_msgcall (RETVAL, debug_msgcall);
1278 }
1191} 1279}
1192 OUTPUT: 1280 OUTPUT:
1193 RETVAL 1281 RETVAL
1194 1282
1195void 1283void
1196db_env_open (DB_ENV *env, octetstring db_home, U32 open_flags, int mode, SV *callback = &PL_sv_undef) 1284db_env_open (DB_ENV *env, octetstring db_home, U32 open_flags, int mode, SV *callback = &PL_sv_undef)
1197 CODE: 1285 CODE:
1198{ 1286{
1199 dREQ (REQ_ENV_OPEN); 1287 dREQ (REQ_ENV_OPEN);
1200 1288
1201 env->set_thread_count (env, get_nthreads ()); 1289 env->set_thread_count (env, wanted + 2);
1202 1290
1203 req->env = env; 1291 req->env = env;
1204 req->uint1 = open_flags | DB_THREAD; 1292 req->uint1 = open_flags | DB_THREAD;
1205 req->int1 = mode; 1293 req->int1 = mode;
1206 req->buf1 = strdup_ornull (db_home); 1294 req->buf1 = strdup_ornull (db_home);
1599 CODE: 1687 CODE:
1600 RETVAL = env->set_flags (env, flags, onoff); 1688 RETVAL = env->set_flags (env, flags, onoff);
1601 OUTPUT: 1689 OUTPUT:
1602 RETVAL 1690 RETVAL
1603 1691
1692void set_errfile (DB_ENV *env, FILE *errfile = 0)
1693 CODE:
1694 env->set_errfile (env, errfile);
1695
1696void set_msgfile (DB_ENV *env, FILE *msgfile = 0)
1697 CODE:
1698 env->set_msgfile (env, msgfile);
1699
1700int set_verbose (DB_ENV *env, U32 which, int onoff = 1)
1701 CODE:
1702 RETVAL = env->set_verbose (env, which, onoff);
1703 OUTPUT:
1704 RETVAL
1705
1604int set_encrypt (DB_ENV *env, const char *password, U32 flags = 0) 1706int set_encrypt (DB_ENV *env, const char *password, U32 flags = 0)
1605 CODE: 1707 CODE:
1606 RETVAL = env->set_encrypt (env, password, flags); 1708 RETVAL = env->set_encrypt (env, password, flags);
1607 OUTPUT: 1709 OUTPUT:
1608 RETVAL 1710 RETVAL
1692 CODE: 1794 CODE:
1693 RETVAL = db->set_cachesize (db, gbytes, bytes, ncache); 1795 RETVAL = db->set_cachesize (db, gbytes, bytes, ncache);
1694 OUTPUT: 1796 OUTPUT:
1695 RETVAL 1797 RETVAL
1696 1798
1697int set_flags (DB *db, U32 flags); 1799int set_flags (DB *db, U32 flags)
1698 CODE: 1800 CODE:
1699 RETVAL = db->set_flags (db, flags); 1801 RETVAL = db->set_flags (db, flags);
1700 OUTPUT: 1802 OUTPUT:
1701 RETVAL 1803 RETVAL
1702 1804
1716 CODE: 1818 CODE:
1717 RETVAL = db->set_bt_minkey (db, minkey); 1819 RETVAL = db->set_bt_minkey (db, minkey);
1718 OUTPUT: 1820 OUTPUT:
1719 RETVAL 1821 RETVAL
1720 1822
1721int set_re_delim(DB *db, int delim); 1823int set_re_delim (DB *db, int delim)
1722 CODE: 1824 CODE:
1723 RETVAL = db->set_re_delim (db, delim); 1825 RETVAL = db->set_re_delim (db, delim);
1724 OUTPUT: 1826 OUTPUT:
1725 RETVAL 1827 RETVAL
1726 1828

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines