@Test public void testGetFieldDefinition() throws Exception { assertEquals( "FOO TIMESTAMP", nativeMeta.getFieldDefinition( new ValueMetaDate( "FOO" ), "", "", false, true, false ) ); assertEquals( "TIMESTAMP", nativeMeta.getFieldDefinition( new ValueMetaTimestamp( "FOO" ), "", "", false, false, false ) ); assertEquals( "BOOLEAN", nativeMeta.getFieldDefinition( new ValueMetaBoolean( "FOO" ), "", "", false, false, false ) ); assertEquals( "FLOAT", nativeMeta.getFieldDefinition( new ValueMetaNumber( "FOO" ), "", "", false, false, false ) ); assertEquals( "FLOAT", nativeMeta.getFieldDefinition( new ValueMetaBigNumber( "FOO" ), "", "", false, false, false ) ); assertEquals( "INTEGER", nativeMeta.getFieldDefinition( new ValueMetaInteger( "FOO" ), "", "", false, false, false ) ); assertEquals( "VARCHAR", nativeMeta.getFieldDefinition( new ValueMetaString( "FOO", 0, 0 ), "", "", false, false, false ) ); assertEquals( "VARCHAR(15)", nativeMeta.getFieldDefinition( new ValueMetaString( "FOO", 15, 0 ), "", "", false, false, false ) ); assertEquals( "VARBINARY", nativeMeta.getFieldDefinition( new ValueMetaBinary( "FOO", 0, 0 ), "", "", false, false, false ) ); assertEquals( "VARBINARY(50)", nativeMeta.getFieldDefinition( new ValueMetaBinary( "FOO", 50, 0 ), "", "", false, false, false ) ); assertEquals( " UNKNOWN", nativeMeta.getFieldDefinition( new ValueMetaInternetAddress( "FOO" ), "", "", false, false, false ) ); assertEquals( " UNKNOWN" + System.getProperty( "line.separator" ), nativeMeta.getFieldDefinition( new ValueMetaInternetAddress( "FOO" ), "", "", false, false, true ) ); }
@Override public String getFieldDefinition( ValueMetaInterface v, String tk, String pk, boolean use_autoinc, boolean add_fieldname, boolean add_cr ) { String retval = ""; String fieldname = v.getName(); int length = v.getLength(); if ( add_fieldname ) { retval += fieldname + " "; } int type = v.getType(); switch ( type ) { case ValueMetaInterface.TYPE_DATE: case ValueMetaInterface.TYPE_TIMESTAMP: retval += "TIMESTAMP"; break; case ValueMetaInterface.TYPE_BOOLEAN: retval += "BOOLEAN"; break; case ValueMetaInterface.TYPE_NUMBER: case ValueMetaInterface.TYPE_BIGNUMBER: retval += "FLOAT"; break; case ValueMetaInterface.TYPE_INTEGER: retval += "INTEGER"; break; case ValueMetaInterface.TYPE_STRING: retval += ( length < 1 ) ? "VARCHAR" : "VARCHAR(" + length + ")"; break; case ValueMetaInterface.TYPE_BINARY: retval += ( length < 1 ) ? "VARBINARY" : "VARBINARY(" + length + ")"; break; default: retval += " UNKNOWN"; break; } if ( add_cr ) { retval += Const.CR; } return retval; }
VerticaDatabaseMeta extends BaseDatabaseMeta implements DatabaseInterface { @Override public String getFieldDefinition( ValueMetaInterface v, String tk, String pk, boolean use_autoinc, boolean add_fieldname, boolean add_cr ) { String retval = ""; String fieldname = v.getName(); int length = v.getLength(); if ( add_fieldname ) { retval += fieldname + " "; } int type = v.getType(); switch ( type ) { case ValueMetaInterface.TYPE_DATE: case ValueMetaInterface.TYPE_TIMESTAMP: retval += "TIMESTAMP"; break; case ValueMetaInterface.TYPE_BOOLEAN: retval += "BOOLEAN"; break; case ValueMetaInterface.TYPE_NUMBER: case ValueMetaInterface.TYPE_BIGNUMBER: retval += "FLOAT"; break; case ValueMetaInterface.TYPE_INTEGER: retval += "INTEGER"; break; case ValueMetaInterface.TYPE_STRING: retval += ( length < 1 ) ? "VARCHAR" : "VARCHAR(" + length + ")"; break; case ValueMetaInterface.TYPE_BINARY: retval += ( length < 1 ) ? "VARBINARY" : "VARBINARY(" + length + ")"; break; default: retval += " UNKNOWN"; break; } if ( add_cr ) { retval += Const.CR; } return retval; } }
VerticaDatabaseMeta extends BaseDatabaseMeta implements DatabaseInterface { @Override public String getFieldDefinition( ValueMetaInterface v, String tk, String pk, boolean use_autoinc, boolean add_fieldname, boolean add_cr ) { String retval = ""; String fieldname = v.getName(); int length = v.getLength(); if ( add_fieldname ) { retval += fieldname + " "; } int type = v.getType(); switch ( type ) { case ValueMetaInterface.TYPE_DATE: case ValueMetaInterface.TYPE_TIMESTAMP: retval += "TIMESTAMP"; break; case ValueMetaInterface.TYPE_BOOLEAN: retval += "BOOLEAN"; break; case ValueMetaInterface.TYPE_NUMBER: case ValueMetaInterface.TYPE_BIGNUMBER: retval += "FLOAT"; break; case ValueMetaInterface.TYPE_INTEGER: retval += "INTEGER"; break; case ValueMetaInterface.TYPE_STRING: retval += ( length < 1 ) ? "VARCHAR" : "VARCHAR(" + length + ")"; break; case ValueMetaInterface.TYPE_BINARY: retval += ( length < 1 ) ? "VARBINARY" : "VARBINARY(" + length + ")"; break; default: retval += " UNKNOWN"; break; } if ( add_cr ) { retval += Const.CR; } return retval; }  }
VerticaDatabaseMeta extends BaseDatabaseMeta implements DatabaseInterface { @Override public String getFieldDefinition( ValueMetaInterface v, String tk, String pk, boolean use_autoinc, boolean add_fieldname, boolean add_cr ) { String retval = ""; String fieldname = v.getName(); int length = v.getLength(); if ( add_fieldname ) { retval += fieldname + " "; } int type = v.getType(); switch ( type ) { case ValueMetaInterface.TYPE_DATE: case ValueMetaInterface.TYPE_TIMESTAMP: retval += "TIMESTAMP"; break; case ValueMetaInterface.TYPE_BOOLEAN: retval += "BOOLEAN"; break; case ValueMetaInterface.TYPE_NUMBER: case ValueMetaInterface.TYPE_BIGNUMBER: retval += "FLOAT"; break; case ValueMetaInterface.TYPE_INTEGER: retval += "INTEGER"; break; case ValueMetaInterface.TYPE_STRING: retval += ( length < 1 ) ? "VARCHAR" : "VARCHAR(" + length + ")"; break; case ValueMetaInterface.TYPE_BINARY: retval += ( length < 1 ) ? "VARBINARY" : "VARBINARY(" + length + ")"; break; default: retval += " UNKNOWN"; break; } if ( add_cr ) { retval += Const.CR; } return retval; }  @Override int[] getAccessTypeList(); @Override String getDriverClass(); @Override String getURL( String hostname, String port, String databaseName ); @Override boolean isFetchSizeSupported(); @Override boolean supportsBitmapIndex(); @Override String getAddColumnStatement( String tablename, ValueMetaInterface v, String tk, boolean use_autoinc,
    String pk, boolean semicolon ); @Override String getModifyColumnStatement( String tablename, ValueMetaInterface v, String tk, boolean use_autoinc,
    String pk, boolean semicolon ); @Override String getFieldDefinition( ValueMetaInterface v, String tk, String pk, boolean use_autoinc,
    boolean add_fieldname, boolean add_cr ); @Override String[] getUsedLibraries(); @Override int getDefaultDatabasePort(); @Override String getLimitClause( int nrRows ); @Override int getMaxVARCHARLength(); @Override String[] getReservedWords(); @Override String getSQLColumnExists( String columnname, String tablename ); @Override String getSQLQueryFields( String tableName ); @Override String getSQLTableExists( String tablename ); @Override String[] getViewTypes(); @Override boolean supportsAutoInc(); @Override boolean supportsBooleanDataType(); @Override boolean requiresCastToVariousForIsNull(); @Override String getExtraOptionIndicator(); @Override String getExtraOptionSeparator(); @Override boolean supportsSequences(); @Override String getSQLSequenceExists( String sequenceName ); @Override String getSQLListOfSequences(); @Override String getSQLCurrentSequenceValue( String sequenceName ); @Override String getSQLNextSequenceValue( String sequenceName ); @Override boolean supportsTimeStampToDateConversion(); @Override boolean supportsGetBlob(); @Override boolean isDisplaySizeTwiceThePrecision(); }
VerticaDatabaseMeta extends BaseDatabaseMeta implements DatabaseInterface { @Override public String getFieldDefinition( ValueMetaInterface v, String tk, String pk, boolean use_autoinc, boolean add_fieldname, boolean add_cr ) { String retval = ""; String fieldname = v.getName(); int length = v.getLength(); if ( add_fieldname ) { retval += fieldname + " "; } int type = v.getType(); switch ( type ) { case ValueMetaInterface.TYPE_DATE: case ValueMetaInterface.TYPE_TIMESTAMP: retval += "TIMESTAMP"; break; case ValueMetaInterface.TYPE_BOOLEAN: retval += "BOOLEAN"; break; case ValueMetaInterface.TYPE_NUMBER: case ValueMetaInterface.TYPE_BIGNUMBER: retval += "FLOAT"; break; case ValueMetaInterface.TYPE_INTEGER: retval += "INTEGER"; break; case ValueMetaInterface.TYPE_STRING: retval += ( length < 1 ) ? "VARCHAR" : "VARCHAR(" + length + ")"; break; case ValueMetaInterface.TYPE_BINARY: retval += ( length < 1 ) ? "VARBINARY" : "VARBINARY(" + length + ")"; break; default: retval += " UNKNOWN"; break; } if ( add_cr ) { retval += Const.CR; } return retval; }  @Override int[] getAccessTypeList(); @Override String getDriverClass(); @Override String getURL( String hostname, String port, String databaseName ); @Override boolean isFetchSizeSupported(); @Override boolean supportsBitmapIndex(); @Override String getAddColumnStatement( String tablename, ValueMetaInterface v, String tk, boolean use_autoinc,
    String pk, boolean semicolon ); @Override String getModifyColumnStatement( String tablename, ValueMetaInterface v, String tk, boolean use_autoinc,
    String pk, boolean semicolon ); @Override String getFieldDefinition( ValueMetaInterface v, String tk, String pk, boolean use_autoinc,
    boolean add_fieldname, boolean add_cr ); @Override String[] getUsedLibraries(); @Override int getDefaultDatabasePort(); @Override String getLimitClause( int nrRows ); @Override int getMaxVARCHARLength(); @Override String[] getReservedWords(); @Override String getSQLColumnExists( String columnname, String tablename ); @Override String getSQLQueryFields( String tableName ); @Override String getSQLTableExists( String tablename ); @Override String[] getViewTypes(); @Override boolean supportsAutoInc(); @Override boolean supportsBooleanDataType(); @Override boolean requiresCastToVariousForIsNull(); @Override String getExtraOptionIndicator(); @Override String getExtraOptionSeparator(); @Override boolean supportsSequences(); @Override String getSQLSequenceExists( String sequenceName ); @Override String getSQLListOfSequences(); @Override String getSQLCurrentSequenceValue( String sequenceName ); @Override String getSQLNextSequenceValue( String sequenceName ); @Override boolean supportsTimeStampToDateConversion(); @Override boolean supportsGetBlob(); @Override boolean isDisplaySizeTwiceThePrecision();  }