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

Comparing BDB/BDB.xs (file contents):
Revision 1.42 by root, Wed Jul 9 12:39:56 2008 UTC vs.
Revision 1.46 by root, Wed Jul 9 21:16:14 2008 UTC

139enum { 139enum {
140 REQ_QUIT, 140 REQ_QUIT,
141 REQ_ENV_OPEN, REQ_ENV_CLOSE, REQ_ENV_TXN_CHECKPOINT, REQ_ENV_LOCK_DETECT, 141 REQ_ENV_OPEN, REQ_ENV_CLOSE, REQ_ENV_TXN_CHECKPOINT, REQ_ENV_LOCK_DETECT,
142 REQ_ENV_MEMP_SYNC, REQ_ENV_MEMP_TRICKLE, REQ_ENV_DBREMOVE, REQ_ENV_DBRENAME, 142 REQ_ENV_MEMP_SYNC, REQ_ENV_MEMP_TRICKLE, REQ_ENV_DBREMOVE, REQ_ENV_DBRENAME,
143 REQ_DB_OPEN, REQ_DB_CLOSE, REQ_DB_COMPACT, REQ_DB_SYNC, REQ_DB_UPGRADE, 143 REQ_DB_OPEN, REQ_DB_CLOSE, REQ_DB_COMPACT, REQ_DB_SYNC, REQ_DB_UPGRADE,
144 REQ_DB_PUT, REQ_DB_GET, REQ_DB_PGET, REQ_DB_DEL, REQ_DB_KEY_RANGE, 144 REQ_DB_PUT, REQ_DB_EXISTS, REQ_DB_GET, REQ_DB_PGET, REQ_DB_DEL, REQ_DB_KEY_RANGE,
145 REQ_TXN_COMMIT, REQ_TXN_ABORT, REQ_TXN_FINISH, 145 REQ_TXN_COMMIT, REQ_TXN_ABORT, REQ_TXN_FINISH,
146 REQ_C_CLOSE, REQ_C_COUNT, REQ_C_PUT, REQ_C_GET, REQ_C_PGET, REQ_C_DEL, 146 REQ_C_CLOSE, REQ_C_COUNT, REQ_C_PUT, REQ_C_GET, REQ_C_PGET, REQ_C_DEL,
147 REQ_SEQ_OPEN, REQ_SEQ_CLOSE, REQ_SEQ_GET, REQ_SEQ_REMOVE, 147 REQ_SEQ_OPEN, REQ_SEQ_CLOSE, REQ_SEQ_GET, REQ_SEQ_REMOVE,
148}; 148};
149 149
411 return !SvTRUE (ERRSV); 411 return !SvTRUE (ERRSV);
412} 412}
413 413
414static void req_free (bdb_req req) 414static void req_free (bdb_req req)
415{ 415{
416 SvREFCNT_dec (req->callback);
417
416 free (req->buf1); 418 free (req->buf1);
417 free (req->buf2); 419 free (req->buf2);
418 free (req->buf3); 420 free (req->buf3);
421
419 Safefree (req); 422 Safefree (req);
420} 423}
421 424
422#ifdef USE_SOCKETS_AS_HANDLES 425#ifdef USE_SOCKETS_AS_HANDLES
423# define TO_SOCKET(x) (win32_get_osfhandle (x)) 426# define TO_SOCKET(x) (win32_get_osfhandle (x))
805 808
806 case REQ_DB_PUT: 809 case REQ_DB_PUT:
807 req->result = req->db->put (req->db, req->txn, &req->dbt1, &req->dbt2, req->uint1); 810 req->result = req->db->put (req->db, req->txn, &req->dbt1, &req->dbt2, req->uint1);
808 break; 811 break;
809 812
813#if DB_VERSION_MINOR >= 6
814 case REQ_DB_EXISTS:
815 req->result = req->db->exists (req->db, req->txn, &req->dbt1, req->uint1);
816 break;
817#endif
810 case REQ_DB_GET: 818 case REQ_DB_GET:
811 req->result = req->db->get (req->db, req->txn, &req->dbt1, &req->dbt3, req->uint1); 819 req->result = req->db->get (req->db, req->txn, &req->dbt1, &req->dbt3, req->uint1);
812 break; 820 break;
813 821
814 case REQ_DB_PGET: 822 case REQ_DB_PGET:
1686 sv_to_dbt (&req->dbt2, data); 1694 sv_to_dbt (&req->dbt2, data);
1687 req->uint1 = flags; 1695 req->uint1 = flags;
1688 REQ_SEND; 1696 REQ_SEND;
1689} 1697}
1690 1698
1699#if DB_VERSION_MINOR >= 6
1700
1701void
1702db_exists (DB *db, DB_TXN_ornull *txn, SV *key, U32 flags = 0, SV *callback = 0)
1703 PREINIT:
1704 CALLBACK
1705 CODE:
1706{
1707 dREQ (REQ_DB_EXISTS);
1708 req->db = db;
1709 req->txn = txn;
1710 req->uint1 = flags;
1711 sv_to_dbt (&req->dbt1, key);
1712 REQ_SEND;
1713}
1714
1715#endif
1716
1691void 1717void
1692db_get (DB *db, DB_TXN_ornull *txn, SV *key, SV *data, U32 flags = 0, SV *callback = 0) 1718db_get (DB *db, DB_TXN_ornull *txn, SV *key, SV *data, U32 flags = 0, SV *callback = 0)
1693 PREINIT: 1719 PREINIT:
1694 CALLBACK 1720 CALLBACK
1695 CODE: 1721 CODE:
2113 if (errno) 2139 if (errno)
2114 croak ("DB_ENV->txn_begin: %s", db_strerror (errno)); 2140 croak ("DB_ENV->txn_begin: %s", db_strerror (errno));
2115 OUTPUT: 2141 OUTPUT:
2116 RETVAL 2142 RETVAL
2117 2143
2144#if DB_VERSION_MINOR >= 5
2145
2146DB_TXN *
2147cdsgroup_begin (DB_ENV *env)
2148 CODE:
2149 errno = env->cdsgroup_begin (env, &RETVAL);
2150 if (errno)
2151 croak ("DB_ENV->cdsgroup_begin: %s", db_strerror (errno));
2152 OUTPUT:
2153 RETVAL
2154
2155#endif
2156
2118MODULE = BDB PACKAGE = BDB::Db 2157MODULE = BDB PACKAGE = BDB::Db
2119 2158
2120void 2159void
2121DESTROY (DB_ornuked *db) 2160DESTROY (DB_ornuked *db)
2122 CODE: 2161 CODE:

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines