Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 5 Jahren, 2 Monaten
Letzter Beitrag:
vor 5 Jahren, 1 Monat
Beteiligte Autoren:
Yogi Yang, Pragma Tix

[WD17] For Yogi Yang.Re-engineering a Cute Postgres application.

Startbeitrag von Pragma Tix am 26.03.2013 12:04

Hi Yogi,
sorry for the delayed answer. Last week Nick and I had a intensive extreme programming session. Since that session I get an allergic Reaction if I just open the office door. (Should have a timeout)
About Extreme programming : http://en.wikipedia.org/wiki/Extreme_programming
How to import a QT/Postgres application.
1) Shut down Windev and Install the native Postgres Driver.
2) Start Windev, create a new Project, create a new empty analysis.
3)Create a new connection.
3a) Click Analysis/Connection and create a new connection . f.i. local_pg_conn
3b) Test the connection before you carry on.

(see screenshot)

3b)Import the Postgres tables.
- Click
Structure of files/Import the description of files/tables
A wizard appears - click the next. You will see the "Choosing the datasource" pane.
Select Postgres and click next.
On the "Migration the Data" pane Select : Access the data in its current format. Click next.
On the "Selecting the source database" pane select Your new Postgres connection defined in one of the previous steps. local_pg_conn.
On the "Selecting tables to import" pane Untick (deactivate) the Show system tables checkbox, then select all Tables. ( I would not use the queries)
Click next and that's it.
Save the analysis.
Some Notes :
Note 1)

Comfort / Modifying the table structure :
In order to make you live a bit more comfortable.... Convert all imported files to Hyperfile.
Reason 1) : You can easily modify the structure of your tables. ( a feature which is not available for Postgres)
Reason 2 ) In case that your Postgres Table is using strange sequences, drop the primary keys. Create simple auto-increment fields
Redesign Table-Relationship and referentiell integrity rules, using the powerful Merise design pattern.
Once your Database design is production ready ...
-Create a new Postgres Database
-create a new Connection for you shiny new database See 3a.
-change the connection for all tables back to Postgress. (using your new connection).
physically create the database-tables using HCreationIfNotFound()

Note 2)
Stored procedures. See :
It is about Oracle, but the info is also valid for Postgres.

Note 3)
You have to use SQLTransAction() instead of HTransActionXXX()
(I would use Exceptions ie WHEN EXCEPTION IN... DO ... ELSE ... END)

Note 4)
Pate Halsted is a known Postgres wizard .. You will find some of Pete's Postgres related Blogs at :

creating this messages takes me about 20 minutes ... so thats it from my side.



Hello Pragma,

Thanks for detailed reply.

It will be quite helpful to me.

In your reply you refer to 'Merise design pattern'. Can you point me to any documentation that explains this in depth?

You have stated that we should generate Analysis and use it but as I do not want to modify the structure of the database in anyway and I don't want to convert it to HF either so want it be better to access pgSQL directly without intermediate Analysis?

Thanks & Regards,

Yogi Yang

von Yogi Yang - am 26.03.2013 14:38
Merise see :

Most of us use the Logical Database Model (without creating a Conceptual DM) nevertheless we use part of the Merise design without even noticeing it.

You do not have to convert your Postgres database into Hyperfile. You should consider converting in case that :
Your primary keys use a strange sequence. ie. 1. 100, 200. Delete the primary key, create an automatic ID based PK.
Your links are not defined as they should.
You want to modify the table structure.

Finally it is not my decission..

von Pragma Tix - am 26.03.2013 16:30
Hello Pragma,

I conclude that in case of pgSQL as I do not want to allow WD to make any changes to its structure in anyway I do not need to generate Analysis? If I am wrong please correct me.

Finally which is the best way to access pgSQL database and its data without generating analysis?

von Yogi Yang - am 29.03.2013 10:50
Hi Yogi,
You have to generate the analysis, even if there is no need to modify the Postgres DB-table-structure.
See, my first message. Just follow the steps and ignore the converting to Hyperfile stuff.


von Pragma Tix - am 29.03.2013 20:00
Hello Pragma,

Thanks for your insights.

I will do as you have suggested.

von Yogi Yang - am 01.04.2013 10:35
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.