SCM

[#1010649] DataReader.FieldCount returning -1

View Trackers | Bugs | Download .csv | Monitor

Date:
2009-06-09 15:03
Priority:
3
State:
Open
Submitted by:
Dario Quintana (darioquintana)
Assigned to:
Nobody (None)
Npgsql Version:
2.0
Category:
Group:
Resolution:
Accepted
Summary:
DataReader.FieldCount returning -1

Detailed description
This test is not passing

cmd.CommandType = System.Data.CommandType.Text;
cmd.Text = "insert into Users (Name,Password) values('gavin','secret')";
reader = cmd.ExecuteReader();
Assert.AreEqual(0, reader.FieldCount);

But instead the reader.FieldCount is -1.

Followup

Message
Date: 2009-06-09 18:24
Sender: Francisco Figueiredo jr.

Fixed in cvs.
Please give it a try and let me know if it works ok.

Now you can use the connection string value Compatible=2.0.5 or lower in order to get old behavior back.
Date: 2009-06-09 17:46
Sender: Francisco Figueiredo jr.

I think we would just need to change the return value. After reading the docs I don't know when to return -1 anymore :(
Date: 2009-06-09 17:18
Sender: Dario Quintana

Actually provider for MsSQLServer, Oracle and MySQL are
returning 0 for this case.
Date: 2009-06-09 15:18
Sender: Dario Quintana

Weird, the SQLClient is return 0 with exactly that query
Date: 2009-06-09 15:12
Sender: Josh Cooley

According to MSDN, -1 is the correct value to return. See the remarks section here:
http://msdn.microsoft.com/en-us/library/system.data.idatarecord.fieldcount.aspx

Are there other providers that return 0 for this? Or is there some other reason for expecting 0?

Attached Files:

Changes:

Field Old Value Date By
ResolutionNone2009-06-09 18:24fxjr
Powered By FusionForge