Update of /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/NPgClient
In directory sc8-pr-cvs1:/tmp/cvs-serv14193
Modified Files:
PgStatement.cs
Log Message:
Performance improvement
Index: PgStatement.cs
===================================================================
RCS file: /cvsroot/pgsqlclient/pgsqlclient_10/PostgreSql.Data.PgSqlClient/source/NPgClient/PgStatement.cs,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** PgStatement.cs 1 Nov 2003 10:31:05 -0000 1.9
--- PgStatement.cs 18 Nov 2003 14:19:29 -0000 1.10
***************
*** 52,56 ****
private bool allRowsFetched;
private PgRowDescriptor rowDescriptor;
! private ArrayList rows;
private PgParameter[] parameters;
private PgParameter outParameter;
--- 52,57 ----
private bool allRowsFetched;
private PgRowDescriptor rowDescriptor;
! private object[] rows;
! private int rowIndex;
private PgParameter[] parameters;
private PgParameter outParameter;
***************
*** 102,106 ****
}
! public ArrayList Rows
{
get { return rows; }
--- 103,107 ----
}
! public object[] Rows
{
get { return rows; }
***************
*** 140,144 ****
{
this.outParameter = new PgParameter();
! this.rows = new ArrayList();
this.parseName = String.Empty;
this.portalName = String.Empty;
--- 141,146 ----
{
this.outParameter = new PgParameter();
! this.rows = null;
! this.rowIndex = 0;
this.parseName = String.Empty;
this.portalName = String.Empty;
***************
*** 205,209 ****
// Clear actual row list
! rows.Clear();
// Update status
--- 207,212 ----
// Clear actual row list
! rows = null;
! rowIndex = 0;
// Update status
***************
*** 344,347 ****
--- 347,353 ----
try
{
+ this.rows = new object[fetchSize];
+ this.rowIndex = 0;
+
PgOutputPacket packet = new PgOutputPacket(db.Settings.Encoding);
***************
*** 365,368 ****
--- 371,377 ----
}
+ // reset rowIndex
+ this.rowIndex = 0;
+
// If the command is finished and has returned rows
// set all rows are received
***************
*** 397,401 ****
}
! public void ExecuteFunction()
{
lock (db)
--- 406,410 ----
}
! public void ExecuteFunction(int id)
{
lock (db)
***************
*** 405,410 ****
PgOutputPacket packet = new PgOutputPacket(db.Settings.Encoding);
! // TODO: Send function oid
! packet.WriteInt(0);
// Send parameters format code.
--- 414,419 ----
PgOutputPacket packet = new PgOutputPacket(db.Settings.Encoding);
! // Function id
! packet.WriteInt(id);
// Send parameters format code.
***************
*** 487,491 ****
object[] row = null;
! if (!this.allRowsFetched && this.rows.Count == 0)
{
lock (this)
--- 496,501 ----
object[] row = null;
! if ((!this.allRowsFetched && this.rows.Length == 0) ||
! (!this.allRowsFetched && this.rows.Length >= this.fetchSize))
{
lock (this)
***************
*** 496,506 ****
}
! if (rows.Count > 0)
{
// Return always first row
! row = (object[])this.rows[0];
! // Remove row from the list
! this.rows.RemoveAt(0);
}
--- 506,521 ----
}
! if (this.rows != null &&
! this.rows.Length > 0 &&
! this.rows[this.rowIndex] != null)
{
// Return always first row
! row = (object[])this.rows[this.rowIndex++];
! }
! if (this.rowIndex >= this.fetchSize ||
! this.rows[this.rowIndex] == null )
! {
! this.rows = null;
}
***************
*** 546,550 ****
// Clear rows
! rows.Clear();
// Update Status
--- 561,566 ----
// Clear rows
! rows = null;
! rowIndex = 0;
// Update Status
***************
*** 738,742 ****
}
! this.rows.Add(values);
}
--- 754,758 ----
}
! this.rows[this.rowIndex++] = values;
}
|