by Compuin » Fri Apr 14, 2017 11:53 pm
Aca el codigo
function TMyMSQuery( cCls ) ; return( MyGenClass( cCls, TMSQuery() ) )
The variable __aHCls
AAdd( __aHCls, { cClsName, __nClassH } )
the class and handle
How free
static __aHCls := {}
#include "HbClass.ch"
function MyGenClass( cClsName, FromClass )
local n, __nClassH, __odatabase
local cFromClass := upper( FromClass:ClassName() )
cClsName := "TMY" + Upper( if( empty( cClsName ), ;
PadL( len( __aHCls ), 7, "0" ), Alltrim( cClsName ) ) )
if ( n := AScan( __aHCls, { |aClass| aClass[ 1 ] == cClsName } ) ) == 0
_HB_CLASS cClsName
__oDatabase := HBClass():New( cClsName, { cFromClass } )
__oDatabase:Create()
__nClassH := __oDatabase:hClass
AAdd( __aHCls, { cClsName, __nClassH } )
else
__nClassH := __aHCls[ n, 2 ]
endif
return( __clsInst( __nClassH ) )
//Cretae the function for deleted __aHCls the handling
//the class
Function CloseClass( oClase )
Local n,cClsName
cClsName := "TMY" + Upper( PadL( len( __aHCls ), 7, "0" ) )
if ( n := AScan( __aHCls, { |aClass| aClass[ 1 ] == cClsName } ) ) == 0
// ya se creo la clase
else
__aHCls[ n, 1 ]:=NIL
__aHCls[ n, 2 ]:=NIL
ADEL( __aHCls , n )
endif
oClase:=NIL
return( cClsName )
FWH 20.12
Hbmk2 32/64 Bits (Build 19.29.30133)
Microsoft Visual C 32 Bits
MySql 8.0.24 32/64 Bits
VS Code