sqlparser/datatypes.cpp
// BLOB in Oracle, DB2, MySQL, Informix
BLOB in Oracle, DB2, MySQL, Informix
BLOB in Oracle DB2 MySQL Informix
bool SqlParser::ParseBlobType(Token *name)
{
    if(name == NULL)
        return false;
    if(name->Compare("BLOB", L"BLOB", 4) == false)
        return false;
	STATS_DECL
	STATS_ITM_DECL 
	STATS_SET_DESC(SQL_DATATYPE_BLOB_DESC)
    Token *open = GetNextCharToken('(', L'(');
    if(open != NULL)
    {
         (void) GetNextToken();
        Token *semantics = GetNextToken();
        if(Token::Compare(semantics, "K", L"K", 1) == false &&
            Token::Compare(semantics, "M", L"M", 1) == false &&
            Token::Compare(semantics, "G", L"G", 1) == false)
        {
            PushBack(semantics);
            semantics = NULL;
        }
        Token *close = GetNextCharToken(')', L')');
        if(Target(SQL_DB2, SQL_MYSQL) == false)
            Token::Remove(open, close);
    }
    if(_target == SQL_SQL_SERVER)
    {
        Token::Change(name, "VARBINARY", L"VARBINARY", 9);
        AppendNoFormat(name, "(max)", L"(max)", 5);
    }
    else
    if(Target(SQL_MARIADB, SQL_MARIADB_ORA, SQL_MYSQL) && _source != SQL_MYSQL)
		Token::Change(name, "LONGBLOB", L"LONGBLOB", 8);
    else
    if(Target(SQL_POSTGRESQL, SQL_GREENPLUM) == true)
		Token::Change(name, "BYTEA", L"BYTEA", 5);
	STATS_SET_CONV_OK(true)
	STATS_SET_COMPLEXITY(true, STATS_CONV_LOW)
	DTYPE_STATS(name)
    DTYPE_DTL_STATS_L(name)
    return true;
}
bool SqlParser :: ParseBlobType ( Token * name ) { if ( name == NULL ) return false ; if ( name -> Compare ( " " , L" " , 4 ) == false ) return false ; STATS_DECL STATS_ITM_DECL STATS_SET_DESC ( SQL_DATATYPE_BLOB_DESC ) Token * open = GetNextCharToken ( ' ' , L' ' ) ; if ( open != NULL ) { ( void ) GetNextToken ( ) ; Token * semantics = GetNextToken ( ) ; if ( Token :: Compare ( semantics , " " , L" " , 1 ) == false && Token :: Compare ( semantics , " " , L" " , 1 ) == false && Token :: Compare ( semantics , " " , L" " , 1 ) == false ) { PushBack ( semantics ) ; semantics = NULL ; } Token * close = GetNextCharToken ( ' ' , L' ' ) ; if ( Target ( SQL_DB2 , SQL_MYSQL ) == false ) Token :: Remove ( open , close ) ; } if ( _target == SQL_SQL_SERVER ) { Token :: Change ( name , " " , L" " , 9 ) ; AppendNoFormat ( name , " " , L" " , 5 ) ; } else if ( Target ( SQL_MARIADB , SQL_MARIADB_ORA , SQL_MYSQL ) && _source != SQL_MYSQL ) Token :: Change ( name , " " , L" " , 8 ) ; else if ( Target ( SQL_POSTGRESQL , SQL_GREENPLUM ) == true ) Token :: Change ( name , " " , L" " , 5 ) ; STATS_SET_CONV_OK ( true ) STATS_SET_COMPLEXITY ( true , STATS_CONV_LOW ) DTYPE_STATS ( name ) DTYPE_DTL_STATS_L ( name ) return true ; }
BLOB in Oracle, DB2, MySQL, Informix
BLOB in Oracle DB2 MySQL Informix
// Num and semantics are optional in DB2, MySQL /*Token *num */ // DB2 allows specifying size (1024, 1M etc.) // If target is not DB2, MySQL remove semantics attribute // Convert to VARBINARY(max) in SQL Server // Convert to LONGBLOB in MySQL // Convert to BYTEA in PostgreSQL, Greenplum