mysql+seaside squeak beginners question
Ragnar Hojland Espinosa
ragnar at linalco.com
Thu Jul 18 13:44:02 UTC 2002
I'm using the mysql driver with seaside (nice tool indeed). Basically I
want to print the fname column from the people table. Being new to
smalltalk it took me a bit to figure out how to do this, but my solution
looks extremelly wasteful.
Is there a way to optimize the companies method? Even if i throw it as a
new method of ExDB (JdmStatement with overloaded new which executes a
JdmConnection and createStatement) it looks awful.
Heres what I have
* in ExListCompanyLine:
addHandlers
(template elementNamed: 'name')
keyPath: 'company.fname'
html
^ '[name]'
* and in ExListCompanies:
companies
| r c a |
r _ (ExDB new) executeQuery: 'select fname,lname from people'.
c _ r columns collect: [:col | col name].
a _ OrderedCollection new.
[r next] whileTrue:
[ | d |
d _ Dictionary new.
c collect: [ :col |
"value _ r valuedName: col."
d at: col put: (r valueNamed: col).
].
a addLast: d.
].
^ a
--
Ragnar Hojland - Project Manager
Linalco "Especialistas Linux y en Software Libre"
Tel: +34-91-5970074 Fax: +34-91-5970083
More information about the Squeak-dev
mailing list
|