Forum > Packages and Libraries

Postgres, ZEOS and Visual PlanIt - unable to create a table

(1/5) > >>

kkuba:
I have a serious problem with Turbo Visual PlanIt.  I am using Lazauras 2.2 (TVPlanIt from OPM), ZEOS 7.2.14 and Postgress 14.2 PSQL is from this Postgress version

Prepares the simplest possible example.
1. I create a database in Postgres 14.
2. I am placing and configuring Zconnection. I verify the connection to the base, everything works fine.
3. I am placing TVpZeoseDatastore and set the connection to Zconnection and then check AutoCreate property.
4. The entire IDE is crashing down. After closing the damaged environment, the IDE project cannot be loaded any more. Reloading the entire IDE crashes again.

For testing, I repeated the operation in CodeTyphon 7.7. In CT there is ZEOS 8.0 configured and the compiler is FPC 3.31. Unfortunately, the problem is exactly the same. The whole environment breaks down. The advantage of CT is a better error message - which I attached.

The problem is very difficult to diagnose for me because not only the application is damaged, but the entire Lazaurus is damaged. Thanks in advance for any help.

wp:

--- Quote from: kkuba on April 17, 2022, 03:32:04 pm ---After closing the damaged environment, the IDE project cannot be loaded any more. Reloading the entire IDE crashes again.

--- End quote ---
This is very unusual. Could it be that you set up the IDE to automatically re-load the project of the last session? "Tools" > "Options" > "Environment" > "IDE Startup" > "Open last project and packages at start". Since you cannot fix this in the IDE due to it crashing you must edit the config file manually: Find the folder in which Lazarus saves the user profile settings. Normally this is in your home directory (Windows: c:\users\<your login name>\appdata\local\lazarus, Linux: ~/.lazarus); in case of a secondary installation it is the folder specified in the lazarus.cfg file of the Lazarus installation, or as commandline argument (--pcp=.... or --primary-config-path=...). Open the file environmentoptions.xml in an editor and find the node <AutoSave>. Set the attribute OpenLastProjectAtStart to false. Now Lazarus should start again.

As for the TvPlanIt issue: Since I am not very experienced with the large database systems they are not tested very well. I am aware that the AutoCreate and AutoConnect properties is problematic sometimes. Do not set them at designtime because a fatal bug will crash the IDE. Better to set TDatastore.AutoCreate in the form's OnCreate handler, or even better call TDatastore.CreateTables and connect manually (Connected := true). If there is a crash it will affect the application only, not the IDE, and debugging will be much easier.

Did you try the demo project in examples/datastores/zeos?

paweld:
As for the error, it occurs because PostgreSql does not support the AUTOINCREMENT keyword.
To fix this problem you need to edit the structures in the vpzeosds.pas file, instead of INTEGER AUTOINCREMENT use SERIAL - attached is the file customized for this RDBMS.

As for the problem with Lazarus, as @wp wrote, you have the option to open the last checked project and this causes errors. You can also solve the problem by renaming the directory with that project and then launching the IDE - if it doesn't find the project, it will start with an empty new project

wp:

--- Quote from: paweld on April 17, 2022, 05:25:57 pm ---As for the error, it occurs because PostgreSql does not support the AUTOINCREMENT keyword.
To fix this problem you need to edit the structures in the vpzeosds.pas file, instead of INTEGER AUTOINCREMENT use SERIAL - attached is the file customized for this RDBMS.

--- End quote ---
Thanks for this information. I am not a heavy user of ZEOS, but isn't ZEOS designed such as to avoid these differences in SQL dialects? Or does ZEOS provide its own "general-purpose" AUTOINCREMENT keyword which is valid for all database systems?

af0815:
IMHO no, ZEOS breaks the differences between Delphi and Lazarus. But i have seen, not breaking the differnces between  DB with autoincrements or with generators or SQL have simply nothing. There is no 'general purpose' autoincrement. And there are a lot of differences between the DBs if you dive deeper. And it is not a problem of ZEOS, you can see this in SQLdb or you hook in windows on ADO or ODBC. ODBC ther is the question - on Linux (which implementation) or Windows. And .........

I have never found a common autoincrement working for MS-SQL, Interbase, Sqlite and DBase working :-) I have no knowledge about Oracle-DB or Postgres. But you have always to respect the specialities of a DB-Sever (and its Version) if you make more than 'select col1,col2,col3 from mytable' :-)

Navigation

[0] Message Index

[#] Next page

Go to full version