phpgroupware-developers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Phpgroupware-developers] Re: how does setup work


From: Michael Dean
Subject: Re: [Phpgroupware-developers] Re: how does setup work
Date: 24 Jun 2003 19:53:56 -0500

That would be true in that case.  All you need to do for code that
should only run if the database needs upgraded is:

if (!$oProc->m_bDeltaOnly)
{
        $db2 = $oProc->m_odb;
        $db2->Query("insert into blah (ugh) values (crap)");
        $site_id = $db2->get_last_insert_id(...);
}

On Tue, 2003-06-24 at 20:02, address@hidden wrote:
> What I experienced was, when using something like 
> 
>               $db2 = $phpgw_setup->db;
>               $db2->query("INSERT ...")
>         $site_id = $db2->get_last_insert_id(...);
>         ... other database updates
> 
> the insert and the updates where executed on each run of setup, but
> when using
> 
>         $phpgw_setup->oProc->query(""INSERT ...")
>         $site_id = $phpgw_setup->oProc->get_last_insert_id(...);
>         ... other database updates
> 
> I got an error about function get_last_insert_id not defined.
> 
> Finally, I found a solution, that seems to work:
>               $phpgw_setup->oProc->query("INSERT INTO ...)");
> 
>         //selecting the insert_id from the previous insert
>               $phpgw_setup->oProc->query("SELECT cat_id FROM ...");
>               if ($phpgw_setup->oProc->next_record())
>               {
>                       $site_id = $phpgw_setup->oProc->f('cat_id');
>             ... database updates






reply via email to

[Prev in Thread] Current Thread [Next in Thread]