~maria-captains/mariadb-java-client/trunk

« back to all changes in this revision

Viewing changes to src/main/java/org/mariadb/jdbc/MySQLGeneratedKeysResultSet.java

  • Committer: Vladislav Vaintroub
  • Date: 2013-02-13 16:28:01 UTC
  • Revision ID: wlad@montyprogram.com-20130213162801-tfmiw1lova983zr3
Refactor code for getGeneratedKeys() - remove unnecessary classes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
package org.mariadb.jdbc;
2
 
 
3
 
import org.mariadb.jdbc.internal.common.queryresults.*;
4
 
import org.mariadb.jdbc.internal.mysql.MySQLProtocol;
5
 
 
6
 
import java.sql.*;
7
 
 
8
 
public class MySQLGeneratedKeysResultSet extends MySQLResultSet {
9
 
    public MySQLGeneratedKeysResultSet(QueryResult dqr, Statement statement, MySQLProtocol protocol) {
10
 
       super(dqr,statement, protocol);
11
 
    }
12
 
 
13
 
    public int findColumn(String columnLabel) throws SQLException {
14
 
        /*
15
 
         There is only a single column returned in generated keys (autoincrement value),
16
 
         and we do not know the real name of the primary  key, because it is not returned by the protocol
17
 
         (and because we're too lazy  to check in information schema, this is expensive operation).
18
 
         At the moment the solution is to map just any name to index 1.
19
 
        */
20
 
        return 1;
21
 
    }
22
 
}