本文整理汇总了C++中ndbdictionary::Table::getNoOfPrimaryKeys方法的典型用法代码示例。如果您正苦于以下问题:C++ Table::getNoOfPrimaryKeys方法的具体用法?C++ Table::getNoOfPrimaryKeys怎么用?C++ Table::getNoOfPrimaryKeys使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ndbdictionary::Table
的用法示例。
在下文中一共展示了Table::getNoOfPrimaryKeys方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Record
/*
DBIndex = {
name : "" , // Index name; undefined for PK
isPrimaryKey : true , // true for PK; otherwise undefined
isUnique : true , // true or false
isOrdered : true , // true or false; can scan if true
columnNumbers : [] , // an ordered array of column numbers
};
*/
Handle<Object> GetTableCall::buildDBIndex_PK() {
HandleScope scope;
Local<Object> obj = Object::New();
obj->Set(String::NewSymbol("isPrimaryKey"), Boolean::New(true), ReadOnly);
obj->Set(String::NewSymbol("isUnique"), Boolean::New(true), ReadOnly);
obj->Set(String::NewSymbol("isOrdered"), Boolean::New(false), ReadOnly);
/* Loop over the columns of the key.
Build the "columnNumbers" array and the "record" object, then set both.
*/
int ncol = ndb_table->getNoOfPrimaryKeys();
DEBUG_PRINT("Creating Primary Key Record");
Record * pk_record = new Record(arg0->dict, ncol);
Local<Array> idx_columns = Array::New(ncol);
for(int i = 0 ; i < ncol ; i++) {
const char * col_name = ndb_table->getPrimaryKey(i);
const NdbDictionary::Column * col = ndb_table->getColumn(col_name);
pk_record->addColumn(col);
idx_columns->Set(i, v8::Int32::New(col->getColumnNo()));
}
pk_record->completeTableRecord(ndb_table);
obj->Set(String::NewSymbol("columnNumbers"), idx_columns);
obj->Set(String::NewSymbol("record"), Record_Wrapper(pk_record), ReadOnly);
return scope.Close(obj);
}
示例2: scope
/*
DBIndex = {
name : "" , // Index name
isPrimaryKey : true , // true for PK; otherwise undefined
isUnique : true , // true or false
isOrdered : true , // true or false; can scan if true
columnNumbers : [] , // an ordered array of column numbers
};
*/
Handle<Object> GetTableCall::buildDBIndex_PK() {
EscapableHandleScope scope(isolate);
Local<Object> obj = Object::New(isolate);
SET_RO_PROPERTY(obj, SYMBOL(isolate, "name"), String::NewFromUtf8(isolate, "PRIMARY_KEY"));
SET_RO_PROPERTY(obj, SYMBOL(isolate, "isPrimaryKey"), Boolean::New(isolate, true));
SET_RO_PROPERTY(obj, SYMBOL(isolate, "isUnique"), Boolean::New(isolate, true));
SET_RO_PROPERTY(obj, SYMBOL(isolate, "isOrdered"), Boolean::New(isolate, false));
/* Loop over the columns of the key.
Build the "columnNumbers" array and the "record" object, then set both.
*/
int ncol = ndb_table->getNoOfPrimaryKeys();
DEBUG_PRINT("Creating Primary Key Record");
Record * pk_record = new Record(dict, ncol);
Local<Array> idx_columns = Array::New(isolate, ncol);
for(int i = 0 ; i < ncol ; i++) {
const char * col_name = ndb_table->getPrimaryKey(i);
const NdbDictionary::Column * col = ndb_table->getColumn(col_name);
pk_record->addColumn(col);
idx_columns->Set(i, v8::Int32::New(isolate, col->getColumnNo()));
}
pk_record->completeTableRecord(ndb_table);
obj->Set(SYMBOL(isolate, "columnNumbers"), idx_columns);
SET_RO_PROPERTY(obj, SYMBOL(isolate, "record"), Record_Wrapper(pk_record));
return scope.Escape(obj);
}