phpgroupware-developers
[Top][All Lists]
Advanced

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

Re: [Phpgroupware-developers] Scheme Proc on sequence for postgresql


From: Edgar Luna
Subject: Re: [Phpgroupware-developers] Scheme Proc on sequence for postgresql
Date: Thu, 23 Oct 2003 20:18:58 -0500
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3 (gnu/linux)

Michael Dean <address@hidden> writes:

> The short version is that the sequence needs to be updated to match the
> table data after the new table is created and populated.  The flow of
> the function does not need to change.  Try adding this before the final
> return (beware of line wrapping):
Yeap.

> // Update sequence to match
> $sSeqField = '';
> $this->GetSequenceFieldForTable($oProc, $sTableName, $sSeqField);
> if ($sSeqField != '')
> {
>       $sSeqName = '';
>       $this->GetSequenceForTable($oProc, $sTableName, $sSeqName);
>       if ($sSeqName != '')
>       {
>               // we have a sequence name and the corresponding field, so it 
> must be
> golden
>               $sSQL = "SELECT SETVAL('$sSeqName', (SELECT MAX($sSeqField) FROM
> $sTableName))";
>               $oProc->m_odb->query($sSQL);
>       }
> }

Ok, I'll test with this then.

Thanks a lot

-- 
Edgar Antonio Luna Díaz - http://www.sogrp.com
Fingerprint: C008 5EAC 5272 AC8C 7589  4821 8B34 6166 8733 8310




reply via email to

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