[Mono-dev] OdbcDataReader enhancement

Ernesto equistango at gmail.com
Thu Jul 10 08:46:14 EDT 2008


I'm not familiarized with the mono test suite, but this is what I get 
when I run make run-test-local in mcs/class/System.Data

Tests run: 1498 (all pass), Not run: 11, Time: 112,014661 seconds

Looks ok to me.

Regards,
Ernesto

Nagappan A escribió:
> Hello Ernesto,
>
> I appreciate your work :) The value of _dataTableSchema is not being 
> used anywhere, though its been filled each time. Good catch !
>
> Could you please try running the unit test too and make sure it 
> doesn't break existing test cases.
>
> Thanks
> Nagappan
>
> 2008/7/8 Ernesto <equistango at gmail.com <mailto:equistango at gmail.com>>:
>
>
>     Hi, I was taking a look at OdbcDataReader.cs and found something
>     that got my attention: a call to GetSchemaTable() in the class'
>     constructor.
>
>     The DataReader is supposed to be a very fast reader for
>     forward-only queries, and getting complete schema information on
>     every DataReader is a very expensive (and unsolicited) operation.
>     The call seems completely unnecesary to me. Only  column
>     information is necessary.
>
>     This patch replaces two calls to GetSchemaTable() for calls to a
>     new function GetColumns().
>     It works perfectly in my tests and it's way much faster. Can
>     someone please review and comment?
>
>     Regards,
>     Ernesto
>
>
>     Index: OdbcDataReader.cs
>     ===================================================================
>     --- OdbcDataReader.cs   (revision 107477)
>     +++ OdbcDataReader.cs   (working copy)
>     @@ -75,7 +75,7 @@
>                            short colcount = 0;
>                            libodbc.SQLNumResultCols (hstmt, ref colcount);
>                            cols = new OdbcColumn [colcount];
>     -                       GetSchemaTable ();
>     +                       GetColumns ();
>                    }
>
>                    internal OdbcDataReader (OdbcCommand command,
>     CommandBehavior behavior,
>     @@ -225,6 +225,13 @@
>                            }
>                            return cols [ordinal];
>                    }
>     +
>     +               // Load all column descriptions
>     +               private void GetColumns ()
>     +               {
>     +                       for(int i = 0; i < cols.Length; i++)
>     +                               GetColumn (i);
>     +               }
>
>                    public
>      #if NET_2_0
>     @@ -913,7 +920,7 @@
>                                    libodbc.SQLNumResultCols (hstmt,
>     ref colcount);
>                                    cols = new OdbcColumn [colcount];
>                                    _dataTableSchema = null; // force
>     fresh creation
>     -                               GetSchemaTable ();
>     +                               GetColumns ();
>                            }
>                            return (ret == OdbcReturn.Success);
>                    }
>
>
>
>     _______________________________________________
>     Mono-devel-list mailing list
>     Mono-devel-list at lists.ximian.com
>     <mailto:Mono-devel-list at lists.ximian.com>
>     http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
>
>
>
> -- 
> Linux Desktop (GUI Application) Testing Project - 
> http://ldtp.freedesktop.org
> http://nagappanal.blogspot.com 



More information about the Mono-devel-list mailing list