pg.ddx.io pgsql-php@postgresql.org mailing list archive
help / color / mirror / Atom feedPEAR Problem
4+ messages / 3 participants
[nested] [flat]
* PEAR Problem
@ 2001-10-08 12:37 Gurudutt <guru@indvalley.com>
2001-10-08 22:14 ` Re: PEAR Problem Papp Gyozo <pgerzson@freestart.hu>
2001-10-09 04:04 ` Re: PEAR Problem Dan Wilson <phpPgAdmin@acucore.com>
0 siblings, 2 replies; 4+ messages in thread
From: Gurudutt @ 2001-10-08 12:37 UTC (permalink / raw)
To: pgsql-sql@postgresql.org; +Cc: pgsql-php
Hi,
It's me again. I have been able to solve most of the porting problems
from mysql to pgsql. But I have got struck in one place. I have a
problem where PEAR's associative array doesn't recognise the mix case
letters.
eg . I issue a query through PEAR db and get results using fetchRow of
PEAR. Now I have set associative array feature ON.
suppose the query is
select NetCode,NetworkName from NetworkTab;
this would return the result into a variable called $dbRow
to echo the contents returned by the pgsql, I have to give
$dbRow[NetCode] and $dbRow[NetworkName]
This used to work perfectly fine with mysql, but as I moved to pgsql,
PEAR started to return nothing
like if i echo $dbRow[NetCode] it prints nothing
but in the same echo is I change it echo $dbRow[netcode], it prints
the value of the Network Code.
How do I handle this situation. The application is fully written with Mix Case
letters for the database fields and returned result set.
And one more thing "SET AUTOCOMMIT=0" which is to set auto commiting
to "No" in mysql doesn't work in pgsql what is the equivalent command.
--
Best regards,
Gurudutt mailto:guru@indvalley.com
Life is not fair - get used to it.
Bill Gates
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: PEAR Problem
2001-10-08 12:37 PEAR Problem Gurudutt <guru@indvalley.com>
@ 2001-10-08 22:14 ` Papp Gyozo <pgerzson@freestart.hu>
1 sibling, 0 replies; 4+ messages in thread
From: Papp Gyozo @ 2001-10-08 22:14 UTC (permalink / raw)
To: Gurudutt <guru@indvalley.com>; pgsql-sql@postgresql.org; +Cc: pgsql-php
Hi,
maybe this problem isn't originated in PEAR, but in pg itself.
Postgres folds everything to lowercase except one within "" (doublequotes).
So, if you - ie.: in psql:
psql=# CREATE TABLE veRYMixedCAse (NetCode integer,...);
then actually you will create a table named 'verymixedcase'.
In PHP (PEAR actually) you need to refer to this table and its columns
in lowercase.
You may run psql and execute:
\dt -- to figure out what names to be given to your tables
and then
\d NetworkTab or \d networktab -- and what names of the columns have
----- Original Message -----
From: "Gurudutt" <guru@indvalley.com>
To: <pgsql-sql@postgresql.org>
Cc: <pgsql-php@postgresql.org>
Sent: Monday, October 08, 2001 2:37 PM
Subject: [PHP] PEAR Problem
> Hi,
>
> It's me again. I have been able to solve most of the porting problems
> from mysql to pgsql. But I have got struck in one place. I have a
> problem where PEAR's associative array doesn't recognise the mix case
> letters.
>
> eg . I issue a query through PEAR db and get results using fetchRow of
> PEAR. Now I have set associative array feature ON.
>
> suppose the query is
>
> select NetCode,NetworkName from NetworkTab;
>
> this would return the result into a variable called $dbRow
>
> to echo the contents returned by the pgsql, I have to give
> $dbRow[NetCode] and $dbRow[NetworkName]
>
> This used to work perfectly fine with mysql, but as I moved to pgsql,
> PEAR started to return nothing
>
> like if i echo $dbRow[NetCode] it prints nothing
>
> but in the same echo is I change it echo $dbRow[netcode], it prints
> the value of the Network Code.
>
> How do I handle this situation. The application is fully written with Mix
Case
> letters for the database fields and returned result set.
>
> And one more thing "SET AUTOCOMMIT=0" which is to set auto commiting
> to "No" in mysql doesn't work in pgsql what is the equivalent command.
>
> --
> Best regards,
> Gurudutt mailto:guru@indvalley.com
>
> Life is not fair - get used to it.
> Bill Gates
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: PEAR Problem
2001-10-08 12:37 PEAR Problem Gurudutt <guru@indvalley.com>
@ 2001-10-09 04:04 ` Dan Wilson <phpPgAdmin@acucore.com>
1 sibling, 0 replies; 4+ messages in thread
From: Dan Wilson @ 2001-10-09 04:04 UTC (permalink / raw)
To: Gurudutt <guru@indvalley.com>; pgsql-sql@postgresql.org; +Cc: pgsql-php
This is caused by the fact that PostgreSQL is case insensitive. In order
for it to actually take the case into account, you need quote your field
names and table names.
So your query would then be: select "NetCode","NetworkName" from
"NetworkTab";
Then you would be able to access the fields with $dbRow[NetworkName].
-Dan
: Hi,
:
: It's me again. I have been able to solve most of the porting problems
: from mysql to pgsql. But I have got struck in one place. I have a
: problem where PEAR's associative array doesn't recognise the mix case
: letters.
:
: eg . I issue a query through PEAR db and get results using fetchRow of
: PEAR. Now I have set associative array feature ON.
:
: suppose the query is
:
: select NetCode,NetworkName from NetworkTab;
:
: this would return the result into a variable called $dbRow
:
: to echo the contents returned by the pgsql, I have to give
: $dbRow[NetCode] and $dbRow[NetworkName]
:
: This used to work perfectly fine with mysql, but as I moved to pgsql,
: PEAR started to return nothing
:
: like if i echo $dbRow[NetCode] it prints nothing
:
: but in the same echo is I change it echo $dbRow[netcode], it prints
: the value of the Network Code.
:
: How do I handle this situation. The application is fully written with Mix
Case
: letters for the database fields and returned result set.
:
: And one more thing "SET AUTOCOMMIT=0" which is to set auto commiting
: to "No" in mysql doesn't work in pgsql what is the equivalent command.
:
: --
: Best regards,
: Gurudutt mailto:guru@indvalley.com
:
: Life is not fair - get used to it.
: Bill Gates
:
:
: ---------------------------(end of broadcast)---------------------------
: TIP 5: Have you checked our extensive FAQ?
:
: http://www.postgresql.org/users-lounge/docs/faq.html
:
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: PEAR Problem
@ 2001-10-09 08:07 Gurudutt <guru@indvalley.com>
0 siblings, 0 replies; 4+ messages in thread
From: Gurudutt @ 2001-10-09 08:07 UTC (permalink / raw)
To: pgsql-php
Hello Dan,
Thanks very much for the help. Ya I tried enclosing with the quotes on
that unfortunately it doesn't work, it gives error.
Here are source code for the files.
You can try creating a table names ACT_NetworkTab with 2 fields,
NetCode(Integer) and NetWorkName(Varchar)
This is the php code which is used to print the values
<?
//include new pgsql pear db file ...
require_once("pgsqlpear.php");
//verify for database server ...
if(!$db)
{
//error occured .. send him to Error page ...
echo "Database conenction failed (Line : 18)";
exit;
}
else
{
//Begin Transaction ..
$Begin_Query = "BEGIN";
$Begin_Result = $db->query($Begin_Query);
//Auto Commit Query ..
//$AutoCommit_Query = "SET autocommit=0";
//$AutoCommit_Result = $db->query($AutoCommit_Query);
$Query = "SELECT \"NetCode\",\"NetWorkName\" FROM
\"ACT_NetworkTab\"";
$Result = $db->query($Query);
if(DB::isError($Result))
{
//Do a Roll Back ....
$RoleBack_Query = "ROLLBACK";
$RoleBack_Result = $db->query($RoleBack_Query);
echo "Query Failed (line 38)";
exit;
}
else
{
while($Row = $Result->fetchrow())
{
echo
"NetCode:",$Row[NetCode]."---NetName:".$Row[NetworkName];
echo "<br>";
}
} //end of if db success ....
//Commit the operation here .....
$Commit_Query = "COMMIT";
$Commit_Result = $db->query($Commit_Query);
} //end of if submit ...
?>
This is the pgsql.php include file for Database connectivity
<?
$dbuser = "postgres";
$dbpassword = "postgres";
$dbhost = "localhost";
$dbname = "ACTBilling";
require_once("DB.php");
$db = DB::connect("pgsql://$dbuser:$dbpassword@$dbhost/$dbname");
if(DB::isError($db))
{
$db = 0;
echo $db->getMessage();
}
else
{
$db->setFetchMode(DB_FETCHMODE_ASSOC);
}
?>
Please try and help me!!
--
Best regards,
Gurudutt mailto:guru@indvalley.com
Life is not fair - get used to it.
Bill Gates
Tuesday, October 09, 2001, 9:34:24 AM, you wrote:
DW> This is caused by the fact that PostgreSQL is case insensitive. In order
DW> for it to actually take the case into account, you need quote your field
DW> names and table names.
DW> So your query would then be: select "NetCode","NetworkName" from
DW> "NetworkTab";
DW> Then you would be able to access the fields with $dbRow[NetworkName].
DW> -Dan
DW> : Hi,
DW> :
DW> : It's me again. I have been ab
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2001-10-09 08:07 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-10-08 12:37 PEAR Problem Gurudutt <guru@indvalley.com>
2001-10-08 22:14 ` Papp Gyozo <pgerzson@freestart.hu>
2001-10-09 04:04 ` Dan Wilson <phpPgAdmin@acucore.com>
2001-10-09 08:07 Re: PEAR Problem Gurudutt <guru@indvalley.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox