[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] postgresql tests/run.scm line 17 ff.
From: |
Herr |
Subject: |
Re: [Chicken-users] postgresql tests/run.scm line 17 ff. |
Date: |
Sun, 03 Mar 2013 18:48:30 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130215 Thunderbird/17.0.3 |
Am 03.03.2013 17:57, schrieb Peter Bex:
> 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.
>
quick answer to the data types, I am using my own PHP REPL loading my
application
system: no problem so far.
address@hidden:~/htdocs$ myreadline.php
Personal interactive mode
Forms ending in braces need a semikolon ';' to execute.
> $cliuser=54;
> include 'config1.php';
> $dbh=Envman::getDBH();
> $res = $dbh->selectAllAssoc('select 1 < 2 as val1, 2 < 1 as val2, \'Hi\' as
> val3,
99 as val4 ');
> var_dump($res);
array(1) {
[0]=>
array(4) {
["val1"]=>
bool(true)
["val2"]=>
bool(false)
["val3"]=>
string(2) "Hi"
["val4"]=>
int(99)
}
}
>
But generally, in PHP, you have to make friends with loose comparison and have
http://php.net/manual/en/types.comparisons.php pinned to your <favorite focus
of view>.
I hope the list will appreciate this OT info.
/Str.