Customer Portal

Auto Increment primary key

Comments 2

  • Avatar
    novakj
    0
    Comment actions Permalink
    Hi Marc,

    You can use DBOutputTable component for loading data into database. The second output port is used for returned values. You can define returning data by returning statement specified in the query.

    Example of MySQL query with returning statement:

    INSERT INTO `myUsers` (`firstname`, `lastname`) VALUES (?, ?) RETURNING $inserted_id:=AUTO_GENERATED


    Question marks serve as placeholders for Clover field values (from input metadata) and virtual field called "AUTO_GENERATED" is used for returning auto generated id (mapped to the second output port with field named "inserted_id").

    I prepared for you simple example, please see the attached graph (for testing please modify your database connection details).

    For more details about returning statement please see the documentation of DataOutputTable component here:
    http://doc.cloveretl.com/documentation/UserGuide/index.jsp?topic=/com.cloveretl.gui.docs/docs/dboutputtable.html
  • Avatar
    marc
    0
    Comment actions Permalink
    Hi Jiri,

    Thank you for the very quick response, this does exactly what I was hoping for.

    regards
    Marc

Please sign in to leave a comment.