MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / insert

Function insert

utils/db_berkeley/bdb_recover.c:573–593  ·  view source on GitHub ↗

* insert -- given the data row (v) and its length (vlen), we build the corresponding * key, and insert the data in to the db. * This will over-right the value if already present. */

Source from the content-addressed store, hash-verified

571* This will over-right the value if already present.
572*/
573int insert(table_p tp, char* v, int vlen)
574{
575 char k[MAX_ROW_SIZE];
576 int rc, klen;
577 DB *db;
578
579 if(!tp || !v) return 1;
580 if((db = get_db(tp)) == NULL) return 2;
581
582 memset(k,0,MAX_ROW_SIZE);
583 if( extract_key(tp, k, v) )
584 {
585 fprintf(stderr, "[insert] failed to extract key for row: %.*s",vlen, v);
586 return 2;
587 }
588
589 klen = strlen(k);
590 rc = _insert(db, k, v, klen, vlen);
591
592 return rc;
593}
594
595
596/**

Callers 3

dbase.cFile · 0.85
recoverFunction · 0.85
updateFunction · 0.85

Calls 3

get_dbFunction · 0.85
extract_keyFunction · 0.85
_insertFunction · 0.85

Tested by

no test coverage detected