Troubles installing modified version of hMailServer

Use this forum if you want to discuss a problem or ask a question related to a hMailServer beta release.
Post Reply
Ivana
New user
New user
Posts: 3
Joined: 2017-10-25 14:19

Troubles installing modified version of hMailServer

Post by Ivana » 2017-10-25 14:32

Hello,

I've been working on a patch to allow per-user flags for hMailServer. In the process of doing so I created a new table (hm_flags) that keeps track of each message and it's flags for each user.

I've added the 'create/alter table' queries to the CreateTable scripts and ran the setup compiler. The problem is when I try to install the modified version of hMailServer either the sql commands do not execute or nothing happens to the database.

Currently for my tests I am using SQL Server.
Here's a more detailed explanation of the steps I do after I transfer to another computer 2 hMailServer setups - my own and a release version 5.7 downloaded from github:
1. I try to install the compiled version of the server, but an error occurs while creating the database "create/alter procedure must be the first".
2. Another thing I've tried is first I install the release version of hMailServer then uninstall it but I keep the created database. Then I try installing the compiled version and instead of using the alredy created database I choose "select existing database" but again there is no change in it and the new table is not added.
I know this because I monitor the queries with SQL Server Profiler.

I've tried different setups of my compiled version. One without modified scripts and one with the hm_flags table added.
Keep in mind that to modify and test the code I made the modifications directly to the database without adding them to the install scripts and I ran the modified hMailServer from Visual Studio instead of making an installer and installing.

I am willing to submit the patch on github after I finish with creating a proper installer.

Regards,
Ivana

User avatar
Dravion
Senior user
Senior user
Posts: 2071
Joined: 2015-09-26 11:50
Location: Germany
Contact:

Re: Troubles installing modified version of hMailServer

Post by Dravion » 2017-10-25 14:39

The sql table creation step is not performed by the Innosetup installer.Innosetup calls dbsetup.exe (a .net c# exe) which connects to the hmailserver.exe service database object and executes the the proper sql scripts. If you want to modify the tables you have to modify the existing sql scripts in the dbscripts folder and test if dbsetup creates the correct tables.if anything goes ok, do your innosetup compilation to include your modificafions into the hMailServer setup program.

Ivana
New user
New user
Posts: 3
Joined: 2017-10-25 14:19

Re: Troubles installing modified version of hMailServer

Post by Ivana » 2017-10-25 16:36

Hello,

I have modified the .sql scripts and run the dbsetup and there is still the same error "CREATE/ALTER PROCEDURE' must be the first statement in a query batch". Also I've tried the same thing using the original .sql script from github https://github.com/hmailserver/hmailser ... sMSSQL.sql and I got the same error again.

User avatar
Dravion
Senior user
Senior user
Posts: 2071
Joined: 2015-09-26 11:50
Location: Germany
Contact:

Re: Troubles installing modified version of hMailServer

Post by Dravion » 2017-10-25 17:06

Its a MS Transact SQL Problem. Place GO before CREATE proc, this should fix the problem.

Ivana
New user
New user
Posts: 3
Joined: 2017-10-25 14:19

Re: Troubles installing modified version of hMailServer

Post by Ivana » 2017-10-26 10:10

Hello,

I solved the problem by converting the .sql file end of line characters to CRLF.

Regards

Post Reply