[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mason
Subject:    Re: [Mason] Help with DBI under Mason
From:       Francisco Alves Cabrita <francisco () nortenet ! pt>
Date:       2004-12-29 14:31:03
Message-ID: 200412291431.06333.francisco () nortenet ! pt
[Download RAW message or body]

I its me again, i think i found the error,,
I wrote an perl script (shell) and i see that the table name ENT_CONSELHO is 
""parsed"" as ent_conselho (lowercase) and of course DBI dont find this table 
in postgresql database,, they are all UPPERCASE,,so,, can some one help me to 
FORCE this case-sensitive SELECT?!

PS: i did create an table ent_conselho (in lowercase) to test,, and it 
worked :). but i cant reconstruct all tables.

pg.pl
!/usr/bin/perl -w
use strict;
use DBI;
my $dbh;
my $host="10.1.1.51";
my $dbname="WORKMEDIA";
my $user="workmedia";
my $pass="XPTO";
my $port="5432";
my $dsn = "DBI:Pg:dbname=$dbname;host=$host";
$dbh = DBI->connect($dsn,$user,$pass) or die "Erro na
 con: $DBI::errstr";
my $sql ="SELECT * FROM ENT_CONSELHO";
my $sth = $dbh->prepare($sql) or die "ERRO_PREP: $DBI
::errstr";
$sth->execute() or die "ERRO_EXEC: $DBI::errstr";
my @row;
while(@row=$sth->fetchrow_array()){
print "ROW: @row\n";
}
warn "ERRO_FINAL: $DBI::errstr"
if $DBI::errstr;
$dbh->disconnect
        or warn "ERRO_DISC: $DBI::errstr";
exit;


Thanks again in advance.
Francisco

Em Quarta 29 Dezembro 2004 11:53, o Francisco Alves Cabrita escreveu:
> Hello all,,
>
> I'm newbie in Perl and in Mason too, but i'm reading and trying to make
> some work.
> My problem is under DBI making a SELECT, i have no errors running the
> script. I have a PostgreSQL database with some tables with DATA(values) in
> it, i have used phpPgAdmin to do so.
>
> My dbicon.mas :
> <%init>
> use DBI;
> my $dsn = "DBI:Pg:dbname=$dbname;host=$host";
> $dbh = DBI->connect($dsn,$user,$pass) or die "Erro na con: $DBI::errstr";
> return $dbh;
> </%init>
> <%once>
> my $dbh;
> </%once>
> <%args>
> $host=>'10.1.1.51';
> $dbname=>'WORKMEDIA';
> $user=>'workmedia';
> $pass=>'XPTO';
> $port=>'5432';
> </%args>
>
> and the doby.mas where i make the SELECT:
> b>BODY.MAS</b><br />
> % my $sql = qq{SELECT * FROM ENT_CONSELHO};
> % my $sth = $dbh->prepare($sql);
> % $sth->execute();
> % my($id,$distrito_id,$nome_conselho);
> % $sth->bind_columns(undef, \$id, \$distrito_id, \$nome_conselho);
> % while($sth->fetchrow()){
> id:[<% $id %>]<br />
> distrito_id:[<% $distrito_id %>]<br />
> nome_conselho:[<% $nome_conselho %>]<br /><br />
> % }
> % $sth->finish();
> % $dbh->disconnect();
> <%once>
> my $dbh;
> </%once>
> <%init>
> $dbh=$m->comp("dbicon.mas");
> </%init>
>
> I'm reading this articles:
> http://www.saturn5.com/~jwb/dbi-examples.html
> http://www.perl.com/pub/a/1999/10/DBI.html
> http://search.cpan.org/~timb/DBI-1.46/DBI.pm
>
> Can some one Help me to figure whats appening here !!?
>
> Thanks in advance
> Francisco

[Attachment #3 (application/pgp-signature)]
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic