本文整理汇总了C++中TeDatabasePortal::getInt方法的典型用法代码示例。如果您正苦于以下问题:C++ TeDatabasePortal::getInt方法的具体用法?C++ TeDatabasePortal::getInt怎么用?C++ TeDatabasePortal::getInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TeDatabasePortal
的用法示例。
在下文中一共展示了TeDatabasePortal::getInt方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getMaxValue
int getMaxValue(TeDatabase* database, const std::string& tableName, const std::string& intColumnName)
{
TeDatabasePortal* portal = database->getPortal();
std::string sql = "SELECT MAX(" + intColumnName + ") FROM " + tableName;
int maxVal = 0;
if(portal->query(sql) && portal->fetchRow())
{
maxVal = portal->getInt(0);
}
delete portal;
return maxVal;
}
示例2: updateDB301To302
bool updateDB301To302(TeDatabase* db, string& errorMessage)
{
TeDatabasePortal* portal = db->getPortal();
if(!portal)
return false;
// ----- valid attribute table
TeAttrTableVector attrTableVec;
if(db->getAttrTables(attrTableVec))
{
for(unsigned int i=0; i<attrTableVec.size(); ++i)
{
TeTable fromTable = attrTableVec[i];
bool flag = false;
if(fromTable.tableType()==TeAttrMedia)
continue;
//verify if there is another table with the same name
for(unsigned int j=0; j<i; ++j)
{
if(TeConvertToUpperCase(attrTableVec[j].name())==TeConvertToUpperCase(fromTable.name()))
{
flag = true;
break;
}
}
if(flag)
continue;
if(db->validTable(fromTable)) //fromTable was modified
{
TeAttributeList newAttrList = fromTable.attributeList();
TeAttributeList oldAttrList = attrTableVec[i].attributeList();
TeAttributeList::iterator newAttIt = newAttrList.begin();
TeAttributeList::iterator oldAttIt = oldAttrList.begin();
bool change = false;
while(newAttIt!=newAttrList.end())
{
if(((*oldAttIt).rep_.name_) != ((*newAttIt).rep_.name_))
{
TeAttributeRep rep = (*newAttIt).rep_;
if(db->alterTable(fromTable.name(), rep, (*oldAttIt).rep_.name_))
change = true;
}
++newAttIt;
++oldAttIt;
}
if(change)
{
// update te_layer_table
string upd = " UPDATE te_layer_table ";
upd += " SET unique_id = '"+ fromTable.uniqueName() +"'";
upd += ", attr_link = '"+ fromTable.linkName() +"'";
upd += " WHERE attr_table = '"+ fromTable.name() +"'";
if(!db->execute (upd))
{
delete portal;
errorMessage = "Error updating te_layer_table!\n";
errorMessage += db->errorMessage();
return false;
}
}
}//if
}//for
portal->freeResult();
}
// ----- te_grouping table
string sel = " SELECT theme_id, grouping_attr, grouping_attr_type FROM te_grouping ";
if(!portal->query(sel))
{
delete portal;
return false;
}
while(portal->fetchRow())
{
string themeId, gAttr;
themeId = portal->getData(0);
gAttr = portal->getData(1);
int gTypr = portal->getInt(2);
if(((gAttr.empty()) || (gAttr=="NONE")) && (gTypr==0))
{
string del = " DELETE FROM te_grouping WHERE theme_id = "+ themeId;
db->execute(del);
}
}
// ----- te_grouping table
//.........这里部分代码省略.........