BUG #3611: The first INSERT return -1 with prepare() before

From: "" <Philippe(dot)Errard(at)Wanadoo(dot)fr>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #3611: The first INSERT return -1 with prepare() before
Date: 2007-09-16 12:51:32
Message-ID: 200709161251.l8GCpWqm096863@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 3611
Logged by:
Email address: Philippe(dot)Errard(at)Wanadoo(dot)fr
PostgreSQL version: 8.2.4
Operating system: Windows XP
Description: The first INSERT return -1 with prepare() before
Details:

DbProviderFactory dbpf =
DbProviderFactories.GetFactory("Npgsql");
.....
dbConnect = dbpf.CreateConnection();
dbConnect.ConnectionString = dbCsb.ConnectionString;
dbConnect.Open(); ----> OK

dbCmd_Select = dbConnect.CreateCommand();
dbCmd_Insert = dbConnect.CreateCommand();

dbCmd_Select.CommandText = "SELECT col_1, col_2....FROM mytable Where
...."
dbCmd_Select.Prepare(); ---> OK

dbCmd_Insert.CommandText = "INSERT ...." this INSERT only add one
row
dbCmd_Insert.Prepare(); ----> OK

....
int RowAdded;
RowAdded = dbCmd_Insert.ExecuteNonQuery(); ---> KO return -1
RowAdded = dbCmd_Insert.ExecuteNonQuery(); ---> OK return 1
RowAdded = dbCmd_Insert.ExecuteNonQuery(); ---> OK return 1
RowAdded = dbCmd_Insert.ExecuteNonQuery(); ---> OK return 1
......


//------ NOTE File NpgsqlMLediator.cs-------

public void AddCompletedResponse(String response)
{
if (_rd != null)

The first INSERT executes this code

// Finished receiving the resultset. Add it to the buffer.
_resultSets.Add(new NpgsqlResultSet(_rd, _rows));

// Add a placeholder response.
_responses.Add(null);

// Discard the RowDescription.
_rd = null;
}
else
{
The other INSERT uses this code

// Add a placeholder resultset.
_resultSets.Add(null);
// It was just a non query string. Just add the response.
_responses.Add(response);
}

}

//--------------

if I delete the line dbCmd_Select.Prepare(), the first INSERT is OK

Best Regards

Browse pgsql-bugs by date

  From Date Subject
Next Message Martin Pitt 2007-09-16 18:34:21 psql CLI: warn about ongoing transaction on exit
Previous Message Boris 2007-09-16 01:08:57 BUG #3610: Vaccum stop and can not continue