本文整理汇总了C++中CppSQLite3Query::getValuebyName方法的典型用法代码示例。如果您正苦于以下问题:C++ CppSQLite3Query::getValuebyName方法的具体用法?C++ CppSQLite3Query::getValuebyName怎么用?C++ CppSQLite3Query::getValuebyName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CppSQLite3Query
的用法示例。
在下文中一共展示了CppSQLite3Query::getValuebyName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateDataToDB
/*
Date:2013/05/29
Purpose:
parameters 1:根据层次
2:改变的名字,有新旧比较
*/
BOOL CWorkspaceBar::UpdateDataToDB(){
CppSQLite3DB SqliteDBT3000;
CppSQLite3DB SqliteDBBuilding;
CppSQLite3Table table;
CppSQLite3Query q;
SqliteDBT3000.open((UTF8MBSTR)g_strDatabasefilepath);
SqliteDBBuilding.open((UTF8MBSTR)g_strCurBuildingDatabasefilePath);
try
{
CString strSql; BOOL is_exist=FALSE; CString str_temp;
switch (m_level)
{
case 0: //Subnet
{
strSql.Format(_T("select * from Building order by Main_BuildingName"));
q = SqliteDBT3000.execQuery((UTF8MBSTR)strSql);
while(!q.eof())
{
str_temp.Empty();
str_temp= q.getValuebyName(L"Building_Name");
if (str_temp.Compare(m_name_new)==0)
{
is_exist=TRUE;
break;
}
q.nextRow();
}
if (!is_exist) //更新的名字在数据库中查找不到的
{
////////////先更新Building表/////////////////////
//CString strSql;
strSql.Format(_T("delete from Building_ALL where Building_Name = '%s' "),m_name_old);
SqliteDBT3000.execDML((UTF8MBSTR)strSql);
strSql.Format(_T("Insert into Building_ALL(Building_Name,Default_Build) values('%s','%d')"),m_name_new,1);
SqliteDBT3000.execDML((UTF8MBSTR)strSql);
strSql.Format(_T("update Building set Building_Name='%s',Main_BuildingName= where Building_Name='%s'"),m_name_new,m_name_new,m_name_old);
//MessageBox(strSql);
SqliteDBT3000.execDML((UTF8MBSTR)strSql);
strSql.Format(_T("select * from ALL_NODE where Building_Name='%s' order by Building_Name"),m_name_old);
q = SqliteDBBuilding.execQuery((UTF8MBSTR)strSql);
while(!q.eof())
{
strSql.Format(_T("update ALL_NODE set Building_Name='%s' where Building_Name='%s'"),m_name_new,m_name_old);
SqliteDBBuilding.execDML((UTF8MBSTR)strSql);
q.nextRow();
}
}
else
{
return FALSE;
}
break;
}
case 1: //Floor
{
// m_pRs->Open((_variant_t)strSql,_variant_t((IDispatch *)m_pCon,true),adOpenStatic,adLockOptimistic,adCmdText);
HTREEITEM parentnode=m_TreeCtrl.GetParentItem(m_hSelItem);
CString subnetname=m_TreeCtrl.GetItemText(parentnode);//m_pRs->GetCollect("Building_Name");
// m_pRs->Close();
strSql.Format(_T("select * from ALL_NODE where Building_Name='%s' and Floor_name='%s' order by Building_Name"),subnetname,m_name_new);
q = SqliteDBBuilding.execQuery((UTF8MBSTR)strSql);
while(!q.eof())
{
str_temp.Empty();
str_temp=q.getValuebyName(L"Floor_name");
if (str_temp.Compare(m_name_new)==0)
{is_exist=TRUE;
break;
}
q.nextRow();
}
if (is_exist)
//.........这里部分代码省略.........
示例2: ReloadSingleLevelSetDB
void CUserAcessSetDlg::ReloadSingleLevelSetDB()
{
m_FlexGrid2.Clear();
m_FlexGrid2.put_Cols(4);
m_FlexGrid2.put_TextMatrix(0,1,_T("Grid 1"));
m_FlexGrid2.put_TextMatrix(0,1,_T("User"));
m_FlexGrid2.put_TextMatrix(0,2,_T("Network Controller"));
m_FlexGrid2.put_TextMatrix(0,3,_T("Database"));
m_FlexGrid2.put_ColWidth(0,1000);
m_FlexGrid2.put_ColWidth(1,1000);
m_FlexGrid2.put_ColWidth(2,1500);
m_FlexGrid2.put_ColWidth(3,1000);
for(int i=0;i<4;i++)
{
m_FlexGrid2.put_ColAlignment(i,4);
}
CppSQLite3Table table;
CppSQLite3Query q;
CppSQLite3DB SqliteDBBuilding;
SqliteDBBuilding.open((UTF8MBSTR)g_strCurBuildingDatabasefilePath);
CString strSql;
strSql.Format(_T("select * from UserLevelSingleSet where MainBuilding_Name='%s' and Building_Name='%s' and username='%s'"),m_strMainBuilding,m_strSubNetName,m_strUserName);
q = SqliteDBBuilding.execQuery((UTF8MBSTR)strSql);
_variant_t temp_variant;
BOOL b_useLogin=false;
int temp_row=0;
CString strTemp;
int nTemp;
while(!q.eof())
{
++temp_row;
strTemp=q.getValuebyName(L"username");
m_FlexGrid2.put_TextMatrix(temp_row,1,strTemp);
nTemp=q.getIntField("networkcontroller");
switch (nTemp)
{
case 0:strTemp=_T("Read & write");break;
case 1:strTemp=_T("Read only");break;
default:strTemp=_T("Read & write");
}
m_FlexGrid2.put_TextMatrix(temp_row,2,strTemp);
nTemp=q.getIntField("database_limition");//
switch (nTemp)
{
case 0:strTemp=_T("Read & write");break;
case 1:strTemp=_T("Read only");break;
default:strTemp=_T("Read & write");
}
m_FlexGrid2.put_TextMatrix(temp_row,3,strTemp);
q.nextRow();
}
SqliteDBBuilding.closedb();
}
示例3: InserProductToUserSetDB
void CUserAcessSetDlg::InserProductToUserSetDB()
{
CppSQLite3Table table;
CppSQLite3Query q;
CppSQLite3DB SqliteDBBuilding;
SqliteDBBuilding.open((UTF8MBSTR)g_strCurBuildingDatabasefilePath);
CString strSql;
strSql.Format(_T("select * from user_level where MainBuilding_Name='%s' and Building_Name='%s'and username='%s'"),m_strMainBuilding,m_strSubNetName,m_strUserName);
q = SqliteDBBuilding.execQuery((UTF8MBSTR)strSql);
USERLEVEL UserLevelV;
_variant_t temp_variant;
CString strTemp;
int nTemp;
m_UserLevelLst.clear();
while(!q.eof())
{
strTemp=q.getValuebyName(L"username");//
UserLevelV.strUserName=strTemp;
nTemp=q.getIntField("serial_number");//
UserLevelV.nSerialNumber=nTemp;
m_UserLevelLst.push_back(UserLevelV);
q.nextRow();
}
VERYPRODCT veryProduct;
//strSql=_T("select * from ALL_NODE where ");///MainBuilding_Name
strSql.Format(_T("select * from ALL_NODE where MainBuilding_Name='%s' and Building_Name='%s'"),m_strMainBuilding,m_strSubNetName);
// m_pRs->Open((_variant_t)strSql,_variant_t((IDispatch *)m_pCon,true),adOpenStatic,adLockOptimistic,adCmdText);
q = SqliteDBBuilding.execQuery((UTF8MBSTR)strSql);
m_VeryProdctLst.clear();
while(!q.eof())
{
//veryProduct.strMainBuildingName=m_pRs->GetCollect("MainBuilding_Name");//
strTemp=q.getValuebyName(L"MainBuilding_Name");//
veryProduct.strMainBuildingName=strTemp;
//veryProduct.strBuildingName=m_pRs->GetCollect("Building_Name");//
strTemp=q.getValuebyName(L"Building_Name");//
veryProduct.strBuildingName=strTemp;
// veryProduct.nSerialNumber=m_pRs->GetCollect("Serial_ID");
strTemp=q.getValuebyName(L"Serial_ID");//
veryProduct.nSerialNumber=_wtol(strTemp);
//veryProduct.ProductID=m_pRs->GetCollect("Product_ID");
strTemp=q.getValuebyName(L"Product_ID");//
veryProduct.ProductID=_wtoi(strTemp);
//veryProduct.product_class_id=m_pRs->GetCollect("Product_class_ID");
strTemp=q.getValuebyName(L"Product_class_ID");//
veryProduct.product_class_id=_wtoi(strTemp);
//veryProduct.strFloorName=m_pRs->GetCollect("Floor_name");
strTemp=q.getValuebyName(L"Floor_name");//
veryProduct.strFloorName=strTemp;
// veryProduct.strRoomName=m_pRs->GetCollect("Room_name");
strTemp=q.getValuebyName(L"Room_name");//
veryProduct.strRoomName=strTemp;
m_VeryProdctLst.push_back(veryProduct);
q.nextRow();
}
int nVerySerialNum;
int nUserlevelSerial;
CString strUserName;
for(UINT i=0;i<m_VeryProdctLst.size();i++)
{
nVerySerialNum=m_VeryProdctLst.at(i).nSerialNumber;
BOOL bFind=FALSE;
for(UINT j=0;j<m_UserLevelLst.size();j++)
{
nUserlevelSerial=m_UserLevelLst.at(j).nSerialNumber;
if(nVerySerialNum==nUserlevelSerial)
{
bFind=TRUE;
break;
}
//else
//{
// bFind=FALSE;
//.........这里部分代码省略.........
示例4: ReloadUserLevelDB
void CUserAcessSetDlg::ReloadUserLevelDB()
{
m_FlexGrid.Clear();
m_FlexGrid.put_Cols(13);
m_FlexGrid.put_TextMatrix(0,1,_T("Grid 2"));
m_FlexGrid.put_TextMatrix(0,1,_T("User"));
m_FlexGrid.put_TextMatrix(0,2,_T("Serial"));
m_FlexGrid.put_TextMatrix(0,3,_T("ID"));
m_FlexGrid.put_TextMatrix(0,4,_T("Floor"));
m_FlexGrid.put_TextMatrix(0,5,_T("Room"));
m_FlexGrid.put_TextMatrix(0,6,_T("Main Screen"));
m_FlexGrid.put_TextMatrix(0,7,_T("Parameter"));
m_FlexGrid.put_TextMatrix(0,8,_T("Output "));
// m_FlexGrid.put_TextMatrix(0,9,_T("Network Ctr"));
m_FlexGrid.put_TextMatrix(0,9,_T("Graphic"));
// m_FlexGrid.put_TextMatrix(0,10,_T("Building Set"));
m_FlexGrid.put_TextMatrix(0,10,_T("Burn Hex"));
m_FlexGrid.put_TextMatrix(0,11,_T("Load Config"));
m_FlexGrid.put_TextMatrix(0,12,_T("All Screen"));
m_FlexGrid.put_ColWidth(0,700);
m_FlexGrid.put_ColWidth(1,700);
m_FlexGrid.put_ColWidth(2,700);
m_FlexGrid.put_ColWidth(3,1000);
m_FlexGrid.put_ColWidth(4,1000);
m_FlexGrid.put_ColWidth(5,1000);
m_FlexGrid.put_ColWidth(6,1100);
m_FlexGrid.put_ColWidth(7,1100);
m_FlexGrid.put_ColWidth(8,1100);
m_FlexGrid.put_ColWidth(9,1100);
m_FlexGrid.put_ColWidth(10,1100);
m_FlexGrid.put_ColWidth(11,1100);
m_FlexGrid.put_ColWidth(12,1100);
for(int i=0;i<13;i++)
{
m_FlexGrid.put_ColAlignment(i,4);
}
CppSQLite3Table table;
CppSQLite3Query q;
CppSQLite3DB SqliteDBBuilding;
SqliteDBBuilding.open((UTF8MBSTR)g_strCurBuildingDatabasefilePath);
CString strSql;
//m_pRsTemp->Open((_variant_t)("select * from user_level where username = '"+m_strUserName+"'"),_variant_t((IDispatch *)m_pConTmp,true),adOpenStatic,adLockOptimistic,adCmdText);
// strSql.Format(_T("select * from user_level where MainBuilding_Name='%s' and Building_Name='%s'"),m_strMainBuilding,m_strSubNetName);
strSql.Format(_T("select * from user_level where MainBuilding_Name='%s' and Building_Name='%s' and username='%s'"),m_strMainBuilding,m_strSubNetName,m_strUserName);
q = SqliteDBBuilding.execQuery((UTF8MBSTR)strSql);
table = SqliteDBBuilding.getTable((UTF8MBSTR)strSql);
USERLEVEL UserLevelV;
int temp_row=0;
int nTemp;
CString strTemp;
_variant_t temp_variant;
m_FlexGrid.put_Rows(table.numRows()+1);
for(int i=1;i<table.numRows()+1;i++)
{
for(int k=0;k<=12;k++)
{
if (i%2==0)
{
m_FlexGrid.put_Row(i);m_FlexGrid.put_Col(k);m_FlexGrid.put_CellBackColor(COLOR_CELL);
}
}
}
while(!q.eof())
{
++temp_row;
strTemp=q.getValuebyName(L"MainBuilding_Name");
UserLevelV.strMainBuildingName=strTemp;
strTemp=q.getValuebyName(L"Building_Name");
UserLevelV.strSubBuildingName=strTemp;
strTemp=q.getValuebyName(L"username");
UserLevelV.strUserName=strTemp;
nTemp=q.getIntField("serial_number");
UserLevelV.nSerialNumber=nTemp;
nTemp=q.getIntField("product_id");
UserLevelV.ProductID=nTemp;
strTemp=q.getValuebyName(L"floorname");
//.........这里部分代码省略.........
示例5:
void T38AI8AO::InitialRegister(){
T3Register temp;
g_VectorT3Register.clear();
CppSQLite3DB SqliteDBT3000;
CppSQLite3Table table;
CppSQLite3Query q;
SqliteDBT3000.open((UTF8MBSTR)g_strDatabasefilepath);
#if 1
CString SQL = _T("select * from T3_RegisterList");
q = SqliteDBT3000.execQuery((UTF8MBSTR)SQL);
_variant_t vartemp;
while(!q.eof())
{
temp.regID=q.getIntField("RegID");
temp.regName =q.getValuebyName(L"T3_8AI8AO");
q.nextRow();
g_VectorT3Register.push_back(temp);
}
SqliteDBT3000.closedb();
SN_LOW=Get_RegID(_T("SN_LOW")) ;
SN_HI=Get_RegID(_T("SN_HI")) ;
EPROM_VER_NUMBER=Get_RegID(_T("EPROM_VER_NUMBER")) ;
FIRMWARE_VER_NUMBER=Get_RegID(_T("FIRMWARE_VER_NUMBER")) ;
MODBUS_ID=Get_RegID(_T("MODBUS_ID")) ;
PRODUCT_MODEL =Get_RegID(_T("PRODUCT_MODEL"));
HARDWARE_VER_NUMBER=Get_RegID(_T("HARDWARE_VER_NUMBER")) ;
PIC_VER_NUMBER=Get_RegID(_T("PIC_VER_NUMBER")) ;
CALIBRATION_OUTPUTS =Get_RegID(_T("CALIBRATION_OUTPUTS"));
BAUDRATE=Get_RegID(_T("BAUDRATE")) ;
RESPONSE_DELAY =Get_RegID(_T("RESPONSE_DELAY"));
OUTPUT1 =Get_RegID(_T("OUTPUT1 "));
OUTPUT2 =Get_RegID(_T("OUTPUT2 "));
OUTPUT3 =Get_RegID(_T("OUTPUT3 "));
OUTPUT4 =Get_RegID(_T("OUTPUT4 "));
OUTPUT5 =Get_RegID(_T("OUTPUT5 "));
OUTPUT6 =Get_RegID(_T("OUTPUT6 "));
OUTPUT7 =Get_RegID(_T("OUTPUT7 "));
OUTPUT8 =Get_RegID(_T("OUTPUT8 "));
INPUT1 =Get_RegID(_T("INPUT1 "));
INPUT2 =Get_RegID(_T("INPUT2 "));
INPUT3 =Get_RegID(_T("INPUT3 "));
INPUT4 =Get_RegID(_T("INPUT4 "));
INPUT5 =Get_RegID(_T("INPUT5 "));
INPUT6 =Get_RegID(_T("INPUT6 "));
INPUT7 =Get_RegID(_T("INPUT7 "));
INPUT8 =Get_RegID(_T("INPUT8 "));
SWITCH1_STATUS=Get_RegID(_T("SWITCH1_STATUS")) ;
SWITCH2_STATUS=Get_RegID(_T("SWITCH2_STATUS")) ;
RANGE_INPUT1 =Get_RegID(_T("RANGE_INPUT1 "));
RANGE_INPUT2 =Get_RegID(_T("RANGE_INPUT2 "));
RANGE_INPUT3 =Get_RegID(_T("RANGE_INPUT3 "));
RANGE_INPUT4 =Get_RegID(_T("RANGE_INPUT4 "));
RANGE_INPUT5 =Get_RegID(_T("RANGE_INPUT5 "));
RANGE_INPUT6 =Get_RegID(_T("RANGE_INPUT6 "));
RANGE_INPUT7 =Get_RegID(_T("RANGE_INPUT7 "));
RANGE_INPUT8 =Get_RegID(_T("RANGE_INPUT8 "));
FILTER_INPUT1 =Get_RegID(_T("FILTER_INPUT1 "));
FILTER_INPUT2 =Get_RegID(_T("FILTER_INPUT2 "));
FILTER_INPUT3 =Get_RegID(_T("FILTER_INPUT3 "));
FILTER_INPUT4 =Get_RegID(_T("FILTER_INPUT4 "));
FILTER_INPUT5 =Get_RegID(_T("FILTER_INPUT5 "));
FILTER_INPUT6 =Get_RegID(_T("FILTER_INPUT6 "));
FILTER_INPUT7 =Get_RegID(_T("FILTER_INPUT7 "));
FILTER_INPUT8 =Get_RegID(_T("FILTER_INPUT8 "));
#endif
}