sqlparser/helpers.cpp
// Read the data type from available meta information
Read the data type from available meta information
Read the data type from available meta information
const char* SqlParser::GetMetaType(Token *object, Token *column)
{
    if(object == NULL)
        return NULL;
    TokenStr obj;
    TokenStr col;
	if(column == NULL)
		SplitIdentifierByLastPart(object, obj, col, 2);
	else
	{
		obj.Append(object);
		col.Append(column);
	}
    std::transform(obj.str.begin(), obj.str.end(), obj.str.begin(), ::tolower);
    std::map<std::string, ListT<Meta>*>::iterator i = _meta.find(obj.str);
     if(i != _meta.end())
     {
         Meta *meta = i->second->GetFirstNoCurrent();
	     while(meta != NULL)
	     {
             if(_stricmp(meta->column.c_str(), col.str.c_str()) == 0)
                 return meta->dtype.c_str();
		     meta = meta->next;
         }
     }
     return NULL;
}
const char * SqlParser :: GetMetaType ( Token * object , Token * column ) { if ( object == NULL ) return NULL ; TokenStr obj ; TokenStr col ; if ( column == NULL ) SplitIdentifierByLastPart ( object , obj , col , 2 ) ; else { obj . Append ( object ) ; col . Append ( column ) ; } std :: transform ( obj . str . begin ( ) , obj . str . end ( ) , obj . str . begin ( ) , :: tolower ) ; std :: map < std :: string , ListT < Meta > * > :: iterator i = _meta . find ( obj . str ) ; if ( i != _meta . end ( ) ) { Meta * meta = i -> second -> GetFirstNoCurrent ( ) ; while ( meta != NULL ) { if ( _stricmp ( meta -> column . c_str ( ) , col . str . c_str ( ) ) == 0 ) return meta -> dtype . c_str ( ) ; meta = meta -> next ; } } return NULL ; }
Read the data type from available meta information
Read the data type from available meta information
// Separate object and column names