Upgrade to v0.86

This commit is contained in:
Marc G. Fournier 1998-03-29 21:52:54 +00:00
parent 748fab8d5d
commit 9c93fa2e4a
6 changed files with 298 additions and 274 deletions

View File

@ -1,7 +1,5 @@
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Copyright (c) 1994-7 Regents of the University of California Copyright (c) 1994-7 Regents of the University of California
Permission to use, copy, modify, and distribute this software and its Permission to use, copy, modify, and distribute this software and its
@ -21,10 +19,10 @@ AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO
PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
---------------------------------------------------------------------------
PGACCESS 0.86 29 March 1998
PGACCESS 0.83 11 March 1998
================================ ================================
I dedicate this program to my little 4 year daughter Ana-Maria and my wife I dedicate this program to my little 4 year daughter Ana-Maria and my wife
for their understanding. I hope they will forgive me for spending so many for their understanding. I hope they will forgive me for spending so many
@ -38,15 +36,15 @@ First of all because PostgreSQL lacks a graphical interface where you
can manage your tables, edit them, define queries, sequences and can manage your tables, edit them, define queries, sequences and
functions. functions.
I use Tcl/Tk because it's a powerfull language, and it took me only I use Tcl/Tk because it's a powerful language, and it took me only
four days of hard work to get it as you see it now. four days of hard work to get it as you see it now.
2.How to INSTALL ? 2.How to INSTALL ?
You will need Tcl/Tk package, I am using now Tcl 7.6 and Tk 4.2. There You will need Tcl/Tk package, I am using now Tcl 7.6 and Tk 4.2.
are some problems running under Tcl/Tk 8.0 but I will soon fix them. PgAccess is running also on Tcl/Tk 8.0
Also, you will need the PostgreSQL to Tcl interface library, lined as a Also, you will need the PostgreSQL to Tcl interface library, lined as a
Tcl/Tk 'load'-able module. It is called libpgtcl and the source is Tcl/Tk 'load'-able module. It is called libpgtcl and the source is
@ -65,7 +63,9 @@ go for it.
You run it with the command: You run it with the command:
wish -f pgaccess.tcl wish -f pgaccess.tcl [database]
[database] is optional.
Another way of loading the PostgreSQL library is running it with pgwish. Another way of loading the PostgreSQL library is running it with pgwish.
It's a wish compiled with libpgtcl library so it could understand the It's a wish compiled with libpgtcl library so it could understand the
@ -82,7 +82,7 @@ pgaccess.tcl file.
- Saves preferences in ~/pgaccessrc file - Saves preferences in ~/pgaccessrc file
Tables Tables
- opening tables for vieweing, max 200 records - opening tables for viewing, max 200 records
- column resizing by dragging the vertical grid lines - column resizing by dragging the vertical grid lines
- text will wrap in cells now - text will wrap in cells now
- dynamic row height when editing - dynamic row height when editing
@ -93,7 +93,7 @@ Tables
- editing in place, double click the text you want to change - editing in place, double click the text you want to change
- record deleting , point the record, press Del key - record deleting , point the record, press Del key
- adding new records ,save new row with right-button-click on table for the moment - adding new records ,save new row with right-button-click on table for the moment
- table generator assistant lizzard :-) (not wizzard) - table generator assistant
- table renaming and deleting (dropping) - table renaming and deleting (dropping)
- table information retrieving : owner, field information, indexes - table information retrieving : owner, field information, indexes
@ -102,7 +102,7 @@ Queries
- save view layout - save view layout
- can store queries as views - can store queries as views
- execution of queries - execution of queries
- vieweing of select type queries result - viewing of select type queries result
- running action queries (insert, update, delete) - running action queries (insert, update, delete)
- visual query builder with drag & drop support, table aliasing - visual query builder with drag & drop support, table aliasing
@ -128,7 +128,7 @@ Reports
Forms Forms
- open user defined forms - open user defined forms
- form design module available - form design module available
- query widget allowing access to a recordset - query widget allowing access to a record set
Scripts Scripts
- define, modify and call user defined scripts - define, modify and call user defined scripts
@ -137,17 +137,17 @@ Scripts
- table design (add new fields, renaming, etc) - table design (add new fields, renaming, etc)
- sequence and function renaming - sequence and function renaming
- more powerfull report generator and viewer - more powerful report generator and viewer
- help on line - help on line
6. How you should report the errors? 6. How you should report the errors?
First of all : operating system, PostgreSQL version,Tcl/Tk version. First of all : operating system, PostgreSQL version,Tcl/Tk version.
A more detailed story of what have you done when error had occured. A more detailed story of what have you done when error had occurred.
Tcl/Tk stops usually with a error message and there is a button there Tcl/Tk stops usually with a error message and there is a button there
"Stack Trace" and if you press it, you will see a detailed information "Stack Trace" and if you press it, you will see a detailed information
about the place where it stucks. Please send it to me. about the place where it stuck. Please send it to me.
Some information about table structure, no. of fields, records would Some information about table structure, no. of fields, records would
be also good. be also good.

View File

@ -5,13 +5,22 @@ CREATE TABLE pga_reports (reportname varchar(64), reportsource text, reportbody
CREATE TABLE phonebook (name varchar(32), phone_nr varchar(16), city varchar(32), company bool, continent char16); CREATE TABLE phonebook (name varchar(32), phone_nr varchar(16), city varchar(32), company bool, continent char16);
CREATE TABLE pga_layout (tablename varchar(64), nrcols int2, colnames text, colwidth text); CREATE TABLE pga_layout (tablename varchar(64), nrcols int2, colnames text, colwidth text);
COPY pga_queries FROM stdin; COPY pga_queries FROM stdin;
Query that can be saved as view S select * from phonebook where continent='usa'
\. \.
COPY pga_forms FROM stdin; COPY pga_forms FROM stdin;
A simple demo form asdf 14 {1 2 3 4 5 6 7 8 9 10 11 12 13 14} 377x315+170+155 {label label1 {15 36 99 57} {} {Selected color} {}} {entry entry2 {111 36 225 54} {} entry2 color} {radio red {249 21 342 36} {} {Red as cherry} color} {radio green {249 45 342 60} {} {Green as a melon} color} {radio blue {249 69 342 84} {} {Blue as the sky} color} {button button6 {45 69 198 99} {set color spooky} {Set a weird color} {}} {label label7 {24 129 138 147} {} {The checkbox's value} {}} {entry entry8 {162 129 172 147} {} entry8 cbvalue} {checkbox checkbox9 {180 126 279 150} {} {Check me :-)} cbvalue} {button button10 {219 273 366 303} {destroy .asdf} {Close that simple form} {}} {button button11 {219 237 366 267} {open_form "Phone book"} {Open my phone book} {}} {listbox lb {12 192 162 267} {} listbox12 {}} {button button13 {12 156 162 186} {.asdf.lb insert end red green blue cyan white navy black purple maroon violet} {Add some information} {}} {button button14 {12 273 162 303} {.asdf.lb delete 0 end} {Clear this listbox} {}}
Phone book pb 26 {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26} 444x310+284+246 {label label1 {33 12 63 30} {} Name {}} {entry name_entry {87 9 217 30} {} entry2 pbqs(name)} {label label3 {33 39 73 54} {} Phone {}} {entry entry4 {87 36 195 57} {} entry4 pbqs(phone_nr)} {label label5 {33 66 78 84} {} City {}} {entry entry6 {87 63 195 84} {} entry6 pbqs(city)} {query qs {3 6 33 33} {} query7 {}} {button button8 {126 177 198 203} {.pb.qs:setsql "select oid,* from phonebook where name ~* '$what' order by name"\ Phone book pb 26 {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26} 444x310+284+246 {label label1 {33 12 63 30} {} Name {}} {entry name_entry {87 9 217 30} {} entry2 pbqs(name)} {label label3 {33 39 73 54} {} Phone {}} {entry entry4 {87 36 195 57} {} entry4 pbqs(phone_nr)} {label label5 {33 66 78 84} {} City {}} {entry entry6 {87 63 195 84} {} entry6 pbqs(city)} {query qs {3 6 33 33} {} query7 {}} {button button8 {126 177 198 203} {.pb.qs:setsql "select oid,* from phonebook where name ~* '$what' order by name"\
.pb.qs:open\ .pb.qs:open\
set nrecs [.pb.qs:nrecords]\ set nrecs [.pb.qs:nrecords]\
.pb.qs:updatecontrols\ .pb.qs:updatecontrols\
.pb.qs:fill .pb.allnames name} Find {}} {button button9 {159 276 229 302} {.pb.qs:close\ .pb.qs:fill .pb.allnames name\
bind .pb.allnames <ButtonRelease-1> {\
set ancr [.pb.allnames curselection]\
if {$ancr!=""} {\
\ .pb.qs:moveto $ancr\
\ .pb.qs:updatecontrols\
}\
}} Find {}} {button button9 {159 276 229 302} {.pb.qs:close\
.pb.qs:clearcontrols\ .pb.qs:clearcontrols\
set nrecs {}\ set nrecs {}\
set what {}\ set what {}\
@ -46,7 +55,6 @@ tk_messageBox -title Information -message "A new record has been added!"\
# so I force it to 'f' (false)\ # so I force it to 'f' (false)\
set pbqs(company) f\ set pbqs(company) f\
focus .pb.name_entry} New {}} {listbox allnames {246 12 432 240} {} listbox26 {}} focus .pb.name_entry} New {}} {listbox allnames {246 12 432 240} {} listbox26 {}}
A simple demo form asdf 14 {1 2 3 4 5 6 7 8 9 10 11 12 13 14} 377x315+170+155 {label label1 {15 36 99 57} {} {Selected color} {}} {entry entry2 {111 36 225 54} {} entry2 color} {radio red {249 21 342 36} {} {Red as cherry} color} {radio green {249 45 342 60} {} {Green as a melon} color} {radio blue {249 69 342 84} {} {Blue as the sky} color} {button button6 {45 69 198 99} {set color spooky} {Set a weird color} {}} {label label7 {24 129 138 147} {} {The checkbox's value} {}} {entry entry8 {162 129 172 147} {} entry8 cbvalue} {checkbox checkbox9 {180 126 279 150} {} {Check me :-)} cbvalue} {button button10 {219 273 366 303} {destroy .asdf} {Close that simple form} {}} {button button11 {219 237 366 267} {open_form "Phone book"} {Open my phone book} {}} {listbox lb {12 192 162 267} {} listbox12 {}} {button button13 {12 156 162 186} {.asdf.lb insert end red green blue cyan white navy black purple maroon violet} {Add some information} {}} {button button14 {12 273 162 303} {.asdf.lb delete 0 end} {Clear this listbox} {}}
\. \.
COPY pga_scripts FROM stdin; COPY pga_scripts FROM stdin;
How are forms keeped inside ? open_table pga_forms\ How are forms keeped inside ? open_table pga_forms\
@ -69,9 +77,14 @@ MUGADUMBU +92 534662634 \N t africa
Frank Zappa 6734567 Montreal f usa Frank Zappa 6734567 Montreal f usa
Jimmy Page 66323452 f europe Jimmy Page 66323452 f europe
Constantin Teodorescu +40 39 611820 Braila f europe Constantin Teodorescu +40 39 611820 Braila f europe
NGBENDU Wazabanga 34577345 \N f africa Ngbendu Wazabanga 34577345 f africa
Victor Ciorbea 634567 Bucuresti f europe
Mugabe Kandalam 7635745 f africa
\. \.
COPY pga_layout FROM stdin; COPY pga_layout FROM stdin;
pga_forms 2 formname formsource 82 713 pga_forms 2 formname formsource 82 713
phonebook 5 name phone_nr city company continent 150 105 80 66 85 phonebook 5 name phone_nr city company continent 150 105 80 66 85
Usaisti 5 name phone_nr city company continent 150 150 150 150 150
q1 5 name phone_nr city company continent 150 150 150 150 150
view_saved_from_that_query 5 name phone_nr city company continent 150 150 150 150 150
\. \.

View File

@ -1,188 +1,182 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML> <HTML>
<HEAD> <HEAD>
<TITLE></TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; Linux 2.0.32 i586) [Netscape]"> <META NAME="GENERATOR" CONTENT="Mozilla/4.04 [en] (X11; I; Linux 2.0.32 i586) [Netscape]">
</HEAD> </HEAD>
<BODY TEXT="#000000" BGCOLOR="#FFEBCD" LINK="#0000EF" VLINK="#51188E" ALINK="#FF0000"> <BODY TEXT="#000000" BGCOLOR="#FFEBCD" LINK="#0000EF" VLINK="#51188E" ALINK="#FF0000">
<H1>FORMS</H1> <H1>
FORMS</H1>
<P> <HR WIDTH="100%">
<HR WIDTH="100%"></P>
<P>This version (0.83) of PgAccess has changed a little the visual form <P>This version (0.83) of PgAccess has changed a little the visual form
builder introduced since 0.82 version : variable handling, query-results builder introduced since 0.82 version : variable handling, query results
interface and control bindings naming convention. Please read it carefully, interface and control bindings naming convention. Please read it carefully,
download the database demo and practice a while before trying to design download the database demo and practice a while before trying to design
your own forms.</P> your own forms.
<P>For the moment, it has only some basic widgets : labels, entries, buttons <P>For the moment, it has only some basic widgets : labels, entries, buttons
, listboxes , checkboxes and radiobuttons.</P> , listboxes , checkboxes and radiobuttons.
<P>Also there is a pseudo query widget that allows you yo have access to <P>Also there is a pseudo query widget that allows you yo have access to
a query results. </P> a query results.
<P><B>How do you generate widgets :</B></P>
<P><B>How do you generate widgets :</B>
<OL> <OL>
<LI>select a widget from the toolbox by clicking the appropriate radiobutton</LI> <LI>
select a widget from the toolbox by clicking the appropriate radiobutton</LI>
<LI>move to the canvas , point with the mouse at the desired location and <LI>
click the mouse button to begin</LI> move to the canvas , point with the mouse at the desired location and click
the mouse button to begin</LI>
<LI>keeping the mouse-button pressed move the mouse in order to draw a <LI>
rectangle that will hold the widget</LI> keeping the mouse-button pressed move the mouse in order to draw a rectangle
that will hold the widget</LI>
<LI>release the mouse-button </LI> <LI>
release the mouse-button</LI>
</OL> </OL>
In the rectangle that you have designed it will appear the selected object.
<P>In the rectangle that you have designed it will appear the selected <BR>Move now to the attribute window to change some of its properties.
object.<BR>
Move now to the attribute window to change some of its properties.</P>
<P>Renaming, resizing items are possible (for the moment) only by modifying <P>Renaming, resizing items are possible (for the moment) only by modifying
appropriate parameters in attribute window. You <B>must </B>press Enter appropriate parameters in attribute window. You <B>must </B>press Enter
in the edit field after changing a value in order to be accepted. </P> in the edit field after changing a value in order to be accepted.
<P>You can also move items by dragging them or delete them by pressing <P>You can also move items by dragging them or delete them by pressing
Del key after selecting them.</P> Del key after selecting them.
<P>In attribute window, there are some fields named <B><TT><FONT SIZE=+1>Command <P>In attribute window, there are some fields named <B><TT><FONT SIZE=+1>Command
</FONT></TT></B>and <B><TT><FONT SIZE=+1>Variable</FONT></TT></B>. </P> </FONT></TT></B>and <B><TT><FONT SIZE=+1>Variable</FONT></TT></B>.
<P>The field <B><TT><FONT SIZE=+1>Command </FONT></TT></B>have meaning <P>The field <B><TT><FONT SIZE=+1>Command </FONT></TT></B>have meaning
only for Button widgets and holds the command that will be invoked when only for Button widgets and holds the command that will be invoked when
the button is pressed. </P> the button is pressed.
<P>&nbsp;&nbsp;&nbsp;&nbsp;The field <B><TT><FONT SIZE=+1>Variable </FONT></TT></B>have <P>&nbsp;&nbsp;&nbsp; The field <B><TT><FONT SIZE=+1>Variable </FONT></TT></B>have
meaning only for EditField , Label widgets , checkboxes and radiobuttons meaning only for EditField , Label widgets , checkboxes and radiobuttons
and it is the name of the global variable that will hold the value for and it is the name of the global variable that will hold the value for
that widget. For checkboxes the values are <B>t</B> and <B>f</B> (from that widget. For checkboxes the values are <B>t</B> and <B>f</B> (from
true and false) in order to simplify binding to logical data fields (PgAccess true and false) in order to simplify binding to logical data fields (PgAccess
0.82 used 0 and 1).</P> 0.82 used 0 and 1).
<P>&nbsp;&nbsp;&nbsp;&nbsp;For radiobuttons, it is usual to assign the <P>&nbsp;&nbsp;&nbsp; For radiobuttons, it is usual to assign the same
same variable to the same radiobuttons within the same group. That variable variable to the same radiobuttons within the same group. That variable
will contain the name of the widget of the radiobutton that has been pressed. will contain the name of the widget of the radiobutton that has been pressed.
Let's presume that you have entered 3 radiobuttons named red, green and Let's presume that you have entered 3 radiobuttons named red, green and
blue, all of them having the same variable named color. If you will press blue, all of them having the same variable named color. If you will press
them, they will assign their names to global variable.</P> them, they will assign their names to global variable.
<P>&nbsp;&nbsp;&nbsp;&nbsp;In order to make a simple test, put an entry <P>&nbsp;&nbsp;&nbsp; In order to make a simple test, put an entry field
field and set it's variable to <B>v1</B> and a button who's command is and set it's variable to <B>v1</B> and a button who's command is "set v1
&quot;set v1 whisky&quot;. Press the button &quot;Test form&quot; and click whisky". Press the button "Test form" and click on the button. In that
on the button. In that entry should appear whisky. <BR> entry should appear whisky.
Another test is defining in Script module a script called &quot;My first <BR>Another test is defining in Script module a script called "My first
script&quot; having the following commands: <BR> script" having the following commands:
<TT><FONT SIZE=+1>tk_messageBox -title Warning -message &quot;This is my <BR><TT><FONT SIZE=+1>tk_messageBox -title Warning -message "This is my
first message!&quot;</FONT></TT> <BR> first message!"</FONT></TT>
and then define a button who's command is <B><TT><FONT SIZE=+1>execute_script <BR>and then define a button who's command is <B><TT><FONT SIZE=+1>execute_script
&quot;My first script&quot;</FONT></TT></B>. </P> "My first script"</FONT></TT></B>.
<H2>
<H2>Database manipulation</H2> Database manipulation</H2>
Let's presume that our form have the internal name <B><TT>mf </TT></B>(my
<P>Let's presume that our form have the internal name <B><TT>mf </TT></B>(my
form). He will be referred inside the Tcl/Tk source as <B><TT>.mf</TT></B> form). He will be referred inside the Tcl/Tk source as <B><TT>.mf</TT></B>
<BR> <BR>If you want to close the form in run-time you have to issue the command
If you want to close the form in run-time you have to issue the command <B><TT>destroy .mf</TT></B>
<B><TT>destroy .mf</TT></B> </P>
<P>Also, any widget will have the name prefixed by <B><TT>.mf&nbsp;</TT></B>&nbsp;&nbsp;&nbsp;&nbsp; <P>Also, any widget will have the name prefixed by <B><TT>.mf&nbsp;</TT></B>&nbsp;&nbsp;&nbsp;&nbsp;
We will have <B><TT>.mf.button1</TT></B> or <B><TT>.mf.listbox1</TT></B> We will have <B><TT>.mf.button1</TT></B> or <B><TT>.mf.listbox1</TT></B>
. </P> .
<P>We can name the query widget <B><TT>qry</TT></B> for example. The complete <P>We can name the query widget <B><TT>qry</TT></B> for example. The complete
name will be <B><TT>.mf.qry</TT></B> then. <BR> name will be <B><TT>.mf.qry</TT></B> then.
The <B><TT>Command </TT></B>property of the query widget must contain the <BR>The <B><TT>Command </TT></B>property of the query widget must contain
SQL command that will be executed. <BR> the SQL command that will be executed.
When the form will be in run-time, automatically you will have acces to <BR>When the form will be in run-time, automatically you will have access
the following procedures and functions : </P> to the following procedures and functions :
<P><B><TT>.mf.qry:open</TT></B> - opens the connection and execute the <P><B><TT>.mf.qry:open</TT></B> - opens the connection and execute the
query (returns nothing) <BR> query (returns nothing)
<B><TT>.mf.qry:setsql newsql</TT></B> - set the command query that will <BR><B><TT>.mf.qry:setsql newsql</TT></B> - set the command query that
be executed at the next <B><TT>.mf.qry:open<BR> will be executed at the next <B><TT>.mf.qry:open</TT></B>
.mf.qry:nrecords</TT></B> - returns the number of records in the selected <BR><B><TT>.mf.qry:nrecords</TT></B> - returns the number of records in
query <BR> the selected query
<B><TT>.mf.qry:crtrecord </TT></B>- returns the current record number inside <BR><B><TT>.mf.qry:crtrecord </TT></B>- returns the current record number
the query result<BR> inside the query result
<B><TT>.mf.qry:fields</TT></B> - returns a list of the fields in the result <BR><B><TT>.mf.qry:fields</TT></B> - returns a list of the fields in the
set <BR> result set
<B><TT>.mf.qry:movefirst</TT></B> - move the cursor to the first record <BR><B><TT>.mf.qry:movefirst</TT></B> - move the cursor to the first record
in the recordset <BR> in the recordset
<TT><B>.mf.qry:movelast</B> , <B>.mf.qry:movenext</B> , <B>.mf.qry:moveprevious</B> <BR><B><TT>.mf.qry:movelast</TT></B><TT> , <B>.mf.qry:movenext</B> , <B>.mf.qry:moveprevious</B>
</TT>- moves the cursor there<BR> </TT>- moves the cursor there
<B><TT>.mf.qry:moveto newrecno</TT></B> - move the cursor to that new record <BR><B><TT>.mf.qry:moveto newrecno</TT></B> - move the cursor to that new
number (first is 0)<BR> record number (first is 0)
<B><TT>.mf.qry:updatecontrols</TT></B> - update the variables inside the <BR><B><TT>.mf.qry:updatecontrols</TT></B> - update the variables inside
designed form that have a particular name (I'll explain later) <BR> the designed form that have a particular name (I'll explain later)
<B><TT>.mf.qry:clearcontrols</TT></B> - clear the variables inside the <BR><B><TT>.mf.qry:clearcontrols</TT></B> - clear the variables inside
designed form binded to a query result<BR> the designed form binded to a query result
<TT><B>.mf.qry:fill listbox field</B> </TT>- fill the named listbox (whole <BR><B><TT>.mf.qry:fill listbox field</TT></B><TT> </TT>- fill the named
widget name as <B><TT>.mf.listbox1</TT></B>) with the all the values of listbox (whole widget name as <B><TT>.mf.listbox1</TT></B>) with the all
that field in the current queryresult<BR> the values of that field in the current queryresult
<B><TT>.mf.qry:close</TT></B> - close the connection (<B><FONT COLOR="#FF0000">if <BR><B><TT>.mf.qry:close</TT></B> - close the connection (<B><FONT COLOR="#FF0000">if
you don't close the query result, you will loose some memory</FONT></B>) you don't close the query result, you will loose some memory</FONT></B>)
</P>
<P>It's no need to close a query-result if you want to assign it a new <P>It's no need to close a query-result if you want to assign it a new
SQL command and open it again. That will be done automatically.</P> SQL command and open it again. That will be done automatically.
<P>If you want to bound some controls to the fields of the recordset, you <P>If you want to bound some controls to the fields of the recordset, you
will have to name their associate variable like that : </P> will have to name their associate variable like that :
<P><B><TT>mfqry(salary)</TT></B> to get the &quot;salary&quot; field , <P><B><TT>mfqry(salary)</TT></B> to get the "salary" field , or <B><TT>mfqry(name)</TT></B>
or <B><TT>mfqry(name)</TT></B> to get the &quot;name&quot; field. So, you to get the "name" field. So, you take the internal name of the form (without
take the internale name of the form (without the leading point) and merge the leading point) and merge it with the query-widget name and you will
it with the query-widget name and you will get a associative arrayname. get a associative array name. The values are given using the field name
The values are given using the field name as a key in this associative as a key in this associative array.
array.<BR> <BR><B><FONT COLOR="#FF0000">* WARNING *</FONT></B> The naming style has
<B><FONT COLOR="#FF0000">* WARNING *</FONT></B> The naming style has been been changed from 0.82 version of PgAccess and I cannot guarantee that
changed from 0.82 version of PgAccess and I cannot guarantee that it not it not be changed again in the future. I'm just trying to make it as simple
be changed again in the future. I'm just trying to make it as simple it it could be. The old style naming convention had some incompatibilities
could be. The old style naming convention had some incompatibilities with with Tcl/Tk syntax.
Tcl/Tk syntax.</P>
<P><B><FONT SIZE=+1><FONT COLOR="#9400D3">QUESTION</FONT> : </FONT></B>Do <P><B><FONT SIZE=+1><FONT COLOR="#9400D3">QUESTION</FONT> : </FONT></B>Do
you think that it would be more clear if the above functions and procedures you think that it would be more clear if the above functions and procedures
regarding a query-widget would be named in a similar manner as binded variable regarding a query-widget would be named in a similar manner as binded variable
controls ? That mean, <B><TT>mfqry:open</TT></B> and <B><TT>mfqry:updatecontrols</TT></B> controls ? That mean, <B><TT>mfqry:open</TT></B> and <B><TT>mfqry:updatecontrols</TT></B>
instead of <B><TT>.mf.qry:open</TT></B> and <B><TT>.mf.qry:updatecontrols</TT></B> instead of <B><TT>.mf.qry:open</TT></B> and <B><TT>.mf.qry:updatecontrols</TT></B>
?</P> ?
<P>The only advantage of <B><TT>.mf.qry:open</TT></B> is that is much closer <P>The only advantage of <B><TT>.mf.qry:open</TT></B> is that is much closer
to the Tk method of referring objects within a window and it may give to to the Tk method of referring objects within a window and it may give to
the programmer the feeling that he is using a object-oriented widget. Since the programmer the feeling that he is using a object-oriented widget. Since
I cannot use further for naming binded variables a similar manner (<B><TT>.mf.qry.salary)</TT></B> I cannot use further for naming binded variables a similar manner (<B><TT>.mf.qry.salary)</TT></B>
it might be possible to abandon that naming convention .</P> it might be possible to abandon that naming convention .
<P>Here it is a dumped <B><A HREF="formdemo.sql">sample database</A></B> <P>Here it is a dumped <B><A HREF="formdemo.sql">sample database</A></B>
that contains a demo database. What should you do ?<BR> that contains a demo database. What should you do ?
Shift-click the above URL in order to download that tiny file (4 Kb). Create <BR>Shift-click the above URL in order to download that tiny file (4 Kb).
a empty database and <B><TT>psql yourdatabase &lt;formdemo.sql</TT></B></P> Create a empty database and <B><TT>psql yourdatabase &lt;formdemo.sql</TT></B>
<P>You should find a single table called &quot;phonebook&quot; a form called <P>You should find a single table called "phonebook" a form called "Phone
&quot;Phone book&quot; and another &quot;A simple demo form&quot;.</P> book" and another "A simple demo form".
<P>First of all enter and view the phonebook table in table view. Note <P>First of all enter and view the phonebook table in table view. Note
the fields and their values.<BR> the fields and their values.
Open the &quot;Phone book&quot; form and enter a letter (a, e or i) in <BR>Open the "Phone book" form and enter a letter (a, e or i) in the field
the field to the left of &quot;Find&quot; button then press Find. It's to the left of "Find" button then press Find. It's fine to enter one letter
fine to enter one letter in order to get more records in query result. in order to get more records in query result. You will get information
You will get information about the number of records selected, in the listbox about the number of records selected, in the listbox you will see all the
you will see all the values of field &quot;name&quot; from the current values of field "name" from the current data set. Use buttons to move to
data set. Use buttons to move to first, next, previous or last record within first, next, previous or last record within the record set.
the record set.</P>
<P>In order to add a new record, press the &quot;New&quot; button in order <P>In order to add a new record, press the "New" button in order to get
to get new, clean entries. Fill them with your data and press &quot;Add new, clean entries. Fill them with your data and press "Add new" button.
new&quot; button. A new phonebook record will be added. Also, if you want A new phonebook record will be added. Also, if you want to update a record,
to update a record, change it's values in the displayed fields after finding change it's values in the displayed fields after finding it and press "Update"
it and press &quot;Update&quot; button. The values will be updated in the button. The values will be updated in the database BUT NOT IN THE CURRENT
database BUT NOT IN THE CURRENT QUERY RESULT . If you want to see them QUERY RESULT . If you want to see them modified, make a new query trying
modified, make a new query trying to find it again.</P> to find it again.
<P><FONT COLOR="#000080">Before using the results from a query you should <P><FONT COLOR="#000080">Before using the results from a query you should
know that the information that has been retrieved could be found only in know that the information that has been retrieved could be found only in
@ -194,31 +188,29 @@ data set !!! For example fields gathered from multiple tables or summary
fields. It isn't just simple to make an automatic update procedure. The fields. It isn't just simple to make an automatic update procedure. The
programmer must know how to make the update or the append procedure, sometimes programmer must know how to make the update or the append procedure, sometimes
using key fields to point to the desired record or an OID. There are examples using key fields to point to the desired record or an OID. There are examples
in the demo database in &quot;Phone book&quot; form. It may be possible in the demo database in "Phone book" form. It may be possible that in the
that in the future, I will develop another pseudo-widget describing a table. future, I will develop another pseudo-widget describing a table. It would
It would be more simple than to implement an update or append or even a be more simple than to implement an update or append or even a delete procedure.</FONT>
delete procedure.</FONT></P>
<P>There is in the demo database also another simple form called &quot;A <P>There is in the demo database also another simple form called "A simple
simple demo form&quot;. It will show you how to handle variables from checkboxes, demo form". It will show you how to handle variables from checkboxes, radiobuttons,
radiobuttons, how to use listboxes, open another forms and so on. I think how to use listboxes, open another forms and so on. I think they will help
they will help you.</P> you.
<P>In order to avoid naming user defined forms with&nbsp; a particular <P>In order to avoid naming user defined forms with&nbsp; a particular
name of another PgAccess form, I would recommend naming them as udf0, udf1 name of another PgAccess form, I would recommend naming them as udf0, udf1
(user defined form 0 , 1 ) </P> (user defined form 0 , 1 )
<P> <P>
<HR WIDTH="25%"></P> <HR WIDTH="25%">
<P>Please feel free to send me your oppinion at <B>teo@flex.ro</B> on forms <P>Please feel free to send me your opinion at <B>teo@flex.ro</B> on forms
designing and usage. </P> designing and usage.
<P><B><FONT SIZE=+1>KEEP IN MIND ! &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;THE
FORM API WILL CHANGE IN ORDER TO BE MORE SIMPLE AND BETTER!&nbsp;&nbsp;&nbsp;&nbsp;SEND
ME YOUR WISHES, YOUR IDEAS, YOUR OPINIONS !<BR>
ALSO ... DON'T BLAME ME IF YOU WILL HAVE TO RE-DESIGN YOUR OLD FORMS DUE
TO SOME INCOMPATIBILITIES WITH NEWER PGACCESS VERSIONS.</FONT></B></P>
<P><B><FONT SIZE=+1>KEEP IN MIND !&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
THE FORM API WILL CHANGE IN ORDER TO BE MORE SIMPLE AND BETTER!&nbsp;&nbsp;&nbsp;
SEND ME YOUR WISHES, YOUR IDEAS, YOUR OPINIONS !</FONT></B>
<BR><B><FONT SIZE=+1>ALSO ... DON'T BLAME ME IF YOU WILL HAVE TO RE-DESIGN
YOUR OLD FORMS DUE TO SOME INCOMPATIBILITIES WITH NEWER PGACCESS VERSIONS.</FONT></B>
</BODY> </BODY>
</HTML> </HTML>

View File

@ -1,130 +1,133 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML> <HTML>
<HEAD> <HEAD>
<TITLE>PgAccess - a Tcl/Tk PostgreSQL interface</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; Linux 2.0.32 i586) [Netscape]"> <META NAME="GENERATOR" CONTENT="Mozilla/4.04 [en] (X11; I; Linux 2.0.32 i586) [Netscape]">
<TITLE>PgAccess - a Tcl/Tk PostgreSQL interface</TITLE>
</HEAD> </HEAD>
<BODY BGCOLOR="#FFFFFF"> <BODY BGCOLOR="#FFFFFF">
<H1>PgAccess - a database management tool for <A HREF="http://www.postgreSQL.org">PostgreSQL</A></H1> <H1>
PgAccess - a database management tool for <A HREF="http://www.postgreSQL.org">PostgreSQL</A></H1>
<P> <HR>
<HR></P>
<P>This program is protected by the following <A HREF="copyright.html">copyright</A> <P>This program is protected by the following <A HREF="copyright.html">copyright</A>
</P> <LI>
<A HREF="pgaccess-0.86.tar.gz">Download the last version of PgAccess (press
shift and click this link)</A>.</LI>
<LI><A HREF="pgaccess-0.83.tar.gz">Download the last version of Pgaccess
(press shift and click this link)</A>.</LI>
<P>Latest version of PgAccess is 0.83 , 11 March 1998 ! <BR>
&nbsp; </P>
<P>Latest version of PgAccess is 0.86 , 29 March 1998 !
<BR>&nbsp;
<BR>&nbsp;
<CENTER><TABLE BORDER=3 CELLSPACING=0 CELLPADDING=0 WIDTH="100%" BGCOLOR="#FFB6C1" > <CENTER><TABLE BORDER=3 CELLSPACING=0 CELLPADDING=0 WIDTH="100%" BGCOLOR="#FFB6C1" >
<TR> <TR>
<TD> <TD>
<CENTER><P><B><FONT SIZE=+2>PgAccess can now design <A HREF="forms.html">Forms</A></FONT></B>, <CENTER><B><FONT SIZE=+2>PgAccess can now design <A HREF="forms.html">Forms</A></FONT></B>,
<B><FONT SIZE=+2><A HREF="pga-rad.html">Reports and Scripts</A></FONT></B> <B><FONT SIZE=+2><A HREF="pga-rad.html">Reports and Scripts</A></FONT></B>&nbsp;</CENTER>
</P></CENTER>
</TD> </TD>
</TR> </TR>
</TABLE></CENTER> </TABLE></CENTER>
<H3><FONT COLOR="#000080">Installation problems</FONT></H3> <H3>
<FONT COLOR="#000080">Installation problems</FONT></H3>
<UL> <UL>
<LI>Some problems related with locale special characters could be solved <LI>
by this <A HREF="specialchars.html">simple patch</A></LI> Some problems related with locale special characters could be solved by
this <A HREF="specialchars.html">simple patch</A></LI>
<LI>I think that there were some problems loading libpgtcl library. I invite <LI>
I think that there were some problems loading libpgtcl library. I invite
you to read a <A HREF="index.html#libpgtcl">special section concerning you to read a <A HREF="index.html#libpgtcl">special section concerning
libpgtcl</A> </LI> libpgtcl</A></LI>
</UL> </UL>
<H3><FONT COLOR="#191970">What does PgAccess now!</FONT></H3> <H3>
<FONT COLOR="#191970">What does PgAccess now!</FONT></H3>
<P>Here are some images from PgAccess windows : <A HREF="pic-pga-1.gif">Main Here are some images from PgAccess windows : <A HREF="pic-pga-1.gif">Main
window </A>, <A HREF="pic-pga-2.gif">table builder </A>, <A HREF="pic-pga-4.gif">table(query) window </A>, <A HREF="pic-pga-2.gif">table builder </A>, <A HREF="pic-pga-4.gif">table(query)
view </A>, <A HREF="pic-pga-3.gif">visual query builder </A>. </P> view </A>, <A HREF="pic-pga-3.gif">visual query builder </A>.
<P><B>Tables</B> <BR> <P><B>Tables</B>
- opening tables for viewing, max 200 records (changed by preferences menu) <BR>- opening tables for viewing, max. 200 records (changed by preferences
<BR> menu)
- column resizing, dragging the vertical grid line (better in table space <BR>- column resizing, dragging the vertical grid line (better in table
rather than in the table header) <BR> space rather than in the table header)
- text wrap in cells - layout saved for every table <BR> <BR>- text wrap in cells - layout saved for every table
- import/export to external files (SDF,CSV) <BR> <BR>- import/export to external files (SDF,CSV)
- filter capabilities (enter filter like (price&gt;3.14) <BR> <BR>- filter capabilities (enter filter like (price>3.14)
- sort order capabilities (enter manually the sort field(s)) <BR> <BR>- sort order capabilities (enter manually the sort field(s))
- editing in place <BR> <BR>- editing in place
- improved table generator assistant <BR> <BR>- improved table generator assistant
- improved field editing <BR> <BR>- improved field editing
<B>Queries</B> <BR> <BR><B>Queries</B>
- define , edit and stores &quot;user defined queries&quot; <BR> <BR>- define , edit and stores "user defined queries"
- store queries as views <BR> <BR>- store queries as views
- execution of queries <BR> <BR>- execution of queries
- viewing of select type queries result <BR> <BR>- viewing of select type queries result
- query deleting and renaming <BR> <BR>- query deleting and renaming
- visual query builder with drag &amp; drop capabilities. For any of you <BR>- visual query builder with drag &amp; drop capabilities. For any of
who had installed the Tcl/Tk plugin for Netscape Navigator, you can see you who had installed the Tcl/Tk plugin for Netscape Navigator, you can
it at work <A HREF="qbtclet.html">clicking here</A> <BR> see it at work <A HREF="qbtclet.html">clicking here</A>
<B>Sequences</B> <BR> <BR><B>Sequences</B>
- defines sequences, delete them and inspect them <BR> <BR>- defines sequences, delete them and inspect them
<B>Functions</B> <BR> <BR><B>Functions</B>
- define, inspect and delete functions in SQL language <BR> <BR>- define, inspect and delete functions in SQL language
<B>Reports</B> <BR> <BR><B>Reports</B>
- design and display simple reports from tables <BR> <BR>- design and display simple reports from tables
- fields and labels, font changing, style and size <BR> <BR>- fields and labels, font changing, style and size
- saves and loads report description from database <BR> <BR>- saves and loads report description from database
- show report previews, sample postscript output file <BR> <BR>- show report previews, sample postscript output file
<B>Forms</B> <BR> <BR><B>Forms</B>
- open user defined forms <BR> <BR>- open user defined forms
- form design module available <BR> <BR>- form design module available
- query widget available, controls bound to query results <BR> <BR>- query widget available, controls bound to query results
- <A HREF="forms.html">click here</A> for a description of forms and how <BR>- <A HREF="forms.html">click here</A> for a description of forms and
they can be used <BR> how they can be used
<B>Scripts</B> <BR> <BR><B>Scripts</B>
- define, modify and call user defined scripts <BR> <BR>- define, modify and call user defined scripts
Here is <A HREF="pga-rad.html">a special section concerning forms and scripts</A> <BR>Here is <A HREF="pga-rad.html">a special section concerning forms and
. </P> scripts</A> .
<P>On the TODO list! <BR> <P>On the TO-DO list!
- table design (add new fields, renaming, etc.) </P> <BR>- table design (add new fields, renaming, etc.)
<P>&nbsp; </P> <P>&nbsp;
<P>If you have any comment, suggestion for improvements, please feel free <P>If you have any comment, suggestion for improvements, please feel free
to e-mail to : <A HREF="mailto:teo@flex.ro">teo@flex.ro&nbsp;</A> </P> to e-mail to : <A HREF="mailto:teo@flex.ro">teo@flex.ro&nbsp;</A>
<P><B><FONT COLOR="#FF1493"><FONT SIZE=+2>Mailing list for PgAccess </FONT></FONT></B><A HREF="maillist.html">Here <P><B><FONT COLOR="#FF1493"><FONT SIZE=+2>Mailing list for PgAccess </FONT></FONT></B><A HREF="maillist.html">Here
you will find how to subscribe to this mailing list</A>. </P> you will find how to subscribe to this mailing list</A>.
<P> <P>
<HR></P> <HR>
<H1>
More information about libpgtcl - downloads</H1>
&nbsp;&nbsp;&nbsp;&nbsp; Also, you will need the PostgreSQL to Tcl interface
library, lined as a Tcl/Tk 'load'-able module. It is called libpgtcl and
the source is located in the PostgreSQL directory /src/interfaces/libpgtcl.
Specifically, you will need a libpgtcl library that is 'load'-able from
Tcl/Tk.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; This is technically different from
an ordinary PostgreSQL loadable object file, because libpgtcl is a collection
of object files. Under Linux, this is called libpgtcl.so.
<BR>&nbsp;&nbsp;&nbsp;&nbsp; You can download <B><A HREF="lib-pg63-redhat42.tar.gz">from
here</A></B>&nbsp; libpgtcl.so and libpq.so compiled for PostgreSQL 6.3
version running on a Linux RedHat 4.2 i386 systems. Just copy libpgtcl.so
and libpq.so into your system library directory (/usr/lib or /lib) and
go for it.
<H1>More information about libgtcl</H1> <P>&nbsp;&nbsp;&nbsp;&nbsp; One of the solutions is to remove from the
source the line containing <B>load libpgtcl.so </B>and to load pgaccess.tcl
not with wish, but with pgwish (or wishpg) that wish that was linked with
libpgtcl library! I do not recommend this one.
<P>Also, you will need the PostgreSQL to Tcl interface library, lined as <P>&nbsp;&nbsp;&nbsp;&nbsp; If you have installed RedHat 5.0, you should
a Tcl/Tk 'load'-able module. It is called libpgtcl and the source is located get the last distribution kit of PostgreSQL and compile it from scratch.
in the PostgreSQL directory /src/interfaces/libpgtcl. Specifically, you RedHat 5.0 is using some new versions of libraries and you have to compile
will need a libpgtcl library that is 'load'-able from Tcl/Tk. This is technically and install again at least <B>libpq </B>and <B><TT>libpgtcl </TT></B>libraries.
different from an ordinary PostgreSQL loadable object file, because libpgtcl
is a collection of object files. Under Linux, this is called libpgtcl.so.
<BR>
You can download <A HREF="libpgtcl.so">from here </A>a version already
compiled for Linux RedHat 4.2 i386 systems. Just copy libpgtcl.so into
your system library directory (/usr/lib or /lib) and go for it. One of
the solutions is to remove from the source the line containing <B>load
libpgtcl.so </B>and to load pgaccess.tcl not with wish, but with pgwish
(or wishpg) that wish that was linked with libpgtcl library! </P>
<P>If you have installed RedHat 5.0, you should get the last distribution
kit of postgreSQL and compile it from scratch. RedHat 5.0 is using some
new versions of libraries and you have to compile and install again at
least <B>libpq </B>and <B><TT>libpgtcl </TT></B>libraries. </P>
<P>However, the application should work without problems! </P>
<P>However, the application should work without problems!
</BODY> </BODY>
</HTML> </HTML>

View File

@ -25,12 +25,12 @@ invoked.
<P>&nbsp;&nbsp; This mechanism and the extremely versatile scripting mode <P>&nbsp;&nbsp; This mechanism and the extremely versatile scripting mode
of Tcl/Tk would give PgAccess a great power for creating end user application of Tcl/Tk would give PgAccess a great power for creating end user application
using PosgreSQL. The most important thing is that the user could call procedures using PostgreSQL. The most important thing is that the user could call
and functions that I have used for building up PgAccess ! procedures and functions that I have used for building up PgAccess !
<H3> <H3>
Forms</H3> Forms</H3>
&nbsp;&nbsp; Forms are used for creating windows and placing widgets inside &nbsp;&nbsp; Forms are used for creating windows and placing widgets inside
it. When PgAccess interpreet them, a new window appear, with buttons as it. When PgAccess interpret them, a new window appear, with buttons as
defined that could call "user defined scripts", "user defined procedures" defined that could call "user defined scripts", "user defined procedures"
or "internal PgAccess procedures". or "internal PgAccess procedures".
<BR>&nbsp;&nbsp; Forms can hold all the widgets allowed in Tcl/Tk , buttons, <BR>&nbsp;&nbsp; Forms can hold all the widgets allowed in Tcl/Tk , buttons,
@ -45,7 +45,7 @@ You can define your own procedures inside a script called "Library" for
example. You can call your procedures from within another script, from example. You can call your procedures from within another script, from
another procedure. another procedure.
<BR>&nbsp;&nbsp; The most important thing is that you have total access <BR>&nbsp;&nbsp; The most important thing is that you have total access
to the PgAccess's core of functions and procedures used by me in building to the PgAccess core of functions and procedures used by me in building
PgAccess as an application. Just write <B><TT><FONT COLOR="#000080">open_table PgAccess as an application. Just write <B><TT><FONT COLOR="#000080">open_table
"Your sample table"</FONT></TT></B> and you'll see the result. "Your sample table"</FONT></TT></B> and you'll see the result.
<BR>&nbsp;&nbsp; If you are writing a script called "Autoexec" then it <BR>&nbsp;&nbsp; If you are writing a script called "Autoexec" then it

View File

@ -181,7 +181,7 @@ global dbc
cursor_watch .dw cursor_watch .dw
.dw.lb delete 0 end .dw.lb delete 0 end
catch { catch {
pg_select $dbc "select * from pga_forms order by formname" rec { pg_select $dbc "select formname from pga_forms order by formname" rec {
.dw.lb insert end $rec(formname) .dw.lb insert end $rec(formname)
} }
} }
@ -1627,6 +1627,8 @@ if {$flag} {
proc {open_table} {objname} { proc {open_table} {objname} {
global mw sortfield filter tablename global mw sortfield filter tablename
set sortfield {}
set filter {}
Window show .mw Window show .mw
set tablename $objname set tablename $objname
mw_load_layout $objname mw_load_layout $objname
@ -2415,7 +2417,7 @@ catch {
} }
proc {show_error} {emsg} { proc {show_error} {emsg} {
tk_messageBox -title Error -icon error -message $emsg tk_messageBox -title Error -icon error -message $emsg
} }
proc {show_table_information} {tblname} { proc {show_table_information} {tblname} {
@ -2542,15 +2544,20 @@ global pref newdbname newpport newhost dbc
load libpgtcl.so load libpgtcl.so
catch {draw_tabs} catch {draw_tabs}
load_pref load_pref
if {$pref(autoload) && ($pref(lastdb)!="")} { if {$argc>0} {
set newdbname $pref(lastdb) set newdbname [lindex $argv 0]
set newhost $pref(lasthost) set newhost localhost
set newpport $pref(lastport) set newpport 5432
open_database open_database
} elseif {$pref(autoload) && ($pref(lastdb)!="")} {
set newdbname $pref(lastdb)
set newhost $pref(lasthost)
set newpport $pref(lastport)
open_database
} }
wm protocol .dw WM_DELETE_WINDOW { wm protocol .dw WM_DELETE_WINDOW {
catch {pg_disconnect $dbc} catch {pg_disconnect $dbc}
exit } exit }
} }
proc {Window} {args} { proc {Window} {args} {
@ -2629,7 +2636,7 @@ proc vTclWindow.about {base} {
label $base.l2 -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-* -relief groove -text {A Tcl/Tk interface to label $base.l2 -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-* -relief groove -text {A Tcl/Tk interface to
PostgreSQL PostgreSQL
by Constantin Teodorescu} by Constantin Teodorescu}
label $base.l3 -borderwidth 0 -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-* -relief sunken -text {vers 0.83} label $base.l3 -borderwidth 0 -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-* -relief sunken -text {vers 0.86}
label $base.l4 -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-* -relief groove -text {You will always get the latest version at: label $base.l4 -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-* -relief groove -text {You will always get the latest version at:
http://www.flex.ro/pgaccess http://www.flex.ro/pgaccess
@ -3401,9 +3408,8 @@ proc vTclWindow.qb {base} {
} else { } else {
set qcmd [.qb.text1 get 1.0 end] set qcmd [.qb.text1 get 1.0 end]
regsub -all "\n" $qcmd " " qcmd regsub -all "\n" $qcmd " " qcmd
regsub -all "'" $qcmd "''" qcmd
if {$qcmd==""} then { if {$qcmd==""} then {
show_error "This query has no commands ?" show_error "This query has no commands ?"
} else { } else {
if { [lindex [split [string toupper [string trim $qcmd]]] 0] == "SELECT" } { if { [lindex [split [string toupper [string trim $qcmd]]] 0] == "SELECT" } {
set qtype S set qtype S
@ -3411,6 +3417,7 @@ proc vTclWindow.qb {base} {
set qtype A set qtype A
} }
if {$cbv} { if {$cbv} {
tk_messageBox -message "create view $queryname as $qcmd"
set retval [catch {set pgres [pg_exec $dbc "create view $queryname as $qcmd"]} errmsg] set retval [catch {set pgres [pg_exec $dbc "create view $queryname as $qcmd"]} errmsg]
if {$retval} { if {$retval} {
show_error "Error defining view\n\n$errmsg" show_error "Error defining view\n\n$errmsg"
@ -3419,34 +3426,43 @@ proc vTclWindow.qb {base} {
Window destroy .qb Window destroy .qb
} }
} else { } else {
cursor_watch .qb regsub -all "'" $qcmd "''" qcmd
set retval [catch { cursor_watch .qb
set retval [catch {
if {$queryoid==0} then { if {$queryoid==0} then {
set pgres [pg_exec $dbc "insert into pga_queries values ('$queryname','$qtype','$qcmd')"] set pgres [pg_exec $dbc "insert into pga_queries values ('$queryname','$qtype','$qcmd')"]
} else { } else {
set pgres [pg_exec $dbc "update pga_queries set queryname='$queryname',querytype='$qtype',querycommand='$qcmd' where oid=$queryoid"] set pgres [pg_exec $dbc "update pga_queries set queryname='$queryname',querytype='$qtype',querycommand='$qcmd' where oid=$queryoid"]
} }
} errmsg] } errmsg]
cursor_arrow .qb cursor_arrow .qb
if {$retval} then { if {$retval} then {
show_error "Error executing query\n$errmsg" show_error "Error executing query\n$errmsg"
} else { } else {
cmd_Queries cmd_Queries
if {$queryoid==0} {set queryoid [pg_result $pgres -oid]} if {$queryoid==0} {set queryoid [pg_result $pgres -oid]}
} }
} }
catch {pg_result $pgres -clear} catch {pg_result $pgres -clear}
} }
}} -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-* -padx 9 -pady 3 -text {Save query definition} }} -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-* -padx 9 -pady 3 -text {Save query definition}
button $base.execbtn -borderwidth 1 -command {Window show .mw button $base.execbtn -borderwidth 1 -command {
set qcmd [.qb.text1 get 0.0 end] set qcmd [.qb.text1 get 0.0 end]
regsub -all "\n" $qcmd " " qcmd regsub -all "\n" [string trim $qcmd] " " qcmd
set mw(layout_name) $queryname if {[lindex [split [string toupper $qcmd]] 0]!="SELECT"} {
mw_load_layout $queryname if {[tk_messageBox -title Warning -message "This is an action query!\n\nExecute it?" -type yesno -default no]=="yes"} {
set mw(query) $qcmd sql_exec noquiet $qcmd
set mw(updatable) 0 }
set mw(isaquery) 1 } else {
mw_select_records $qcmd} -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-* -padx 9 -pady 3 -text {Execute query} Window show .mw
set mw(layout_name) $queryname
mw_load_layout $queryname
set mw(query) $qcmd
set mw(updatable) 0
set mw(isaquery) 1
mw_select_records $qcmd
}
} -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-* -padx 9 -pady 3 -text {Execute query}
button $base.termbtn -borderwidth 1 -command {.qb.cbv configure -state normal button $base.termbtn -borderwidth 1 -command {.qb.cbv configure -state normal
set cbv 0 set cbv 0
set queryname {} set queryname {}