Peter Lukezic | 1 Nov 2007 01:05
Picon
Picon

Database - how to get lastInsertID?


-----Ursprüngliche Nachricht-----
Von: Peter Lukezic [mailto:peter.l@...] 
Gesendet: Donnerstag, 01. November 2007 00:59
An: 'components@...'
Betreff: Database - how to get lastInsertID?

Hi, 

i’m really new to ezComponents and i’m going to really like them much better
then the zend-framework…

but in the database components i’m looking for something to get the id of my
last insert statement… perhaps someone could help...

eg.

$q = $this->db->createInsertQuery();
$q->insertInto( '_nic2006' )
->set( 'id', $q->bindValue( ) )
->set( 'plz', $q->bindValue( '1010' ) )
->set( 'ort', $q->bindValue( "wien" ) );
$stmt = $q->prepare();
$stmt->execute();

Best regards, peter lukezic

--

-- 
Components mailing list
Components@...
(Continue reading)

Gontran Zepeda | 1 Nov 2007 04:00

Re: Database - how to get lastInsertID?

Dear Peter,

% On 2007-11-01 at 01:05:15 +0100, Peter Lukezic wrote:
> but in the database components i’m looking for something to get the id of my
> last insert statement… perhaps someone could help...
> eg.
> 
> $q = $this->db->createInsertQuery();
> $q->insertInto( '_nic2006' )
> ->set( 'id', $q->bindValue( ) )
> ->set( 'plz', $q->bindValue( '1010' ) )
> ->set( 'ort', $q->bindValue( "wien" ) );
> $stmt = $q->prepare();
> $stmt->execute();

Caveats apply, ymmv, but this is in the docs.

$my_id = $this->db->lastInsertId();

Warm regards,
-- 
Gontran
% # E Pluribus Unix
% /usr/bin/fortune
I don't deserve this award, but I have arthritis and I don't deserve that
either.
		-- Jack Benny
--

-- 
Components mailing list
Components@...
(Continue reading)

Derick Rethans | 1 Nov 2007 10:16
Picon
Favicon
Gravatar

Re: Database - how to get lastInsertID?

On Wed, 31 Oct 2007, Gontran Zepeda wrote:

> % On 2007-11-01 at 01:05:15 +0100, Peter Lukezic wrote:
> > but in the database components i?m looking for something to get the id of my
> > last insert statement? perhaps someone could help...
> > eg.
> > 
> > $q = $this->db->createInsertQuery();
> > $q->insertInto( '_nic2006' )
> > ->set( 'id', $q->bindValue( ) )
> > ->set( 'plz', $q->bindValue( '1010' ) )
> > ->set( 'ort', $q->bindValue( "wien" ) );
> > $stmt = $q->prepare();
> > $stmt->execute();
> 
> Caveats apply, ymmv, but this is in the docs.
> 
> $my_id = $this->db->lastInsertId();

I don't recall if it's in the docs, but as $stmt is a normal 
PDOStatement, all methods of that class work of course as well. 
The documentation for prepare() lists this: 
http://ez.no/doc/components/view/latest/(file)/Database/ezcQuery.html#prepare
But I will add a link to the PDOStatement documentation there.

regards,
Derick
Derick Rethans | 1 Nov 2007 10:40
Picon
Favicon
Gravatar

Re: additional params to ezcDBFactory -> PDO params?

Hello Christian,

On Mon, 29 Oct 2007, Christian Michel wrote:

> Hello,
> 
> is there any reason, why additional params cannot be set to 
> ezcDbFactory::create()?

No, not really - could you please file this as a feature request at 
http://issues.ez.no/ProjectSelect.php?Id=1 ?

regards,
Derick
Peter Lukezic | 1 Nov 2007 12:12
Picon
Picon

Database - how to get lastInsertID?

Thnx a lot - haven't found it in the documentation. peter

Frederik Holljen | 1 Nov 2007 13:12
Picon

Re: Database - how to get lastInsertID?

On 11/1/07, Peter Lukezic <peter.l@...> wrote:
> Thnx a lot - haven't found it in the documentation. peter
It's part of PDO (which database derives from). There is a link to the
PDO documentation from the tutorial.

Cheers,
Frederik
Thomas Koch | 2 Nov 2007 10:34
Picon

Reduce time consuming tasks

Hi,

we want to integrate ezcExecution and I stumbled about a rather time consuming 
point in ezcExecution::init():

        // Check if the passed classname actually implements the interface. We
        // have to do that with reflection here unfortunately since we only
        // have the classname and not an object.
        $interfaceClass = new ReflectionClass( 'ezcExecutionErrorHandler' );
        $handlerClass = new ReflectionClass( $callbackClassName );
        if ( !$handlerClass->isSubclassOf( $interfaceClass ) )
        {
            throw new ezcExecutionWrongClassException( $callbackClassName );
        }

So for each and every request we would instantiate two ReflectionClass 
objects. I've not done any Benchmark for this, but I assume, that it's an 
unnecessary waste of time.

Of course it's fine to have this error during development, but I'd like to 
switch this test of for production. If it worked once while testing, then it 
works every time as long as I don't change the source code.

So I have a suggestion for the next ezc Releases: Add a "development" and 
a "production" mode to ezcBase. Every Component can ask for the current mode 
and decide, which tests to do.

Tests that should be skipped in production mode:
A test that depends only on the sourcecode and will pass everytime as long as 
the sourcecode remains unchanged, should be skipped.
(Continue reading)

Dave Fischetti | 7 Nov 2007 06:20
Picon

Getting "Trying to get property of non-object"

I'm using the MAIL component in my application. All has been running  
great, but recently started receiving this error sporadically when  
parsing incoming mail in a mailbox.

<b>Notice</b>:  Trying to get property of non-object in <b>/var/www/ 
vhosts/domain.com/httpdocs//inbox.php5</b> on line <b>684</b><br />

That line is this function:

function formatAddress( $address )
{
     return "{$address->email}";
}

now I'm not sure what is causing it all of a sudden, but I am seeing  
spam that sometimes comes into the account that has now FROM address,  
but I haven't ensured that its happening when receiving those messages.

Any help would be greatly appreciated.

Regards,

Fish
 ><>
Gontran Zepeda | 7 Nov 2007 07:24

Re: Getting "Trying to get property of non-object"


In the interest of understanding your situation, please allow a question or
few.

% On 2007-11-07 at 00:20:53 -0500, Dave Fischetti wrote:
> I'm using the MAIL component in my application. All has been running  
> great, but recently started receiving this error sporadically when  
> parsing incoming mail in a mailbox.
> 
> <b>Notice</b>:  Trying to get property of non-object in <b>/var/www/ 
> vhosts/domain.com/httpdocs//inbox.php5</b> on line <b>684</b><br />

Has anything changed on your system relating to web services?  Have you
changed the version of Components that you are using?  Which version are
you using?

> That line is this function:
> 
> function formatAddress( $address )
> {
>      return "{$address->email}";
> }
> 
> now I'm not sure what is causing it all of a sudden, but I am seeing  
> spam that sometimes comes into the account that has now FROM address,  
> but I haven't ensured that its happening when receiving those messages.
> 
> 
> Any help would be greatly appreciated.

(Continue reading)

Dave Fischetti | 7 Nov 2007 21:43
Picon

Re: Getting "Trying to get property of non-object"

Hey Gontran, Thanks for the reply.

I don't believe anything has changed. Since seeing this error. Though  
I am on a Dedicated Virtual Server on Media Temple. They do  
periodically update things. But my version of EZ has remained 2007.1.1

PHP 5 is running in CGI mode (I still have php 4 on the server  
everywhere else. This is my only php5 script right now).

I guess I can live with the Notice, and just silence the PHP5 notices  
display. I just thought I might have missed something.

The script is being called by a cron job:
/usr/bin/lynx -source http://www.domain.com/inbox.php5

I guess I could silence the cron so it doesnt reply at all (thats  
where I'm seeing the errors. In my returned cron emails)

Thanks so much for the reply. Really appreciate it.

Fish

 ><>

On Nov 7, 2007, at 1:24 AM, Gontran Zepeda wrote:

>
> In the interest of understanding your situation, please allow a  
> question or
> few.
(Continue reading)


Gmane