[Mono-devel-list] Problem with DbDataAdapter... RESOLVED

Konstantin Triger kostat at mainsoft.com
Mon May 23 13:43:57 EDT 2005


Sorry,

This happened because patch does not work with \r and our code is full 
of it. Should run dos2unix sometime...
Anyway attached a tar.gz with the files themselves.

Regards,
Konstantin Triger



Hubert FONGARNAND wrote:

>Hello
>I think you're patch has something bad...
>i get :
>hub-lin-dev System.Data # cat ../../../DataContainer.patch | patch -p0
>patching file System.Data.Common/DataContainer.cs
>Hunk #1 FAILED at 170.
>Hunk #2 FAILED at 250.
>Hunk #3 FAILED at 263.
>Hunk #4 FAILED at 358.
>Hunk #5 FAILED at 371.
>Hunk #6 FAILED at 469.
>Hunk #7 FAILED at 482.
>Hunk #8 FAILED at 581.
>Hunk #9 FAILED at 594.
>Hunk #10 FAILED at 693.
>Hunk #11 FAILED at 706.
>Hunk #12 FAILED at 805.
>Hunk #13 FAILED at 818.
>Hunk #14 FAILED at 915.
>Hunk #15 FAILED at 1077.
>Hunk #16 FAILED at 1104.
>Hunk #17 FAILED at 1136.
>Hunk #18 FAILED at 1149.
>Hunk #19 FAILED at 1190.
>Hunk #20 FAILED at 1204.
>Hunk #21 FAILED at 1284.
>Hunk #22 FAILED at 1297.
>Hunk #23 FAILED at 1393.
>Hunk #24 FAILED at 1406.
>Hunk #25 FAILED at 1501.
>Hunk #26 FAILED at 1514.
>Hunk #27 FAILED at 1612.
>Hunk #28 FAILED at 1625.
>Hunk #29 FAILED at 1725.
>Hunk #30 FAILED at 1738.
>30 out of 30 hunks FAILED -- saving rejects to file 
>System.Data.Common/DataContainer.cs.rej
>patching file System.Data/ISafeDataRecord.cs
>Hunk #1 FAILED at 1.
>Hunk #2 FAILED at 24.
>Hunk #3 FAILED at 58.
>3 out of 3 hunks FAILED -- saving rejects to file 
>System.Data/ISafeDataRecord.cs.rej
>
>I'm doing something wrong???
>thanks
>
>Le Dimanche 22 Mai 2005 14:39, vous avez écrit :
>  
>
>>Hello all,
>>
>>This is definitely a bug. Suresh, you are right, there should be a
>>GetDateTimeSafe(), which was sadly missed and not found with tests
>>because our structs are actually classes, so there was no exception.
>>
>>In addition, the docs say that IsDBNull should be called before a call
>>to a get method.
>>
>>The attached patch provides the relevant fixes, please let me know
>>whether it works.
>>
>>Regards,
>>Konstantin Triger
>>
>>Sureshkumar T wrote:
>>    
>>
>>>I guess the following is more proper fix. But, I am not sure why there
>>>is no GetDateTimeSafe in ISafeRecord and is there any reason to leave
>>>this to throw exception. Kosta could clear this.  Hubert, can you please
>>>try this?
>>>
>>>[SNIP]
>>>Index: System.Data.Common/DataContainer.cs
>>>===================================================================
>>>--- System.Data.Common/DataContainer.cs (revision 44790)
>>>+++ System.Data.Common/DataContainer.cs (working copy)
>>>@@ -1069,7 +1069,8 @@
>>>                       {
>>>                               // if exception thrown, it should be
>>>caught
>>>                               // in the  caller method
>>>-
>>>base.SetValue(index,record.GetDateTime(field));
>>>+                                this[index] = record.GetValue(field);
>>>+
>>>
>>>base.SetItemFromDataRecord(index,record,field);
>>>                       }
>>>[/SNIP]
>>>
>>>suresh.
>>>
>>>On Fri, 2005-05-20 at 12:36 +0200, Hubert FONGARNAND wrote:
>>>      
>>>
>>>>Hello
>>>>
>>>>I've found the last problems I had...
>>>>The problem is when you do a fill with a null datetime in the result
>>>>dataset...
>>>>the problem is in method
>>>>internal void ReadIDataRecord(int recordIndex, IDataRecord record, int[]
>>>>mapping, int length)
>>>>of the record cache class
>>>>this method do a call of :
>>>>	column.DataContainer.SetItemFromDataRecord(recordIndex, record,i);
>>>>
>>>>so the problem comes from the sealed class DateTimeDataContainer :
>>>>AbstractObjectDataContainer
>>>>
>>>>the method record.GetDateTime(field); throw a not well catched exception
>>>>when the datetime is null
>>>>So, as a trick, i've added a try catch :
>>>>
>>>>my patch is :
>>>>
>>>>Index: DataContainer.cs
>>>>===================================================================
>>>>--- DataContainer.cs    (revision 44793)
>>>>+++ DataContainer.cs    (working copy)
>>>>@@ -1069,7 +1069,15 @@
>>>>                       {
>>>>                               // if exception thrown, it should be
>>>>caught // in the  caller method
>>>>-
>>>>base.SetValue(index,record.GetDateTime(field));
>>>>+                               Object date=null;
>>>>+                               try
>>>>+                               {
>>>>+                                date=record.GetDateTime(field);
>>>>+                               }catch
>>>>+                               {
>>>>+                               }
>>>>+                               base.SetValue(index,date);
>>>>+
>>>>
>>>>base.SetItemFromDataRecord(index,record,field);
>>>>                       }
>>>>
>>>>Le Mercredi 18 Mai 2005 11:32, vous avez écrit :
>>>>        
>>>>
>>>>>Hello Hubert,
>>>>>
>>>>>I'm completely agree that bugs are a bad thing, that's why I'm here to
>>>>>help you as soon as possible. The reason the DataAdapter code has
>>>>>changed is to solve other bugs, and the solution required some
>>>>>"cooperation" from providers too. Unfortunately it's not simple to make
>>>>>a complete testing over all the providers, so I do expect for some
>>>>>number of issues, but believe that with yours and others help we will
>>>>>stabilize the code very fast.
>>>>>
>>>>>I would like to ask you several questions:
>>>>>
>>>>>  1. Does your PG app work? If not, can you send the stack traces/code
>>>>>     samples of the problems?
>>>>>  2. What is your current problem with Oracle? Can you please send a
>>>>>     stack? (It cannot be the same one because in my latest patch I
>>>>>     removed the calls to System.Data.DataRow:get_Item (System.String
>>>>>     columnName) from the BuildSchema).
>>>>>  3. If it's possible, can you send your entire app, so I'll test it
>>>>>     here? (The confidentiality will be ensured).
>>>>>
>>>>>Thank you in advance for your patience and cooperation.
>>>>>
>>>>>Regards,
>>>>>Konstantin Triger
>>>>>
>>>>>Hubert FONGARNAND wrote:
>>>>>          
>>>>>
>>>>>>You're patch has nothing changes... I get always the same error...
>>>>>>With the postgresql app... I can now login... but there's plenty of
>>>>>>bugs inside... I think the best solution is to get an older version of
>>>>>>Mono!
>>>>>>
>>>>>>Why do you include a patch if there's compatibility problems with data
>>>>>>providers!!!
>>>>>>
>>>>>>thanks
>>>>>>
>>>>>>Le Mardi 17 Mai 2005 16:26, vous avez écrit :
>>>>>>            
>>>>>>
>>>>>>>Hello again,
>>>>>>>
>>>>>>>Seems that Oracle provider does not initialize at all some columns in
>>>>>>>SchemaTable.
>>>>>>>The attached patch fixes that in a generic way.
>>>>>>>
>>>>>>>Regards,
>>>>>>>Konstantin Triger
>>>>>>>
>>>>>>>Hubert FONGARNAND wrote:
>>>>>>>              
>>>>>>>
>>>>>>>>I've applied your patch...
>>>>>>>>It corrects the problem with my postgresql app...
>>>>>>>>but i get always an error with the same app with oracle :
>>>>>>>>
>>>>>>>>System.IndexOutOfRangeException: Array index is out of range.
>>>>>>>>in <0x00067> System.Data.DataRow:get_Item (System.String columnName,
>>>>>>>>DataRowVersion version)
>>>>>>>>in <0x00015> System.Data.DataRow:get_Item (System.String columnName)
>>>>>>>>in <0x00495> System.Data.Common.DbDataAdapter:BuildSchema
>>>>>>>>(IDataReader reader, System.Data.DataTable table, SchemaType
>>>>>>>>schemaType,
>>>>>>>>MissingSchemaAction missingSchAction, MissingMappingAction
>>>>>>>>missingMapAction,
>>>>>>>>System.Data.Common.DataTableMappingCollection dtMapping)
>>>>>>>>in <0x00059> System.Data.Common.DbDataAdapter:BuildSchema
>>>>>>>>(IDataReader reader, System.Data.DataTable table, SchemaType
>>>>>>>>schemaType)
>>>>>>>>in (wrapper remoting-invoke-with-check)
>>>>>>>>System.Data.Common.DbDataAdapter:BuildSchema
>>>>>>>>(System.Data.IDataReader,System.Data.DataTable,System.Data.SchemaType
>>>>>>>>) in <0x00087> System.Data.Common.DbDataAdapter:FillTable
>>>>>>>>(System.Data.DataTable dataTable, IDataReader dataReader, Int32
>>>>>>>>startRecord, Int32 maxRecords, System.Int32 counter)
>>>>>>>>in (wrapper remoting-invoke-with-check)
>>>>>>>>System.Data.Common.DbDataAdapter:FillTable
>>>>>>>>(System.Data.DataTable,System.Data.IDataReader,int,int,int&)
>>>>>>>>in <0x00117> System.Data.Common.DbDataAdapter:Fill
>>>>>>>>(System.Data.DataSet dataSet, System.String srcTable, IDataReader
>>>>>>>>dataReader, Int32 startRecord, Int32 maxRecords)
>>>>>>>>in <0x000ce> System.Data.Common.DbDataAdapter:Fill
>>>>>>>>(System.Data.DataSet dataSet, Int32 startRecord, Int32 maxRecords,
>>>>>>>>System.String srcTable, IDbCommand command, CommandBehavior
>>>>>>>>behavior)
>>>>>>>>in <0x00036> System.Data.Common.DbDataAdapter:Fill
>>>>>>>>(System.Data.DataSet dataSet, System.String srcTable)
>>>>>>>>in (wrapper remoting-invoke-with-check)
>>>>>>>>System.Data.Common.DbDataAdapter:Fill (System.Data.DataSet,string)
>>>>>>>>in <0x00121> MoteurCRM.CProfil:RetourneGroupeCommercial
>>>>>>>>(System.String cnxstring, System.String televendeur_Id)
>>>>>>>>in <0x007e7> FicheClient.Logon:btnValider_Click (System.Object
>>>>>>>>sender, System.EventArgs e)
>>>>>>>>in (wrapper delegate-invoke)
>>>>>>>>System.MulticastDelegate:invoke_void_object_EventArgs
>>>>>>>>(object,System.EventArgs)
>>>>>>>>
>>>>>>>>Thanks...
>>>>>>>>
>>>>>>>>Le Mardi 17 Mai 2005 12:09, Konstantin Triger a écrit :
>>>>>>>>                
>>>>>>>>
>>>>>>>>>Agreed, but in fact the provider should set the defaults, not the
>>>>>>>>>DataAdapter :-).
>>>>>>>>>
>>>>>>>>>Regards,
>>>>>>>>>Konstantin Triger
>>>>>>>>>
>>>>>>>>>Sureshkumar T wrote:
>>>>>>>>>                  
>>>>>>>>>
>>>>>>>>>>>+							bool allowDBNull = value is bool ? (bool)value : false;
>>>>>>>>>>>                      
>>>>>>>>>>>
>>>>>>>>>>default allowDBNull should be true ;-)
>>>>>>>>>>
>>>>>>>>>>suresh.
>>>>>>>>>>                    
>>>>>>>>>>
>>>>>>>>_______________________________________________
>>>>>>>>Ce message et les éventuels documents joints peuvent contenir des
>>>>>>>>informations confidentielles. Au cas où il ne vous serait pas
>>>>>>>>destiné, nous vous remercions de bien vouloir le supprimer et en
>>>>>>>>aviser immédiatement l'expéditeur. Toute utilisation de ce message
>>>>>>>>non conforme à sa destination, toute diffusion ou publication,
>>>>>>>>totale ou partielle et quel qu'en soit le moyen est formellement
>>>>>>>>interdite. Les communications sur internet n'étant pas sécurisées,
>>>>>>>>l'intégrité de ce message n'est pas assurée et la société émettrice
>>>>>>>>ne peut être tenue pour responsable de son contenu.
>>>>>>>>_______________________________________________ Mono-devel-list
>>>>>>>>mailing list
>>>>>>>>Mono-devel-list at lists.ximian.com
>>>>>>>>http://lists.ximian.com/mailman/listinfo/mono-devel-list
>>>>>>>>                
>>>>>>>>
>>>>>>_______________________________________________
>>>>>>Ce message et les éventuels documents joints peuvent contenir des
>>>>>>informations confidentielles. Au cas où il ne vous serait pas destiné,
>>>>>>nous vous remercions de bien vouloir le supprimer et en aviser
>>>>>>immédiatement l'expéditeur. Toute utilisation de ce message non
>>>>>>conforme à sa destination, toute diffusion ou publication, totale ou
>>>>>>partielle et quel qu'en soit le moyen est formellement interdite. Les
>>>>>>communications sur internet n'étant pas sécurisées, l'intégrité de ce
>>>>>>message n'est pas assurée et la société émettrice ne peut être tenue
>>>>>>pour responsable de son contenu.
>>>>>>            
>>>>>>
>>>>_______________________________________________
>>>>Ce message et les éventuels documents joints peuvent contenir des
>>>>informations confidentielles. Au cas où il ne vous serait pas destiné,
>>>>nous vous remercions de bien vouloir le supprimer et en aviser
>>>>immédiatement l'expéditeur. Toute utilisation de ce message non conforme
>>>>à sa destination, toute diffusion ou publication, totale ou partielle et
>>>>quel qu'en soit le moyen est formellement interdite. Les communications
>>>>sur internet n'étant pas sécurisées, l'intégrité de ce message n'est pas
>>>>assurée et la société émettrice ne peut être tenue pour responsable de
>>>>son contenu. _______________________________________________
>>>>Mono-devel-list mailing list
>>>>Mono-devel-list at lists.ximian.com
>>>>http://lists.ximian.com/mailman/listinfo/mono-devel-list
>>>>        
>>>>
>_______________________________________________
>Ce message et les éventuels documents joints peuvent contenir des informations confidentielles.
>Au cas où il ne vous serait pas destiné, nous vous remercions de bien vouloir le supprimer et en aviser immédiatement l'expéditeur. Toute utilisation de ce message non conforme à sa destination, toute diffusion ou publication, totale ou partielle et quel qu'en soit le moyen est formellement interdite.
>Les communications sur internet n'étant pas sécurisées, l'intégrité de ce message n'est pas assurée et la société émettrice ne peut être tenue pour responsable de son contenu.
>  
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.tar.gz
Type: application/octet-stream
Size: 4680 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20050523/a51085cf/attachment.obj 


More information about the Mono-devel-list mailing list