Failure of odbc_num_rows sometimes
am 28.11.2005 00:07:56 von Robert Stearns
When I have an Sql statement of the form:
SELECT LOC_ID,REPEAT('--',LEVELX)||NAMEX
FROM is3.locations
WHERE entity_id=2
AND (inactive='N' OR inactive IS NULL)
AND leftx BETWEEN 2 AND 983
ORDER BY LEFTX
odbc_num_rows returns -1. When I change the sql statement to:
SELECT LOC_ID,CHAR(LEVELX)||' '||NAMEX
FROM is3.locations
WHERE entity_id=2
AND (inactive='N' OR inactive IS NULL)
AND leftx BETWEEN 2 AND 983
ORDER BY LEFTX
odbc_num_rows returns the correct result.
Both statements work in the ADS development environment.
The rdms is db2 udb v8.1.9 linux
php is 4.4.0 with db2 compiled in
'./configure' '--prefix=/usr/local/php-4.4.0'
'--with-apxs2=/usr/local/apache2.0.54/bin/apxs'
'--with-ibm-db2=/db2home/db2inst1/sqllib'
'--with-openssl=/usr/local/ssl-0.9.8'
Re: Failure of odbc_num_rows sometimes
am 28.11.2005 13:01:35 von Hilarion
> When I have an Sql statement of the form:
>
> SELECT LOC_ID,REPEAT('--',LEVELX)||NAMEX
> FROM is3.locations
> WHERE entity_id=2
> AND (inactive='N' OR inactive IS NULL)
> AND leftx BETWEEN 2 AND 983
> ORDER BY LEFTX
>
> odbc_num_rows returns -1. When I change the sql statement to:
>
> SELECT LOC_ID,CHAR(LEVELX)||' '||NAMEX
> FROM is3.locations
> WHERE entity_id=2
> AND (inactive='N' OR inactive IS NULL)
> AND leftx BETWEEN 2 AND 983
> ORDER BY LEFTX
>
> odbc_num_rows returns the correct result.
>
> Both statements work in the ADS development environment.
>
> The rdms is db2 udb v8.1.9 linux
>
> php is 4.4.0 with db2 compiled in
> './configure' '--prefix=/usr/local/php-4.4.0'
> '--with-apxs2=/usr/local/apache2.0.54/bin/apxs'
> '--with-ibm-db2=/db2home/db2inst1/sqllib'
> '--with-openssl=/usr/local/ssl-0.9.8'
Maybe it's a problem with "--" being a comment combination.
Try using one "-" instead of two, or concatenate them.
Hilarion
Re: Failure of odbc_num_rows sometimes
am 28.11.2005 19:54:01 von Robert Stearns
Hilarion wrote:
>> When I have an Sql statement of the form:
>>
>> SELECT LOC_ID,REPEAT('--',LEVELX)||NAMEX
>> FROM is3.locations
>> WHERE entity_id=2
>> AND (inactive='N' OR inactive IS NULL)
>> AND leftx BETWEEN 2 AND 983
>> ORDER BY LEFTX
>>
>> odbc_num_rows returns -1. When I change the sql statement to:
>>
>> SELECT LOC_ID,CHAR(LEVELX)||' '||NAMEX
>> FROM is3.locations
>> WHERE entity_id=2
>> AND (inactive='N' OR inactive IS NULL)
>> AND leftx BETWEEN 2 AND 983
>> ORDER BY LEFTX
>>
>> odbc_num_rows returns the correct result.
>>
>> Both statements work in the ADS development environment.
>>
>> The rdms is db2 udb v8.1.9 linux
>>
>> php is 4.4.0 with db2 compiled in
>> './configure' '--prefix=/usr/local/php-4.4.0'
>> '--with-apxs2=/usr/local/apache2.0.54/bin/apxs'
>> '--with-ibm-db2=/db2home/db2inst1/sqllib'
>> '--with-openssl=/usr/local/ssl-0.9.8'
>
>
>
> Maybe it's a problem with "--" being a comment combination.
> Try using one "-" instead of two, or concatenate them.
>
> Hilarion
That's not it. I changed the expression to `REPEAT(''-'',LEVELX*2)` and
got the same results.