|
| 1 | +CREATE SEQUENCE "cities_id_seq" start 7 increment 1 maxvalue 2147483647 minvalue 1 cache 1 ; |
| 2 | +SELECT nextval ('cities_id_seq'); |
| 3 | +CREATE TABLE "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 | +CREATE TABLE "pga_forms" ( |
| 12 | + "formname" character varying(64), |
| 13 | + "formsource" text); |
| 14 | +CREATE TABLE "pga_scripts" ( |
| 15 | + "scriptname" character varying(64), |
| 16 | + "scriptsource" text); |
| 17 | +CREATE TABLE "pga_reports" ( |
| 18 | + "reportname" character varying(64), |
| 19 | + "reportsource" text, |
| 20 | + "reportbody" text, |
| 21 | + "reportprocs" text, |
| 22 | + "reportoptions" text); |
| 23 | +CREATE TABLE "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 | +CREATE TABLE "pga_layout" ( |
| 30 | + "tablename" character varying(64), |
| 31 | + "nrcols" int2, |
| 32 | + "colnames" text, |
| 33 | + "colwidth" text); |
| 34 | +CREATE TABLE "pga_schema" ( |
| 35 | + "schemaname" character varying(64), |
| 36 | + "schematables" text, |
| 37 | + "schemalinks" text); |
| 38 | +REVOKE ALL on "pga_schema" from PUBLIC; |
| 39 | +GRANT ALL on "pga_schema" to PUBLIC; |
| 40 | +CREATE TABLE "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 ALL on "cities" from PUBLIC; |
| 45 | +GRANT UPDATE,DELETE,SELECT,RULE on "cities" to "fane"; |
| 46 | +GRANT ALL on "cities" to "liviu"; |
| 47 | +CREATE FUNCTION "getcityprefix" (int4 ) RETURNS varchar AS 'select prefix from cities where id = $1 ' LANGUAGE 'SQL'; |
| 48 | +COPY "pga_queries" FROM stdin; |
| 49 | +Query that can be saved as view S select * from phonebook where continent='usa' \N \N \N \N |
| 50 | +\. |
| 51 | +COPY "pga_forms" FROM stdin; |
| 52 | +Phone book pb 28 {FS {}} 444x307+284+246 {label label1 {33 10 68 28} {} 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 {set oid $DataSet(.pb.qs,oid)}\ |
| 87 | +if {[string trim $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 {[string trim $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 form full 21 {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 {Helvetica 12 italic}\ |
| 116 | +.full.txt tag configure large -font {Helvetica -14 bold}\ |
| 117 | +.full.txt tag configure title -font {Helvetica 12 bold italic} -justify center\ |
| 118 | +.full.txt tag configure link -font {Helvetica -12 underline} -foreground #000080\ |
| 119 | +.full.txt tag configure code -font {Courier 13}\ |
| 120 | +.full.txt tag configure warning -font {Helvetica 12 bold} -foreground #800000\ |
| 121 | +\ |
| 122 | +# That't the way help files are written\ |
| 123 | +\ |
| 124 | +.full.txt delete 1.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 namespace f3 13 {3 4 5 6 7 9 10 11 12 13} 377x263+59+127 {radio usa {36 24 138 36} {} USA selcont} {radio europe {36 45 141 60} {} Europe selcont} {radio africa {36 66 147 81} {} Africa selcont} {label label6 {9 99 339 114} {} {Select one of the above continents and press} {}} {button button7 {270 93 354 117} {Tables::open phonebook "continent='$selcont'" $selorder} {Show them} {}} {button button9 {66 189 312 213} {Tables::design phonebook} {Show me the phonebook table structure} {}} {button button10 {141 228 240 252} {destroy .f3} {Close the form} {}} {button button11 {93 141 282 165} {Tables::open phonebook "company=true"} {Show me only the companies} {}} {radio name {183 24 261 36} {} {Order by name} selorder} {radio phone_nr {183 45 267 57} {} {Order by phone number} selorder} |
| 132 | +The simplest form mf 5 {FS {set thename {}}} 306x136+82+146 {label label {42 45 99 60} {} 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 form asdf 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 listboxes f2 5 {FS {set thestudent ""}} 257x263+139+147 {listbox lb {6 6 246 186} {} 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 | +Invoices inv 0 {FS {frame .inv.f\ |
| 157 | +place .inv.f -x 5 -y 100 -width 500 -height 300\ |
| 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 filters Tables::open phonebook "name ~* 'e'" "name desc"\ |
| 173 | +\ |
| 174 | +\ |
| 175 | + |
| 176 | +Autoexec Mainlib::tab_click Forms\ |
| 177 | +Forms::open {Full featured form}\ |
| 178 | +\ |
| 179 | +\ |
| 180 | + |
| 181 | +\. |
| 182 | +COPY "pga_reports" FROM stdin; |
| 183 | +My phone book phonebook set 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 | +FIAT 623463445 t europe |
| 187 | +Gelu Voican 01-32234 Bucuresti f europe |
| 188 | +Radu Vasile 01-5523423 Bucuresti f europe |
| 189 | +MUGADUMBU SRL +92 534662634 Cairo t africa |
| 190 | +Jimmy Page 66323452 f europe |
| 191 | +IBM 623346234 \N t usa |
| 192 | +John Doe +44 35 2993825 Washington f usa |
| 193 | +Bill Clinton +44 35 9283845 New York f usa |
| 194 | +Monica Levintchi +44 38 5234526 Dallas f usa |
| 195 | +Bill Gates +42 64 4523454 Los Angeles f usa |
| 196 | +COMPAQ 623462345 \N t usa |
| 197 | +SUN 784563253 \N t usa |
| 198 | +DIGITAL 922644516 \N t usa |
| 199 | +Frank Zappa 6734567 Montreal f usa |
| 200 | +Constantin Teodorescu +40 39 611820 Braila f europe |
| 201 | +Ngbendu Wazabanga 34577345 f africa |
| 202 | +Mugabe Kandalam 7635745 f africa |
| 203 | +Vasile Lupu 52345623 Bucuresti f europe |
| 204 | +Gica Farafrica +42 64 4523454 Los Angeles f usa |
| 205 | +Victor Ciorbea 634567 Bucuresti f europe |
| 206 | +\. |
| 207 | +COPY "pga_layout" FROM stdin; |
| 208 | +pga_forms 2 formname formsource 82 713 |
| 209 | +Usaisti 5 name phone_nr city company continent 150 150 150 150 150 |
| 210 | +q1 5 name phone_nr city company continent 150 150 150 150 150 |
| 211 | +view_saved_from_that_query 5 name phone_nr city company continent 150 150 150 150 150 |
| 212 | +phonebook 5 name phone_nr city company continent 150 105 80 66 104 |
| 213 | +Query that can be saved as view 5 name phone_nr city company continent 150 150 150 150 150 |
| 214 | +pg_database 4 datname datdba encoding datpath 150 150 150 150 |
| 215 | +pg_language 5 lanname lanispl lanpltrusted lanplcallfoid lancompiler 150 150 150 150 150 |
| 216 | +cities 3 id name prefix 60 150 150 |
| 217 | + 3 id name prefix 125 150 150 |
| 218 | + 3 id name prefix 150 150 150 |
| 219 | + 3 id name prefix 150 150 150 |
| 220 | + 3 id name prefix 150 150 150 |
| 221 | +\. |
| 222 | +COPY "pga_schema" FROM stdin; |
| 223 | +Simple schema cities 10 10 phonebook 201.0 84.0 {cities name phonebook city} |
| 224 | +\. |
| 225 | +COPY "cities" FROM stdin; |
| 226 | +3 Braila 4039 |
| 227 | +4 Galati 4036 |
| 228 | +5 Dallas 5362 |
| 229 | +6 Cairo 9352 |
| 230 | +1 Bucuresti 4013 |
| 231 | +7 Montreal 5325 |
| 232 | +\. |
| 233 | +CREATE UNIQUE INDEX "cities_id_key" on "cities" using btree ( "id" "int4_ops" ); |
0 commit comments