Commit 2133276e authored by Bruce Momjian's avatar Bruce Momjian

Update to pgaccess 0.90.

parent 681343ab
...@@ -22,7 +22,7 @@ PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. ...@@ -22,7 +22,7 @@ PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
PGACCESS 0.88 7 June 1998 PGACCESS 0.90 18 September 1998
================================ ================================
I dedicate this program to my little daughters Ana-Maria and Emilia and to my I dedicate this program to my little daughters Ana-Maria and Emilia and to my
wife for their understanding. I hope they will forgive me for spending so many wife for their understanding. I hope they will forgive me for spending so many
...@@ -44,7 +44,7 @@ four days of hard work to get it as you see it now. ...@@ -44,7 +44,7 @@ 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. 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 PgAccess is running fine 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
...@@ -101,7 +101,7 @@ Queries ...@@ -101,7 +101,7 @@ Queries
- define, edit and store "user defined queries" - define, edit and store "user defined queries"
- save view layout - save view layout
- can store queries as views - can store queries as views
- execution of queries - execution of queries with optional user input parameters ( select * from invoices where year=[parameter "Year of selection"] )
- viewing 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
...@@ -152,10 +152,10 @@ Some information about table structure, no. of fields, records would ...@@ -152,10 +152,10 @@ Some information about table structure, no. of fields, records would
be also good. be also good.
=========================================================================== ===========================================================================
You would find always the last version at http://www.flex.ro/pgaccess You would find always the latest version at http://www.flex.ro/pgaccess
Please feel free to e-mail me with any suggestion or bug description Please feel free to e-mail me with any suggestion or bug description
that will help to improve this. that will help to improve it.
Constantin Teodorescu <teo@flex.ro> Constantin Teodorescu <teo@flex.ro>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML> <HTML>
<HEAD> <HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="GENERATOR" CONTENT="Mozilla/4.04 [en] (X11; I; Linux 2.0.32 i586) [Netscape]">
<TITLE>PgAccess - a Tcl/Tk PostgreSQL interface</TITLE> <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.33 i586) [Netscape]">
</HEAD> </HEAD>
<BODY BGCOLOR="#FFFFFF"> <BODY BGCOLOR="#FFFFFF">
<H1> <H1>PgAccess - a free database management tool for <A HREF="http://www.postgreSQL.org">PostgreSQL</A></H1>
PgAccess - a database management tool for <A HREF="http://www.postgreSQL.org">PostgreSQL</A></H1>
<HR> <P>
<HR></P>
<P>This program is protected by the following <A HREF="copyright.html">copyright</A> <LI><A HREF="pgaccess-0.90.tar.gz">Download the last version of PgAccess
<LI> (press shift and click this link)</A>.</LI>
<A HREF="pgaccess-0.88.tar.gz">Download the last version of PgAccess (press
shift and click this link)</A>.</LI>
<CENTER><P>Latest version of PgAccess is 0.90 , 18 September 1998 ! <BR>
<BR>
&nbsp; <B><FONT COLOR="#FF0000">NEW * NEW * NEW *</FONT></B> <B><FONT COLOR="#FF0000">
NEW *</FONT></B> ==== &gt; <B><FONT SIZE=+1>QUERY PARAMETERS</FONT></B>
(see section Queries below)<BR>
<BR>
Precompiled libpgtcl and libpq binaries for i386 are <A HREF="ftp://ftp.flex.ro/pub/pgaccess">here
</A>!!! <BR>
&nbsp; </P></CENTER>
<P>Latest version of PgAccess is 0.88 , 7 June 1998 !
<BR><br>&nbsp;
<font color='red'><b>NEW * NEW * NEW *</b></font> Precompiled libpgtcl and libpq binaries for i386 are <a href='ftp://ftp.flex.ro/pub/pgaccess'> here </a>!!!
<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><B><FONT SIZE=+2>PgAccess can now design <A HREF="forms.html">Forms</A></FONT></B>, <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>&nbsp;</CENTER> <B><FONT SIZE=+2><A HREF="pga-rad.html">Reports and Scripts</A></FONT></B>&nbsp;
</P></CENTER>
</TD> </TD>
</TR> </TR>
</TABLE></CENTER> </TABLE></CENTER>
<H3> <H3><FONT COLOR="#000080">Installation problems</FONT></H3>
<FONT COLOR="#000080">Installation problems</FONT></H3>
<UL> <UL>
<LI> <LI>Some problems related with locale special characters could be solved
Some problems related with locale special characters could be solved by by this <A HREF="specialchars.html">simple patch</A></LI>
this <A HREF="specialchars.html">simple patch</A></LI>
<LI> <LI>I think that there were some problems loading libpgtcl library. I invite
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>
<LI>For Silicon Graphics Indigo computers, Irix operating system, there
is a <A HREF="irix.html">HOWTO make PgAccess to work</A></LI>
</UL> </UL>
<H3> <H3><FONT COLOR="#191970">What does PgAccess now!</FONT></H3>
<FONT COLOR="#191970">What does PgAccess now!</FONT></H3>
Here are some images from PgAccess windows : <A HREF="pic-pga-1.gif">Main <P>Here are some screenshots 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>. view </A>, <A HREF="pic-pga-3.gif">visual query builder </A>. </P>
<P><B>Tables</B> <P><B>Tables</B> <BR>
<BR>- opening tables for viewing, max. 200 records (changed by preferences - opening tables for viewing, max. 200 records (changed by preferences
menu) menu) <BR>
<BR>- column resizing, dragging the vertical grid line (better in table - column resizing, dragging the vertical grid line (better in table space
space rather than in the table header) rather than in the table header) <BR>
<BR>- text wrap in cells - layout saved for every table - text wrap in cells - layout saved for every table <BR>
<BR>- import/export to external files (SDF,CSV) - import/export to external files (SDF,CSV) <BR>
<BR>- filter capabilities (enter filter like (price>3.14) - filter capabilities (enter filter like (price&gt;3.14) <BR>
<BR>- sort order capabilities (enter manually the sort field(s)) - sort order capabilities (enter manually the sort field(s)) <BR>
<BR>- editing in place - editing in place <BR>
<BR>- improved table generator assistant - improved table generator assistant <BR>
<BR>- improved field editing - improved field editing <BR>
<BR><B>Queries</B> <B>Queries</B> <BR>
<BR>- define , edit and stores "user defined queries" - define , edit and stores &quot;user defined queries&quot; <BR>
<BR>- store queries as views - store queries as views <BR>
<BR>- execution of queries - execution of queries with optional user input parameters ( select * from
<BR>- viewing of select type queries result invoices where year=[parameter &quot;Year of selection&quot;] )<BR>
<BR>- query deleting and renaming - viewing of select type queries result <BR>
<BR>- visual query builder with drag &amp; drop capabilities. For any of - query deleting and renaming <BR>
you who had installed the Tcl/Tk plugin for Netscape Navigator, you can - visual query builder with drag &amp; drop capabilities. For any of you
see it at work <A HREF="qbtclet.html">clicking here</A> who had installed the Tcl/Tk plugin for Netscape Navigator, you can see
<BR><B>Sequences</B> it at work <A HREF="qbtclet.html">clicking here</A> <BR>
<BR>- defines sequences, delete them and inspect them <B>Sequences</B> <BR>
<BR><B>Functions</B> - defines sequences, delete them and inspect them <BR>
<BR>- define, inspect and delete functions in SQL language <B>Functions</B> <BR>
<BR><B>Reports</B> - define, inspect and delete functions in SQL language <BR>
<BR>- design and display simple reports from tables <B>Reports</B> <BR>
<BR>- fields and labels, font changing, style and size - design and display simple reports from tables <BR>
<BR>- saves and loads report description from database - fields and labels, font changing, style and size <BR>
<BR>- show report previews, sample postscript output file - saves and loads report description from database <BR>
<BR><B>Forms</B> - show report previews, sample postscript output file <BR>
<BR>- open user defined forms <B>Forms</B> <BR>
<BR>- form design module available - open user defined forms <BR>
<BR>- query widget available, controls bound to query results - form design module available <BR>
<BR>- <A HREF="forms.html">click here</A> for a description of forms and - query widget available, controls bound to query results <BR>
how they can be used - <A HREF="forms.html">click here</A> for a description of forms and how
<BR><B>Scripts</B> they can be used <BR>
<BR>- define, modify and call user defined scripts <B>Scripts</B> <BR>
<BR>Here is <A HREF="pga-rad.html">a special section concerning forms and - define, modify and call user defined scripts <BR>
scripts</A> . Here is <A HREF="pga-rad.html">a special section concerning forms and scripts</A>
. </P>
<P>On the TO-DO list!
<BR>- table design (add new fields, renaming, etc.) <P>On the TO-DO list! <BR>
- table design (add new fields, renaming, etc.) </P>
<P>&nbsp;
<P>This program is protected by the following <A HREF="copyright.html">copyright</A>
</P>
<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> to e-mail to : <A HREF="mailto:teo@flex.ro">teo@flex.ro&nbsp;</A> </P>
<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>. you will find how to subscribe to this mailing list</A>. </P>
<P> <P>
<HR> <HR></P>
<H1>
More information about libpgtcl - downloads</H1> <H1>More information about libpgtcl - downloads</H1>
&nbsp;&nbsp;&nbsp;&nbsp; Also, you will need the PostgreSQL to Tcl interface
<P>&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 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. the source is located in the PostgreSQL directory /src/interfaces/libpgtcl.
Specifically, you will need a libpgtcl library that is 'load'-able from Specifically, you will need a libpgtcl library that is 'load'-able from
Tcl/Tk.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; This is technically different from Tcl/Tk.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; This is technically different from
an ordinary PostgreSQL loadable object file, because libpgtcl is a collection an ordinary PostgreSQL loadable object file, because libpgtcl is a collection
of object files. Under Linux, this is called libpgtcl.so. of object files. Under Linux, this is called libpgtcl.so. <BR>
<BR>&nbsp;&nbsp;&nbsp;&nbsp; You can download <B><A HREF="lib-pg63-redhat42.tar.gz">from &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 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 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 and libpq.so into your system library directory (/usr/lib or /lib) and
go for it. go for it. </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp; One of the solutions is to remove from the <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 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 not with wish, but with pgwish (or wishpg) that wish that was linked with
libpgtcl library! I do not recommend this one. libpgtcl library! I do not recommend this one. </P>
<P>&nbsp;&nbsp;&nbsp;&nbsp; If you have installed RedHat 5.0, you should <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. 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 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. 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>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE>PgAccess on Irix</TITLE>
<META NAME="GENERATOR" CONTENT="Mozilla/3.04Gold (X11; I; Linux 2.0.33 i586) [Netscape]">
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000EF" VLINK="#51188E" ALINK="#FF0000">
<H1>INSTALLING PgAccess UNDER IRIX 5.3.
<HR WIDTH="100%"></H1>
<P><B><FONT COLOR="#000080">This HOWO-TO make PgAccess working under Irix
is written by Stuart Rison</FONT></B></P>
<P>These are the steps that I had to follow to get pgaccess to run on an
INDIGO2 running postgreSQL 6.3.2 under IRIX 5.3. I make no guarantee whatsoever
that the same step will work for others but at least it should point you
in the right direction. Also, I am a biologist by training so I only got
pgaccess working by fudging (that is, trial and error) this means that
some of the steps may be unnecessary (e.g. compiling $postgreSQL_source/src/interfaces/libpgtcl
as both a shared and static library) and they certainly haven't been optimised
(I know nothing about compiler switches etc.).</P>
<P><B>1) Requirements:</B></P>
<UL>
<P>You will need:</P>
<UL>
<LI>postgreSQL source (http://www.postgresql.org)</LI>
<LI>tcl8.0 source (http://www.tclconsortium.org/)</LI>
<LI>tk8.0 source (http://www.tclconsortium.org/)</LI>
<LI>pgaccess source (http://www.flex.ro/pgaccess)</LI>
</UL>
</UL>
<P><B>2) Installation:</B></P>
<P>a) tcl/tk:</P>
<UL>
<P>You must first install tcl and then tk (in that order). I just used
./configure, no switches and gmake. Their installation should be trouble
free. Then you must move headers and libraries to the right places so:</P>
<P>Header files: both tcl and tk have a header file (tcl.h and tk.h). The
tcl.h file is in $tcl_source_dir/generic and the tk.h file is in $tk_source_dir/generic;
both should be copied to /usr/local/include.</P>
<P>Libraries: compilation (with cc) of tcl and tk yield libraries libtcl8.0.a
and libtk8.0.a in $source_dir/unix. Both should be copied to /usr/local/lib.</P>
</UL>
<P>b) postgreSQL:</P>
<UL>
<P>Make sure you have a fully patched postgreSQL source. If your ./configure
says it can't load 'IRIX' settings then you most probably will need to
patch ./configure.</P>
<P>Configure using ./configure with the following switches: ./configure
--with-includes=/usr/local/include</P>
<P>--with-libraries=/usr/local/lib --with-tcl [this and previous line as
one]</P>
<P>Then make, make install as usual</P>
</UL>
<P>c) Compiling libpgtcl:</P>
<UL>
<P>The source for libpgtcl is in $postgreSQL_directory/src/interfaces/libpgsql.</P>
<P>I do this twice. Once with just gmake. This produces a static library
libpgtcl.a which I leave where it is (I don't know what to do with it but
it may just come in handy). The I modify Makefile manually with a text
editor. Essentially I modify two line:</P>
<P>before:</P>
<P># Shared library stuff</P>
<P>install-shlib-dep := shlib :=</P>
<P>after:</P>
<P># Shared library stuff</P>
<P>install-shlib-dep := install-shlib shlib := libpgtcl.so.1</P>
<P>Then gmake -f Makefile_modified. This creates two shared (.so) libraries:
libpgtcl.so and libpgtcl.so.1. I can't tell the difference between them
so I copied them both to /usr/lib/.</P>
</UL>
<P>d) running pgaccess:</P>
<UL>
<P>Uncompress pgaccess (usually with gunzip and tar). So long as 'wish'
(a binary produced when compiling tk8.0) is somewhere in your path, you
should be able to run pgaccess with:</P>
<P>wish -f $pgaccess_dir/pgaccess.tcl [postgreSQL_database_name]</P>
</UL>
<P>e) et voila!</P>
<P><B>3) Concluding remarks:</B></P>
<UL>
<P>As I stated at the start of this document, following the procedure indicated
above worked for me. I am sure, however, that a few of the steps are unnecessary/non-optimised/stupid
etc. If any Unix (IRIX) boffin is reading this and you spot anything you
would like to comment/correct etc. please e-mail me (stuart@ludwig.ucl.ac.uk).
Also, if you just have questions and think I might help, please contact
me at the same e-mail.</P>
<P>Finally, I can accept no responsibility if these steps don't work for
you or if it all goes horribly wrong and you 'damage' your computer trying
them. Let common sense prevail!</P>
</UL>
<P>Good luck</P>
<P>Stuart Rison LICR University College London London W1P 8BT<BR>
<A HREF="mailto:stuart@ludwig.ucl.ac.uk">stuart@ludwig.ucl.ac.uk</A></P>
</BODY>
</HTML>
...@@ -106,7 +106,7 @@ set temp {} ...@@ -106,7 +106,7 @@ set temp {}
switch $activetab { switch $activetab {
Tables { Tables {
if {[tk_messageBox -title "FINAL WARNING" -message "You are going to delete table:\n\n$objtodelete\n\nProceed ?" -type yesno -default no]=="yes"} { if {[tk_messageBox -title "FINAL WARNING" -message "You are going to delete table:\n\n$objtodelete\n\nProceed ?" -type yesno -default no]=="yes"} {
sql_exec noquiet "drop table $objtodelete" sql_exec noquiet "drop table \"$objtodelete\""
sql_exec quiet "delete from pga_layout where tablename='$objtodelete'" sql_exec quiet "delete from pga_layout where tablename='$objtodelete'"
cmd_Tables cmd_Tables
} }
...@@ -1193,7 +1193,7 @@ if {$mw(row_edited)==$mw(last_rownum)} { ...@@ -1193,7 +1193,7 @@ if {$mw(row_edited)==$mw(last_rownum)} {
set msg "Updating record ..." set msg "Updating record ..."
after 1000 {set msg ""} after 1000 {set msg ""}
regsub -all ' $fldval \\' sqlfldval regsub -all ' $fldval \\' sqlfldval
set retval [sql_exec noquiet "update $tablename set $fld='$sqlfldval' where oid=$oid"] set retval [sql_exec noquiet "update \"$tablename\" set $fld='$sqlfldval' where oid=$oid"]
} }
cursor_arrow .mw cursor_arrow .mw
if {!$retval} { if {!$retval} {
...@@ -1267,7 +1267,7 @@ if {$mw(newrec_fields)==""} {return 1} ...@@ -1267,7 +1267,7 @@ if {$mw(newrec_fields)==""} {return 1}
set msg "Saving new record ..." set msg "Saving new record ..."
after 1000 {set msg ""} after 1000 {set msg ""}
set retval [catch { set retval [catch {
set sqlcmd "insert into $tablename ([join $mw(newrec_fields) ,]) values ([join $mw(newrec_values) ,])" set sqlcmd "insert into \"$tablename\" ([join $mw(newrec_fields) ,]) values ([join $mw(newrec_values) ,])"
set pgres [pg_exec $dbc $sqlcmd] set pgres [pg_exec $dbc $sqlcmd]
} errmsg] } errmsg]
if {$retval} { if {$retval} {
...@@ -1596,13 +1596,13 @@ if {$how=="design"} { ...@@ -1596,13 +1596,13 @@ if {$how=="design"} {
.qb.text1 insert end $qcmd .qb.text1 insert end $qcmd
} else { } else {
if {$qtype=="S"} then { if {$qtype=="S"} then {
set mw(query) [subst $qcmd]
set mw(updatable) 0
set mw(isaquery) 1
Window show .mw Window show .mw
wm title .mw "Query result: $queryname" wm title .mw "Query result: $queryname"
mw_load_layout $queryname mw_load_layout $queryname
set mw(query) $qcmd mw_select_records $mw(query)
set mw(updatable) 0
set mw(isaquery) 1
mw_select_records $qcmd
} else { } else {
set answ [tk_messageBox -title Warning -type yesno -message "This query is an action query!\n\n[string range $qcmd 0 30] ...\n\nDo you want to execute it?"] set answ [tk_messageBox -title Warning -type yesno -message "This query is an action query!\n\n[string range $qcmd 0 30] ...\n\nDo you want to execute it?"]
if {$answ} { if {$answ} {
...@@ -1646,7 +1646,7 @@ set filter {} ...@@ -1646,7 +1646,7 @@ set filter {}
Window show .mw Window show .mw
set tablename $objname set tablename $objname
mw_load_layout $objname mw_load_layout $objname
set mw(query) "select oid,$tablename.* from $objname" set mw(query) "select oid,\"$tablename\".* from \"$objname\""
set mw(updatable) 1 set mw(updatable) 1
set mw(isaquery) 0 set mw(isaquery) 0
mw_select_records $mw(query) mw_select_records $mw(query)
...@@ -1665,6 +1665,23 @@ mw_load_layout $vn ...@@ -1665,6 +1665,23 @@ mw_load_layout $vn
mw_select_records $mw(query) mw_select_records $mw(query)
} }
proc {parameter} {msg} {
global gpw
Window show .gpw
focus .gpw.e1
set gpw(var) ""
set gpw(flag) 0
set gpw(msg) $msg
bind .gpw <Destroy> "set gpw(flag) 1"
grab .gpw
tkwait variable gpw(flag)
if {$gpw(result)} {
return $gpw(var)
} else {
return ""
}
}
proc {ql_add_new_table} {} { proc {ql_add_new_table} {} {
global qlvar dbc global qlvar dbc
...@@ -1704,7 +1721,7 @@ set tables {} ...@@ -1704,7 +1721,7 @@ set tables {}
for {set i 0} {$i<$qlvar(ntables)} {incr i} { for {set i 0} {$i<$qlvar(ntables)} {incr i} {
set thename {} set thename {}
catch {set thename $qlvar(tablename$i)} catch {set thename $qlvar(tablename$i)}
if {$thename!=""} {lappend tables "$qlvar(tablename$i) $qlvar(tablealias$i)"} if {$thename!=""} {lappend tables "\"$qlvar(tablename$i)\" $qlvar(tablealias$i)"}
} }
set sqlcmd "$sqlcmd from [join $tables ,] " set sqlcmd "$sqlcmd from [join $tables ,] "
set sup1 {} set sup1 {}
...@@ -1767,10 +1784,10 @@ if {[ql_get_tag_info $obj res]=="f"} { ...@@ -1767,10 +1784,10 @@ if {[ql_get_tag_info $obj res]=="f"} {
# Is object a table ? # Is object a table ?
set tablealias [ql_get_tag_info $obj tab] set tablealias [ql_get_tag_info $obj tab]
set tablename $qlvar(ali_$tablealias) set tablename $qlvar(ali_$tablealias)
if {$tablename==""} return if {"$tablename"==""} return
if {[tk_messageBox -title WARNING -icon question -message "Remove table $tablename from query ?" -type yesno -default no]=="no"} return if {[tk_messageBox -title WARNING -icon question -message "Remove table $tablename from query ?" -type yesno -default no]=="no"} return
for {set i [expr [llength $qlvar(restables)]-1]} {$i>=0} {incr i -1} { for {set i [expr [llength $qlvar(restables)]-1]} {$i>=0} {incr i -1} {
if {$tablename==[lindex $qlvar(restables) $i]} { if {"$tablename"==[lindex $qlvar(restables) $i]} {
set qlvar(resfields) [lreplace $qlvar(resfields) $i $i] set qlvar(resfields) [lreplace $qlvar(resfields) $i $i]
set qlvar(restables) [lreplace $qlvar(restables) $i $i] set qlvar(restables) [lreplace $qlvar(restables) $i $i]
set qlvar(rescriteria) [lreplace $qlvar(rescriteria) $i $i] set qlvar(rescriteria) [lreplace $qlvar(rescriteria) $i $i]
...@@ -2004,7 +2021,7 @@ set allbox [.ql.c bbox rect] ...@@ -2004,7 +2021,7 @@ set allbox [.ql.c bbox rect]
if {$allbox==""} {set posx 10} else {set posx [expr 20+[lindex $allbox 2]]} if {$allbox==""} {set posx 10} else {set posx [expr 20+[lindex $allbox 2]]}
set tablename $qlvar(tablename$it) set tablename $qlvar(tablename$it)
set tablealias $qlvar(tablealias$it) set tablealias $qlvar(tablealias$it)
.ql.c create text $posx $posy -text $tablename -anchor nw -tags [subst {tab$tablealias f-oid mov tableheader}] -font -Adobe-Helvetica-Bold-R-Normal-*-*-120-*-*-*-*-* .ql.c create text $posx $posy -text "$tablename" -anchor nw -tags [subst {tab$tablealias f-oid mov tableheader}] -font -Adobe-Helvetica-Bold-R-Normal-*-*-120-*-*-*-*-*
incr posy 16 incr posy 16
foreach fld $qlvar(tablestruct$it) { foreach fld $qlvar(tablestruct$it) {
.ql.c create text $posx $posy -text $fld -fill #010101 -anchor nw -tags [subst {f-$fld tab$tablealias mov}] -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-* .ql.c create text $posx $posy -text $fld -fill #010101 -anchor nw -tags [subst {f-$fld tab$tablealias mov}] -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*
...@@ -2382,7 +2399,7 @@ incr py [expr $rbvar(y_pghdr)-$rbvar(y_rpthdr)] ...@@ -2382,7 +2399,7 @@ incr py [expr $rbvar(y_pghdr)-$rbvar(y_rpthdr)]
set di [lsearch $rbvar(regions) detail] set di [lsearch $rbvar(regions) detail]
set y_hi $rbvar(y_detail) set y_hi $rbvar(y_detail)
set y_lo $rbvar(y_[lindex $rbvar(regions) [expr $di-1]]) set y_lo $rbvar(y_[lindex $rbvar(regions) [expr $di-1]])
pg_select $dbc "select * from $rbvar(tablename)" rec { pg_select $dbc "select * from \"$rbvar(tablename)\"" rec {
foreach {field x y objid objtype} $fields { foreach {field x y objid objtype} $fields {
if {($y>=$y_lo) && ($y<=$y_hi)} then { if {($y>=$y_lo) && ($y<=$y_hi)} then {
if {$objtype=="t_f"} { if {$objtype=="t_f"} {
...@@ -2406,7 +2423,7 @@ tk_messageBox -title Information -message "The printed image in Postscript is in ...@@ -2406,7 +2423,7 @@ tk_messageBox -title Information -message "The printed image in Postscript is in
proc {rb_save_report} {} { proc {rb_save_report} {} {
global rbvar global rbvar
set prog "set rbvar(tablename) $rbvar(tablename)" set prog "set rbvar(tablename) \"$rbvar(tablename)\""
foreach region $rbvar(regions) { foreach region $rbvar(regions) {
set prog "$prog ; set rbvar(y_$region) $rbvar(y_$region)" set prog "$prog ; set rbvar(y_$region) $rbvar(y_$region)"
} }
...@@ -2652,7 +2669,7 @@ proc vTclWindow.about {base} { ...@@ -2652,7 +2669,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.88} label $base.l3 -borderwidth 0 -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-* -relief sunken -text {vers 0.90}
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
...@@ -3261,7 +3278,7 @@ proc vTclWindow.nt {base} { ...@@ -3261,7 +3278,7 @@ proc vTclWindow.nt {base} {
show_error "Your table has no fields!" show_error "Your table has no fields!"
focus .nt.e2 focus .nt.e2
} else { } else {
set temp "create table $newtablename ([join [.nt.lb get 0 end] ,])" set temp "create table \"$newtablename\" ([join [.nt.lb get 0 end] ,])"
if {$fathername!=""} then {set temp "$temp inherits ($fathername)"} if {$fathername!=""} then {set temp "$temp inherits ($fathername)"}
cursor_watch .nt cursor_watch .nt
set retval [catch { set retval [catch {
...@@ -3539,13 +3556,13 @@ if {[lindex [split [string toupper $qcmd]] 0]!="SELECT"} { ...@@ -3539,13 +3556,13 @@ if {[lindex [split [string toupper $qcmd]] 0]!="SELECT"} {
sql_exec noquiet $qcmd sql_exec noquiet $qcmd
} }
} else { } else {
set mw(query) [subst $qcmd]
set mw(updatable) 0
set mw(isaquery) 1
Window show .mw Window show .mw
set mw(layout_name) $queryname set mw(layout_name) $queryname
mw_load_layout $queryname mw_load_layout $queryname
set mw(query) $qcmd mw_select_records $mw(query)
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} } -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
...@@ -3612,14 +3629,15 @@ Window destroy .ql} -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-* -p ...@@ -3612,14 +3629,15 @@ Window destroy .ql} -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-* -p
bind $base.entt <Key-Return> { bind $base.entt <Key-Return> {
ql_add_new_table ql_add_new_table
} }
button $base.execbtn -borderwidth 1 -command {Window show .mw button $base.execbtn -borderwidth 1 -command {
set qcmd [ql_compute_sql] set qcmd [ql_compute_sql]
set mw(layout_name) nolayoutneeded set mw(layout_name) nolayoutneeded
mw_load_layout $mw(layout_name) set mw(query) [subst $qcmd]
set mw(query) $qcmd
set mw(updatable) 0 set mw(updatable) 0
set mw(isaquery) 1 set mw(isaquery) 1
mw_select_records $qcmd} -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-* -padx 9 -pady 3 -text {Execute SQL} Window show .mw
mw_load_layout $mw(layout_name)
mw_select_records $mw(query)} -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-* -padx 9 -pady 3 -text {Execute SQL}
button $base.stoqb -borderwidth 1 -command {Window show .qb button $base.stoqb -borderwidth 1 -command {Window show .qb
.qb.text1 delete 1.0 end .qb.text1 delete 1.0 end
.qb.text1 insert end [ql_compute_sql] .qb.text1 insert end [ql_compute_sql]
...@@ -3675,7 +3693,7 @@ proc vTclWindow.rf {base} { ...@@ -3675,7 +3693,7 @@ proc vTclWindow.rf {base} {
if {$newobjname==""} { if {$newobjname==""} {
show_error "You must give object a new name!" show_error "You must give object a new name!"
} elseif {$activetab=="Tables"} { } elseif {$activetab=="Tables"} {
set retval [sql_exec noquiet "alter table $oldobjname rename to $newobjname"] set retval [sql_exec noquiet "alter table \"$oldobjname\" rename to \"$newobjname\""]
if {$retval} { if {$retval} {
sql_exec quiet "update pga_layout set tablename='$newobjname' where tablename='$oldobjname'" sql_exec quiet "update pga_layout set tablename='$newobjname' where tablename='$oldobjname'"
cmd_Tables cmd_Tables
...@@ -4520,6 +4538,65 @@ catch {Window destroy .$fdvar(forminame)} ...@@ -4520,6 +4538,65 @@ catch {Window destroy .$fdvar(forminame)}
-x 175 -y 25 -width 60 -height 17 -anchor nw -bordermode ignore -x 175 -y 25 -width 60 -height 17 -anchor nw -bordermode ignore
} }
proc vTclWindow.gpw {base} {
if {$base == ""} {
set base .gpw
}
if {[winfo exists $base]} {
wm deiconify $base; return
}
###################
# CREATING WIDGETS
###################
toplevel $base -class Toplevel
wm focusmodel $base passive
set sw [winfo screenwidth .]
set sh [winfo screenheight .]
set x [expr ($sw - 297)/2]
set y [expr ($sh - 98)/2]
wm geometry $base 297x98+$x+$y
wm maxsize $base 1009 738
wm minsize $base 1 1
wm overrideredirect $base 0
wm resizable $base 0 0
wm deiconify $base
wm title $base "Input parameter"
label $base.l1 \
-anchor nw -borderwidth 1 \
-font -Adobe-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-* \
-justify left -relief sunken -textvariable gpw(msg) -wraplength 200
entry $base.e1 \
-background #fefefe -borderwidth 1 -highlightthickness 0 \
-textvariable gpw(var)
bind $base.e1 <Key-KP_Enter> {
set gpw(result) 1
destroy .gpw
}
bind $base.e1 <Key-Return> {
set gpw(result) 1
destroy .gpw
}
button $base.bok \
-borderwidth 1 -command {set gpw(result) 1
destroy .gpw} -padx 9 \
-pady 3 -text Ok
button $base.bcanc \
-borderwidth 1 -command {set gpw(result) 0
destroy .gpw} -padx 9 \
-pady 3 -text Cancel
###################
# SETTING GEOMETRY
###################
place $base.l1 \
-x 10 -y 5 -width 201 -height 53 -anchor nw -bordermode ignore
place $base.e1 \
-x 10 -y 65 -width 200 -height 24 -anchor nw -bordermode ignore
place $base.bok \
-x 225 -y 5 -width 61 -height 26 -anchor nw -bordermode ignore
place $base.bcanc \
-x 225 -y 35 -width 61 -height 26 -anchor nw -bordermode ignore
}
proc vTclWindow.fdtb {base} { proc vTclWindow.fdtb {base} {
if {$base == ""} { if {$base == ""} {
set base .fdtb set base .fdtb
......
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