FW: [PEAR] dataobject : problem with insert function
| From: | Denis Gerasimov | Date: | Mon, 23 Aug 2004 10:18:52 +0000 |
| Subject: | FW: [PEAR] dataobject : problem with insert function | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-14234@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Denis Gerasimov [mailto:denis.gerasimov@vekos.ru]
> Sent: Monday, August 23, 2004 2:13 PM
> To: 'Ludovic LAURENT'
> Subject: RE: [PEAR] dataobject : problem with insert function
>
>
> Hmmm...
>
> But this just is a notice, not fatal error. I mean that all should work
> anyway.
> Does it work, i.e. inserts new record to db or not?
>
> There are some more ways to do this:
>
> 1. if you need this dataobject only for inserting new records you may try
> to delete [yourtablename__keys] section for this table from your
> database.ini file.
>
> 2. you also may do this 'dynamically' with config
>
> $arrOptions = &PEAR::getStaticProperty('DB_DataObject', 'options');
>
> and make appropriate changes there.
>
> 3. set
>
> $this->keys('real_field_name');
>
> Where 'real_field_name' is any NOT integer field.
>
> 4. disable warnings for your script like this:
>
> ini_set('error_reporting', E_ALL & ~E_NOTICE);
>
> One of these should solve your problem.
>
> -----Original Message-----
> From: Ludovic LAURENT [mailto:ludov.laurent@laposte.net]
> Sent: Monday, August 23, 2004 1:48 PM
> To: Denis Gerasimov; PEAR General ML
> Subject: Re: [PEAR] dataobject : problem with insert function
>
> N, I've always the error messages...
>
> Notice: Undefined index: in /usr/local/lib/php/pear/DB/DataObject.php on
> line 1795
> ----- Original Message -----
> From: "Denis Gerasimov" <denis.gerasimov@vekos.ru>
> To: "PEAR General ML" <pear-general@lists.php.net>
> Cc: "'Ludovic LAURENT'" <ludov.laurent@laposte.net>
> Sent: Monday, August 23, 2004 11:38 AM
> Subject: FW: [PEAR] dataobject : problem with insert function
>
>
> >
> > OK, I see.
> >
> > Try using
> >
> > $this->keys('');
> >
> > instead of
> >
> > $this->keys(null);
> >
> > Does it work without a notice?
> >
> > Best regards, Denis Gerasimov
> > Outsourcing Services Manager,
> > VEKOS, Ltd.
> > www.vekos.ru
> >
> >
> > > -----Original Message-----
> > > From: Ludovic LAURENT [mailto:ludov.laurent@laposte.net]
> > > Sent: Monday, August 23, 2004 1:24 PM
> > > To: Denis Gerasimov
> > > Subject: Re: [PEAR] dataobject : problem with insert function
> > >
> > > I've a problem,
> > >
> > > function insert(){
> > >
> > > DB_DataObject::DebugLevel(1);
> > >
> > > $this->rubcode=156486;
> > >
> > > $keys = $this->keys();
> > >
> > > $this->keys(null);
> > >
> > >
> > >
> > > parent::insert();
> > >
> > > $this->keys('rubcode');
> > >
> > >
> > > }
> > >
> > >
> > >
> > > When I use this function, i've the following error message :
> > >
> > >
> > >
> > > Notice: Undefined index: in /usr/local/lib/php/pear/DB/DataObject.php
> on
> > > line 1795
> > >
> > > ----- Original Message -----
> > > From: "Denis Gerasimov" <denis.gerasimov@vekos.ru>
> > > To: "'mike'" <laurent.ludovic@free.fr>
> > > Sent: Monday, August 23, 2004 10:02 AM
> > > Subject: RE: [PEAR] dataobject : problem with insert function
> > >
> > >
> > > >
> > > > Hello,
> > > >
> > > > Is this a primary key for your table?
> > > >
> > > > If so, you may call $this->keys(null) to reset primary keys of the
> > > table.
> > > > Then insertion will go fine.
> > > > But don't forget to restore them if you need them later in you code.
> For
> > > > example:
> > > >
> > > > $keys = $this->keys();
> > > > $this->keys(null);
> > > >
> > > > // performing insertion here...
> > > >
> > > > $this->keys($keys);
> > > >
> > > > Best regards, Denis Gerasimov
> > > > Outsourcing Services Manager,
> > > > VEKOS, Ltd.
> > > > www.vekos.ru
> > > >
> > > > -----Original Message-----
> > > > From: mike [mailto:laurent.ludovic@free.fr]
> > > > Sent: Monday, August 23, 2004 11:45 AM
> > > > To: pear-general@lists.php.net
> > > > Subject: [PEAR] dataobject : problem with insert function
> > > >
> > > > Hi,
> > > >
> > > > I would like redefine insert function because I need to set the key
> > > value.
> > > > But Dataobject ignore the value that I give it.
> > > > Here's the function :
> > > >
> > > > function insert(){
> > > >
> > > > DB_DataObject::DebugLevel(1);
> > > >
> > > > $this->rubcode=81;
> > > >
> > > >
> > > > parent::insert();
> > > >
> > > >
> > > > }
> > > >
> > > >
> > > >
> > > > Normally, I should have 81 for the insert value, really, I have the
> > > value
> > > 9,
> > > > dataobject does not take into account my value. What have I to do?
> > > >
> > > > --
> > > > PEAR General Mailing List (http://pear.php.net/)
> > > > To unsubscribe, visit:
> > > > http://www.php.net/unsub.php
> > > >
> > > >
> >
>
> --
> PEAR General Mailing List (http://pear.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php