@Override public String getURL( String hostname, String port, String databaseName ) { if ( getAccessType() == DatabaseMeta.TYPE_ACCESS_NATIVE ) { String url = getAttributes().getProperty( ATRRIBUTE_CUSTOM_URL, "" ); return url; } else { return "jdbc:odbc:" + databaseName; } }
/** * @see DatabaseInterface#getNotFoundTK(boolean) */ @Override public int getNotFoundTK( boolean use_autoinc ) { return super.getNotFoundTK( use_autoinc ); }
public String getDatabaseDialect() { return super.getAttribute( DATABASE_DIALECT_ID, getPluginName() ); }
@Override public void addAttribute( String attributeId, String value ) { super.addAttribute( attributeId, value ); if ( DATABASE_DIALECT_ID.equals( attributeId ) ) { resolveDialect( value ); } }
/** * Generates the SQL statement to add a column to the specified table For this generic type, i set it to the most * common possibility. * * @param tablename * The table to add * @param v * The column defined as a value * @param tk * the name of the technical key field * @param use_autoinc * 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 add a column to the specified table */ @Override public String getAddColumnStatement( String tablename, ValueMetaInterface v, String tk, boolean use_autoinc, String pk, boolean semicolon ) { if ( databaseDialect != null ) { return databaseDialect.getAddColumnStatement( tablename, v, tk, use_autoinc, pk, semicolon ); } return "ALTER TABLE " + tablename + " ADD " + getFieldDefinition( v, tk, pk, use_autoinc, true, false ); }
/** * @see DatabaseInterface#getNotFoundTK(boolean) */ @Override public int getNotFoundTK( boolean use_autoinc ) { if ( supportsAutoInc() && use_autoinc ) { return 1; } return super.getNotFoundTK( use_autoinc ); }
break; case ValueMetaInterface.TYPE_BOOLEAN: if ( supportsBooleanDataType() ) { retval += "BOOLEAN"; } else {
DatabaseInterface databaseInterface = meta.getDatabaseInterface(); if ( databaseInterface instanceof GenericDatabaseMeta ) { ( (GenericDatabaseMeta) databaseInterface).setDatabaseDialect( databaseDialectList.getValue() );
DatabaseInterface databaseInterface = meta.getDatabaseInterface(); if ( databaseInterface instanceof GenericDatabaseMeta ) { databaseDialectList.setSelectedItem( ( (GenericDatabaseMeta) databaseInterface).getDatabaseDialect() );
public void setDatabaseDialect( String databaseDialect ) { super.addAttribute( DATABASE_DIALECT_ID, databaseDialect ); resolveDialect( databaseDialect ); }
/** * 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 use_autoinc * 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 use_autoinc, String pk, boolean semicolon ) { if ( databaseDialect != null ) { return databaseDialect.getModifyColumnStatement( tablename, v, tk, use_autoinc, pk, semicolon ); } return "ALTER TABLE " + tablename + " MODIFY " + getFieldDefinition( v, tk, pk, use_autoinc, true, false ); }
@Override public String getDriverClass() { if ( getAccessType() == DatabaseMeta.TYPE_ACCESS_NATIVE ) { String driverClass = getAttributes().getProperty( ATRRIBUTE_CUSTOM_DRIVER_CLASS, "" ); return driverClass; } else { return "sun.jdbc.odbc.JdbcOdbcDriver"; // always ODBC! } }
private void resolveDialect( String dialectName ) { if ( dialectName == null ) { return; } if ( dialectName.equals( getPluginName() ) ) { databaseDialect = null; } else { DatabaseInterface[] dialects = DatabaseMeta.getDatabaseInterfaces(); for ( DatabaseInterface dialect : dialects ) { if ( dialectName.equals( dialect.getPluginName() ) ) { databaseDialect = dialect; break; } } } }