phpgroupware-developers
[Top][All Lists]
Advanced

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

RE: [phpGroupWare-developers] Postres support -> Proposal


From: Sigurd Nes
Subject: RE: [phpGroupWare-developers] Postres support -> Proposal
Date: Wed, 18 Jun 2008 17:35:14 +0200 (MEST)

> From: Benoit Hamet address@hidden
> Sent: 2008-06-18 16:50:05 CEST
> To: address@hidden
> Subject: Re: [phpGroupWare-developers] Postres support -> Proposal
> 
> Hi Sigurd,
> 
> Sigurd Nes a écrit :
> >> From: Benoit Hamet address@hidden
> >> Sent: 2008-06-18 13:22:56 CEST
> >> To: address@hidden
> >> Subject: Re: [phpGroupWare-developers] Postres support / update DB to      
> >> 0.9.18.015
> >>
> >> Can you give concrete example of problems ?
> >>
> > I don't have access to a pre 8.2 - but I think you can test the reporting 
> > of constraints by navigate to setup/sqltoarray.php?appname=<your 
> > favorite>&submit=True
> > 
> > you might want to have fk, uc, and ix on (some of) your tables.
> Well, in my light application, no apps are using fk ... so was hard to
> test. Anyway I add the constraints for acl_account to references
> account_id into phpgw_account.account_id : Here the output on a pgsql 7.4 :
> 'phpgw_acl' => array(
>   'fd' => array(
>   'acl_account' => array('type' => 'int', 'precision' => 4,'nullable' =>
> True),
>   'acl_rights' => array('type' => 'int', 'precision' => 4,'nullable' =>
> True),
>   'acl_grantor' => array('type' => 'int', 'precision' => 4,'nullable' =>
> True),
>   'acl_type' => array('type' => 'int', 'precision' => 2,'nullable' => True),
>   'location_id' => array('type' => 'int', 'precision' => 4,'nullable' =>
> True)
>  ),
>   'pk' => array(),
>   'fk' => array('phpgw_accounts' => array('acl_account' => 'account_id')),
>   'ix' => array(acl_account),
>   'uc' => array()
> ),
> 
> So it's working for install before 8.2

Ok - that's good :)

> > 
> > I had some problems with reporting on fk for version later than 8.2.
> Hu, So I misunderstood you're previous point. You want to support pgsql
> only until 8.2 ???
> 
Not at all :)
I want to support versions later than 8.2

But since the version we have to support is 7.4 - I'm withdrawing the original 
proposal.

> > I'm not sure (haven't looked into it recently )that adodb's MetaForeignKeys 
> > returned a desired result.
> > 
> > There is some code from phpPgAdmin - that could be used - but that one 
> > assumes that you are looking at nspname='public'
> 
> Sorry, I guess I'm totaly lost ...
> 
> In your first mail you were saying :
> "
> I propose to drop support for postgres prior to 8.2
> 
> There was a change in behavior regarding the use of oid that has impact
> on class.db.inc.php (the get_last_insert_id) and
> class.schema_proc_pgsql.inc.php for retrieving various meta data.
> "
> Ok, you are telling us, that version > 8.2 of pgsql are not working with
> the actual code ... and your solution is to drop the working code ????

It's working just fine (for post 8.2 anyway - don't know about pre-versions) - 
thought it might be a bit simplified.
 
> Well, let me think twice about that :
>  - the get_last_insert_id : For me it's the adodb layer which is
> responsible for these things, not "us". So if their code is broken, help
> them to fix it, do not try to workaround in our code. Perhaps are we
> misusing their code, in that case, we should fix it... For now I propose
> that the code of that function being the following :
> public function get_last_insert_id($table, $field)
> {
>   return $this->adodb->Insert_ID($table, $field);
> }
> and nothing else.
> If you have STRONG arguments against it, give it to all of us, and we
> will discuss and see. if no I will commit this in 2 weeks.
> 

Then you will have support for pre 8.2 only - and that would be a sad situation.

and for mssql you will need something like (tested and working):
<code>
if(!isset($table) || $table == '' || !isset($field) || $field == '')
{
        return -1;
}
$result = @mssql_query("select @@identity", $this->adodb->_queryID);
if(!$result)
{
        return -1;
}
return mssql_result($result, 0, 0);

</code>

That's my argument - don't know if it is a STRONG one :)

>  - class.schema_proc_pgsql.inc.php : well I'm not sure that these
> classes are still needed "like this" since they don't seems to use the
> adodb layer but use SQL directly ... so I thing that updating them
> should be done instead of only supporting a version of pgsql ... Will
> try to look at it now.
> 

In my experience - you can use adodb for some of it - but not everything - 
expecting it to work for both pre and post 8.2

Regards

Sigurd

reply via email to

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