Exemplo n.º 1
0
const CVariant& CResultSet::GetVariant(const CDBParamVariant& param)
{
    int index = 0;

    if (param.IsPositional()) {
        index = param.GetPosition();
    } else {
        index = GetColNum(param.GetName());
    }

    CheckIdx(index);
    --index;

    if (index < m_LastVariantNum) {
        x_CacheItems(index);
    }
    else {
        switch (m_RowReadType) {
        case eReadRaw:
            // Here we will be also when IsDisableBind() == true
            m_data[index].SetNull();
            break;
        case eReadUnknown:
            m_RowReadType = eReadVariant;
            m_column = -1;
            // fall through
        //case eReadVariant:
        default:
            x_CacheItems(index);
            break;
        }
    }

    return m_data[index];
}
Exemplo n.º 2
0
bool DBDictionary::CreateDBDic( const XmlNode * resNode )
{
	int nodeCount = resNode->GetNodeCount( "table" );
	for( int num = 0; num < nodeCount; num++ )
	{
		const XmlNode * tableNode = resNode->GetNode( "table", num );
		std::string tableName = tableNode->GetAttribute( "name" );

		// 디비 커넥터 접속해서 컬럼 가져오기
		ColList colList;
		DBConnector::GetInstance().GetColumnsList( tableName.c_str(), colList );

		// 디비 커넥터 접속해서 데이터 가져오기
		DataList dataList;
		DBConnector::GetInstance().GetDataList( tableName.c_str(), dataList );

		TableDataForDic tableDataList;
		tableDataList._tableName = tableName;

		int nodeCount = tableNode->GetNodeCount( "col" );
		for( int cnt = 0; cnt < nodeCount; cnt++ )
		{
			const XmlNode * colNode = tableNode->GetNode( "col", cnt );
			std::string colName = colNode->GetAttribute( "name" );

			ColDataForDic colDataList;
			colDataList._colName = colName;

			int colNum = GetColNum( colName, colList );
			GetColData( colNum, dataList, colDataList._dataList );

			tableDataList._dataList.push_back( colDataList );
		}

		_dic.push_back( tableDataList );
	}

	return true;
}