>#define TABLE_NAME "c:\temp\test.dbf" > >set safety off >set exclusive off >clear > >create table (TABLE_NAME) free (col1 i) >use (TABLE_NAME) >select 0 > >? program(), set("datasession") > >loDecorator = createobject("DecoratorSession", createobject("test", TABLE_NAME)) >? program(), set("datasession") >=loDecorator.populate() >=loDecorator.list() >? program(), set("datasession") >? alias() > >define class DecoratorSession as custom > > protected DecoratedObject > > function init( toReference ) > if vartype(toReference) != 'O' > return .f. > endif > this.DecoratedObject = toReference > endfunc > > function this_access( tcMember ) > * BEWARE - any PEMs of the DecoratedObject that > * are duplicated in THIS are inaccessable > if pemstatus(this, tcMember, 5) > return this > else > return this.DecoratedObject > endif > endfunc > > function destroy() > this.DecoratedObject = null > endfunc > >enddefine > >define class test as session > > function init( tcTableName ) > * remember that private datasessions require their own settings > set exclusive off > use (tcTableName) > endfunc > > function populate > > ? program(), set("datasession") > > local i, lnCount > lnCount = 5 > for i = 1 to lnCount > insert into (alias()) (col1) values (i) > endfor > return lnCount > endfunc > > function list > > ? program(), set("datasession") > > scan > ? col1 > endscan > return reccount() > endfunc > >enddefine >