I'm looking for Berkeley DB equivalent of 

```
SELECT COUNT All, SELECT COUNT WHERE LIKE "%...%"

```

I have got 100 records with keys: 1, 2, 3, ... 100. 

I have got the following code: 

```
//Key = 1
i=1;
strcpy_s(buf, to_string(i).size()+1, to_string(i).c_str());
key.data = buf;
key.size = to_string(i).size()+1;
key.flags = 0;
data.data = rbuf;
data.size = sizeof(rbuf)+1;
data.flags = 0;

//Cursor
if ((ret = dbp->cursor(dbp, NULL, &dbcp, 0)) != 0) {
    dbp->err(dbp, ret, "DB->cursor");
    goto err1;
}

//Get
dbcp->get(dbcp, &key, &data_read, DB_SET_RANGE);
db_recno_t cnt;

dbcp->count(dbcp, &cnt, 0);
cout <<"count: "<<cnt<<endl;

```

Count cnt is always 1 but I expect it calculates all the partial key matches for Key=1: 1, 10, 11, 21, ... 91. 
What is wrong in my code/understanding of DB\_SET\_RANGE ? 
Is it possible to get SELECT COUNT WHERE LIKE "%...%" in BDB ? 
Also is it possible to get SELECT COUNT All records from the file ? 

Thanks