[prev in list] [next in list] [prev in thread] [next in thread]
List: dbi-dev
Subject: parameter binding problem
From: "Chris Yambo" <cyambo () thoughtbubble ! com>
Date: 1998-01-30 12:05:53
[Download RAW message or body]
*** From dbi-users -- To unsubscribe, see the end of this message. ***
I keep getting a datatype mismatch whenever I try to perform this code
on an odbc database.
my $sth=$dbh->prepare('select show_date,show_time,show from bravo
where (show_date=? and (show_time>=? and show_time<=?)) or (show_date=?
and(show_time>=? and show_time<=?)) order by show_date,show_time asc');
$sth->bind_param(1,$today,{TYPE=>SQL_DATE});
$sth->bind_param(2,$t1,{TYPE=>SQL_TIME});
$sth->bind_param(3,'23:59:59',{TYPE=>SQL_TIME});
$sth->bind_param(4,$tomorrow,{TYPE=>SQL_DATE});
$sth->bind_param(5,'00:00:00',{TYPE=>SQL_TIME});
$sth->bind_param(6,$t2,{TYPE=>SQL_TIME});
As you can see the bind_param method is ignoring my TYPE=>SQL_DATE
declaration, it is still binding it as a varchar, not a date (or a
timestamp)
bind 1 <== '30-Jan-1998' (attribs: )
bind 1 <== '30-Jan-1998' (size 11/12/0, ptype 4, otype 1)
bind 1: CType=1, SqlType=VARCHAR, ColDef=0
<- bind_param= 1
-> bind_param for DBD::ODBC::st (DBI::st=HASH(0x693488)~0x667d28 2
undef HAS
This is the trace output from after the 6 parameter bindings
H(0x667cd4))
-> execute for DBD::ODBC::st (DBI::st=HASH(0x693488)~0x667d28)
dbd_describe sql 7112760: num_fields=3
describe: col 1 'TIMESTAMP': len disp , prec scale=0
describe: col 2 'TIMESTAMP': len disp , prec scale=0
describe: col 3 'VARCHAR': len%5 disp%6, prec%5 scale=0
describe: col 1 'show_date': sqltype=TIMESTAMP, ctype=SQL_C_CHAR,
maxlen
describe: col 2 'show_time': sqltype=TIMESTAMP, ctype=SQL_C_CHAR,
maxlen
describe: col 3 'show': sqltype=VARCHAR, ctype=SQL_C_CHAR,
maxlen%6
dbd_st_execute (for sql f7112760 after)...
ERROR EVENT -1 '[Microsoft][ODBC Microsoft Access 97 Driver] Data
type misma
tch in criteria expression. (SQL-22005)(DBD: st_execute/SQLExecute
err=-1)' (Han
dlers: undef)
st_execute/SQLExecute error -1 recorded: [Microsoft][ODBC Microsoft
Access 97 Dr
iver] Data type mismatch in criteria expression. (SQL-22005)(DBD:
st_execute/SQL
Execute err=-1)
<- execute= undef
!! ERROR: -1 '[Microsoft][ODBC Microsoft Access 97 Driver] Data type
mismatc
h in criteria expression. (SQL-22005)(DBD: st_execute/SQLExecute
err=-1)'
[Microsoft][ODBC Microsoft Access 97 Driver] Data type mismatch in
criteria expr
ession. (SQL-22005)(DBD: st_execute/SQLExecute err=-1) at
C:\PERL\lib\site/sched
ule/Day.pm line 111, <FIN> chunk 23.
Can anyone help me fix this problem?
--
chris
_____________________________________________________
+-----------------------+thought bubble productions
web+--------------------+http://www.thoughtbubble.com
email+------------------+cyambo@thoughtbubble.com
------------------------------------------------------------------------------
To unsubscribe from this list, please visit http://www.fugue.com/dbi
If you are without web access, or if you are having trouble with the web page,
please send mail to dbi-request@fugue.com. Please try to use the web
page first - it will take a long time for your request to be processed by hand.
------------------------------------------------------------------------------
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic