Zend_Db_Table_Abstract::insert() issue

View: New views
2 Messages — Rating Filter:   Alert me  

Zend_Db_Table_Abstract::insert() issue

by Philip G :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I'm looking in the comments here and I ran into a problem:

        /**
         * Zend_Db_Table assumes that if you have a compound primary key
         * and one of the columns in the key uses a sequence,
         * it's the _first_ column in the compound key.
         */

According to this, it assumes the first key in a compound key is the sequence. Err, that's not true. Is there anyway to overwrite this assumption? We have tons of tables with quite complex cascading keys (some cases, 5 columns) and the sequence key is often the find column in the list.

I'm running into an issue right now where we have one table with a two column compound key. The first column is a static number (related to our client numbers) and the second column is the sequence number. When I do an insert() it returns only the first column. This is against an Oracle DB, with a trigger on insert to mimic auto_increment (although, it's a sequence). I've tried setting the sequence to the sequence name and just leaving the default. Both cases, I only get 1 key of the compound PK back. I think it's related to the above column.

Are there any hooks within Zend_Db_Table_Abstract I can use to overwrite this default / assumed behavior?

--
Philip
gp@...
http://www.gpcentre.net/

Parent Message unknown Re: Zend_Db_Table_Abstract::insert() issue

by Philip G :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Ah ha. Thanks for the insight. I missed that variable. Setting it to 2 worked.

Thanks!

(PS: Replied to list for archive purposes).

Philip


On Fri, May 16, 2008 at 12:56 PM, <bill@...> wrote:
That comment is no longer true (and should probably be removed).

Read the comment for the Zend_Db_Table_Abstract class variable $_identity.

http://framework.zend.com/apidoc/core/Zend_Db/Table/Zend_Db_Table_Abstract.html#$_identity

-Bill Karwin

Philip G wrote:
>
> I'm looking in the comments here and I ran into a problem:
>
>         /**
>          * Zend_Db_Table assumes that if you have a compound primary key
>          * and one of the columns in the key uses a sequence,
>          * it's the _first_ column in the compound key.
>          */
>
>
> According to this, it assumes the first key in a compound key is the
> sequence. Err, that's not true. Is there anyway to overwrite this
> assumption? We have tons of tables with quite complex cascading keys (some
> cases, 5 columns) and the sequence key is often the find column in the
> list.
>
>
> I'm running into an issue right now where we have one table with a two
> column compound key. The first column is a static number (related to our
> client numbers) and the second column is the sequence number. When I do an
> insert() it returns only the first column. This is against an Oracle DB,
> with a trigger on insert to mimic auto_increment (although, it's a
> sequence). I've tried setting the sequence to the sequence name and just
> leaving the default. Both cases, I only get 1 key of the compound PK back.
> I
> think it's related to the above column.
>
> Are there any hooks within Zend_Db_Table_Abstract I can use to overwrite
> this default / assumed behavior?
>
> --
> Philip
> gp@...
> http://www.gpcentre.net/
>
>
Quoted from:
http://www.nabble.com/Zend_Db_Table_Abstract%3A%3Ainsert%28%29-issue-tp17278927p17278927.html




--
Philip
gp@...
http://www.gpcentre.net/