try {
int count = 1;
selectStatement = conn.prepareStatement( select );
if ( leftType.length > 1 ) {
Complex left = (Complex) leftValue;
for ( int i=0; i < left.size(); i++ ) {
selectStatement.setObject( count, idToSQL( i, left.get(i)), leftType[i] );
count++;
}
} else {
selectStatement.setObject( count, idToSQL( 0, leftValue ), leftType[0] );
count++;
}
if ( rightType.length > 1 ) {
Complex right = (Complex) rightValue;
for ( int i=0; i < right.size(); i++ ) {
selectStatement.setObject( count, ridToSQL( i, right.get(i) ), rightType[i] );
count++;
}
} else {
selectStatement.setObject( count, ridToSQL( 0, rightValue ), rightType[0] );
}
count = 1;
rset = selectStatement.executeQuery();
insertStatement = conn.prepareStatement( insert );
if ( ! rset.next() ) {
if ( leftType.length > 1 ) {
Complex left = (Complex) leftValue;
for ( int i=0; i < left.size(); i++ ) {
insertStatement.setObject( count, idToSQL( i, left.get(i)), leftType[i] );
count++;
}
} else {
insertStatement.setObject( count, idToSQL( 0, leftValue ), leftType[0] );
count++;
}
if ( rightType.length > 1 ) {
Complex right = (Complex) rightValue;
for ( int i=0; i < right.size(); i++ ) {
insertStatement.setObject( count, ridToSQL( i, right.get(i) ), rightType[i] );
count++;
}
} else {
insertStatement.setObject( count, ridToSQL( 0, rightValue ), rightType[0] );
}