chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] postgresql tests/run.scm line 17 ff.


From: Peter Bex
Subject: Re: [Chicken-users] postgresql tests/run.scm line 17 ff.
Date: Sun, 3 Mar 2013 17:57:29 +0100
User-agent: Mutt/1.4.2.3i

On Sun, Mar 03, 2013 at 05:50:30PM +0100, Herr wrote:
> > I hope you find this more convenient than the shitty functions provided
> > by PHP.  I always get frustrated having to write code for handling
> > booleans and arrays in PHP all the time, over and over again.
> > How is TCL's interface?
> 
> PHP: with PDO I don't find it so shitty. A lot of query results it get as 
> array of
> objects, ready to handle to the presentation/HTML layer, because the code 
> goes with
> the data.

As I understand it, PDO returns everything as string, too.
So "SELECT 1, '2'::text, FALSE, array[1, 2, 3]::int[]" will return
one row with column values: "1", "2", "f", "{1, 2, 3}".  You'll still
need to convert the number to a number, the 'f' to a false boolean
(tricky! 'f' is a true value in PHP) and parse the array of integers.
Nested arrays are particularly bad.  Of course if you're not really
using the advanced features of Postgres (which are its strength!),
you'll have less problems.

> Tcl: it is extremely succinct, getting the result as flat list covers all the 
> uses
> where the select column list does not change. With some small helpers a 
> typical
> pattern is:
> 
> foreach {fname lname email} [pg_query_list "select fname, lname..."] {
>      # variables are bound to the row values, go ahead
> }

That's convenient, but what does it do with typed values?

Cheers,
Peter
-- 
http://www.more-magic.net



reply via email to

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