Java Code Examples for org.pentaho.di.core.row.ValueMetaInterface#getName()
The following examples show how to use
org.pentaho.di.core.row.ValueMetaInterface#getName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StepTransform.java From kettle-beam with Apache License 2.0 | 6 votes |
private StepMeta createInjectorStep( TransMeta transMeta, String injectorStepName, RowMetaInterface injectorRowMeta, int x, int y ) { InjectorMeta injectorMeta = new InjectorMeta(); injectorMeta.allocate( injectorRowMeta.size() ); for ( int i = 0; i < injectorRowMeta.size(); i++ ) { ValueMetaInterface valueMeta = injectorRowMeta.getValueMeta( i ); injectorMeta.getFieldname()[ i ] = valueMeta.getName(); injectorMeta.getType()[ i ] = valueMeta.getType(); injectorMeta.getLength()[ i ] = valueMeta.getLength(); injectorMeta.getPrecision()[ i ] = valueMeta.getPrecision(); } StepMeta injectorStepMeta = new StepMeta( injectorStepName, injectorMeta ); injectorStepMeta.setLocation( x, y ); injectorStepMeta.setDraw( true ); transMeta.addStep( injectorStepMeta ); return injectorStepMeta; }
Example 2
Source File: TableOutputDialog.java From pentaho-kettle with Apache License 2.0 | 5 votes |
private static boolean isValidRowMeta( RowMetaInterface rowMeta ) { for ( ValueMetaInterface value : rowMeta.getValueMetaList() ) { String name = value.getName(); if ( name == null || name.isEmpty() ) { return false; } } return true; }
Example 3
Source File: VerticaDatabaseMeta.java From pentaho-kettle with Apache License 2.0 | 4 votes |
@Override public String getFieldDefinition( ValueMetaInterface v, String tk, String pk, boolean useAutoinc, boolean addFieldName, boolean addCr ) { String retval = ""; String fieldname = v.getName(); int length = v.getLength(); // Unused in vertica // int precision = v.getPrecision(); if ( addFieldName ) { 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 ( addCr ) { retval += Const.CR; } return retval; }
Example 4
Source File: SAPDBDatabaseMeta.java From pentaho-kettle with Apache License 2.0 | 4 votes |
@Override public String getFieldDefinition( ValueMetaInterface v, String tk, String pk, boolean useAutoinc, boolean addFieldName, boolean addCr ) { String retval = ""; String fieldname = v.getName(); int length = v.getLength(); int precision = v.getPrecision(); if ( addFieldName ) { if ( Const.indexOfString( fieldname, getReservedWords() ) >= 0 ) { retval += getStartQuote() + fieldname + getEndQuote(); } else { retval += fieldname + " "; } } int type = v.getType(); switch ( type ) { case ValueMetaInterface.TYPE_TIMESTAMP: case ValueMetaInterface.TYPE_DATE: retval += "TIMESTAMP"; break; case ValueMetaInterface.TYPE_BOOLEAN: retval += "CHAR(1)"; break; case ValueMetaInterface.TYPE_NUMBER: case ValueMetaInterface.TYPE_INTEGER: case ValueMetaInterface.TYPE_BIGNUMBER: if ( fieldname.equalsIgnoreCase( tk ) || // Technical key fieldname.equalsIgnoreCase( pk ) // Primary key ) { retval += "BIGINT NOT NULL PRIMARY KEY"; } else { if ( length > 0 ) { if ( precision > 0 || length > 18 ) { retval += "DECIMAL(" + length; if ( precision > 0 ) { retval += ", " + precision; } retval += ")"; } else { if ( length > 9 ) { retval += "INT64"; } else { if ( length < 5 ) { retval += "SMALLINT"; } else { retval += "INTEGER"; } } } } else { retval += "DOUBLE"; } } break; case ValueMetaInterface.TYPE_STRING: if ( length < 32720 ) { retval += "VARCHAR"; if ( length > 0 ) { retval += "(" + length + ")"; } else { retval += "(8000)"; // Maybe use some default DB String length? } } else { retval += "BLOB SUB_TYPE TEXT"; } break; default: retval += " UNKNOWN"; break; } if ( addCr ) { retval += Const.CR; } return retval; }
Example 5
Source File: MSSQLServerDatabaseMeta.java From pentaho-kettle with Apache License 2.0 | 4 votes |
@Override public String getFieldDefinition( ValueMetaInterface v, String tk, String pk, boolean useAutoinc, boolean addFieldName, boolean addCr ) { String retval = ""; String fieldname = v.getName(); int length = v.getLength(); int precision = v.getPrecision(); if ( addFieldName ) { retval += fieldname + " "; } int type = v.getType(); switch ( type ) { case ValueMetaInterface.TYPE_TIMESTAMP: case ValueMetaInterface.TYPE_DATE: retval += "DATETIME"; break; case ValueMetaInterface.TYPE_BOOLEAN: if ( supportsBooleanDataType() ) { retval += "BIT"; } else { retval += "CHAR(1)"; } break; case ValueMetaInterface.TYPE_NUMBER: case ValueMetaInterface.TYPE_INTEGER: case ValueMetaInterface.TYPE_BIGNUMBER: if ( fieldname.equalsIgnoreCase( tk ) || // Technical key fieldname.equalsIgnoreCase( pk ) // Primary key ) { if ( useAutoinc ) { retval += "BIGINT PRIMARY KEY IDENTITY(0,1)"; } else { retval += "BIGINT PRIMARY KEY"; } } else { if ( precision == 0 ) { if ( length > 18 ) { retval += "DECIMAL(" + length + ",0)"; } else { if ( length > 9 ) { retval += "BIGINT"; } else { retval += "INT"; } } } else { if ( precision > 0 && length > 0 ) { retval += "DECIMAL(" + length + "," + precision + ")"; } else { retval += "FLOAT(53)"; } } } break; case ValueMetaInterface.TYPE_STRING: if ( length < getMaxVARCHARLength() ) { // Maybe use some default DB String length in case length<=0 if ( length > 0 ) { retval += "VARCHAR(" + length + ")"; } else { retval += "VARCHAR(100)"; } } else { retval += "TEXT"; // Up to 2bilion characters. } break; case ValueMetaInterface.TYPE_BINARY: retval += "VARBINARY(MAX)"; break; default: retval += " UNKNOWN"; break; } if ( addCr ) { retval += Const.CR; } return retval; }
Example 6
Source File: MySQLDatabaseMeta.java From pentaho-kettle with Apache License 2.0 | 4 votes |
@Override public String getFieldDefinition( ValueMetaInterface v, String tk, String pk, boolean useAutoinc, boolean addFieldName, boolean addCr ) { String retval = ""; String fieldname = v.getName(); if ( v.getLength() == DatabaseMeta.CLOB_LENGTH ) { v.setLength( getMaxTextFieldLength() ); } int length = v.getLength(); int precision = v.getPrecision(); if ( addFieldName ) { retval += fieldname + " "; } int type = v.getType(); switch ( type ) { case ValueMetaInterface.TYPE_TIMESTAMP: case ValueMetaInterface.TYPE_DATE: retval += "DATETIME"; break; case ValueMetaInterface.TYPE_BOOLEAN: if ( supportsBooleanDataType() ) { retval += "BOOLEAN"; } else { retval += "CHAR(1)"; } break; case ValueMetaInterface.TYPE_NUMBER: case ValueMetaInterface.TYPE_INTEGER: case ValueMetaInterface.TYPE_BIGNUMBER: if ( fieldname.equalsIgnoreCase( tk ) || // Technical key fieldname.equalsIgnoreCase( pk ) // Primary key ) { if ( useAutoinc ) { retval += "BIGINT AUTO_INCREMENT NOT NULL PRIMARY KEY"; } else { retval += "BIGINT NOT NULL PRIMARY KEY"; } } else { // Integer values... if ( precision == 0 ) { if ( length > 9 ) { if ( length < 19 ) { // can hold signed values between -9223372036854775808 and 9223372036854775807 // 18 significant digits retval += "BIGINT"; } else { retval += "DECIMAL(" + length + ")"; } } else { retval += "INT"; } } else { // Floating point values... if ( length > 15 ) { retval += "DECIMAL(" + length; if ( precision > 0 ) { retval += ", " + precision; } retval += ")"; } else { // A double-precision floating-point number is accurate to approximately 15 decimal places. // http://mysql.mirrors-r-us.net/doc/refman/5.1/en/numeric-type-overview.html retval += "DOUBLE"; } } } break; case ValueMetaInterface.TYPE_STRING: if ( length > 0 ) { if ( length == 1 ) { retval += "CHAR(1)"; } else if ( length < 256 ) { retval += "VARCHAR(" + length + ")"; } else if ( length < 65536 ) { retval += "TEXT"; } else if ( length < 16777216 ) { retval += "MEDIUMTEXT"; } else { retval += "LONGTEXT"; } } else { retval += "TINYTEXT"; } break; case ValueMetaInterface.TYPE_BINARY: retval += "LONGBLOB"; break; default: retval += " UNKNOWN"; break; } if ( addCr ) { retval += Const.CR; } return retval; }
Example 7
Source File: HypersonicDatabaseMeta.java From pentaho-kettle with Apache License 2.0 | 4 votes |
@Override public String getFieldDefinition( ValueMetaInterface v, String tk, String pk, boolean useAutoinc, boolean addFieldName, boolean addCr ) { StringBuilder retval = new StringBuilder( 128 ); String fieldname = v.getName(); int length = v.getLength(); int precision = v.getPrecision(); if ( addFieldName ) { retval.append( fieldname ).append( ' ' ); } int type = v.getType(); switch ( type ) { case ValueMetaInterface.TYPE_TIMESTAMP: case ValueMetaInterface.TYPE_DATE: retval.append( "TIMESTAMP" ); break; case ValueMetaInterface.TYPE_BOOLEAN: if ( supportsBooleanDataType() ) { retval.append( "BOOLEAN" ); } else { retval.append( "CHAR(1)" ); } break; case ValueMetaInterface.TYPE_NUMBER: case ValueMetaInterface.TYPE_INTEGER: case ValueMetaInterface.TYPE_BIGNUMBER: if ( fieldname.equalsIgnoreCase( tk ) || // Technical key fieldname.equalsIgnoreCase( pk ) // Primary key ) { retval.append( "BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 0, INCREMENT BY 1) PRIMARY KEY" ); } else { if ( length > 0 ) { if ( precision > 0 || length > 18 ) { retval.append( "NUMERIC(" ).append( length ).append( ", " ).append( precision ).append( ')' ); } else { if ( length > 9 ) { retval.append( "BIGINT" ); } else { if ( length < 5 ) { retval.append( "SMALLINT" ); } else { retval.append( "INTEGER" ); } } } } else { retval.append( "DOUBLE PRECISION" ); } } break; case ValueMetaInterface.TYPE_STRING: if ( length >= DatabaseMeta.CLOB_LENGTH ) { retval.append( "LONGVARCHAR" ); } else { retval.append( "VARCHAR" ); if ( length > 0 ) { retval.append( '(' ).append( length ); } else { retval.append( '(' ); // Maybe use some default DB String length? } retval.append( ')' ); } break; default: retval.append( " UNKNOWN" ); break; } if ( addCr ) { retval.append( Const.CR ); } return retval.toString(); }
Example 8
Source File: ExtenDBDatabaseMeta.java From pentaho-kettle with Apache License 2.0 | 4 votes |
@Override public String getFieldDefinition( ValueMetaInterface v, String tk, String pk, boolean useAutoinc, boolean addFieldName, boolean addCr ) { String retval = ""; String fieldname = v.getName(); int length = v.getLength(); int precision = v.getPrecision(); if ( addFieldName ) { retval += fieldname + " "; } int type = v.getType(); switch ( type ) { case ValueMetaInterface.TYPE_TIMESTAMP: case ValueMetaInterface.TYPE_DATE: retval += "TIMESTAMP"; break; case ValueMetaInterface.TYPE_BOOLEAN: if ( supportsBooleanDataType() ) { retval += "BOOLEAN"; } else { retval += "CHAR(1)"; } break; case ValueMetaInterface.TYPE_NUMBER: case ValueMetaInterface.TYPE_INTEGER: case ValueMetaInterface.TYPE_BIGNUMBER: if ( fieldname.equalsIgnoreCase( tk ) || // Technical key fieldname.equalsIgnoreCase( pk ) // Primary key ) { if ( length > 9 ) { retval += "BIGSERIAL"; } else { retval += "SERIAL"; } } else { if ( length > 0 ) { if ( precision > 0 || length > 18 ) { retval += "NUMERIC(" + length + ", " + precision + ")"; } else { if ( length > 9 ) { retval += "BIGINT"; } else { if ( length < 5 ) { retval += "SMALLINT"; } else { retval += "INTEGER"; } } } } else { retval += "DOUBLE PRECISION"; } } break; case ValueMetaInterface.TYPE_STRING: retval += "VARCHAR"; if ( length > 0 ) { retval += "(" + length; } else { retval += "("; // Maybe use some default DB String length? } retval += ")"; break; default: retval += " UNKNOWN"; break; } if ( addCr ) { retval += Const.CR; } return retval; }
Example 9
Source File: NetezzaDatabaseMeta.java From pentaho-kettle with Apache License 2.0 | 4 votes |
@Override public String getFieldDefinition( ValueMetaInterface v, String tk, String pk, boolean useAutoinc, boolean addFieldName, boolean addCr ) { String retval = ""; String fieldname = v.getName(); int length = v.getLength(); int precision = v.getPrecision(); if ( addFieldName ) { retval += fieldname + " "; } int type = v.getType(); switch ( type ) { case ValueMetaInterface.TYPE_DATE: retval += "date"; break; case ValueMetaInterface.TYPE_BOOLEAN: retval += "boolean"; break; case ValueMetaInterface.TYPE_NUMBER: case ValueMetaInterface.TYPE_INTEGER: case ValueMetaInterface.TYPE_BIGNUMBER: if ( length > 0 ) { if ( precision == 0 ) { if ( length <= 2 ) { retval += "byteint"; } else if ( length <= 4 ) { retval += "smallint"; } else if ( length <= 9 ) { retval += "integer"; } else { retval += "bigint"; } } else { if ( length < 9 ) { retval += "real"; } else if ( length < 18 ) { retval += "double"; } else { retval += "numeric(" + length; if ( precision > 0 ) { retval += ", " + precision; } retval += ")"; } } } break; case ValueMetaInterface.TYPE_STRING: if ( length > MAX_CHAR_LEN ) { retval += "varchar(" + MAX_CHAR_LEN + ")"; } else { retval += "varchar(" + length + ")"; } break; default: retval += " UNKNOWN"; break; } if ( addCr ) { retval += Const.CR; } return retval; }
Example 10
Source File: PhysicalTableImporter.java From pentaho-metadata with GNU Lesser General Public License v2.1 | 4 votes |
private static IPhysicalColumn importPhysicalColumnDefinition( ValueMetaInterface v, SqlPhysicalTable physicalTable, String locale, final ImportStrategy importStrategy ) { // The name of the column in the database // String columnName = v.getName(); // The field type? // FieldType fieldType = FieldType.guessFieldType( v.getName() ); // Create a physical column. // SqlPhysicalColumn physicalColumn = new SqlPhysicalColumn( physicalTable ); physicalColumn.setId( v.getName() ); physicalColumn.setTargetColumn( columnName ); physicalColumn.setFieldType( fieldType ); physicalColumn.setAggregationType( AggregationType.NONE ); // Set the localized name... // String niceName = beautifyName( importStrategy.displayName( v ) ); physicalColumn.setName( new LocalizedString( locale, niceName ) ); // Set the parent concept to the base concept... // physicalColumn.getConcept().setParentInterface(schemaMeta.findConcept( // Settings.getConceptNameBase())); // The data type... DataType dataType = getDataType( v ); physicalColumn.setDataType( dataType ); if ( null != v.getConversionMask() ) { physicalColumn.setProperty( "source_mask", v.getConversionMask() ); } if ( null != v.getDecimalSymbol() ) { physicalColumn.setProperty( "source_decimalSymbol", v.getDecimalSymbol() ); } if ( null != v.getGroupingSymbol() ) { physicalColumn.setProperty( "source_groupingSymbol", v.getGroupingSymbol() ); } if ( null != v.getCurrencySymbol() ) { physicalColumn.setProperty( "source_currencySymbol", v.getCurrencySymbol() ); } return physicalColumn; }
Example 11
Source File: TeradataDatabaseMeta.java From pentaho-kettle with Apache License 2.0 | 4 votes |
@Override public String getFieldDefinition( ValueMetaInterface v, String tk, String pk, boolean useAutoinc, boolean addFieldName, boolean addCr ) { String retval = ""; String fieldname = v.getName(); int length = v.getLength(); int precision = v.getPrecision(); if ( addFieldName ) { retval += fieldname + " "; } int type = v.getType(); switch ( type ) { case ValueMetaInterface.TYPE_TIMESTAMP: case ValueMetaInterface.TYPE_DATE: retval += "TIMESTAMP"; break; case ValueMetaInterface.TYPE_BOOLEAN: retval += "CHAR(1)"; break; case ValueMetaInterface.TYPE_NUMBER: case ValueMetaInterface.TYPE_INTEGER: case ValueMetaInterface.TYPE_BIGNUMBER: if ( fieldname.equalsIgnoreCase( tk ) || // Technical key fieldname.equalsIgnoreCase( pk ) // Primary key ) { retval += "INTEGER"; // TERADATA has no Auto-increment functionality nor Sequences! } else { if ( length > 0 ) { if ( precision > 0 || length > 9 ) { retval += "DECIMAL(" + length + ", " + precision + ")"; } else { if ( length > 5 ) { retval += "INTEGER"; } else { if ( length < 3 ) { retval += "BYTEINT"; } else { retval += "SMALLINT"; } } } } else { retval += "DOUBLE PRECISION"; } } break; case ValueMetaInterface.TYPE_STRING: if ( length > 64000 ) { retval += "CLOB"; } else { retval += "VARCHAR"; if ( length > 0 ) { retval += "(" + length + ")"; } else { retval += "(64000)"; // Maybe use some default DB String length? } } break; default: retval += " UNKNOWN"; break; } if ( addCr ) { retval += Const.CR; } return retval; }
Example 12
Source File: PostgreSQLDatabaseMeta.java From pentaho-kettle with Apache License 2.0 | 4 votes |
@Override public String getFieldDefinition( ValueMetaInterface v, String tk, String pk, boolean useAutoinc, boolean addFieldName, boolean addCr ) { String retval = ""; String fieldname = v.getName(); if ( v.getLength() == DatabaseMeta.CLOB_LENGTH ) { v.setLength( getMaxTextFieldLength() ); } int length = v.getLength(); int precision = v.getPrecision(); if ( addFieldName ) { retval += fieldname + " "; } int type = v.getType(); switch ( type ) { case ValueMetaInterface.TYPE_TIMESTAMP: case ValueMetaInterface.TYPE_DATE: retval += "TIMESTAMP"; break; case ValueMetaInterface.TYPE_BOOLEAN: if ( supportsBooleanDataType() ) { retval += "BOOLEAN"; } else { retval += "CHAR(1)"; } break; case ValueMetaInterface.TYPE_NUMBER: case ValueMetaInterface.TYPE_INTEGER: case ValueMetaInterface.TYPE_BIGNUMBER: if ( fieldname.equalsIgnoreCase( tk ) || // Technical key fieldname.equalsIgnoreCase( pk ) // Primary key ) { retval += "BIGSERIAL"; } else { if ( length > 0 ) { if ( precision > 0 || length > 18 ) { // Numeric(Precision, Scale): Precision = total length; Scale = decimal places retval += "NUMERIC(" + ( length + precision ) + ", " + precision + ")"; } else { if ( length > 9 ) { retval += "BIGINT"; } else { if ( length < 5 ) { retval += "SMALLINT"; } else { retval += "INTEGER"; } } } } else { retval += "DOUBLE PRECISION"; } } break; case ValueMetaInterface.TYPE_STRING: if ( length < 1 || length >= DatabaseMeta.CLOB_LENGTH ) { retval += "TEXT"; } else { retval += "VARCHAR(" + length + ")"; } break; default: retval += " UNKNOWN"; break; } if ( addCr ) { retval += Const.CR; } return retval; }
Example 13
Source File: VectorWiseDatabaseMeta.java From pentaho-kettle with Apache License 2.0 | 4 votes |
@Override public String getFieldDefinition( ValueMetaInterface v, String tk, String pk, boolean useAutoinc, boolean addFieldName, boolean addCr ) { String retval = ""; String fieldname = v.getName(); int length = v.getLength(); int precision = v.getPrecision(); if ( addFieldName ) { retval += fieldname + " "; } int type = v.getType(); switch ( type ) { case ValueMetaInterface.TYPE_TIMESTAMP: case ValueMetaInterface.TYPE_DATE: retval += "TIMESTAMP"; break; case ValueMetaInterface.TYPE_BOOLEAN: retval += "CHAR(1)"; break; case ValueMetaInterface.TYPE_NUMBER: case ValueMetaInterface.TYPE_INTEGER: case ValueMetaInterface.TYPE_BIGNUMBER: if ( fieldname.equalsIgnoreCase( tk ) || // Technical key fieldname.equalsIgnoreCase( pk ) // Primary key ) { if ( useAutoinc ) { retval += "GENERATED ALWAYS AS IDENTITY START WITH 1 INCREMENT BY 1"; } else { retval += "BIGINT PRIMARY KEY NOT NULL"; } } else { if ( precision == 0 ) { // integer numbers if ( length > 9 ) { retval += "BIGINT"; } else { if ( length == -1 || length > 4 ) { // If the length is undefined or greater than 4, use a standard INTEGER retval += "INTEGER"; } else { if ( length > 2 ) { retval += "SMALLINT"; } else { retval += "INTEGER1"; } } } } else { retval += "FLOAT8"; } } break; case ValueMetaInterface.TYPE_STRING: // Maybe use some default DB String length in case length<=0 if ( length > 0 ) { if ( length > 32000 ) { retval += "VARCHAR(32000)"; } else { retval += "VARCHAR(" + length + ")"; } } else { retval += "VARCHAR(9999)"; } break; default: retval += " UNKNOWN"; break; } if ( addCr ) { retval += Const.CR; } return retval; }
Example 14
Source File: IngresDatabaseMeta.java From pentaho-kettle with Apache License 2.0 | 4 votes |
@Override public String getFieldDefinition( ValueMetaInterface v, String tk, String pk, boolean useAutoinc, boolean addFieldName, boolean addCr ) { String retval = ""; String fieldname = v.getName(); int length = v.getLength(); int precision = v.getPrecision(); if ( addFieldName ) { retval += fieldname + " "; } int type = v.getType(); switch ( type ) { case ValueMetaInterface.TYPE_TIMESTAMP: retval += "TIMESTAMP"; break; case ValueMetaInterface.TYPE_DATE: retval += "DATE"; break; case ValueMetaInterface.TYPE_BOOLEAN: retval += "CHAR(1)"; break; case ValueMetaInterface.TYPE_NUMBER: case ValueMetaInterface.TYPE_INTEGER: case ValueMetaInterface.TYPE_BIGNUMBER: if ( fieldname.equalsIgnoreCase( tk ) || // Technical key fieldname.equalsIgnoreCase( pk ) // Primary key ) { if ( useAutoinc ) { retval += "BIGINT PRIMARY KEY IDENTITY(0,1)"; } else { retval += "BIGINT PRIMARY KEY NOT NULL"; } } else { if ( precision == 0 ) { // integer numbers if ( length > 9 ) { retval += "BIGINT"; } else { if ( length > 4 ) { retval += "INTEGER"; } else { if ( length > 2 ) { retval += "SMALLINT"; } else { retval += "INTEGER1"; } } } } else { retval += "FLOAT"; } } break; case ValueMetaInterface.TYPE_STRING: // Maybe use some default DB String length in case length<=0 if ( length > 0 ) { retval += "VARCHAR(" + length + ")"; } else { retval += "VARCHAR(2000)"; } break; default: retval += " UNKNOWN"; break; } if ( addCr ) { retval += Const.CR; } return retval; }
Example 15
Source File: FirebirdDatabaseMeta.java From pentaho-kettle with Apache License 2.0 | 3 votes |
/** * Generates the SQL statement to modify a column in the specified table * * @param tablename * The table to add * @param v * The column defined as a value * @param tk * the name of the technical key field * @param useAutoinc * whether or not this field uses auto increment * @param pk * the name of the primary key field * @param semicolon * whether or not to add a semi-colon behind the statement. * @return the SQL statement to modify a column in the specified table */ @Override public String getModifyColumnStatement( String tablename, ValueMetaInterface v, String tk, boolean useAutoinc, String pk, boolean semicolon ) { return "ALTER TABLE " + tablename + " ALTER COLUMN " + v.getName() + " TYPE " + getFieldDefinition( v, tk, pk, useAutoinc, false, false ); }
Example 16
Source File: DB2DatabaseMeta.java From pentaho-kettle with Apache License 2.0 | 3 votes |
/** * Generates the SQL statement to modify a column in the specified table * * @param tablename * The table to add * @param v * The column defined as a value * @param tk * the name of the technical key field * @param useAutoinc * whether or not this field uses auto increment * @param pk * the name of the primary key field * @param semicolon * whether or not to add a semi-colon behind the statement. * @return the SQL statement to modify a column in the specified table */ @Override public String getModifyColumnStatement( String tablename, ValueMetaInterface v, String tk, boolean useAutoinc, String pk, boolean semicolon ) { String retval = ""; retval += "ALTER TABLE " + tablename + " DROP COLUMN " + v.getName() + Const.CR + ";" + Const.CR; retval += "ALTER TABLE " + tablename + " ADD COLUMN " + getFieldDefinition( v, tk, pk, useAutoinc, true, false ); return retval; }
Example 17
Source File: MSAccessDatabaseMeta.java From pentaho-kettle with Apache License 2.0 | 2 votes |
/** * Generates the SQL statement to drop a column from the specified table * * @param tablename * The table to add * @param v * The column defined as a value * @param tk * the name of the technical key field * @param useAutoinc * whether or not this field uses auto increment * @param pk * the name of the primary key field * @param semicolon * whether or not to add a semi-colon behind the statement. * @return the SQL statement to drop a column from the specified table */ @Override public String getDropColumnStatement( String tablename, ValueMetaInterface v, String tk, boolean useAutoinc, String pk, boolean semicolon ) { return "ALTER TABLE " + tablename + " DROP COLUMN " + v.getName() + Const.CR; }
Example 18
Source File: ExtenDBDatabaseMeta.java From pentaho-kettle with Apache License 2.0 | 2 votes |
/** * Generates the SQL statement to drop a column from the specified table * * @param tablename * The table to add * @param v * The column defined as a value * @param tk * the name of the technical key field * @param useAutoinc * whether or not this field uses auto increment * @param pk * the name of the primary key field * @param semicolon * whether or not to add a semi-colon behind the statement. * @return the SQL statement to drop a column from the specified table */ @Override public String getDropColumnStatement( String tablename, ValueMetaInterface v, String tk, boolean useAutoinc, String pk, boolean semicolon ) { return "ALTER TABLE " + tablename + " DROP " + v.getName() + Const.CR; }
Example 19
Source File: BaseDatabaseMeta.java From pentaho-kettle with Apache License 2.0 | 2 votes |
/** * Generates the SQL statement to drop a column from the specified table * * @param tablename * The table to add * @param v * The column defined as a value * @param tk * the name of the technical key field * @param useAutoinc * whether or not this field uses auto increment * @param pk * the name of the primary key field * @param semicolon * whether or not to add a semi-colon behind the statement. * @return the SQL statement to drop a column from the specified table */ @Override public String getDropColumnStatement( String tablename, ValueMetaInterface v, String tk, boolean useAutoinc, String pk, boolean semicolon ) { return "ALTER TABLE " + tablename + " DROP " + v.getName() + Const.CR; }
Example 20
Source File: VectorWiseDatabaseMeta.java From pentaho-kettle with Apache License 2.0 | 2 votes |
/** * Generates the SQL statement to drop a column from the specified table * * @param tablename * The table to add * @param v * The column defined as a value * @param tk * the name of the technical key field * @param useAutoinc * whether or not this field uses auto increment * @param pk * the name of the primary key field * @param semicolon * whether or not to add a semi-colon behind the statement. * @return the SQL statement to drop a column from the specified table */ @Override public String getDropColumnStatement( String tablename, ValueMetaInterface v, String tk, boolean useAutoinc, String pk, boolean semicolon ) { return "ALTER TABLE " + tablename + " DROP COLUMN " + v.getName() + Const.CR; }