Обсуждение: PATCH for CREATE DATABASE with COLLATE, CTYPE & CONNECTION LIMIT
Hi All,
Please find the patch for "CREATE DATABASE" with COLLATE, CTYPE & CONNECTION LIMIT.
Changed the following files:
* include/schema/pgDatabase.h
- Declarations of variables & functions for collate, ctype & connection limit
* include/dlg/dlgDatabase.h
- Declaration of the event handlers to take care the auto-completion of ctlComboBox for collate & ctype
* schema/pgDatabase.cpp
- Made modifications in GetSql function for reverse engineering of the query
- Made modifications in CreateObjects for fetching ctype, collate and connection limit details from pg_database catalog for existing databases, saved as datctype, datcollate, datconnlimit respectively.
* dlg/dlgDatabase.cpp
- Defined the following variables:
+ cbCollate as ctlComboBox
+ cbCType as ctlComboBox
+ spConnLimit as wxSpinCtrl
- Defined event-handlers for auto-completion operation for cbCollate & cbCType
- COLLATE & CTYPE takes locale as input value.
Currently, we don't have any way to get the supported server-locale on client side. :(
Hence, I have kept the values fetched from the already used locale values earlier along with C & POSIX.
- Made modification for Create a new database & editing existing database (properties).
* ui/dlgDatabase.xrc
- Increased the height of the property dialog by 10
- Added controls for collate, ctype & connection limit
You may need to run embed-xrc.
I have followed this link to implement this.
http://developer.postgresql.org/pgdocs/postgres/sql-createdatabase.html
Range for the Connection limit is set to -1 to 1000.
Regards,
Ashesh
Please find the patch for "CREATE DATABASE" with COLLATE, CTYPE & CONNECTION LIMIT.
Changed the following files:
* include/schema/pgDatabase.h
- Declarations of variables & functions for collate, ctype & connection limit
* include/dlg/dlgDatabase.h
- Declaration of the event handlers to take care the auto-completion of ctlComboBox for collate & ctype
* schema/pgDatabase.cpp
- Made modifications in GetSql function for reverse engineering of the query
- Made modifications in CreateObjects for fetching ctype, collate and connection limit details from pg_database catalog for existing databases, saved as datctype, datcollate, datconnlimit respectively.
* dlg/dlgDatabase.cpp
- Defined the following variables:
+ cbCollate as ctlComboBox
+ cbCType as ctlComboBox
+ spConnLimit as wxSpinCtrl
- Defined event-handlers for auto-completion operation for cbCollate & cbCType
- COLLATE & CTYPE takes locale as input value.
Currently, we don't have any way to get the supported server-locale on client side. :(
Hence, I have kept the values fetched from the already used locale values earlier along with C & POSIX.
- Made modification for Create a new database & editing existing database (properties).
* ui/dlgDatabase.xrc
- Increased the height of the property dialog by 10
- Added controls for collate, ctype & connection limit
You may need to run embed-xrc.
I have followed this link to implement this.
http://developer.postgresql.org/pgdocs/postgres/sql-createdatabase.html
Range for the Connection limit is set to -1 to 1000.
Regards,
Ashesh
Ashesh Vashi a écrit : > [...] > Please find the patch for "CREATE DATABASE" with COLLATE, CTYPE & > CONNECTION LIMIT. > Some comments : * the new properties are not displayed in the Properties tab. * the Comment field is really too small; you should make the dialog bigger. * CTYPE is not recognized by the syntax highlighting handler (it appears in black). And a question: why do you limit the connection limit to 1000? Thanks for your patch. Regards. -- Guillaume. http://www.postgresqlfr.org http://dalibo.com
Hi Guillaume Lelarge,
Thanks for the comments.
Guillaume Lelarge wrote:
* COLLATE & CTYPE should visible for PostgreSQL 8.4.
* CONNECTION LIMIT should be visible for PostgreSQL 8.1 & later.
(I may forget to ask you to use embed-xrc.bat on windows. :( )
If not, I will have to look into the patch. :(
For sack of it, I have done it, actully I was looking for input from you all.
What do you say?
Thanks for reviewing the patch.
Will send the updated patch as soon as possible.
Regards,
Ashesh
Thanks for the comments.
Guillaume Lelarge wrote:
If you want, I can make it visible for all the version of PostgreSQL and make it disabled for not supported version of PostgreSQL.Ashesh Vashi a écrit :[...] Please find the patch for "CREATE DATABASE" with COLLATE, CTYPE & CONNECTION LIMIT.Some comments :* the new properties are not displayed in the Properties tab.
* COLLATE & CTYPE should visible for PostgreSQL 8.4.
* CONNECTION LIMIT should be visible for PostgreSQL 8.1 & later.
(I may forget to ask you to use embed-xrc.bat on windows. :( )
If not, I will have to look into the patch. :(
Will do.* the Comment field is really too small; you should make the dialog bigger.
Oh.. I missed out.* CTYPE is not recognized by the syntax highlighting handler (it appears in black).
Nobody asked to me to limit it to 1000.And a question: why do you limit the connection limit to 1000?
For sack of it, I have done it, actully I was looking for input from you all.
What do you say?
Thanks for reviewing the patch.
Will send the updated patch as soon as possible.
Regards,
Ashesh
Thanks for your patch. Regards.
On Mon, Nov 17, 2008 at 5:49 AM, Ashesh D Vashi <ashesh.vashi@enterprisedb.com> wrote: > If you want, I can make it visible for all the version of PostgreSQL and > make it disabled for not supported version of PostgreSQL. > * COLLATE & CTYPE should visible for PostgreSQL 8.4. > * CONNECTION LIMIT should be visible for PostgreSQL 8.1 & later. > (I may forget to ask you to use embed-xrc.bat on windows. :( ) > If not, I will have to look into the patch. :( Yup, as a general rule we disable controls for versions of Postgres that doesn't support them - we don't make the invisible. There are two reasons for this - to make the presentation of dialogues to the user consistent (some could change quite considerably otherwise), and to avoid layout issues caused by having multiple possible designs. > And a question: why do you limit the connection limit to 1000? > > > Nobody asked to me to limit it to 1000. > For sack of it, I have done it, actully I was looking for input from you > all. > What do you say? Yeah, I'd set the limit to the bounds of the datatype used in the catalogs, or that PostgreSQL will accept if thats a lower value (despite the fact that may seem ridiculously high). -- Dave Page EnterpriseDB UK: http://www.enterprisedb.com
Hi Dave Page,
Thanks for the inputs.
I will send the updated patch.
Regards,
Ashesh
Dave Page wrote:
Thanks for the inputs.
I will send the updated patch.
Regards,
Ashesh
Dave Page wrote:
On Mon, Nov 17, 2008 at 5:49 AM, Ashesh D Vashi <ashesh.vashi@enterprisedb.com> wrote:If you want, I can make it visible for all the version of PostgreSQL and make it disabled for not supported version of PostgreSQL. * COLLATE & CTYPE should visible for PostgreSQL 8.4. * CONNECTION LIMIT should be visible for PostgreSQL 8.1 & later. (I may forget to ask you to use embed-xrc.bat on windows. :( ) If not, I will have to look into the patch. :(Yup, as a general rule we disable controls for versions of Postgres that doesn't support them - we don't make the invisible. There are two reasons for this - to make the presentation of dialogues to the user consistent (some could change quite considerably otherwise), and to avoid layout issues caused by having multiple possible designs.And a question: why do you limit the connection limit to 1000? Nobody asked to me to limit it to 1000. For sack of it, I have done it, actully I was looking for input from you all. What do you say?Yeah, I'd set the limit to the bounds of the datatype used in the catalogs, or that PostgreSQL will accept if thats a lower value (despite the fact that may seem ridiculously high).
Hi All,
Please find the attached updated patch.
Patch contains following changes:
* Added "ctype" in keyword list as RESERVED
* Added support for COLLATE, CTYPE & CONNECTION LIMIT in pgDatabase
* Added reverse engineering support for SQL generation from existing schema
* Added these variable in properties list.
(Made them disabled for the not-supported versions of PostgreSQL)
* Added them in property list (forgot to add it in the previous patch)
* Used wxTextCtrl instead of wxSpinCtrl for connection limit control in
properties dialog, as we don't want to put any restriction on the maximum
limit for it.
Regards,
Ashesh
Please find the attached updated patch.
Patch contains following changes:
* Added "ctype" in keyword list as RESERVED
* Added support for COLLATE, CTYPE & CONNECTION LIMIT in pgDatabase
* Added reverse engineering support for SQL generation from existing schema
* Added these variable in properties list.
(Made them disabled for the not-supported versions of PostgreSQL)
* Added them in property list (forgot to add it in the previous patch)
* Used wxTextCtrl instead of wxSpinCtrl for connection limit control in
properties dialog, as we don't want to put any restriction on the maximum
limit for it.
Regards,
Ashesh
Hi On Mon, Nov 17, 2008 at 12:56 PM, Ashesh D Vashi <ashesh.vashi@enterprisedb.com> wrote: > Hi All, > > Please find the attached updated patch. > > Patch contains following changes: > * Added "ctype" in keyword list as RESERVED > * Added support for COLLATE, CTYPE & CONNECTION LIMIT in pgDatabase > * Added reverse engineering support for SQL generation from existing schema > * Added these variable in properties list. > (Made them disabled for the not-supported versions of PostgreSQL) > * Added them in property list (forgot to add it in the previous patch) > * Used wxTextCtrl instead of wxSpinCtrl for connection limit control in > properties dialog, as we don't want to put any restriction on the maximum > limit for it. Some thoughts (all minor), in no particular order: - Let's use 'Collation' and 'Character type' in both the properties list view and on the dialog for the labels - it'll look much nicer than COLLATE and CTYPE I think. - dlgDatabase needs to have it's sizing fixed - the cell holding the CTYPE controls is stretching, but it should be the comment cell that stretches (<growablerows> needs to change to 11 perhaps?). - Entering a new connection limit, and clicking the SQL tab doesn't show me an SQL statement if the value entered is too large, but does enable the OK button The easiest fix is probably to limit the number of characters the control will access. That should still allow a huge number to entered. - Entering a connection limit of -<anything but 1> is silently converted to 1. We should just ignore anything that isn't 1, rather than trying to correct it for the user. - 'Connection Limit' in the properties list should not have a capital L. - This code in dlgDatabase may be uneeded now? + // As some of the controls has been made hidden, + // Update() will help to rearrange all the other controls properly. + this->Update(); - The COLLATE and CTYPE options should be omitted from the CREATE DATBASE SQL generated by dlgDatabase, if the user hasn't specified values. - The CONNECTION LIMIT option seems to have an additional space in the indent: CREATE DATABASE foobar WITH ENCODING='UTF8' COLLATE='' CTYPE='' CONNECTION LIMIT=99; Looks pretty good though in general :-) -- Dave Page EnterpriseDB UK: http://www.enterprisedb.com
Hi,
Please find the updated patch.
Datatype for the datconnlimit is integer.
Regards,
Ashesh
Please find the updated patch.
Done.Some thoughts (all minor), in no particular order: - Let's use 'Collation' and 'Character type' in both the properties list view and on the dialog for the labels - it'll look much nicer than COLLATE and CTYPE I think.
Changed <growablerows> to 11.- dlgDatabase needs to have it's sizing fixed - the cell holding the CTYPE controls is stretching, but it should be the comment cell that stretches (<growablerows> needs to change to 11 perhaps?).
Maximum number allowed will be 2147483647.- Entering a new connection limit, and clicking the SQL tab doesn't show me an SQL statement if the value entered is too large, but does enable the OK button The easiest fix is probably to limit the number of characters the control will access. That should still allow a huge number to entered.
Datatype for the datconnlimit is integer.
Done.- Entering a connection limit of -<anything but 1> is silently converted to 1. We should just ignore anything that isn't 1, rather than trying to correct it for the user.
Done.- 'Connection Limit' in the properties list should not have a capital L.
Done.- This code in dlgDatabase may be uneeded now? + // As some of the controls has been made hidden, + // Update() will help to rearrange all the other controls properly. + this->Update();
Done.- The COLLATE and CTYPE options should be omitted from the CREATE DATBASE SQL generated by dlgDatabase, if the user hasn't specified values.
Done.- The CONNECTION LIMIT option seems to have an additional space in the indent: CREATE DATABASE foobar WITH ENCODING='UTF8' COLLATE='' CTYPE='' CONNECTION LIMIT=99;
Regards,
Ashesh
Hi On Tue, Nov 18, 2008 at 10:57 AM, Ashesh D Vashi <ashesh.vashi@enterprisedb.com> wrote: > Hi, > > Please find the updated patch. Thanks - committed with minor changes: - Change 'Collate' to 'Collation' - There were still a couple of places in the code which changed the connection limit to -1 if it was less than that. I've removed those - so we can rely on the server to catch errors there (the behaviour is more consistent this way). Note that I did find that the server will accept connection limits of < -1 anyway - I've reported this as a PG bug. -- Dave Page EnterpriseDB UK: http://www.enterprisedb.com