@ Override public void setGeneratedColumnInfo ( int generate , ResultMetaData meta ) { // can support INSERT_SELECT also if ( type != StatementTypes . INSERT ) { return ; } int colIndex = baseTable . getIdentityColumnIndex ( ) ; if ( colIndex == - 1 ) { return ; } switch ( generate ) { case ResultConstants . RETURN_NO_GENERATED_KEYS : return ; case ResultConstants . RETURN_GENERATED_KEYS_COL_INDEXES : int [ ] columnIndexes = meta . getGeneratedColumnIndexes ( ) ; if ( columnIndexes . length != 1 ) { return ; } if ( columnIndexes [ 0 ] != colIndex ) { return ; } // $FALL-THROUGH$ case ResultConstants . RETURN_GENERATED_KEYS : generatedIndexes = new int [ ] { colIndex } ; break ; case ResultConstants . RETURN_GENERATED_KEYS_COL_NAMES : String [ ] columnNames = meta . getGeneratedColumnNames ( ) ; if ( columnNames . length != 1 ) { return ; } if ( baseTable . findColumn ( columnNames [ 0 ] ) != colIndex ) { return ; } generatedIndexes = new int [ ] { colIndex } ; break ; } generatedResultMetaData = ResultMetaData . newResultMetaData ( generatedIndexes . length ) ; for ( int i = 0 ; i < generatedIndexes . length ; i ++ ) { ColumnSchema column = baseTable . getColumn ( generatedIndexes [ i ] ) ; generatedResultMetaData . columns [ i ] = column ; } generatedResultMetaData . prepareData ( ) ; }
For the creation of the statement