Page 1 of 1
Can't load empty array in binary mode
Posted: Mon 28 Mar 2011 13:57
by Tiago_G
Hello,
I'm trying to load an empty PgSqlArray, created with the PgSqlArray.CreateEmptyArray method.
It's working in Text mode.
in Binary mode, when executing loader.NextRow() i get a NullReferenceException. Can you verify it?
Thanks!
Regards,
Tiago
Posted: Tue 29 Mar 2011 14:04
by Shalex
I have checked dotConnect for PostgreSQL v 5.10.126 and PostgreSQL server v 9.0 with the following code:
Code: Select all
//CREATE TABLE array_test (
// arr integer[] NOT NULL
//);
using (PgSqlConnection conn = new PgSqlConnection()) {
conn.ConnectionString = "server=***;port=***;database=***;uid=***;pwd=***;Protocol=3;";
conn.Open();
PgSqlArray array = PgSqlArray.CreateEmptyArray(PgSqlType.Int);
using (PgSqlLoader loader = new PgSqlLoader()) {
loader.Connection = conn;
loader.TableName = "array_test";
loader.Open();
loader["arr"] = array;
loader.NextRow();
loader.Close();
}
}
It works. Please tell us your versions of dotConnect for PostgreSQL (x.xx.xxx), PostgreSQL server, and the way we should modify this sample to reproduce the problem.
Posted: Wed 30 Mar 2011 10:12
by Tiago_G
Hello,
I'm using v4.95.152 with PostgreSQL 8.4
I changed the sample to change the mode (the default is text mode from what i can see here):
Code: Select all
//CREATE TABLE array_test (
// arr integer[] NOT NULL
//);
using (PgSqlConnection conn = new PgSqlConnection()) {
conn.ConnectionString = "server=***;port=***;database=***;uid=***;pwd=***;Protocol=3;";
conn.Open();
PgSqlArray array = PgSqlArray.CreateEmptyArray(PgSqlType.Int);
using (PgSqlLoader loader = new PgSqlLoader()) {
loader.Connection = conn;
loader.TableName = "array_test";
loader.Mode = PgSqlLoaderMode.Binary; //added
loader.Open();
loader["arr"] = array;
loader.NextRow();
loader.Close();
}
}
Thanks!
Regards,
Tiago
Posted: Wed 30 Mar 2011 15:03
by Shalex
We have reproduced the "Cannot convert value" error when PgSqlLoaderMode.Binary and the "Protocol=3;" connection string parameter are used. We will investigate the issue and notify you about the results.
As a workaround, please use either PgSqlLoaderMode.Text or "Protocol=2;".
Posted: Tue 05 Apr 2011 14:05
by Shalex
The issue with binary mode of PgSqlLoader and empty array is fixed. I will post here when the corresponding build of dotConnect for PostgreSQL is available for download.
Posted: Thu 07 Apr 2011 14:21
by Shalex
New build of dotConnect for PostgreSQL 5.10.135 is available for download now!
It can be downloaded from
http://www.devart.com/dotconnect/postgr ... nload.html (trial version) or from Registered Users' Area (for users with valid subscription only):
http://secure.devart.com/ .
For more information, please refer to
http://www.devart.com/forums/viewtopic.php?t=20709 .