![]() |
![]() |
|
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
| DelevopersObjectDatabase++ APISearch Index |
unsigned int SearchIndex ( unsigned int tableID, unsigned int index, const void *binaryKey, const void *tokenKey = NULL, bool acquireObjectLocks = false, __int64 *objectCount = NULL ); unsigned int SearchIndex ( unsigned int tableID, unsigned int index, const void *binaryKey, unsigned int errorMargin, bool acquireObjectLocks = false, __int64 *objectCount = NULL );
| tableID | The table ID defining the table's handle. |
| index | The index value, 0 for object ID hash index is invalid, 1 for the first defined index |
| binaryKey | The buffer containing the binary key value used in the search of a CODBPP::S_TREE, or the binary section of a CODBPP::A_LIST or a CODBPP::W_LIST key search. |
| tokenKey | The buffer containing the token section for a CODBPP::A_LIST or a CODBPP::W_LIST key search. This variable is of type void beacuse for a CODBPP::A_LIST the string should be in ASCII format, while for a CODBPP::W_LIST it should be a wide character string. |
| errorMargin | Used for search Spatial Pattern indexes, allowing for matching patterns with the error margin. |
| acquireObjectLocks | With this set to true, this method will acquire all object locks before returning NO_ERROR, else the read method will acquire the object lock. |
| objectCount | The total amount of object found in the search. |
CODBPP::Object object;
struct FixedObject{
int First;
RECT Second;
} *fixedObject;
int key[4] = {2,2,4,4}; // Key for a spatial tree index
char16_t string[64];
if((error = database.BeginTransaction()) == NO_ERROR){
if((error = database.OpenTable(1)) == NO_ERROR){
if((error = database.SearchIndex(1,1,key)) == NO_ERROR){
error = database.ReadObject(1,CODBPP::FIRST,&object,1);
while(error == NO_ERROR){
fixedObject = (struct FixedObject*)object.fixed;
swprintf(string,_T"left = %d, top = %d, right = %d, bottom = %d",fixedObject->second.left,fixedObject->second.top,fixedObject->second.right,fixedObject->second.bottom);
MessageBox(string);
error = database.ReadObject(1,CODBPP::NEXT,&object,1);
}
if(error == (0x10000 | CODBPP::NOT_FOUND_INDEX_KEY)) error = NO_ERROR;
}
}
}
if(error && database.GetErrorMessage(&message) == NO_ERROR)
MessageBox(message);
database.EndTransaction();
Copyright © 2003-2008, Ekky Software Pty. Ltd.