|
| 1 | +CREATESEQUENCE "cities_id_seq" start7 increment1 maxvalue2147483647 minvalue1 cache1 ; |
| 2 | +SELECT nextval ('cities_id_seq'); |
| 3 | +CREATETABLE "pga_queries" ( |
| 4 | +"queryname"character varying(64), |
| 5 | +"querytype" character, |
| 6 | +"querycommand"text, |
| 7 | +"querytables"text, |
| 8 | +"querylinks"text, |
| 9 | +"queryresults"text, |
| 10 | +"querycomments"text); |
| 11 | +CREATETABLE "pga_forms" ( |
| 12 | +"formname"character varying(64), |
| 13 | +"formsource"text); |
| 14 | +CREATETABLE "pga_scripts" ( |
| 15 | +"scriptname"character varying(64), |
| 16 | +"scriptsource"text); |
| 17 | +CREATETABLE "pga_reports" ( |
| 18 | +"reportname"character varying(64), |
| 19 | +"reportsource"text, |
| 20 | +"reportbody"text, |
| 21 | +"reportprocs"text, |
| 22 | +"reportoptions"text); |
| 23 | +CREATETABLE "phonebook" ( |
| 24 | +"name"character varying(32), |
| 25 | +"phone_nr"character varying(16), |
| 26 | +"city"character varying(32), |
| 27 | +"company" bool, |
| 28 | +"continent"character varying(16)); |
| 29 | +CREATETABLE "pga_layout" ( |
| 30 | +"tablename"character varying(64), |
| 31 | +"nrcols" int2, |
| 32 | +"colnames"text, |
| 33 | +"colwidth"text); |
| 34 | +CREATETABLE "pga_schema" ( |
| 35 | +"schemaname"character varying(64), |
| 36 | +"schematables"text, |
| 37 | +"schemalinks"text); |
| 38 | +REVOKE ALLon"pga_schema"from PUBLIC; |
| 39 | +GRANT ALLon"pga_schema" to PUBLIC; |
| 40 | +CREATETABLE "cities" ( |
| 41 | +"id" int4 DEFAULT nextval('"cities_id_seq"')NOT NULL, |
| 42 | +"name"character varying(32)NOT NULL, |
| 43 | +"prefix"character varying(16)NOT NULL); |
| 44 | +REVOKE ALLon"cities"from PUBLIC; |
| 45 | +GRANTUPDATE,DELETE,SELECT,RULEon"cities" to"fane"; |
| 46 | +GRANT ALLon"cities" to"liviu"; |
| 47 | +CREATEFUNCTION "getcityprefix" (int4 ) RETURNSvarcharAS'select prefix from cities where id = $1' LANGUAGE'SQL'; |
| 48 | +COPY"pga_queries"FROM stdin; |
| 49 | +Query that can be savedas viewSselect*from phonebookwhere continent='usa' \N\N\N\N |
| 50 | +\. |
| 51 | +COPY"pga_forms"FROM stdin; |
| 52 | +Phone bookpb28 {FS {}} 444x307+284+246 {label label1 {33106828} {} Name {} label1 flat#000000 #d9d9d9 1 n} {entry name_entry {87 9 227 27} {} entry2 DataSet(.pb.qs,name) name_entry sunken #000000 #fefefe 1 n} {label label3 {33 37 73 52} {} Phone {} label3 flat #000000 #d9d9d9 1 n} {entry entry4 {87 36 195 54} {} entry4 DataSet(.pb.qs,phone_nr) entry4 sunken #000000 #fefefe 1 n} {label label5 {33 64 78 82} {} City {} label5 flat #000000 #d9d9d9 1 n} {entry entry6 {87 63 195 81} {} entry6 DataSet(.pb.qs,city) entry6 sunken #000000 #fefefe 1 n} {query qs {3 6 33 33} {} query7 {} qs flat {} {} 1 n} {button button8 {174 177 246 203} {namespace eval DataControl(.pb.qs) {\ |
| 53 | +\setSQL"select oid,* from phonebook where name ~* '$what' order by name"\ |
| 54 | +\open\ |
| 55 | +\set nrecs [getRowCount]\ |
| 56 | +\updateDataSet\ |
| 57 | +\fill .pb.allnames name\ |
| 58 | +\bind .pb.allnames<ButtonRelease-1> {\ |
| 59 | +\set ancr [.pb.allnames curselection]\ |
| 60 | +\ if {$ancr!=""} {\ |
| 61 | +\\DataControl(.pb.qs)::moveTo $ancr\ |
| 62 | +\\DataControl(.pb.qs)::updateDataSet\ |
| 63 | +\ }\ |
| 64 | +\}\ |
| 65 | +}} {Start search} {} button8 raised#000000 #d9d9d9 1 n} {button button9 {363 276 433 300} {DataControl(.pb.qs)::close\ |
| 66 | +DataControl(.pb.qs)::clearDataSet\ |
| 67 | +set nrecs {}\ |
| 68 | +set what {}\ |
| 69 | +destroy .pb\ |
| 70 | +} Exit {} button9 raised#000000 #d9d9d9 2 n} {button button10 {291 237 313 257} {namespace eval DataControl(.pb.qs) {\ |
| 71 | +\moveFirst\ |
| 72 | +\updateDataSet\ |
| 73 | +}\ |
| 74 | +} |< {} button10 ridge#000092 #d9d9d9 2 n} {button button11 {324 237 346 257} {namespace eval DataControl(.pb.qs) {\ |
| 75 | +\movePrevious\ |
| 76 | +\updateDataSet\ |
| 77 | +}\ |
| 78 | +}<< {} button11 ridge#000000 #d9d9d9 2 n} {button button12 {348 237 370 257} {namespace eval DataControl(.pb.qs) {\ |
| 79 | +\moveNext\ |
| 80 | +\updateDataSet\ |
| 81 | +}}>> {} button12 ridge#000000 #d9d9d9 2 n} {button button13 {381 237 403 257} {namespace eval DataControl(.pb.qs) {\ |
| 82 | +\moveLast\ |
| 83 | +\updateDataSet\ |
| 84 | +}\ |
| 85 | +}>| {} button13 ridge#000088 #d9d9d9 2 n} {checkbox checkbox14 {33 87 126 105} {} {Is it a company ?} DataSet(.pb.qs,company) checkbox14 flat #000000 #d9d9d9 1 n} {radio usa {63 108 201 120} {} U.S.A. DataSet(.pb.qs,continent) usa flat #000000 #d9d9d9 1 n} {radio europe {63 126 204 141} {} Europe DataSet(.pb.qs,continent) europe flat #000000 #d9d9d9 1 n} {radio africa {63 144 210 159} {} Africa DataSet(.pb.qs,continent) africa flat #000000 #d9d9d9 1 n} {entry entry18 {129 180 169 198} {} entry18 what entry18 sunken #000000 #fefefe 1 n} {label label19 {108 219 188 234} {} {records found} {} label19 flat #000000 #d9d9d9 1 n} {label label20 {90 219 105 234} {} { } nrecs label20 flat #000000 #d9d9d9 1 n} {label label21 {3 252 33 267} {} OID= {} label21 flat #000000 #d9d9d9 1 n} {label label22 {39 252 87 267} {} { } pbqs(oid) label22 flat #000000 #d9d9d9 1 n} {button button23 {9 276 79 300} {set oid {}\ |
| 86 | +catch {setoid $DataSet(.pb.qs,oid)}\ |
| 87 | +if {[stringtrim $oid]!=""} {\ |
| 88 | + sql_exec noquiet"update phonebook set name='$DataSet(.pb.qs,name)', phone_nr='$DataSet(.pb.qs,phone_nr)',city='$DataSet(.pb.qs,city)',company='$DataSet(.pb.qs,company)',continent='$DataSet(.pb.qs,continent)' where oid=$oid"\ |
| 89 | +} else {\ |
| 90 | + tk_messageBox-title Error-message"No record is displayed!"\ |
| 91 | +}\ |
| 92 | +\ |
| 93 | +}Update {} button23 raised#000000 #d9d9d9 1 n} {button button24 {210 276 280 300} {set thisname $DataSet(.pb.qs,name)\ |
| 94 | +if {[stringtrim $thisname]!=""} {\ |
| 95 | +\sql_exec noquiet"insert into phonebook values (\ |
| 96 | +\\'$DataSet(.pb.qs,name)',\ |
| 97 | +\\'$DataSet(.pb.qs,phone_nr)',\ |
| 98 | +\\'$DataSet(.pb.qs,city)',\ |
| 99 | +\\'$DataSet(.pb.qs,company)',\ |
| 100 | +\\'$DataSet(.pb.qs,continent)'\ |
| 101 | +\)"\ |
| 102 | +\tk_messageBox-title Information-message"A new record has been added!"\ |
| 103 | +} else {\ |
| 104 | +\tk_messageBox-title Error-message"This one doesn't have a name?"\ |
| 105 | +}\ |
| 106 | +\ |
| 107 | +} {Add record} {} button24 raised#000000 #d9d9d9 1 n} {button button25 {141 276 204 300} {DataControl(.pb.qs)::clearDataSet\ |
| 108 | +# clearcontrols stillinitialise\ |
| 109 | +# incorectly booleans controls to {}\ |
| 110 | +# so I force it to 'f' (false)\ |
| 111 | +set DataSet(.pb.qs,company) f\ |
| 112 | +focus .pb.name_entry} {Clear all} {} button25 raised#000000 #d9d9d9 1 n} {listbox allnames {249 6 435 231} {} listbox26 {} allnames sunken #000000 #fefefe 1 n} {label label27 {33 252 90 267} {} {} DataSet(.pb.qs,oid) label27 flat #000000 #d9d9d9 1 n} {label label28 {3 182 128 197} {} {Find name containing} {} {} flat #000000 #d9d9d9 1 n} |
| 113 | +Full featured formfull21 {FS {set entrydemo {nice}\ |
| 114 | +set color {no color selected}}} 377x418+50+130 {label label1 {3 396 165 411} {} {Status line} {} {} sunken #000000 #d9d9d9 2 n} {label label2 {171 396 369 411} {} {Grooved status line} {} {} groove #000098 #d9d9d9 2 f} {label label3 {108 9 270 31} {} { Full featured form} {} {} ridge #000000 #d9d9d9 4 {Times 16 bold italic}} {button button4 {15 210 144 243} {.full.lb insert end {it's} a nice demo form} {Java style button} {} {} groove #6161b6 #d9d9d9 2 b} {label label5 {15 42 115 58} {} {Java style label} {} {} flat #6161b6 #d9d9d9 1 b} {entry entry6 {123 39 279 60} {} entry6 entrydemo {} groove #000000 #fefefe 2 {Courier 13}} {listbox lb {12 69 147 201} {} listbox8 {} {} ridge #000000 #ffffc8 2 n} {button button9 {18 264 39 282} {} 1 {} {} flat #000000 #d9d9d9 1 n} {button button10 {48 264 68 282} {} 2 {} {} flat #000000 #d9d9d9 1 n} {button button11 {78 264 234 282} {} {and other hidden buttons} {} {} flat #000000 #d9d9d9 1 n} {text txt {153 69 372 201} {} text12 {} {} sunken #000000 #d4ffff 1 n} {button button13 {150 210 369 243} {.full.txt tag configure bold -font {Helvetica 12 bold}\ |
| 115 | +.full.txt tag configure italic-font {Helvetica12 italic}\ |
| 116 | +.full.txt tag configure large-font {Helvetica-14 bold}\ |
| 117 | +.full.txt tag configure title-font {Helvetica12 bold italic}-justify center\ |
| 118 | +.full.txt tag configure link-font {Helvetica-12 underline}-foreground#000080\ |
| 119 | +.full.txt tag configure code-font {Courier13}\ |
| 120 | +.full.txt tag configure warning-font {Helvetica12 bold}-foreground#800000\ |
| 121 | +\ |
| 122 | +# That't the way help files are written\ |
| 123 | +\ |
| 124 | +.full.txtdelete1.0 end\ |
| 125 | +.full.txt insert end {Centered title} {title}"\ |
| 126 | +\ |
| 127 | +You can make different" {}"portions of text bold" {bold}" or italic" {italic}".\ |
| 128 | +Some parts of them can be written as follows" {}"\ |
| 129 | +SELECT * FROM PHONEBOOK" {code}"\ |
| 130 | +You can also change" {}"colors for some words" {warning}"or underline them" {link} } {Old style button} {} {} raised#000000 #d9d9d9 2 n} {checkbox checkbox14 {48 297 153 309} {} different {} {} flat #00009c #d9d9d9 1 b} {checkbox checkbox15 {48 321 156 336} {} {fonts and} {} {} flat #cc0000 #d9d9d9 1 i} {checkbox checkbox16 {48 345 156 360} {} colors {} {} flat #00b600 #dfb2df 1 f} {radio radio17 {207 297 330 315} {} {red , rosu , rouge} color red flat #9c0000 #d9d9d9 1 n} {radio radio18 {207 321 324 333} {} {green , verde , vert} color green flat #009000 #d9d9d9 1 n} {radio radio19 {207 345 327 363} {} {blue , albastru, bleu} color blue flat #000000 #d9d9d9 1 n} {label selcolor {210 369 345 384} {} {} color {} flat #000000 #d9d9d9 1 n} {button button21 {285 258 363 285} {destroy .full} Exit {} {} raised #7c0000 #dfdbb8 1 b} |
| 131 | +Working with Tables namespacef313 {34567910111213} 377x263+59+127 {radio usa {362413836} {} USA selcont} {radio europe {364514160} {} Europe selcont} {radio africa {366614781} {} Africa selcont} {label label6 {999339114} {} {Select one of the above continentsand press} {}} {button button7 {27093354117} {Tables::open phonebook"continent='$selcont'" $selorder} {Show them} {}} {button button9 {66189312213} {Tables::design phonebook} {Show me the phonebook table structure} {}} {button button10 {141228240252} {destroy .f3} {Close the form} {}} {button button11 {93141282165} {Tables::open phonebook"company=true"} {Show me only the companies} {}} {radio name {1832426136} {} {Order by name} selorder} {radio phone_nr {1834526757} {} {Order by phonenumber} selorder} |
| 132 | +The simplest formmf5 {FS {set thename {}}} 306x136+82+146 {label label {42459960} {} Name {} label flat#000000 #d9d9d9 1 {Helvetica 12 bold italic}} {entry ename {120 42 219 63} {} entry2 thename ename sunken #000000 #fefefe 1 n} {button button3 {6 96 108 129} {set thename Teo} {Set the name} {} button3 raised #000000 #d9d9d9 1 n} {button button4 {192 96 300 129} {destroy .mf} {Close the form} {} button4 raised #000000 #d9d9d9 1 n} {button button5 {114 96 186 129} {set thename {}} {Clear it} {} button5 raised #000000 #d9d9d9 1 n} |
| 133 | +A simple demo formasdf 14 {FS {set color none}} 370x310+50+75 {label label1 {15 36 99 57} {} {Selected color} {} label1 flat #000000 #d9d9d9 1} {entry entry2 {111 36 225 54} {} entry2 color entry2 sunken #000000 #fefefe 1} {radio red {249 21 342 36} {} {Red as cherry} color red flat #900000 #d9d9d9 1} {radio green {249 45 342 60} {} {Green as a melon} color green flat #008800 #d9d9d9 1} {radio blue {249 69 342 84} {} {Blue as the sky} color blue flat #00008c #d9d9d9 1} {button button6 {45 69 198 99} {set color spooky} {Set a weird color} {} button6 ridge #0000b0 #dfbcdf 2} {label label7 {24 129 149 145} {} {The checkbox's value} {} label7 flat #000000 #d9d9d9 1} {entry entry8 {162 127 172 145} {} entry8 cbvalue entry8 sunken #000000 #fefefe 1} {checkbox checkbox9 {180 126 279 150} {} {Check me :-)} cbvalue checkbox9 flat #000000 #d9d9d9 1} {button button10 {219 273 366 303} {destroy .asdf} {Close that simple form} {} button10 raised #000000 #d9d9d9 1} {button button11 {219 237 366 267} {Forms::open "Phone book"} {Open my phone book} {} button11 raised #000000 #d9d9d9 1} {listbox lb {12 192 162 267} {} listbox12 {} lb sunken #000000 #fefefe 1} {button button13 {12 156 162 186} {.asdf.lb insert end red green blue cyan white navy black purple maroon violet} {Add some information} {} button13 raised #000000 #d9d9d9 1} {button button14 {12 273 162 303} {.asdf.lb delete 0 end} {Clear this listbox} {} button14 raised #000000 #d9d9d9 1} |
| 134 | +Working with listboxesf25 {FS {set thestudent""}} 257x263+139+147 {listbox lb {66246186} {} listbox1 {} lb sunken#000000 #ffffd4 1} {button button2 {9 234 124 258} {# Populate the listbox with some data\ |
| 135 | +#\ |
| 136 | +\ |
| 137 | +foreach student {John Bill Doe Gigi} {\ |
| 138 | +\.f2.lb insert end $student\ |
| 139 | +}\ |
| 140 | +\ |
| 141 | +\ |
| 142 | +\ |
| 143 | +# Binding the event left button release to the\ |
| 144 | +# list box\ |
| 145 | +\ |
| 146 | +bind .f2.lb<ButtonRelease-1> {\ |
| 147 | +\set idsel [.f2.lb curselection]\ |
| 148 | +\if {$idsel!=""} {\ |
| 149 | +\\set thestudent [.f2.lb get $idsel]\ |
| 150 | +\}\ |
| 151 | +}\ |
| 152 | +\ |
| 153 | +# Cleaning the variable thestudent\ |
| 154 | +\ |
| 155 | +set thestudent {}} {Show students} {} button2 groove#000000 #d9d9d9 2} {button button3 {132 234 247 258} {destroy .f2} {Close the form} {} button3 groove #000000 #d9d9d9 1} {label label4 {9 213 119 228} {} {You have selected} {} label4 flat #000000 #d9d9d9 1} {label label5 {129 213 219 228} {} {} thestudent label5 flat #00009a #d9d9d9 1} |
| 156 | +Invoicesinv0 {FS {frame .inv.f\ |
| 157 | +place .inv.f-x5-y100-width500-height300\ |
| 158 | +set wn [Tables::getNewWindowName]\ |
| 159 | +Tables::createWindow .inv.f\ |
| 160 | +set PgAcVar(mw,.inv.f,updatable)0\ |
| 161 | +set PgAcVar(mw,.inv.f,layout_found)0\ |
| 162 | +set PgAcVar(mw,.inv.f,layout_name)""\ |
| 163 | +Tables::selectRecords .inv.f"select * from cities"\ |
| 164 | +}} 631x439+87+84 |
| 165 | +\. |
| 166 | +COPY"pga_scripts"FROM stdin; |
| 167 | +How are forms keeped inside ?Tables::open pga_forms\ |
| 168 | +\ |
| 169 | +\ |
| 170 | +\ |
| 171 | + |
| 172 | +Opening a table with filtersTables::open phonebook"name ~* 'e'""name desc"\ |
| 173 | +\ |
| 174 | +\ |
| 175 | + |
| 176 | +AutoexecMainlib::tab_click Forms\ |
| 177 | +Forms::open {Full featured form}\ |
| 178 | +\ |
| 179 | +\ |
| 180 | + |
| 181 | +\. |
| 182 | +COPY"pga_reports"FROM stdin; |
| 183 | +My phone bookphonebookset PgAcVar(report,tablename) "phonebook" ; set PgAcVar(report,y_rpthdr) 21 ; set PgAcVar(report,y_pghdr) 47 ; set PgAcVar(report,y_detail) 66 ; set PgAcVar(report,y_pgfoo) 96 ; set PgAcVar(report,y_rptfoo) 126 ; .pgaw:ReportBuilder.c create text 10 35 -font -Adobe-Helvetica-Bold-R-Normal--*-120-*-*-*-*-*-* -anchor nw -text {name} -tags {t_l mov ro} ; .pgaw:ReportBuilder.c create text 10 52 -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-* -anchor nw -text {name} -tags {f-name t_f rg_detail mov ro} ; .pgaw:ReportBuilder.c create text 141 36 -font -Adobe-Helvetica-Bold-R-Normal--*-120-*-*-*-*-*-* -anchor nw -text {city} -tags {t_l mov ro} ; .pgaw:ReportBuilder.c create text 141 51 -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-* -anchor nw -text {city} -tags {f-city t_f rg_detail mov ro} ; .pgaw:ReportBuilder.c create text 231 35 -font -Adobe-Helvetica-Bold-R-Normal--*-120-*-*-*-*-*-* -anchor nw -text {phone_nr} -tags {t_l mov ro} ; .pgaw:ReportBuilder.c create text 231 51 -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-* -anchor nw -text {phone_nr} -tags {f-phone_nr t_f rg_detail mov ro}\N\N |
| 184 | +\. |
| 185 | +COPY"phonebook"FROM stdin; |
| 186 | +FIAT623463445teurope |
| 187 | +Gelu Voican01-32234Bucurestifeurope |
| 188 | +Radu Vasile01-5523423Bucurestifeurope |
| 189 | +MUGADUMBU SRL+92534662634Cairotafrica |
| 190 | +Jimmy Page66323452feurope |
| 191 | +IBM623346234\Ntusa |
| 192 | +John Doe+44352993825Washingtonfusa |
| 193 | +Bill Clinton+44359283845New Yorkfusa |
| 194 | +Monica Levintchi+44385234526Dallasfusa |
| 195 | +Bill Gates+42644523454Los Angelesfusa |
| 196 | +COMPAQ623462345\Ntusa |
| 197 | +SUN784563253\Ntusa |
| 198 | +DIGITAL922644516\Ntusa |
| 199 | +Frank Zappa6734567Montrealfusa |
| 200 | +Constantin Teodorescu+4039611820Brailafeurope |
| 201 | +Ngbendu Wazabanga34577345fafrica |
| 202 | +Mugabe Kandalam7635745fafrica |
| 203 | +Vasile Lupu52345623Bucurestifeurope |
| 204 | +Gica Farafrica+42644523454Los Angelesfusa |
| 205 | +Victor Ciorbea634567Bucurestifeurope |
| 206 | +\. |
| 207 | +COPY"pga_layout"FROM stdin; |
| 208 | +pga_forms2formname formsource82713 |
| 209 | +Usaisti5name phone_nr city company continent150150150150150 |
| 210 | +q15name phone_nr city company continent150150150150150 |
| 211 | +view_saved_from_that_query5name phone_nr city company continent150150150150150 |
| 212 | +phonebook5name phone_nr city company continent1501058066104 |
| 213 | +Query that can be savedas view5name phone_nr city company continent150150150150150 |
| 214 | +pg_database4datname datdba encoding datpath150150150150 |
| 215 | +pg_language5lanname lanispl lanpltrusted lanplcallfoid lancompiler150150150150150 |
| 216 | +cities3id name prefix60150150 |
| 217 | +3id name prefix125150150 |
| 218 | +3id name prefix150150150 |
| 219 | +3id name prefix150150150 |
| 220 | +3id name prefix150150150 |
| 221 | +\. |
| 222 | +COPY"pga_schema"FROM stdin; |
| 223 | +Simple schemacities1010 phonebook201.084.0{cities name phonebook city} |
| 224 | +\. |
| 225 | +COPY"cities"FROM stdin; |
| 226 | +3Braila4039 |
| 227 | +4Galati4036 |
| 228 | +5Dallas5362 |
| 229 | +6Cairo9352 |
| 230 | +1Bucuresti4013 |
| 231 | +7Montreal5325 |
| 232 | +\. |
| 233 | +CREATEUNIQUE INDEX "cities_id_key"on"cities" using btree ("id""int4_ops" ); |