[Mono-list] OdbcDataReader.cs bug. Attached with fix.

Sureshkumar T tsureshkumar at novell.com
Tue Jun 14 00:59:43 EDT 2005


Please feel free to file a bug report at http://bugzilla.ximian.com
under Sys.Data along with your fix. For the patch diff, use command
"diff -u".

Thanks,
suresh.

On Mon, 2005-06-13 at 15:21 -0700, ndo at rockwellcollins.com wrote:
> 
> I've found a minor bug in OdbcDataReader.cs in the private string []
> GetPrimaryKeys() method. 
> 
> The bug is for the following scenario: 
> 
> 1) Have a table with compound primary keys (in this case, two database
> columns make a row unique). 
> 
> 2) Exercise the query where the selected column in the query is not
> one of the primary key. There is only one field retrieved in the
> Select statement. 
> 
> 3) The bug in the GetPrimaryKeys() was allocated the return keys
> string array based on the number of returned columns in the Select
> statement. 
> In this scenario, the returned column in Select statement is one, and
> the number of primary keys in the table is two. So the bug was
> actually occurred 
> in the while(true) of fetching the primary key from backend database,
> and the while loop is crashing on the second time it retrieves the
> second 
> primary key since the keys[] string array only allocated one slot up
> front. 
> 
> 4) attached is the diff of the OdbcDataReader.cs from tarball 1.1.7
> with the latest from svn (retrieved about 11am June 13th 05). The fix
> that I made to 
> GetPrimaryKeys() method was not to make an assumption of keys[] string
> array to be allocated up front the number of returned columns from
> Select statement. There  
> is a local ArrayList object being introduced to dynamic add the
> primary keys fetched from backend database. As the completion of the
> fetch, then the  
> ArrayList will convert and return an array of string back. The
> signature of the method doesn't change. 
> 
> 5) Please review the fix. I don't know how the procedure once the bug
> review is approved, so please instruct me how to proceed from there. 
> 
> 
> 
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list


More information about the Mono-list mailing list