phpgroupware-developers
[Top][All Lists]
Advanced

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

Re: [Phpgroupware-developers] Patches for PostgreSQL??


From: Chris Weiss
Subject: Re: [Phpgroupware-developers] Patches for PostgreSQL??
Date: Fri, 21 Nov 2003 16:15:35 +0000

ack!  '' isn't an int!  where it's doing that is a bug, please make a specific
bug repoert.

Dani Oderbolz (address@hidden) wrote:
>
> Kai Hofmann wrote:
>
> >Hi Dani,
> >
> >
> >
> >>When I used it, I got many "pg-atoi: Zero length string" errors.
> >>
> >>Does anybody know about the real status of this?
> >>
> >>
> >
> >I don't know the exact status of the postgre support, but
> >I am working on SAPDB support - so the problem you mentioned
> >sounds familar to me.
> >The SQL statements itself are not a problem to my best knowledge,
> >its more the  db_addslashes function that should be correctly
> >adapted for the corresponding database.
> >For SAPDB it looks like the following:
> >
> >/**
> > * Escape strings before sending them to the database
> > *
> > * @param string $str the string to be escaped
> > * @return string escaped sting
> > */
> >function db_addslashes($str)
> > {
> >  return str_replace("'","''",$str);
> > }
> >
> >thats because in SAPDB as well as in SYBASE databases (and ADABAS D I think)
> >a ' will be escaped by using it two times ''.
> >
> >Replacing it with "NULL" is not what you really want. Maybe there are other
> >things
> >that have to be escaped by the addslashes function like  or / etc.
> >but this depends on the database.
> >I have not tested the postgre support for now. But somebody around should
> >have it up and running.
> >
> I guess you are talking about something different
> (while addslashed might be the proper place to put my fix).
> The problem is PostgreSQLs treatment of the string ''.
> If say, you have a coulmn id, which is of type int,
> and you write:
> Select * from table Where id=''
> (This is a type of query that Phpgroupware does often, for exaple if you
> want to add new User Groups.)
> then Postgres tries to treat '' like a number, which it can't.
> Therefore, you have to replace '' which NULL (the intention of '' is to
> get a NULL,
> but this is not the same thing!)
> Actually, its not the same thing for any DB! (But most others don't
> complain).
>
> Thats why I am replacing all '' by NULL (which seems to work).
>
> Cheers, Dani
>
>
>
> _______________________________________________
> Phpgroupware-developers mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/phpgroupware-developers
>





reply via email to

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