// insert a few rows
StringBuffer sql = new StringBuffer();
sql.append( "INSERT INTO \"" );
sql.append( tableName );
sql.append( "\" VALUES (?, ?)");
XPreparedStatement statement = connection.prepareStatement( sql.toString() );
XParameters statementParameters = UnoRuntime.queryInterface( XParameters.class, statement );
final String[] keyValues = impl_getTypedValue( keyTypes[i], 0 );
for ( int row=0; row<displayValues.length; ++row )
{
statementParameters.setString( 1, keyValues[row] );
statementParameters.setString( 2, displayValues[row] );
statement.execute();
}
// remember a column descriptor for later creation of the table with the foreign keys
foreignKeyColumns.add( new HsqlColumnDescriptor( columnFKName, columnType, HsqlColumnDescriptor.REQUIRED,
tableName, columnPKName ) );
// remember the data to fill into this table
foreignKeyValues.add( keyValues );
foreignKeyInsertSQL.append( ", ?" );
}
// create the table taking all those foreign keys
m_database.createTable( new HsqlTableDescriptor( m_foreignKeyTableName, foreignKeyColumns.toArray( new HsqlColumnDescriptor[0] ) ) );
// fill in some data
foreignKeyInsertSQL.append( ")" );
XPreparedStatement statement = connection.prepareStatement( foreignKeyInsertSQL.toString() );
XParameters statementParameters = UnoRuntime.queryInterface( XParameters.class, statement );
for ( int row=0; row<2; ++row )
{
statementParameters.setInt( 1, row );
for ( int i=0; i<keyTypes.length; ++i )
{
statementParameters.setString( i+2, foreignKeyValues.get(i)[row] );
}
statement.execute();
}
m_database.defaultConnection().refreshTables();
}
finally