Thursday, November 20, 2014

Check PostgreSQL version on the machine

Hi All,
Please use the reference from the below custom action I have created for checking the PostgreSQL version on your machine.

function CheckPostgresSQLVersion(hMSI)
STRING ProcessName, szLine, Text,svReturnLine;
NUMBER nvFileHandle, ExitCode,nvResult,nvLineNumber,nLoc;
begin
ProcessName = "CheckPostgresSQLVersion";
OpenFileMode (FILE_MODE_APPEND);
if (CreateFile (nvFileHandle, SUPPORTDIR, "PostgresSQLVersion.bat") = 0) then
szLine = "psql --version";
WriteLine(nvFileHandle, szLine);
endif;

// Close the file.
CloseFile (nvFileHandle);

ExitCode = RunApplication(hMSI, SUPPORTDIR^"PostgresSQLVersion.bat", " >PostgresSQLVersion.txt", "");
if (ExitCode = 0) then
GetFullErrorText(hMSI, 60, SUPPORTDIR, "PostgresSQLVersion.txt", Text);
nvResult = FileGrep (SUPPORTDIR ^ "PostgresSQLVersion.txt", "psql (PostgreSQL)", svReturnLine,nvLineNumber, RESTART);
if(nvResult = 0) then
nLoc = StrFind(svReturnLine,"9.1");

if(nLoc<0 p="" then=""> MsiSetProperty(hMSI, "INVALID_POSTGRESQL_VERSION", "1");
MessageBox("Invalid version of PostgreSQL",SEVERE);
else
MsiSetProperty(hMSI, "INVALID_POSTGRESQL_VERSION", "0");
endif;
endif;
endif;
DeleteFile(SUPPORTDIR^"PostgresSQLVersion.bat");
end;

Tuesday, April 15, 2014

Aborting from a basic msi project using custom Action

To abort in a basic msi project through a custom action, one needs to return ERROR_INSTALL_FAILURE in the installer code.

The custom actions which gets executed successfully should return the value ERROR_SUCCESS.

Tuesday, March 25, 2014

Remove temporary records in msi database (vbscript)

Set viewlist = Database.OpenView("SELECT * FROM `ComboBox` WHERE `Property`='DEFAULT_ENGINE'")
viewlist.Execute

Set reclist = viewlist.Fetch

' delete any existing LISTBOXPROP records
While Not (reclist Is Nothing)
    viewlist.Modify 6, reclist ' 6 = delete
    Set reclist = viewlist.Fetch
Wend

viewlist.Close