sqlparser/datatypes.cpp
// Parse a user-defined data type
Parse a user-defined data type
Parse a user - defined data type
bool SqlParser::ParseUdt(Token *name, int clause_scope)
{
    if(name == NULL)
        return false;
	bool exists = false;
    if(_target == SQL_ORACLE)
    {
        for(ListwmItem *i = _udt.GetFirst(); i != NULL; i = i->next)
        {
            Token *type = (Token*)i->value;
            Token *basetype = (Token*)i->value2;
            Token *basetype_end = (Token*)i->value3;
            if(Token::Compare(type, name) == true)
            {
                Token::Change(name, basetype);
                if(clause_scope != SQL_SCOPE_FUNC_PARAMS && clause_scope != SQL_SCOPE_PROC_PARAMS)
                {
                    if(basetype != basetype_end)
                        AppendCopy(name, basetype->next, basetype_end);
                }
				exists = true;
                break;
            }
        }
    }
	if(!exists)
	{
		ListwmItem *i = Find(_spl_obj_type_table, name);
		if(i != NULL)
		{
			Token *data_type = (Token*)i->value2;
			if(_target_app == APP_JAVA)
			{
				TokenStr dt("HashMap<Integer, ");
				dt.Append(data_type);
				APPENDSTR(dt, ">");
				Token::ChangeNoFormat(name, dt);
			}
			name->data_type = TOKEN_DT_UDT;
			name->data_subtype = TOKEN_DT2_UDT_TAB_SCALAR;
			exists = true;
		}
	}
    return exists;
}
bool SqlParser :: ParseUdt ( Token * name , int clause_scope ) { if ( name == NULL ) return false ; bool exists = false ; if ( _target == SQL_ORACLE ) { for ( ListwmItem * i = _udt . GetFirst ( ) ; i != NULL ; i = i -> next ) { Token * type = ( Token * ) i -> value ; Token * basetype = ( Token * ) i -> value2 ; Token * basetype_end = ( Token * ) i -> value3 ; if ( Token :: Compare ( type , name ) == true ) { Token :: Change ( name , basetype ) ; if ( clause_scope != SQL_SCOPE_FUNC_PARAMS && clause_scope != SQL_SCOPE_PROC_PARAMS ) { if ( basetype != basetype_end ) AppendCopy ( name , basetype -> next , basetype_end ) ; } exists = true ; break ; } } } if ( ! exists ) { ListwmItem * i = Find ( _spl_obj_type_table , name ) ; if ( i != NULL ) { Token * data_type = ( Token * ) i -> value2 ; if ( _target_app == APP_JAVA ) { TokenStr dt ( " " ) ; dt . Append ( data_type ) ; APPENDSTR ( dt , " " ) ; Token :: ChangeNoFormat ( name , dt ) ; } name -> data_type = TOKEN_DT_UDT ; name -> data_subtype = TOKEN_DT2_UDT_TAB_SCALAR ; exists = true ; } } return exists ; }
Parse a user-defined data type
Parse a user - defined data type
// Convert to the base type for Oracle // Add sizes // Check for object table type // HashMap<Integer, data_type> in Java