Database access
Our next objective was to introduce database interaction. We decided to have the following classes for it.
| Tabular | To show multiple records in a grid |
| FreeForm | To show one record with multiple fields |
| DataStore | To interact with database |
In addition two classes were used internally.
- RecordSet - to hold a retrieved record
- Column - to hold information about columns in a tabular and rows in freeform
- A HTTP XML request can be send from the send from a client action, attached to a tabular column, which will invoke a server side function written in the page.
- The server side function can create a class, like FreeForm, and sends it to the client
- The FreeForm is repainted in the client
We created a database of all people attending the BarCamp at Chennai to get the page working.
The code looks like this:
module PageTabular
def showFreeform(pNameClicked)
datastore = DataStore.new("tsgpdc2k", "ubuildmya", "sets")
datastore.databasename = "SessionDB"
freeform = Freeform.new
freeform.name = "DynamicDisplay"
style = Style.new
style[:font_size] = 12
style[:color] = "blue"
liveNewsText = Text.new("")
liveNewsText.style = style
newsDetail = Text.new("")
newsDetail.style = style
presentation = Text.new("")
presentation.style = style
freeform.add("Name", "Attendee Name", liveNewsText)
freeform.add("Details", "Attendee Details", newsDetail)
freeform.add("Presentation", "Presentation Given", presentation)
datastore.sql = "select * from Attendees where name= ?"
datastore.setParameter(1, pNameClicked)
freeform.columns = datastore.select
return freeform
end
def pageText
page = Page.new(:PageTabular)
datastore = DataStore.new("tsgpdc2k","ubuildmya","sets")
datastore.databasename = "SessionDB"
datastore.sql = "select * from Attendees"
freeformstyle = Style.new
freeformstyle[:left] = 300
freeformstyle[:background_color] = '#A5c3ef'
freeform = Freeform.new
freeform.name = "DynamicDisplay"
freeform.width = 350
freeform.style = freeformstyle
freeform.valign = :top
tabularsection1 = Tabular.new
tabularsection1.maxRow = 100
tabularsection1.height = 100
style = Style.new
style[;color] = "blue"
name = CheckBox.new('')
actionclass = Action.new
actionclass.add(page, 'showFreeform', [name], [freeform])
actionclass.add(freeform, "refresh")
name.event[:Click] = actionclass
name.style = style
tabularsection1.add("Name", "Attendee Name", name)
tabularsection1.columns = datastore.select
page << [tabularsection1, freeform]
return page
end
end

8 Comments:
car insurance dallas
instant car insurance quote
car insurance broker
free car insurance quote
car insurance quote online uk
agent car company home insurance life quote rate
auto cheap insurance
agent car company home insurance life quote rate
online car insurance rate
online auto insurance quote
progressive car insurance
norwich union car insurance
aarp car insurance
compare car insurance quote
car insurance quote uk
car insurance ny
car insurance n
cheap online car insurance quote
classic car insurance
car insurance rating
affordable car insurance
classic car insurance
churchil
l car insurance
state farm car insurance
new jersey car insurance
nj car insurance
low cost car insurance online
car insurance chicago
florida car insurance
best car insurance rate
http://cheap-car-insurance.quickfreehost.com
Random Keyword: :)
free online car insurance quote
[url=http://www.firstboots.co.uk][img]http://www.firstboots.co.uk/images/ugg-boots.jpg alt="sale ugg" title="ugg boots"[/img][/url] ugg duck boots http://www.kindboots.co.uk
[url=http://www.wholeboots.co.uk/#q7c70i50d][b]ugg[/b][/url]
[url=http://www.likeboots.co.uk/#a8q69u93s][b]ugg[/b][/url]
[url=http://www.firstboots.co.uk/#l2j48h52d][b]cheap ugg[/b][/url]
get tlfGsHCC [URL=http://www.camera--lenses.com/]canon ef 75-300mm[/URL] , just clicks away HJhAIjqx [URL=http://www.camera--lenses.com/ ] http://www.camera--lenses.com/ [/URL]
you definitely love ZSaHEGdV [URL=http://www.cheapguccireplica.tumblr.com/]gucci shop online[/URL] for more detail yOtkdjrR [URL=http://www.cheapguccireplica.tumblr.com/ ] http://www.cheapguccireplica.tumblr.com/ [/URL]
you love this? WZdQyVYG [URL=http://www.replicalv.webs.com/]replica louis vuitton bags[/URL] at my estore XvHSNVEb [URL=http://www.replicalv.webs.com/ ] http://www.replicalv.webs.com/ [/URL]
buy cpDeOtnY [URL=http://www.aaareplicahandbags.weebly.com/]designer mirror[/URL] with low price ckUHQvlI [URL=http://www.aaareplicahandbags.weebly.com/ ] http://www.aaareplicahandbags.weebly.com/ [/URL]
you will like IIEajKYJ [URL=http://www.aaareplicahandbags.weebly.com/]aaa replica bags[/URL] for more detail NbXJhyxS [URL=http://www.aaareplicahandbags.weebly.com/ ] http://www.aaareplicahandbags.weebly.com/ [/URL]
check RqDDzkXc [URL=http://www.cheapdesigner--handbags.weebly.com/]replica handbags[/URL] for more SMNtOTuD [URL=http://www.cheapdesigner--handbags.weebly.com/ ] http://www.cheapdesigner--handbags.weebly.com/ [/URL]
Post a Comment
<< Home