ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Proposed solution for OCI8 insert_id()

March 07, 2011 6:40pm

Subscribe [1]
  • #1 / Mar 07, 2011 6:40pm

    jrizzi

    1 posts

    Hello,

    I am a codeigniter beginner, working my way from creating my own collection of scripts to a framework for RAD, and I chose CI, for usability and speed.

    Because of my infrastructure, I am required to use oracle for my web db development, which has been pretty good while developing with CI, except for one area, insert_id(), because oracle does not have an auto-increment column type


    I had a few hackish ways of getting around this , like calling select statements of sequences prior to insert that had no triggers, but today really refined a perfect way to return the id on an oracle insert(after creating a sequence and trigger).

    $link = oci_connect($db_schema, $db_psw, $conn);
    
    $code = "INSERT INTO OB_MAIN (COL_1, COL_2, COL_3, SUBMITTED_DT)"
          ." VALUES ('one', 'two', 'three', SYSDATE )"
          ." return ID into :id";
        $squery = oci_parse($link, $code);
        oci_bind_by_name($squery,":id", $id, 10, SQLT_INT);
        oci_execute($squery);
        return $id;

    This is based on the example provided by the Underground PHP and Oracle manual.

    My concern is this…The current oci_driver.php has the insert_id() function listed as “unsupported” , and I would love to roll the above solution into the oci_driver, but understand I should not make changes to the database libraries because they will get overwritten during CI upgrades.

    Is it possible if I or anyone else tuned the above syntax to fit the oci and db drivers, that the CI library would incorporate that change? I know that there arent many of us oracle devs out there, but this would be a massive win for the few and proud

    Thanks for any thoughts

  • #2 / Mar 07, 2011 7:05pm

    WanWizard

    4475 posts

    Fork the reactor code, make your modifications to the OCI driver, and push your changes back. If it’s good, I’m sure they would accept it.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases