SQL query problem

Posted: 07-23-2003, 12:46 PM
I have a problem.
I try to execute SQL command which return more than 9 columns by DBD:PgPP
and DBI (module).
The procedure return error:
Can't call method "fetch" on an undefined value at
c:/per/site/lib/DBD.PgPP.pm line 330.
If I execute less than 9 collumn is OK.
How I can resolve this problem

Robson
r.wyka@interia.pl
POLAND


Reply With Quote

Responses to "SQL query problem"

news.tpi.pl
Guest
Posts: n/a
 
SQL query problem
Posted: 07-23-2003, 12:47 PM


Reply With Quote
news.tpi.pl
Guest
Posts: n/a
 
SQL query problem
Posted: 07-23-2003, 12:47 PM
I have a problem.
I try to execute SQL command which return more than 9 columns by DBD:PgPP
and DBI (module).
The procedure return error:
Can't call method "fetch" on an undefined value at
c:/per/site/lib/DBD.PgPP.pm line 330.
If I execute less than 9 collumn is OK.
How I can resolve this problem

Robson
r.wyka@interia.pl
POLAND


Reply With Quote
Michael Budash
Guest
Posts: n/a
 
Re: SQL query problem
Posted: 07-23-2003, 03:52 PM
In article <bfm09b$5b6$1@atlantis.news.tpi.pl>,
"news.tpi.pl" <mareks1@poczta.onet.pl> wrote:
> I have a problem.
> I try to execute SQL command which return more than 9 columns by DBD:PgPP
> and DBI (module).
> The procedure return error:
> Can't call method "fetch" on an undefined value at
> c:/per/site/lib/DBD.PgPP.pm line 330.
> If I execute less than 9 collumn is OK.
> How I can resolve this problem
>
> Robson
> r.wyka@interia.pl
> POLAND
>
>
pls post the pertinent code leading up to and including the 'fetch' part.

--
Michael Budash
Reply With Quote
Jeff Boes
Guest
Posts: n/a
 
Re: SQL query problem
Posted: 07-23-2003, 03:54 PM
At some point in time, "news.tpi.pl" <mareks1@poczta.onet.pl> wrote:
>I have a problem.
>I try to execute SQL command which return more than 9 columns by DBD:PgPP
>and DBI (module).
>The procedure return error:
>Can't call method "fetch" on an undefined value at
>c:/per/site/lib/DBD.PgPP.pm line 330.
Hmm, that looks like the statement didn't parse properly. Please post code.


Reply With Quote
news.tpi.pl
Guest
Posts: n/a
 
Re: SQL query problem
Posted: 07-24-2003, 10:08 AM
WINDOWS XP + perl v5.80
I create table:
table
id_odb1 int4 primary key,
id_odb2 int4 not null references
ilosc int2,
stan int2,
rok char(4),
moc char(8),
uwagi char(40),
id_typ int2 not null references,
adapt char(4),

$sth = $conn->prepare("SELECT * from table");
$sth->execute();
my @RAD=$sth->fetchrow_array();
or
$sth = $conn->prepare("SELECT id_odb1,
id_odb2,ilosc,stan,rok,moc,uwagi,id_typ,adapt from tabela");
$sth->execute();
IS ERROR
Can't call method "fetch" on an undefined value at
Unknown message type: ' ' at:c:/per/site/lib/DBD.PgPP.pm line 634.
Can,t call method "fetch" on an undefined value at
c:/per/site/lib/DBD.PgPP.pm line 330.


Reply With Quote
news@roaima.freeserve.co.uk
Guest
Posts: n/a
 
Re: SQL query problem
Posted: 07-24-2003, 12:04 PM
news.tpi.pl <mareks1@poczta.onet.pl> wrote:
> I create table:
> table
> id_odb1 int4 primary key,
> id_odb2 int4 not null references
> ilosc int2,
[...]
> Can,t call method "fetch" on an undefined value at
> c:/per/site/lib/DBD.PgPP.pm line 330.
You appear to be using Postgres (well, you're using the PgPP driver). INT2
isn't a valid data type. What is your exact table definition?

Chris
--
@s=split(//,"Je,\nhn ersloak rcet thuarP");$k=$l=@s;for(;$k;$k--){$i=($i+1)%$l
until$s[$i];$c=$s[$i];print$c;undef$s[$i];$i=($i+(ord$c))%$l}
Reply With Quote
news@roaima.freeserve.co.uk
Guest
Posts: n/a
 
Re: SQL query problem
Posted: 07-24-2003, 12:28 PM
news.tpi.pl <mareks1@poczta.onet.pl> wrote:
> I have a problem.
....which is also separately described in comp.lang.perl.modules. Please
don't multi-post as it splits up the separate threads of discussion.

I've already responded there so I won't repeat myself here.

Cheers,
Chris
--
@s=split(//,"Je,\nhn ersloak rcet thuarP");$k=$l=@s;for(;$k;$k--){$i=($i+1)%$l
until$s[$i];$c=$s[$i];print$c;undef$s[$i];$i=($i+(ord$c))%$l}
Reply With Quote
news.tpi.pl
Guest
Posts: n/a
 
Re: SQL query problem
Posted: 07-24-2003, 01:15 PM
Main code:



$database="bpsimple";
$host= "10.10.35.96";
$username="postgres";
$password="";
$conn = DBI->connect("dbi:PgPP:dbname=$database;host=$host;por t=5432",
$username, $password);

doSQL($conn, "DROP TABLE odbiorniki");
doSQL($conn, "CREATE TABLE odbiorniki ( id_odbiornika int4 primary key,
id_odbiorcy int4 not null references odbiorcy (id_odbiorcy),id_producenta
int2 not null references sl_prod (id_producenta), ilosc int2,stan int2, rok
char(4), piek_moc char(8),uwagi char(40), odb_typ int2 not null references
sl_typy (id_typ), adapt char(3))");
open (dat,"dane.txt");
foreach(<dat>){
s/^\s+//; s/\s+$//; chomp ($_);
my
($dat_id,$dat_id_odb,$dat_prod,$dat_szt,$dat_stan, $dat_rok,$dat_piek,$dat_uw
agi,$dat_idtyp)=split(/\;/,$_);
$dat_idtyp =~ s/\s+$//; chomp ($dat_idtyp);
doSQL($conn, "INSERT INTO odbiorniki
(id_odbiornika,id_odbiorcy,id_producenta,ilosc,sta n,rok,piek_moc,uwagi,odb_t
yp,adapt) values
($dat_id,$dat_id_odb,$dat_prod,$dat_szt,$dat_stan, \'$dat_rok\',\'$dat_piek\'
,\'$dat_uwagi\',$dat_idtyp,\'NIE\')");
} close(dat);
sub doSQL
{
open(blad,">>blad_odb.txt");

my ($conn, $command) = @_;
#print $command, "\r";
my $sth = $conn->prepare($command);
my $nrows = $sth->execute;
print "status is ", $DBI::err, "\n" if $DBI::err;
print "#rows affected is ", $nrows, "\n";
print blad "error message: ", $DBI::errstr,"$_", "\n" if $DBI::err;
close(blad);

}

$conn->disconnect;



sub sprawdz_indeks{
if ($index == 0){open(blad,">>blad_odb.txt");
print blad " Nie znaleziono indeksu odbiornika dla
rekordu:\n";
print blad " $_\n";
close(blad);
}}






Reply With Quote
news.tpi.pl
Guest
Posts: n/a
 
Re: SQL query problem
Posted: 07-24-2003, 01:17 PM

doSQL($conn, "CREATE TABLE odbiorniki ( id_odbiornika int4 primary key,
id_odbiorcy int4 not null references odbiorcy (id_odbiorcy),id_producenta
int2 not null references sl_prod (id_producenta), ilosc int2,stan int2, rok
char(4), piek_moc char(8),uwagi char(40), odb_typ int2 not null references
sl_typy (id_typ), adapt char(3))");

doSQL($conn, "INSERT INTO odbiorcy (
id_odbiorcy,nazwa_odbiorcy,adres_odbiorcy)
values($odb_ewid,\'$odb_nazwa\',\'$odb_adres\')");



sub doSQL
{
open(blad,">>blad_odb.txt");

my ($conn, $command) = @_;
#print $command, "\r";
my $sth = $conn->prepare($command);
my $nrows = $sth->execute;
print "status is ", $DBI::err, "\n" if $DBI::err;
print "#rows affected is ", $nrows, "\n";
print blad "error message: ", $DBI::errstr,"$_", "\n" if $DBI::err;
close(blad);

}


Reply With Quote
 
LinkBack Thread Tools Search this Thread Display Modes
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
mulitple query insert problem dtubbs Coldfusion Database Access 2 02-25-2005 05:15 PM
Query of Queries? artists_envy Coldfusion Database Access 3 02-25-2005 03:31 PM
Query problem part 2 tejun Coldfusion Database Access 1 02-21-2005 09:40 PM
Need SQL Query Help from Gurus ctrl+alt+delete Coldfusion Database Access 4 02-18-2005 08:20 PM
query problem tejun Coldfusion Database Access 10 07-11-2003 09:21 AM