int DB->open(DB *db, DB_TXN *txnid, const char *file, const char *database, DBTYPE type, u_int32_t flags, int mode); eg: if ((ret = db_create(&dbp, NULL, 0)) != 0) { fprintf(stderr, "db_create: %s\n", db_strerror(ret)); exit (1); } if ((ret = dbp->open(dbp, NULL, DATABASE, NULL, DB_BTREE, DB_CREATE, 0664)) != 0) { dbp->err(dbp, ret, "%s", DATABASE); exit (1); }
eg: key.data = "sport"; key.size = sizeof("sport"); if ((ret = dbp->del(dbp, NULL, &key, 0)) == 0) printf("db: %s: key was deleted.\n", (char*)key.data); else dbp->err(dbp, ret, "DB->del");
Posted by: 大CC | 17SEP,2013
博客:blog.me115.com
微博:新浪微博