Old 9th January 2007, 16:17   #1
jtonic
Junior Member
 
Join Date: Jan 2007
Posts: 2
PostgreSQL, ExecCmd::exec, large dump file problem

Hi

My installer would install PostgreSQL(silent), and then run 3 sql files (1-make a user, 2-make a database, 3-import nomenclators).

The problem is that the last of them return code 2 and fail to execute (I use ExecCmd::exec).
The dump file is big enough (106 M).

the line that drives me crazy look like
ExecCmd::exec \
'$INSTDIR\Db\bin\psql.exe -q -o "$INSTDIR\Commons\data\arhimed\arhimed.log" -U user db -f "$INSTDIR\Commons\data\arhimed\arhimed.sql"' \
'password$\r$\n'

What can I do against this problem?
Any help is very welcome, jtonic.
jtonic is offline   Reply With Quote
Old 9th January 2007, 20:29   #2
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
This might help, NSIS manual 2.2 Script Files

If you want to use a double-quote in a string you can either use $\" to escape the quote or quote the string with a different type of quote such as ` or '.

Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 10th January 2007, 06:05   #3
Takhir
Major Dude
 
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,222
Plug-in itself uses negative exit codes for it's (internal) errors, so +2 was returned by shell or application. Probably this is "02 File not found". May be quotes for executable can help?
code:
ExecCmd::exec \
'"$INSTDIR\Db\bin\psql.exe" -q -o "$INSTDIR\Commons\data\arhimed\arhimed.log" -U user db -f "$INSTDIR\Commons\data\arhimed\arhimed.sql"' \
'password$\r$\n'

Takhir is offline   Reply With Quote
Old 10th January 2007, 10:59   #4
jtonic
Junior Member
 
Join Date: Jan 2007
Posts: 2
ExecCmd::exec questions

First, thanks you for your replies

If I use -W in psql command I force password request, and the following ExecCmd::exec faild to execute [return code 2]

StrCpy $1 '$INSTDIR\Db\bin\psql.exe -q -U postgres -W postgres -f $INSTDIR\Commons\data\arhimed\create_user.sql'
DetailPrint $1
ExecCmd::exec /NOUNLOAD /ASYNC $1 \
"passwordSQL-paSS$\r$\n"
Pop $0
ExecCmd::wait $0

In postgresql server log I discovered:
2007-01-10 13:28:20 FATAL: password authentication failed for user "postgres"

If I remove option -W all its okie, because psql.exe doesn't need password.

Seemed that password passwordSQL-paSS is not recognized (altered, not delivered) by psql.exe command (via ExecCmd::exec).

Another problem is that blank spaces can't be included in ExecCmd::exec command string:
If $INSTDIR is C:\Program files\Iqbyte the ExecCmd::exec failed with code 1. If I execute the same command in terminal all is okie.

Have anyone else faced with these problems? Any helps are very welcome. Cheers, jtonic.
jtonic is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump