Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 24th May 2012, 09:08   #1
druoleg
Junior Member
 
Join Date: May 2012
Posts: 1
Question txt-file parsing

Hi all!
I need to execute sql query to MS SQL Date base.
Use this metod:
code:
ExecWait '"sqlcmd" -S "$DB_server" -U "$DB_user" -P "$DB_password" -d "$DB_name" -i "$Temp\NS_Fix_IIRF\get_revision.sql" -o "$Temp\NS_Fix_IIRF\result.txt"'


Result:
code:

STR
--------------------
0400

(обработано строк: 1)



Parsing file:
code:

ClearErrors
FileOpen $0 "$Temp\NS_Fix_IIRF\result.txt" r
IfErrors done
${While} $1 != "0400" ;Определяем номер ревизии по результату запроса к БД
FileRead $0 $1
StrCpy "$1" "$1" 4
${EndWhile}
StrCpy "$REV" $1
FileClose $0
done:



If in file is present 0400 - all work fine. Else cycle holds infinitely.

How fix this problem?
Tnx!
druoleg is offline   Reply With Quote
Old 24th May 2012, 09:36   #2
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,840
code:

ClearErrors
FileOpen $0 "$Temp\NS_Fix_IIRF\result.txt" r
IfErrors done

loop:
FileRead $0 $1
IfErrors close
StrCpy "$1" "$1" 4
${If} $1 == "0400"
StrCpy "$REV" $1
goto close
${EndIf}
goto loop

close:
FileClose $0
done:

MSG is offline   Reply With Quote
Old 24th May 2012, 10:30   #3
jpderuiter
Major Dude
 
Join Date: Feb 2007
Posts: 546
Did you know you can execute an sql script with the following Plugin?
http://nsis.sourceforge.net/MSSQL_OLEDB_plug-in
jpderuiter is offline   Reply With Quote
Reply
Go Back   Winamp 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