Skip to content
  • Craig L Russell's avatar
    def159e1
    Clusterj support for autoincrement columns · def159e1
    Craig L Russell authored
    http://wl.no.oracle.com/worklog/NDB-RawIdeaBin/index.pl?tid=8027
    
    Metadata: detect autoincrement columns; allow specification of
    autoincrement batch size
    
    Operation: when inserting row with autoincrement column, see if the
    column was set by user. If not, get autoincrement value from session factory
    and mark the column as set.
    
    SessionFactory: 
    
    schema.sql: add four tables with autoincrement pk columns
    drop table if exists autopkint;
    create table autopkint (
      id int primary key auto_increment,
      val int
    ) ENGINE=ndb;
    
    drop table if exists autopkbigint;
    create table autopkbigint (
      id bigint primary key auto_increment,
      val bigint
    ) ENGINE=ndb;
    
    drop table if exists autopksmallint;
    create table autopksmallint (
      id smallint primary key auto_increment,
      val smallint
    ) ENGINE=ndb;
    
    drop table if exists autopktinyint;
    create table autopktinyint (
      id tinyint primary key auto_increment,
      val tinyint
    ) ENGINE=ndb;
    
    mysql-test/suite/ndb/t/clusterj.test: drop tables after test
    
    Constants.java: Add three constant that users can set:
    PROPERTY_CLUSTER_CONNECT_AUTO_INCREMENT_BATCH_SIZE = "com.mysql.clusterj.connect.autoincrement.batchsize"
    PROPERTY_CLUSTER_CONNECT_AUTO_INCREMENT_STEP = "com.mysql.clusterj.connect.autoincrement.increment"
    PROPERTY_CLUSTER_CONNECT_AUTO_INCREMENT_START = "com.mysql.clusterj.connect.autoincrement.offset"
    
    SessionFactoryImpl.java: Set values for autoincrement constants
      initialize session factory with autoincrement constants
    
    ClusterConnection.java: define initialization for autoincrement constants
    
    Table.java: define get autoincrement column
    
    AutoPKTest.java: test autoincrement for four pk types: int, bigint, smallint, tinyint
      test insert with no primary key set and verify a unique value was used for the column
      test delete by key and verify proper values were inserted
    
    ClusterConnectionImpl.java: when initialized, pass autoincrement constants to DbImpl
    
    DbImpl.java: handle autoincrement
      initialize autoincrement constants
      when needed, get autoincrement value from wrapped Ndb object
    
    NdbRecordImpl.java: handle setting autoincrement value
      initialize autoincrement value setter based on column type
      set autoincrement value into NdbRecord buffer
    
    NdbRecordOperationImpl.java:
      handle autoincrement on insert operation when autoincrement column was not set by user
    
    TableImpl.java: 
      return autoincrement column if it is defined in the NdbTable
    
    Bundle.properties: new error messages for internal and user errors
    
    ndbjtie/NdbApiWrapper.hpp: define new methods
      Ndb__getAutoIncrementValue: get a new autoincrement value from Ndb
      NdbDictionary__Column__getAutoIncrement: return if a column is autoincrement
    
    ndbjtie/ndbapi/Ndb.java: implement Ndb:getAutoIncrementValue
    
    ndbjtie/ndbapi/NdbDictionary.java: implement Column:getAutoIncrement
    
    ndbjtie/ndbapi_jtie.hpp: implement JNI delegation to native method
    def159e1
    Clusterj support for autoincrement columns
    Craig L Russell authored
    http://wl.no.oracle.com/worklog/NDB-RawIdeaBin/index.pl?tid=8027
    
    Metadata: detect autoincrement columns; allow specification of
    autoincrement batch size
    
    Operation: when inserting row with autoincrement column, see if the
    column was set by user. If not, get autoincrement value from session factory
    and mark the column as set.
    
    SessionFactory: 
    
    schema.sql: add four tables with autoincrement pk columns
    drop table if exists autopkint;
    create table autopkint (
      id int primary key auto_increment,
      val int
    ) ENGINE=ndb;
    
    drop table if exists autopkbigint;
    create table autopkbigint (
      id bigint primary key auto_increment,
      val bigint
    ) ENGINE=ndb;
    
    drop table if exists autopksmallint;
    create table autopksmallint (
      id smallint primary key auto_increment,
      val smallint
    ) ENGINE=ndb;
    
    drop table if exists autopktinyint;
    create table autopktinyint (
      id tinyint primary key auto_increment,
      val tinyint
    ) ENGINE=ndb;
    
    mysql-test/suite/ndb/t/clusterj.test: drop tables after test
    
    Constants.java: Add three constant that users can set:
    PROPERTY_CLUSTER_CONNECT_AUTO_INCREMENT_BATCH_SIZE = "com.mysql.clusterj.connect.autoincrement.batchsize"
    PROPERTY_CLUSTER_CONNECT_AUTO_INCREMENT_STEP = "com.mysql.clusterj.connect.autoincrement.increment"
    PROPERTY_CLUSTER_CONNECT_AUTO_INCREMENT_START = "com.mysql.clusterj.connect.autoincrement.offset"
    
    SessionFactoryImpl.java: Set values for autoincrement constants
      initialize session factory with autoincrement constants
    
    ClusterConnection.java: define initialization for autoincrement constants
    
    Table.java: define get autoincrement column
    
    AutoPKTest.java: test autoincrement for four pk types: int, bigint, smallint, tinyint
      test insert with no primary key set and verify a unique value was used for the column
      test delete by key and verify proper values were inserted
    
    ClusterConnectionImpl.java: when initialized, pass autoincrement constants to DbImpl
    
    DbImpl.java: handle autoincrement
      initialize autoincrement constants
      when needed, get autoincrement value from wrapped Ndb object
    
    NdbRecordImpl.java: handle setting autoincrement value
      initialize autoincrement value setter based on column type
      set autoincrement value into NdbRecord buffer
    
    NdbRecordOperationImpl.java:
      handle autoincrement on insert operation when autoincrement column was not set by user
    
    TableImpl.java: 
      return autoincrement column if it is defined in the NdbTable
    
    Bundle.properties: new error messages for internal and user errors
    
    ndbjtie/NdbApiWrapper.hpp: define new methods
      Ndb__getAutoIncrementValue: get a new autoincrement value from Ndb
      NdbDictionary__Column__getAutoIncrement: return if a column is autoincrement
    
    ndbjtie/ndbapi/Ndb.java: implement Ndb:getAutoIncrementValue
    
    ndbjtie/ndbapi/NdbDictionary.java: implement Column:getAutoIncrement
    
    ndbjtie/ndbapi_jtie.hpp: implement JNI delegation to native method
Loading