dim. 09 octobre 2011, 16h04
Gregory
atoutfox.public.association
Re: Utiliser des mots réservés comme nom de variable
Oui, si la classe garde un objet qui correspond a la table
exemple
create cursor Customer ;
( Id I autoinc,;
Name c(30) , ;
Address c(30) ;
)
index on Id tag Id candidate
insert into Customer(Name , Address) values('Georges', '2, Rue Neuve')
obj = createObject('Class1')
=m.obj.GetData(1)
obj.Data.Name = 'Serge'
=m.obj.Update()
=m.obj.GetBlank()
with m.obj.Data
.Name = 'Jean'
.Address = 'Grenoble'
endwith
=m.obj.Insert()
=m.obj.GetBlank()
with m.obj.Data
.Name = 'Olivier'
.Address = 'Paris'
endwith
=m.obj.Insert()
brow
define class Class1 as relation
Data = null
protected function init()
if( !DoDefault() )
return .f.
endif
select Customer && use Customer
=m.this.GetBlank()
endfunc
function GetData(custId)
if( !seek(m.custId) )
this.Data = null
else
scatter memo name this.Data
endif
endfunc
function Update()
if( !seek(m.this.Data.Id) )
return .f.
else
gather name this.Data fields except Id memo
endif
endfunc
function GetBlank()
scatter memo blank name this.Data
endfunc
function Insert()
=RemoveProperty(m.this.Data, 'Id')
insert into Customer from name this.Data
=AddProperty(m.this.Data, 'Id', Customer.Id)
enddefine
______
Gregory
______
"Sergejack" wrote in message news:j6q1eg$2tro$1@news.niouzes.net...
Je ne suis pas sûr de tout suivre.
Est-il possible d'avoir une classe définie de telle manière qu'employer
GATHER sur une instance de cette classe puisse bien mettre à jour des champs
NAME, MEMO, etc. (parmi des champs ADRESSE, etc.) ?
Permalink : http://www.atoutfox.org/nntp.asp?ID=0000007110