Pure Asynchronous Fetch

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
CrimsonED
Posts: 1
Joined: Thu 30 Aug 2012 13:31

Pure Asynchronous Fetch

Post by CrimsonED » Thu 30 Aug 2012 14:07

Hallo,
i think, i have found a bug in the dotConnect for Postgres Version 6.1.58.0

I tried to get the sample code running from the page:
http://www.devart.com/dotconnect/postgr ... #pureasync

I want to get the data of a table with 1,000,000 test records via the async mode.

My Code:

Code: Select all

        void UseDataTable(PgSqlDataTable myDataTable, PgSqlConnection myConnection)
        {

            myDataTable.Connection = myConnection;
            myDataTable.SelectCommand = myConnection.CreateCommand();
            myDataTable.SelectCommand.CommandText = "SELECT * FROM test";
            myDataTable.NonBlocking = true;
            IAsyncResult aRes = myDataTable.BeginFill(null, null);

            //when process is here all data has already been loaded...
            Console.Write("Fetch in process");

            Thread.Sleep(100);
            myDataTable.SuspendFill(true);
            Console.Write("Fetch is stopped");

            myDataTable.EndFill(aRes);
            Console.Write("All records are fetched");
        }

But the beginfill() always gets all data. (it doesnt jumps back).

so I tried the following same for dotConnect Mysql

Code: Select all

        
void UseDataTable(MySqlDataTable myDataTable, MySqlConnection myConnection)
        {
            dataGridView1.AutoGenerateColumns = true;
            myDataTable.Connection = myConnection;
            myDataTable.SelectCommand = myConnection.CreateCommand();
            myDataTable.SelectCommand.CommandText = "SELECT * FROM test";

            IAsyncResult aRes = myDataTable.BeginFill(null, null);

            Console.Write("Fetch in process");

           // Thread.Sleep(100);
           // myDataTable.SuspendFill(true);
           // Console.Write("Fetch is stopped");

           // myDataTable.EndFill(aRes);
           // Console.Write("All records are fetched");
        }
And this works as it should...

So bug or something else ?

P.S.
the SQLs:

Postgres:

Code: Select all

-- DROP TABLE test;

CREATE TABLE test
(
  pid serial NOT NULL,
  text1 character varying(100),
  text2 character varying(200),
  text3 text,
  int1 integer,
  CONSTRAINT test_pkey PRIMARY KEY (pid )
)
WITH (
  OIDS=FALSE
);
ALTER TABLE test
  OWNER TO postgres;
MySQL:

Code: Select all

CREATE TABLE `test` (
  `idtest` int(11) NOT NULL AUTO_INCREMENT,
  `text1` varchar(100) DEFAULT NULL,
  `text2` varchar(200) DEFAULT NULL,
  `text3` text,
  `intX` int(11) DEFAULT NULL,
  PRIMARY KEY (`idtest`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1

Pinturiccio
Devart Team
Posts: 2420
Joined: Wed 02 Nov 2011 09:44

Re: Pure Asynchronous Fetch

Post by Pinturiccio » Tue 04 Sep 2012 14:23

Thank you for the bug report but we can't reproduce it. In our environment Pure Asynchronous Fetch works the same with dotConnect for PostgreSQL and with dotConnect for MySQL. With both providers we retrieve approximately 20000 records.

Could you please create and send us a small test project in which the bug is reproduced on your environment?

Pinturiccio
Devart Team
Posts: 2420
Joined: Wed 02 Nov 2011 09:44

Re: Pure Asynchronous Fetch

Post by Pinturiccio » Wed 05 Sep 2012 14:27

Thank you for the test project. However we could not reproduce the issue. In our environment it works as we described above and PgSqlDataTable1 has approximately 20000 rows.

Please make sure that the PgSqlDataTable1.Active property equals 'False'. Because if it equals 'True', then 1 billion records will be retrieved before the application starts.

Also when you deactivate the Active property of the PgSqlDataTable1 object, you will not see any data in dataGridView1. To display the data, you have to select the dataGridView1 component on your form and set the DataSource property to 'None'. And add one line of code after invoking the UseDataTable table.

Code: Select all

dataGridView1.DataSource = pgSqlDataTable1;

Post Reply