hi there,
I am having trouble inserting null value into table using DBD:ADO
and placeholders. I tried bind_param, bind_param_array and execute_array,
none worked. I tried MS Access and MS SQL server for data sources,
none worked. There is no problem if I use dbi:ODBC instead
to access the same backend database. So I think the problem
must be in DBD:ADO.
Below is the code that I tested and failed. Am I the only one
with this problem?
Thank you
---------------------
code 1, using bind_param:
$sth = $dbh->prepare("INSERT INTO tbl_parameter VALUES (?, ?, ?)");
$sth->bind_param(1, "name");
$sth->bind_param(2, "value");
$sth->bind_param(3, undef);
$sth->execute;
result:
Can't use string ("0") as an ARRAY ref while "strict refs" in
use at C:/Perl/site/lib/DBD/ADO.pm line 1811.
Connection open, destroy at test004.pl line 0
---------------------
code 2, using bind_param_array and execute_array:
$sth = $dbh->prepare("INSERT INTO tbl_parameter VALUES (?, ?, ?)");
$sth->bind_param_array(1, [undef]);
$sth->bind_param_array(2, ["value"]);
$sth->bind_param_array(3, ["description"]);
$tuples = $sth->execute_array({ ArrayTupleStatus => [EMAIL PROTECTED]
});
result:
DBD::ADO::st execute_array failed: Can't execute statement 'INSERT
INTO tbl_parameter VALUES (?, ?, ?)':
Lasterror: -2146824580: OLE exception from "ADODB.Command":
Parameter object is improperly defined. Inconsistent or incomplete
information was provided.
Win32::OLE(0.1502) error 0x800a0e7c
in METHOD/PROPERTYGET "Execute" at test004.pl line 56.
---------------------
code 3, using execute_array:
$sth = $dbh->prepare("INSERT INTO tbl_parameter VALUES (?, ?, ?)");
$tuples = $sth->execute_array({ ArrayTupleStatus => [EMAIL PROTECTED]
}, [undef], ["value"], ["description"]);
result:
DBD::ADO::st execute_array failed: Can't execute statement 'INSERT
INTO tbl_parameter VALUES (?, ?, ?)':
Lasterror: -2146824580: OLE exception from "ADODB.Command":
Parameter object is improperly defined. Inconsistent or incomplete
information was provided.
Win32::OLE(0.1502) error 0x800a0e7c
in METHOD/PROPERTYGET "Execute" at test004.pl line 59.
--------------------------------------------------------------------------
Global Internet phone calls, voicemail, fax, e-mail and instant messaging.
Sign-up today at http://www.hotvoice.com