It works well with bind_param...i made a typo :-) Thank you very much. Emmanuel
"Jeff Urlwin" <[EMAIL PROTECTED]> a �crit dans le message news: [EMAIL PROTECTED] > I'd suggest, given that ActiveState is behind and I'm patching like mad > lately, that you use bind parameters to work around it. It's not a bad > thing and, at least for Oracle, the server can cache the parsing and > execution plan for the query, the more you use place holders and have the > same "exact" query every time (the bind values can change, but if the query > is character-for-character the same, Oracle (and probably others) are > smarter about executing them (or at least execute them a little faster > avoiding the overhead of repreparing them). > > Jeff > > > -----Original Message----- > > From: Emmanuel Jaeckert [mailto:[EMAIL PROTECTED]] > > Sent: Tuesday, February 05, 2002 12:39 PM > > To: [EMAIL PROTECTED] > > Subject: Re: prb using Date/time field with DBI , odbc connected with > > Access 2000 > > > > > > Thank you for your answers, i can't test it now but for now i tried to > > update DBD-ODBC from 0.28 to 0.33 from ppm but it didn't work (i use perl > > from Active State). > > I think i can test it tomorrow. > > > > Bye > > Emmanuel > > > > "Jeff Urlwin" <[EMAIL PROTECTED]> a �crit dans le message news: > > [EMAIL PROTECTED] > > > Emmanuel, > > > > > > There are two ways to fix that. It was a bug in DBD::ODBC. I'm VERY > > > surprised I didn't catch it earlier. > > > > > > 1) Upgrade to the Latest DBD::ODBC (0.33_3) > > > or > > > 2) use bindings/placeholders for the dates. > > > > > > > $res = $dbh->do("INSERT INTO SIT_PREVISIONNEL_HISTO (......., DATEMAJ, > > > > .....) values (......,$rec->{majdate},.....) > > > > > > to > > > use DBI qw(:sql_types); # important to change your use DBI at the top! > > > > > > my $sth = $dbh->prepare("INSERT INTO SIT_PREVISIONNEL_HISTO (......., > > > DATEMAJ, > > > .....) values (......,?,.....) > > > $sth->bind_param(1, $rec->{majdate}, { TYPE => SQL_TIMESTAMP }); > > > $sth->execute; > > > > > > Jeff > > > > > > > Hi, > > > > > > > > I have some problems using date/time field with DBI and a MS > > > > Access Database > > > > over ODBC. > > > > > > > > I try to insert a record containig a date : > > > > $res = $dbh->do("INSERT INTO SIT_PREVISIONNEL_HISTO (......., DATEMAJ, > > > > .....) values (......,$rec->{majdate},.....) > > > > > > > > $rec->{majdate} come from another table and i got it without a > > > > problem with > > > > a SELECT query. > > > > > > > > DBI trace shows that : > > > > > > > > dbd_preparse scanned 2 distinct placeholders > > > > dbd_st_prepare'd sql f61546664 > > > > INSERT INTO SIT_PREVISIONNEL_HISTO > > > > (...,...,...,DATEMAJ,...) > > > > values (...,...,...2002-02-05 > > 15??,...); > > > > 2 <- prepare= DBI::st=HASH(0x38b54d0) at DBI.pm line 930. > > > > -> execute for DBD::ODBC::st (DBI::st=HASH(0x38b54d0)~0x38b54f4) > > > > dbd_st_execute (for sql f61546664 after)... > > > > st_execute/SQLExecute error -1 recorded: [Microsoft][Pilote ODBC > > Microsoft > > > > Access]Champ COUNT incorrect (SQL-07001)(DBD: > > > > st_execute/SQLExecute err=-1) > > > > !! ERROR: -1 '[Microsoft][Pilote ODBC Microsoft Access]Champ COUNT > > > > incorrect (SQL-07001)(DBD: st_execute/SQLExecute err=-1)' > > > > > > > > i don't know why perl found 2 placeholders where none existed... > > > > I'm relatively new to perl and i have certainly missed > > something in the > > > > syntax. > > > > > > > > TIA > > > > Emmanuel > > > > > > > > > >
