Commit 9c93fa2e authored by Marc G. Fournier's avatar Marc G. Fournier

Upgrade to v0.86

parent 748fab8d
---------------------------------------------------------------------------
Copyright (c) 1994-7 Regents of the University of California
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
PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
---------------------------------------------------------------------------
PGACCESS 0.83 11 March 1998
PGACCESS 0.86 29 March 1998
================================
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
......@@ -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
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.
2.How to INSTALL ?
You will need Tcl/Tk package, I am using now Tcl 7.6 and Tk 4.2. There
are some problems running under Tcl/Tk 8.0 but I will soon fix them.
You will need Tcl/Tk package, I am using now Tcl 7.6 and Tk 4.2.
PgAccess is running also on Tcl/Tk 8.0
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
......@@ -65,7 +63,9 @@ go for it.
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.
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
Tables
- opening tables for vieweing, max 200 records
- opening tables for viewing, max 200 records
- column resizing by dragging the vertical grid lines
- text will wrap in cells now
- dynamic row height when editing
......@@ -93,7 +93,7 @@ Tables
- editing in place, double click the text you want to change
- record deleting , point the record, press Del key
- 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 information retrieving : owner, field information, indexes
......@@ -102,7 +102,7 @@ Queries
- save view layout
- can store queries as views
- execution of queries
- vieweing of select type queries result
- viewing of select type queries result
- running action queries (insert, update, delete)
- visual query builder with drag & drop support, table aliasing
......@@ -128,7 +128,7 @@ Reports
Forms
- open user defined forms
- form design module available
- query widget allowing access to a recordset
- query widget allowing access to a record set
Scripts
- define, modify and call user defined scripts
......@@ -137,17 +137,17 @@ Scripts
- table design (add new fields, renaming, etc)
- sequence and function renaming
- more powerfull report generator and viewer
- more powerful report generator and viewer
- help on line
6. How you should report the errors?
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
"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
be also good.
......
......@@ -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 pga_layout (tablename varchar(64), nrcols int2, colnames text, colwidth text);
COPY pga_queries FROM stdin;
Query that can be saved as view S select * from phonebook where continent='usa'
\.
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"\
.pb.qs:open\
set nrecs [.pb.qs:nrecords]\
.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\
set nrecs {}\
set what {}\
......@@ -46,7 +55,6 @@ tk_messageBox -title Information -message "A new record has been added!"\
# so I force it to 'f' (false)\
set pbqs(company) f\
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;
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
Jimmy Page 66323452 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;
pga_forms 2 formname formsource 82 713
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
\.
This diff is collapsed.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE>PgAccess - a Tcl/Tk PostgreSQL interface</TITLE>
<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>
<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></P>
<HR>
<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" >
<TR>
<TD>
<CENTER><P><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>
</P></CENTER>
<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>&nbsp;</CENTER>
</TD>
</TR>
</TABLE></CENTER>
<H3><FONT COLOR="#000080">Installation problems</FONT></H3>
<H3>
<FONT COLOR="#000080">Installation problems</FONT></H3>
<UL>
<LI>Some problems related with locale special characters could be solved
by this <A HREF="specialchars.html">simple patch</A></LI>
<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
libpgtcl</A> </LI>
libpgtcl</A></LI>
</UL>
<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
<H3>
<FONT COLOR="#191970">What does PgAccess now!</FONT></H3>
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)
view </A>, <A HREF="pic-pga-3.gif">visual query builder </A>. </P>
<P><B>Tables</B> <BR>
- opening tables for viewing, max 200 records (changed by preferences menu)
<BR>
- column resizing, dragging the vertical grid line (better in table space
rather than in the table header) <BR>
- text wrap in cells - layout saved for every table <BR>
- import/export to external files (SDF,CSV) <BR>
- filter capabilities (enter filter like (price&gt;3.14) <BR>
- sort order capabilities (enter manually the sort field(s)) <BR>
- editing in place <BR>
- improved table generator assistant <BR>
- improved field editing <BR>
<B>Queries</B> <BR>
- define , edit and stores &quot;user defined queries&quot; <BR>
- store queries as views <BR>
- execution of queries <BR>
- viewing of select type queries result <BR>
- query deleting and renaming <BR>
- visual query builder with drag &amp; drop capabilities. For any of you
who had installed the Tcl/Tk plugin for Netscape Navigator, you can see
it at work <A HREF="qbtclet.html">clicking here</A> <BR>
<B>Sequences</B> <BR>
- defines sequences, delete them and inspect them <BR>
<B>Functions</B> <BR>
- define, inspect and delete functions in SQL language <BR>
<B>Reports</B> <BR>
- design and display simple reports from tables <BR>
- fields and labels, font changing, style and size <BR>
- saves and loads report description from database <BR>
- show report previews, sample postscript output file <BR>
<B>Forms</B> <BR>
- open user defined forms <BR>
- form design module available <BR>
- query widget available, controls bound to query results <BR>
- <A HREF="forms.html">click here</A> for a description of forms and how
they can be used <BR>
<B>Scripts</B> <BR>
- define, modify and call user defined scripts <BR>
Here is <A HREF="pga-rad.html">a special section concerning forms and scripts</A>
. </P>
<P>On the TODO list! <BR>
- table design (add new fields, renaming, etc.) </P>
<P>&nbsp; </P>
view </A>, <A HREF="pic-pga-3.gif">visual query builder </A>.
<P><B>Tables</B>
<BR>- opening tables for viewing, max. 200 records (changed by preferences
menu)
<BR>- column resizing, dragging the vertical grid line (better in table
space rather than in the table header)
<BR>- text wrap in cells - layout saved for every table
<BR>- import/export to external files (SDF,CSV)
<BR>- filter capabilities (enter filter like (price>3.14)
<BR>- sort order capabilities (enter manually the sort field(s))
<BR>- editing in place
<BR>- improved table generator assistant
<BR>- improved field editing
<BR><B>Queries</B>
<BR>- define , edit and stores "user defined queries"
<BR>- store queries as views
<BR>- execution of queries
<BR>- viewing of select type queries result
<BR>- query deleting and renaming
<BR>- visual query builder with drag &amp; drop capabilities. For any of
you who had installed the Tcl/Tk plugin for Netscape Navigator, you can
see it at work <A HREF="qbtclet.html">clicking here</A>
<BR><B>Sequences</B>
<BR>- defines sequences, delete them and inspect them
<BR><B>Functions</B>
<BR>- define, inspect and delete functions in SQL language
<BR><B>Reports</B>
<BR>- design and display simple reports from tables
<BR>- fields and labels, font changing, style and size
<BR>- saves and loads report description from database
<BR>- show report previews, sample postscript output file
<BR><B>Forms</B>
<BR>- open user defined forms
<BR>- form design module available
<BR>- query widget available, controls bound to query results
<BR>- <A HREF="forms.html">click here</A> for a description of forms and
how they can be used
<BR><B>Scripts</B>
<BR>- define, modify and call user defined scripts
<BR>Here is <A HREF="pga-rad.html">a special section concerning forms and
scripts</A> .
<P>On the TO-DO list!
<BR>- table design (add new fields, renaming, etc.)
<P>&nbsp;
<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
you will find how to subscribe to this mailing list</A>. </P>
you will find how to subscribe to this mailing list</A>.
<P>
<HR></P>
<H1>More information about libgtcl</H1>
<P>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. 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>
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>
<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.
<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>&nbsp;&nbsp;&nbsp;&nbsp; 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>However, the application should work without problems!
</BODY>
</HTML>
......@@ -25,12 +25,12 @@ invoked.
<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
using PosgreSQL. The most important thing is that the user could call procedures
and functions that I have used for building up PgAccess !
using PostgreSQL. The most important thing is that the user could call
procedures and functions that I have used for building up PgAccess !
<H3>
Forms</H3>
&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"
or "internal PgAccess procedures".
<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
another procedure.
<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
"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
......
......@@ -181,7 +181,7 @@ global dbc
cursor_watch .dw
.dw.lb delete 0 end
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)
}
}
......@@ -1627,6 +1627,8 @@ if {$flag} {
proc {open_table} {objname} {
global mw sortfield filter tablename
set sortfield {}
set filter {}
Window show .mw
set tablename $objname
mw_load_layout $objname
......@@ -2415,7 +2417,7 @@ catch {
}
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} {
......@@ -2542,15 +2544,20 @@ global pref newdbname newpport newhost dbc
load libpgtcl.so
catch {draw_tabs}
load_pref
if {$pref(autoload) && ($pref(lastdb)!="")} {
set newdbname $pref(lastdb)
set newhost $pref(lasthost)
set newpport $pref(lastport)
open_database
if {$argc>0} {
set newdbname [lindex $argv 0]
set newhost localhost
set newpport 5432
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 {
catch {pg_disconnect $dbc}
exit }
catch {pg_disconnect $dbc}
exit }
}
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
PostgreSQL
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:
http://www.flex.ro/pgaccess
......@@ -3401,9 +3408,8 @@ proc vTclWindow.qb {base} {
} else {
set qcmd [.qb.text1 get 1.0 end]
regsub -all "\n" $qcmd " " qcmd
regsub -all "'" $qcmd "''" qcmd
if {$qcmd==""} then {
show_error "This query has no commands ?"
show_error "This query has no commands ?"
} else {
if { [lindex [split [string toupper [string trim $qcmd]]] 0] == "SELECT" } {
set qtype S
......@@ -3411,6 +3417,7 @@ proc vTclWindow.qb {base} {
set qtype A
}
if {$cbv} {
tk_messageBox -message "create view $queryname as $qcmd"
set retval [catch {set pgres [pg_exec $dbc "create view $queryname as $qcmd"]} errmsg]
if {$retval} {
show_error "Error defining view\n\n$errmsg"
......@@ -3419,34 +3426,43 @@ proc vTclWindow.qb {base} {
Window destroy .qb
}
} else {
cursor_watch .qb
set retval [catch {
regsub -all "'" $qcmd "''" qcmd
cursor_watch .qb
set retval [catch {
if {$queryoid==0} then {
set pgres [pg_exec $dbc "insert into pga_queries values ('$queryname','$qtype','$qcmd')"]
} else {
set pgres [pg_exec $dbc "update pga_queries set queryname='$queryname',querytype='$qtype',querycommand='$qcmd' where oid=$queryoid"]
}
} errmsg]
cursor_arrow .qb
if {$retval} then {
show_error "Error executing query\n$errmsg"
} else {
cmd_Queries
if {$queryoid==0} {set queryoid [pg_result $pgres -oid]}
}
} errmsg]
cursor_arrow .qb
if {$retval} then {
show_error "Error executing query\n$errmsg"
} else {
cmd_Queries
if {$queryoid==0} {set queryoid [pg_result $pgres -oid]}
}
}
catch {pg_result $pgres -clear}
}
}} -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]
regsub -all "\n" $qcmd " " qcmd
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}
regsub -all "\n" [string trim $qcmd] " " qcmd
if {[lindex [split [string toupper $qcmd]] 0]!="SELECT"} {
if {[tk_messageBox -title Warning -message "This is an action query!\n\nExecute it?" -type yesno -default no]=="yes"} {
sql_exec noquiet $qcmd
}
} else {
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
set cbv 0
set queryname {}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment