MySQL:
FWMariaDB library has built-in support for parent-child rowsets. Please see this thread.
viewtopic.php?f=3&t=32736You can see parent-child browses, parent-child-grandchild browses and also one parent with multiple chidren browses. Because FWMariaDB implements client-side filters, the performace is highly optimized.
We can use fwmariadb functions in a tdolphin application also for some functions or for some modules without conflicting with tdolphin.
This is a sample using TDolphin:
- Code: Select all Expand view RUN
#include "fivewin.ch"
function Main()
local oServer, oQryStates, oQryCust, bWhere
local oStates, oCust, oDlg
oServer := FW_DemoDB( "DLP" ) // You may use your server connection
oQryStates := oServer:Query( "select * from `states`" )
bWhere := { || "`state` = '" + oQryStates:code + "'" }
oQryCust := oServer:Query( "select * from customer where " + Eval( bWhere ) )
DEFINE DIALOG oDlg SIZE 900,400 PIXEL TRUEPIXEL ;
TITLE "Parent Child Browse"
@ 20,20 XBROWSE oStates SIZE 200,-20 PIXEL OF oDlg ;
DATASOURCE oQryStates ;
COLUMNS "CODE","NAME" CELL LINES NOBORDER
WITH OBJECT oStates
:bChange := { || oQryCust:SetWhere( Eval( bWhere ) ), oCust:GoTop(), oCust:Refresh() }
:CreateFromCode()
END
@ 20,200 XBROWSE oCust SIZE -20,-20 PIXEL OF oDlg ;
DATASOURCE oQryCust ;
COLUMNS "STATE", "FIRST", "CITY", "AGE", "SALARY" ;
CELL LINES NOBORDER
oCust:CreateFromCode()
ACTIVATE DIALOG oDlg CENTERED
oQryStates:End()
oQryCust:End()
oServer:End()
return nil