datareader returns empty set with fieldnames only

datareader returns empty set with fieldnames only

Postby tr888 » Mon 28 Jan 2013 15:11

EDIT: This was a parameter issue. I am working with PostgreSQL Date and Time, as distinct from .NET CLR DateTime and TimeSpan, and with Boolean. The parameter values are not being accepted for some reason. Opening another thread, closing this one.

I am using the evaluation version of the Devart.Data.PostgreSql provider version 6.4.164, with version 5.0.623.0 of Devart.Data.

I have a postgres function that returns TABLE. It's working. It returns 100 rows with 30 columns. I tested it with npgsql provider and 100 rows with 30 columns come back to the client. However, when I substitute the Devart types for the npgsql types, and invoke the function, the column-names are returned but the set is empty, zero rows.

BTW, npgsql doesn't appear to support named parameter mode, only positional mode, when command is CommandType.StoredProcedure, so we are evaluating both devart and npgsql providers -- just saying so because I don't want you to think I'm a troll. I got called a troll over on MSFT SQL Server forum when trying to get them to make their Time datatype ISO8601 compliant. :-)

Anyway, Npgsql has a connection parameter called Preload Reader which forces the reader to fetch all of the data before returning. Is there a similar setting for the devart connection? Or is there an additional step I must take to get the PgSqlDataReader to fetch all of the data, not just the metadata?

Here's my code for the pg function:

.
. <snip>
.
myPgSqlCommand.Connection.Open();
PgSqlDataReader dr = myPgSqlCommand.ExecuteReader();

// at this point, dr.FieldCount = 30

while (dr.Read() )
{
// we never reach this code block
}
tr888
 
Posts: 2
Joined: Mon 28 Jan 2013 14:46

Re: datareader returns empty set with fieldnames only

Postby Pinturiccio » Tue 29 Jan 2013 15:39

tr888 wrote:Anyway, Npgsql has a connection parameter called Preload Reader which forces the reader to fetch all of the data before returning. Is there a similar setting for the devart connection? Or is there an additional step I must take to get the PgSqlDataReader to fetch all of the data, not just the metadata?

PgSqlCommand has two properties, which are FetchAll and FetchSize, that manage the number of records fetched by PgSqlDataReader.
If PgSqlCommand.FetchAll = true; (default value), all data is fetched. For more information, please refer to http://www.devart.com/dotconnect/postgresql/docs/?Devart.Data.PostgreSql~Devart.Data.PostgreSql.PgSqlCommand~FetchAll.html

If you don't want to fetch all data at once, you should set the FetchAll property to false and specify the number of rows to be fetched at a time in the FetchSize property. For more information, please refer to http://www.devart.com/dotconnect/postgresql/docs/?Devart.Data.PostgreSql~Devart.Data.PostgreSql.PgSqlCommand~FetchSize.html

We have also answered you in another topic http://forums.devart.com/viewtopic.php?t=25757
Pinturiccio
Devart Team
 
Posts: 2020
Joined: Wed 02 Nov 2011 09:44


Return to dotConnect for PostgreSQL