Kinook Software Forum

Go Back   Kinook Software Forum > Visual Build Professional > [VBP] General Discussion
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 04-22-2008, 01:15 PM
teognost teognost is online now
Registered User
 
Join Date: 05-25-2004
Location: Prague,Czech Republic
Posts: 200
Issue-Reading a file with vbld_GetFileContents

I need to read the contents of some sql script files one by one and put the content into a separate file.In order to do this I have a step which sets the macro CURR_SQL_SCRIPT_CONTENT to
[vbld_GetFileContents("%PROCFILES_FULLPATH%")]
and then I have another step which writes into the target file the macro CURR_SQL_SCRIPT_CONTENT
SQL scripts contains brackets like :
IF NOT EXISTS (SELECT * FROM [sm].[DefaultSetting] WHERE [ApplicationType] = 1 AND [ValueId] = 111)

and I see when reading the SQL file everything inside the brackets is just ignored and therefore is not appearing in the target file.
I do not understand what is wrong as in the help it is written vbld_GetFileContents should read everything ok:
"vbld_GetFileContents(Filename): Retrieve the contents of a file and double up characters that are treated specially by Visual Build Pro. Bracket characters [ ] and percent sign % characters are normally interpreted by Visual Build Pro as referencing script code and macros within a field. When retrieving the contents of a file into a field, using this function will cause these characters to be treated as literals by VBP.
"
Any idea how to read everything from SQL script ,including the parts between brackets?
Reply With Quote
  #2  
Old 04-22-2008, 01:51 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
That works as expected in my tests w/ VBP v6.7. The attached sample appends

IF NOT EXISTS (SELECT * FROM [sm].[DefaultSetting] WHERE [ApplicationType] = 1 AND [ValueId] = 111)

to %TEMP%\test2.sql each time it is built.
Attached Files
File Type: bld filecontents.bld (872 Bytes, 1319 views)
Reply With Quote
  #3  
Old 04-22-2008, 02:17 PM
teognost teognost is online now
Registered User
 
Join Date: 05-25-2004
Location: Prague,Czech Republic
Posts: 200
Ok,I tried exactly as in your example and it is fine.The problem was using that intermediate macro CURR_SQL_SCRIPT_CONTENT,the data between macros was lost that way(not sure why).When writing the data directly as you did -works fine.Can you tell me why the macro lost the data?Maybe in the future I would need to store content of such a file in a macro...
see the attachment
Attached Files
File Type: bld filecontents.bld (1.9 KB, 1403 views)
Reply With Quote
  #4  
Old 04-22-2008, 02:24 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
Use

[vbld_EscapeString(vbld_GetFileContents("%TEMP%\tes t.sql"))]

in the Set Macro step so that the macro value gets stored with special VBP chars escaped.

http://www.visualbuild.com/Manual/sysscriptmisc.htm
http://www.visualbuild.com/Manual/specialchars.htm
Reply With Quote
  #5  
Old 04-23-2008, 01:19 AM
teognost teognost is online now
Registered User
 
Join Date: 05-25-2004
Location: Prague,Czech Republic
Posts: 200
Works perfect,thanks for clarification!
Reply With Quote
Reply


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 Off
HTML code is Off



All times are GMT -5. The time now is 10:47 AM.


Copyright © 1999-2023 Kinook Software, Inc.