I just cant understand where the problem is.. Thanks a lot in advance!BEGIN { $ENV{DBI_SQL_NANO} = 1 } use DBI; use DBI::SQL::Nano; my $dbh = DBI->connect('DBI:DBM(RaiseError=1):'); my $query = "CREATE TABLE socks (id TINYINT NOT_NULL AUTO_INCREMENT, i +p VARCHAR(12), port INT,country CHAR(2))" and sql_exec(0,$query); sub sql_exec(0,$query) {....} #sql_exec is my subroutine, which takes 2 args first #boolean, which d +efines 0 non-select query, or 1 select #query respectively, and a que +ry itself, and makes #a standard $sql = $dbh->prepare($query) || die( +$dbh->errstr); # $sql->execute || die($sql->errstr); etc.. $query = "INSERT INTO socks (id,ip,port,country) VALUES (1,180.118.232 +,8080,US)" and sql_exec(0,$query);#no problem #and on binding a select query result we got stuck..for #example $query = "SELECT (id,ip,port,country) FROM socks where id = 1"; $sql = $dbh->prepare($query) || die($dbh->errstr); my ($id,$ip,$country); $sql->bind_columns(\($id,$ip,$port,$country)); $sql->execute || die($sql->errstr); while($sql->fetch) { print "id=>$id, ip=>$ip, port=>$port, country=>$country\n"; } And on a DBI->trace(4); i've got smth like <- fetch= [ '1' '180.118.232' undef ] and on insert i've got -> prepare in DBD::File::db for DBD::DBM::db (DBI::db=HASH(0x80106e440 +)~0x80106e3c0 'INSERT INTO socks (id,ip,port,country) VALUES (1,180.1 +18.232,8080,US)') thr#80100b000 <> FETCH= 'DBD::DBM::st' ('ImplementorClass' from cache) at /usr/l +ocal/lib/perl5/site_perl/5.8.9/mach/DBD/File.pm line 179 via at clic +k.pl line 25 -> STORE in DBD::File::st for DBD::DBM::st (DBI::st=HASH(0x8019a33 +10)~0x80235dcd0 'f_stmt' DBD::DBM::Statement=HASH(0x80235dc20)) thr#8 +0100b000 <- STORE= 1 at /usr/local/lib/perl5/site_perl/5.8.9/mach/DBD/File. +pm line 206 via at click.pl line 25 -> STORE for DBD::DBM::st (DBI::st=HASH(0x8019a3310)~0x80235dcd0 ' +f_params' ARRAY(0x80235ddd0)) thr#80100b000 <- STORE= 1 at /usr/local/lib/perl5/site_perl/5.8.9/mach/DBD/File. +pm line 207 via at click.pl line 25 -> STORE for DBD::DBM::st (DBI::st=HASH(0x8019a3310)~0x80235dcd0 ' +NUM_OF_PARAMS' 0) thr#80100b000
In reply to DBI and bind_columns again by gemoroy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |