Re: [Fontlinge-cvs] fontlinge_rc/scripts fontlinge_database_assistant,1.41,1.42
Brought to you by:
christian_boltz,
raettchen3
From: David H. <da...@dh...> - 2004-04-19 02:00:46
|
Hallo, Am Sun, 18 Apr 2004, Joerg Rossdeutscher schrieb: >David? Liest du mit? Wieso gehtndasnich!?: > >sub execute_mysql { > my ( $query , @args ) =3D ( @_ ); > > >und sp=E4ter: > >$sth =3D $dbh->prepare( $query ); >$sth->execute( @args ); > >Der Query als solcher geht, wenn @args leer ist. Sowas geht aber nicht: > > >$arg[0]=3D"123"; >$arg[1]=3D"Karlheinz"; >execute_mysql( "INSERT INTO foo VALUES (?, ?)" , @arg ); Bei mir geht das. Hat 'foo' denn wirklich nur 2 Spalten? =3D=3D=3D=3D # Table structure for table 'TKTest' CREATE TABLE TKTest ( id int(10) unsigned DEFAULT '0' NOT NULL auto_increment, name varchar(255) NOT NULL, tel varchar(50), PRIMARY KEY (id) ); =3D=3D=3D=3D Beim Testscript bekomme ich ohne das "undef" fuer "id": DBD::mysql::st execute failed: Column count doesn't match value count at = row 1 at db.pl line 11. =3D=3D=3D=3D #!/usr/bin/perl -w use DBI; my $dbh; sub doq { my ( $query , @args ) =3D ( @_ ); $sth =3D $dbh->prepare( $query ); $sth->execute( @args ); } $dbh =3D DBI->connect("DBI:mysql:database=3Dtktest;host=3Dlocalhost", "user", "pass", { 'RaiseError' =3D> 1, 'PrintError' =3D> 1 }) or die; $arg[0]=3D"Karlheinz"; $arg[1]=3D"123"; doq( "INSERT INTO TKTest VALUES (?, ?, ?)" , undef, @arg ); ### oder auch: # doq( "INSERT INTO TKTest VALUES ('undef', ?, ?)" , @arg ); $dbh->disconnect(); =3D=3D=3D=3D (das ist eh ne "dummy" DB ;) -dnh --=20 Please don't confuse me with someone who cares. -- AndyC the WB in the = SDM |