sqldata/sqlapibase.cpp
// Map the data type of column
Map the data type of column
Map the data type of column
void SqlApiBase::MapDataType(SqlCol *col, std::list<SqlDataTypeMap> *dtmap)
{
    if(col == NULL || dtmap == NULL)
        return;
    for(std::list<SqlDataTypeMap>::iterator i = dtmap->begin(); i != dtmap->end(); i++)
	{
        if(_stricmp(col->_datatype_name.c_str(), (*i).name.c_str()) != 0)
            continue;
        if((*i).len_min != -1 && col->_len < (*i).len_min) 
            continue;
        if((*i).len_max != -1 && col->_len > (*i).len_max) 
            continue;
        if((*i).scale_min != -1 && col->_scale < (*i).scale_min)
            continue;
        if((*i).scale_max != -1 && col->_scale > (*i).scale_max)
            continue;
        col->_t_datatype_name = (*i).t_name;
    }
}
void SqlApiBase :: MapDataType ( SqlCol * col , std :: list < SqlDataTypeMap > * dtmap ) { if ( col == NULL || dtmap == NULL ) return ; for ( std :: list < SqlDataTypeMap > :: iterator i = dtmap -> begin ( ) ; i != dtmap -> end ( ) ; i ++ ) { if ( _stricmp ( col -> _datatype_name . c_str ( ) , ( * i ) . name . c_str ( ) ) != 0 ) continue ; if ( ( * i ) . len_min != -1 && col -> _len < ( * i ) . len_min ) continue ; if ( ( * i ) . len_max != -1 && col -> _len > ( * i ) . len_max ) continue ; if ( ( * i ) . scale_min != -1 && col -> _scale < ( * i ) . scale_min ) continue ; if ( ( * i ) . scale_max != -1 && col -> _scale > ( * i ) . scale_max ) continue ; col -> _t_datatype_name = ( * i ) . t_name ; } }
Map the data type of column
Map the data type of column
// Check min length/range // Check max length/range // Check min scale // Check max scale // All conditions met, set the mapping