Fix DataSource.Find() on MySQL. DataView now correctly unselect all lines when we are in creation mode and the view is not editable.

[GB.DB.FORM]
* BUG: DataTable: Write the SQL request of the Find() method is a way that is compatible with MySQL.
* BUG: DataView: Correctly unselect all lines when we are in creation mode and the view is not editable.
This commit is contained in:
Benoît Minisini 2023-08-25 04:28:56 +02:00
parent ac15f27a96
commit a840f497b8
2 changed files with 4 additions and 3 deletions

View File

@ -171,7 +171,7 @@ Public Sub Find(sWhere As String, Optional iFrom As Integer) As Integer
Dim rFind As Result
sSelect = "ROW_NUMBER() OVER (" & $DB.SQL.OrderBy(GetSortKeys())() & ") AS __index"
sReq = $DB.SQL.Select([sSelect, "*"]).From($sTable).Where($sFilter)()
sReq = $DB.SQL.Select(["*", sSelect]).From($sTable).Where($sFilter)()
sReq = "SELECT * FROM (" & sReq & ") AS __pg_sucks WHERE " & sWhere
If iFrom > 0 Then sReq &= " AND __index >= " & CStr(iFrom + 1)
@ -180,7 +180,7 @@ Public Sub Find(sWhere As String, Optional iFrom As Integer) As Integer
If rFind.Count = 0 Then
Return -1
Else
Return rFind[0] - 1
Return rFind["__index"] - 1
Endif
End

View File

@ -89,6 +89,7 @@ Public Sub _new()
$bAllColumns = True
Update
Create()
UpdateMode
$bHighlight = True
UpdateHighlightColor
@ -941,7 +942,7 @@ Private Sub UpdateMode()
Object.Lock($hCtrl)
If $bCreate And If HasNewRecord() Then
If $bCreate And If Not HasNewRecord() Then
$hCtrl.Mode = Select.None
Else
$hCtrl.Mode = $iMode