mail-archives/mono-bugs/2009-November/094744.html

449 строки
17 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [Mono-bugs] [Bug 553307] New: Datasets and Dataadapters are absolutely not behaving like in Microsoft.Net!
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:mono-bugs%40lists.ximian.com?Subject=%5BMono-bugs%5D%20%5BBug%20553307%5D%20New%3A%20Datasets%20and%20Dataadapters%20are%0A%20absolutely%20not%20behaving%20like%20in%20Microsoft.Net%21&In-Reply-To=">
<META NAME="robots" CONTENT="index,nofollow">
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="095251.html">
<LINK REL="Next" HREF="095084.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[Mono-bugs] [Bug 553307] New: Datasets and Dataadapters are absolutely not behaving like in Microsoft.Net!</H1>
<B>bugzilla_noreply at novell.com</B>
<A HREF="mailto:mono-bugs%40lists.ximian.com?Subject=%5BMono-bugs%5D%20%5BBug%20553307%5D%20New%3A%20Datasets%20and%20Dataadapters%20are%0A%20absolutely%20not%20behaving%20like%20in%20Microsoft.Net%21&In-Reply-To="
TITLE="[Mono-bugs] [Bug 553307] New: Datasets and Dataadapters are absolutely not behaving like in Microsoft.Net!">bugzilla_noreply at novell.com
</A><BR>
<I>Fri Nov 6 10:35:02 EST 2009</I>
<P><UL>
<LI>Previous message: <A HREF="095251.html">[Mono-bugs] [Bug 553306] [verifier] SIGSEGV in mono_class_init on a bad assembly
</A></li>
<LI>Next message: <A HREF="095084.html">[Mono-bugs] [Bug 553307] Datasets and Dataadapters are absolutely not behaving like in Microsoft.Net!
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#94744">[ date ]</a>
<a href="thread.html#94744">[ thread ]</a>
<a href="subject.html#94744">[ subject ]</a>
<a href="author.html#94744">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE><A HREF="http://bugzilla.novell.com/show_bug.cgi?id=553307">http://bugzilla.novell.com/show_bug.cgi?id=553307</A>
Summary: Datasets and Dataadapters are absolutely not behaving
like in Microsoft.Net!
Classification: Mono
Product: Mono: Class Libraries
Version: 2.4.x
Platform: i686
OS/Version: openSUSE 11.2
Status: NEW
Severity: Major
Priority: P5 - None
Component: Sys.Data
AssignedTo: <A HREF="http://lists.ximian.com/mailman/listinfo/mono-bugs">bnc-blr-team-mono at forge.provo.novell.com</A>
ReportedBy: <A HREF="http://lists.ximian.com/mailman/listinfo/mono-bugs">jhmgbl2 at t-online.de</A>
QAContact: <A HREF="http://lists.ximian.com/mailman/listinfo/mono-bugs">mono-bugs at lists.ximian.com</A>
Found By: ---
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.0.11)
Gecko/2009060215 Firefox/3.0.11 (.NET CLR 3.5.30729)
I've tried for days getting a database application to work under Mono, but
everytime I make a workaround, a new error is occurring, which does not exist
under .Net!
Here is my Main piece of Code where most Errors occur:
Public Sub FilldsPPT(ByVal ParentCategoryID As Long, ByVal ParentCategoryRow As
dsPP.ParentCategoriesRow, Optional ByRef DTrans As Sqlite.SqliteTransaction =
Nothing, Optional ByVal Recurse As Boolean = False, Optional ByRef
InternalRecurse As Boolean = False)
Const CodeLoc As String = &quot;clsDBPP.FilldsPPT&quot;
gStatus = CodeLoc &amp; &quot; Start PCat: &quot; &amp; ParentCategoryID
Dim qry As String
Dim Param As SqliteParameter
Dim blnCloseConnection As Boolean
_Initializing = True
Try
retry:
Me.DataSetName = &quot;dsPP&quot;
If (ConPP.State) = ConnectionState.Closed Then
ConPP.Open()
blnCloseConnection = True
End If
' *************** Pictures ***************
gStatus = CodeLoc &amp; &quot; Fill Pictures&quot;
qry = &quot;Select * FROM Pictures WHERE ID IN &quot; &amp; _
&quot;(Select PictureID FROM CategoriesOfPictures WHERE
CategoryID IN &quot; &amp; _
&quot;(Select CategoryID FROM ParentCategories WHERE
ParentCategoryID = ?))&quot;
gStatus = CodeLoc &amp; &quot; Fill Pictures Create Command&quot;
Using cmd As New SqliteCommand(qry, ConPP)
cmd.Transaction = DTrans
gStatus = CodeLoc &amp; &quot; Fill Pictures Add Parameter&quot;
Param = cmd.Parameters.Add(&quot;@CategoryID&quot;, DbType.Int32, 4)
Param.Direction = ParameterDirection.Input
Param.Value = ParentCategoryID
gStatus = CodeLoc &amp; &quot; Fill Pictures Create Adapter&quot;
Using da As New SqliteDataAdapter(cmd)
#If Not Linux Then
da.Fill(Me, &quot;Pictures&quot;)
#Else
gStatus = CodeLoc &amp; &quot; Fill Pictures Getting Rowcount&quot;
If Me.Pictures.Rows.Count &gt; 0 Then
gStatus = CodeLoc &amp; &quot; Fill tmpPictures&quot;
Me.EnforceConstraints = False
da.Fill(_dsTMP, &quot;tmpPictures&quot;)
Dim RowCount As Integer = _dsTMP.Tables(&quot;tmpPictures&quot;).Rows.Count
gStatus = CodeLoc &amp; &quot; Filled tmpPictures count: &quot; &amp; RowCount
If RowCount &gt; 0 Then
gStatus = CodeLoc &amp; &quot; Fill Pictures Set Constraints and Delete
Rules&quot;
Me.EnforceConstraints = False
If Me.relationCat_CatOPics IsNot Nothing AndAlso
Me.relationCat_CatOPics.ChildKeyConstraint IsNot Nothing Then
Me.relationPics_CatOPics.ChildKeyConstraint.DeleteRule =
Rule.None
Me.relationThumbs_Pictures.ChildKeyConstraint.DeleteRule =
Rule.None
End If
gStatus = CodeLoc &amp; &quot; Browse Rows RowCount: &quot; &amp; RowCount
Dim first As Boolean = True
For Each r As DataRow In _dsTMP.Tables(&quot;tmpPictures&quot;).Rows
If first Then
gStatus = CodeLoc &amp; &quot; Browse Rows Start&quot;
first = False
End If
Dim drPics As dsPP.PicturesRow =
Me.Pictures.FindByID(CLng(r!ID))
If drPics IsNot Nothing Then
gStatus = CodeLoc &amp; &quot; Not Importing PicRow &quot; &amp; drPics.Name
Else
gStatus = CodeLoc &amp; &quot; Importing PicRow &quot; &amp; CStr(r!Name)
Me.Pictures.ImportRow(r)
End If
Next
If Me.relationCat_CatOPics IsNot Nothing AndAlso
Me.relationCat_CatOPics.ChildKeyConstraint IsNot Nothing Then
Me.relationPics_CatOPics.ChildKeyConstraint.DeleteRule =
Rule.Cascade
Me.relationThumbs_Pictures.ChildKeyConstraint.DeleteRule =
Rule.Cascade
End If
gStatus = CodeLoc &amp; &quot; EnforceConstraints&quot;
End If
gStatus = CodeLoc &amp; &quot;Clear tmpPictures&quot;
_dsTMP.Tables.Remove(&quot;tmpPictures&quot;)
Me.EnforceConstraints = True
Else
da.Fill(Me, &quot;Pictures&quot;)
End If
#End If
End Using
End Using
'********************* Categories *************************
gStatus = CodeLoc &amp; &quot; Fill Categories&quot;
qry = &quot;Select * FROM Categories WHERE ID IN (Select CategoryID FROM
ParentCategories WHERE ParentCategoryID = ?)&quot;
Using cmd As New SqliteCommand(qry, ConPP)
cmd.Transaction = DTrans
Param = cmd.Parameters.Add(&quot;@CategoryID&quot;, DbType.Int32, 4)
Param.Direction = ParameterDirection.Input
Param.Value = ParentCategoryID
Using da As New SqliteDataAdapter(cmd)
#If Not Linux Then
da.Fill(Me, &quot;Categories&quot;)
#Else
If Me.Categories.Rows.Count &gt; 0 Then
Me.EnforceConstraints = False
da.Fill(_dsTMP, &quot;tmpCategories&quot;)
Dim RowCount As Integer = _dsTMP.Tables(&quot;tmpCategories&quot;).RowsCount
If RowCount &gt; 0 Then
If Me.relationParentCatCat_Cat IsNot Nothing AndAlso
Me.relationParentCatCat_Cat.ChildKeyConstraint IsNot Nothing Then
Me.relationParentCatCat_Cat.ChildKeyConstraint.DeleteRule =
Rule.None
Me.relationParentCatParentCat_Cat.ChildKeyConstraint.DeleteRule
= Rule.None
Me.relationCat_CatOPics.ChildKeyConstraint.DeleteRule =
Rule.None
End If
Me.EnforceConstraints = False
For Each r As DataRow In _dsTMP.Tables(&quot;tmpCategories&quot;).Rows
Dim drCategories As dsPP.CategoriesRow =
Me.Categories.FindByID(CLng(r!ID))
If drCategories IsNot Nothing Then
Else
Me.Categories.ImportRow(r)
End If
Next
If Me.relationParentCatCat_Cat IsNot Nothing AndAlso
Me.relationParentCatCat_Cat.ChildKeyConstraint IsNot Nothing Then
Me.relationParentCatCat_Cat.ChildKeyConstraint.DeleteRule =
Rule.Cascade
Me.relationParentCatParentCat_Cat.ChildKeyConstraint.DeleteRule
= Rule.Cascade
Me.relationCat_CatOPics.ChildKeyConstraint.DeleteRule =
Rule.Cascade
End If
End If
_dsTMP.Tables.Remove(&quot;tmpCategories&quot;)
Me.EnforceConstraints = True
Else
da.Fill(Me, &quot;Categories&quot;)
End If
#End If
End Using
End Using
'*****************CatOPics************************
gStatus = CodeLoc &amp; &quot; Fill CatOPics&quot;
qry = &quot;Select * FROM CategoriesOfPictures WHERE CategoryID IN &quot; &amp; _
&quot;(Select CategoryID FROM ParentCategories WHERE
ParentCategoryID = ?)&quot;
Using cmd As New SqliteCommand(qry, ConPP)
cmd.Transaction = DTrans
Param = cmd.Parameters.Add(&quot;@CategoryID&quot;, DbType.Int32, 4)
Param.Direction = ParameterDirection.Input
Param.Value = ParentCategoryID
Using da As New SqliteDataAdapter(cmd)
#If Not Linux Then
da.Fill(Me, &quot;CategoriesOfPictures&quot;)
#Else
If Me.CategoriesOfPictures.Rows.Count &gt; 0 Then
Me.EnforceConstraints = False
da.Fill(_dsTMP, &quot;tmpCategoriesOfPictures&quot;)
For Each r As DataRow In
_dsTMP.Tables(&quot;tmpCategoriesOfPictures&quot;).Rows
Dim drCategoriesOfPictures As dsPP.CategoriesOfPicturesRow =
Me.CategoriesOfPictures.FindByID(CLng(r!ID))
If drCategoriesOfPictures IsNot Nothing Then
'Me.CategoriesOfPictures.RemoveCategoriesOfPicturesRow(drCategoriesOfPictures)
Else
Me.CategoriesOfPictures.ImportRow(r)
End If
Next
_dsTMP.Tables.Remove(&quot;tmpCategoriesOfPictures&quot;)
Me.EnforceConstraints = True
Else
da.Fill(Me, &quot;CategoriesOfPictures&quot;)
End If
#End If
End Using
End Using
' *********************ParentCategories*********************
gStatus = CodeLoc &amp; &quot; Fill ParentCategories&quot;
qry = &quot;Select * FROM ParentCategories WHERE ParentCategoryID = ?&quot;
Using cmd As New SqliteCommand(qry, ConPP)
cmd.Transaction = DTrans
Param = cmd.Parameters.Add(&quot;@CategoryID&quot;, DbType.Int32, 4)
Param.Direction = ParameterDirection.Input
Param.Value = ParentCategoryID
Using da As New SqliteDataAdapter(cmd)
Dim Retrys As Integer
Try
RetryFillPCat:
#If Not Linux Then
da.Fill(Me, &quot;ParentCategories&quot;)
#Else
If Me.ParentCategories.Rows.Count &gt; 0 Then
Me.EnforceConstraints = False
da.Fill(_dsTMP, &quot;tmpParentCategories&quot;)
For Each r As DataRow In
_dsTMP.Tables(&quot;tmpParentCategories&quot;).Rows
Dim drParentCategories As dsPP.ParentCategoriesRow =
Me.ParentCategories.FindByID(CLng(r!ID))
If drParentCategories IsNot Nothing Then
'Me.ParentCategories.RemoveParentCategoriesRow(drParentCategories)
Else
Me.ParentCategories.ImportRow(r)
End If
Next
_dsTMP.Tables.Remove(&quot;tmpParentCategories&quot;)
Me.EnforceConstraints = True
Else
da.Fill(Me, &quot;ParentCategories&quot;)
End If
#End If
Catch ex As ConstraintException
gStatus = CodeLoc &amp; &quot; Fill ParentCategories Constraintexception&quot;
RemoveNonExistentEntrysFROMParentCategories()
Retrys += 1
' Da die Eintr&#228;ge trotz Fehlers geladen werden m&#252;ssen sie vor einem
erneuten Versuch erst gel&#246;scht werden.
For Each r As DataRow In
Me.ParentCategories.Select(&quot;ParentCategoryID = &quot; &amp; ParentCategoryID)
Me.ParentCategories.Rows.Remove(r)
Next
#If Linux Then
If _dsTMP.Tables(&quot;tmpParentCategories&quot;) IsNot Nothing Then
_dsTMP.Tables.Remove(&quot;tmpParentCategories&quot;)
End If
#End If
Me.EnforceConstraints = True
If Retrys &lt; 2 Then GoTo RetryFillPCat
RemoveDoubleEntriesFromParentCategories()
If Retrys &lt; 3 Then GoTo RetryfillpCat
End Try
End Using
End Using
''***********************Thumbs*************************
'qry = &quot;Select * FROM Thumbs where PictureID IN &quot; &amp; _
' &quot;(Select ID FROM Pictures WHERE ID IN &quot; &amp; _
' &quot;(Select PictureID FROM CategoriesOfPictures WHERE
CategoryID IN &quot; &amp; _
' &quot;(Select CategoryID FROM ParentCategories WHERE
ParentCategoryID = ?)))&quot;
'Using cmd As New SQLiteCommand(qry, ConPP)
' Param = cmd.Parameters.Add(&quot;@CategoryID&quot;, DbType.Int32, 4)
' Param.Direction = ParameterDirection.Input
' Param.Value = ParentCategoryID
' Using da As New SQLiteDataAdapter(cmd)
' da.Fill(Me, &quot;Thumbs&quot;)
' End Using
'End Using
'***********************FavFolder*************************
gStatus = CodeLoc &amp; &quot; Fill FavFolder&quot;
If Me.FavFolder.Count = 0 Then
Using da As New SqliteDataAdapter(&quot;Select * FROM FavFolder&quot;, ConPP)
da.SelectCommand.Transaction = DTrans
da.Fill(Me, &quot;FavFolder&quot;)
End Using
End If
'***********************Favorites*************************
gStatus = CodeLoc &amp; &quot; Fill Favorites&quot;
If Me.Favorites.Count = 0 Then
Using da As New SqliteDataAdapter(&quot;Select * FROM Favorites&quot;, ConPP)
da.SelectCommand.Transaction = DTrans
da.Fill(Me, &quot;Favorites&quot;)
End Using
End If
If Recurse Then
Static LastPCats As System.Collections.ObjectModel.Collection(Of Long)
If InternalRecurse = False Then
LastPCats = New System.Collections.ObjectModel.Collection(Of Long)
End If
LastPCats.Add(ParentCategoryID)
If ParentCategoryRow Is Nothing Then
Throw New ApplicationException(&quot;ParentCat is nothing on recurse!&quot;)
End If
For Each PCat As dsPP.ParentCategoriesRow In
ParentCategoryRow.CategoriesRowByParentCatCat_Cat.GetParentCategoriesRowsByParentCatParentCat_Cat
If Not LastPCats.Contains(PCat.CategoryID) Then
FilldsPPT(PCat.CategoryID, PCat, DTrans, Recurse, True)
End If
Next
End If
Catch ex As Exception
HandleError(ex, &quot;dsPP.FillDSPPT&quot;)
Finally
If blnCloseConnection Then
ConPP.Close()
End If
_Initializing = False
End Try
End Sub
Reproducible: Always
Steps to Reproduce:
1.
2.
3.
--
Configure bugmail: <A HREF="http://bugzilla.novell.com/userprefs.cgi?tab=email">http://bugzilla.novell.com/userprefs.cgi?tab=email</A>
------- You are receiving this mail because: -------
You are the QA contact for the bug.
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="095251.html">[Mono-bugs] [Bug 553306] [verifier] SIGSEGV in mono_class_init on a bad assembly
</A></li>
<LI>Next message: <A HREF="095084.html">[Mono-bugs] [Bug 553307] Datasets and Dataadapters are absolutely not behaving like in Microsoft.Net!
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#94744">[ date ]</a>
<a href="thread.html#94744">[ thread ]</a>
<a href="subject.html#94744">[ subject ]</a>
<a href="author.html#94744">[ author ]</a>
</LI>
</UL>
<hr>
<a href="http://lists.ximian.com/mailman/listinfo/mono-bugs">More information about the mono-bugs
mailing list</a><br>
</body></html>