PDA

View Full Version : Checking filenames



NewsArchive
05-24-2007, 10:46 AM
Hi Friedrich,

I have a situation where I need to deploy SQL files for database
updates. I've been doing this for a while without any problems and it
works great. However, I've found out that the (Sybase) utility that I
use to execute the scripts GPFs if the script file (.sql) has a space
in the name. I.e. 006-2007-05-23-database update.sql fails where as
006-2007-05-23-database-update.sql works without problems. I'm so
used to name files with spaces that I completely forget this and make
a mess. Is there a way for me to make SB (5.6) check the filename at
_compile time_ and throw up an error message if there is a space in
any filename with a '.sql' extension? TIA:)

Best regards,

Arnór Baldvinsson
Icetips Creative, Inc.
San Antonio, Texas, USA
www.icetips.com


Subscribe to information from Icetips.com:
http://www.icetips.com/subscribe.php

NewsArchive
05-24-2007, 10:47 AM
Hi Arnór,

That's not possible at the moment (in SB65). I'll give it some thoughts.

Friedrich

NewsArchive
05-24-2007, 10:47 AM
Hi Friedrich,

>That's not possible at the moment (in SB65). I'll give it some thoughts.

Can I have the compiler call an exe that I could use to check this?
YES, Preprocessor: RUN should do it for me. I'll just have a small
exe that I set up to check the filenames of the SQL files as they are
always in the same location so it's easy:)

Best regards,

Arnór Baldvinsson
Icetips Creative, Inc.
San Antonio, Texas, USA
www.icetips.com


Subscribe to information from Icetips.com:
http://www.icetips.com/subscribe.php

NewsArchive
05-24-2007, 10:48 AM
Arnor

> However, I've found out that the (Sybase) utility that I
> use to execute the scripts GPFs if the script file (.sql) has a space
> in the name. I.e. 006-2007-05-23-database update.sql fails where as
> 006-2007-05-23-database-update.sql works without problems.

have you tried "006-2007-05-23-database update.sql"?

A lot of command line utilities will complain if you do not put quotes
around a long file name with spaces.

Bernard

NewsArchive
05-24-2007, 10:48 AM
Hi Bernard,

>have you tried "006-2007-05-23-database update.sql"?
>
>A lot of command line utilities will complain if you do not put quotes
>around a long file name with spaces.

That was my first thought but it still crashes on it. Since my
program calls the iSQL to do this I'll just make _it_ check the
filename. Unfortunately that's a last resort as then the file is
already delivered... hmmm...

Best regards,

Arnór Baldvinsson
Icetips Creative, Inc.
San Antonio, Texas, USA
www.icetips.com


Subscribe to information from Icetips.com:
http://www.icetips.com/subscribe.php

NewsArchive
05-24-2007, 10:52 AM
Hi Arnór,

The problem is that the preprocessor statements are executed before a the
full list of files is available. So this does not work.

What we need is a function that checks the files before the file compression
process is executed (that is after the preprocessor and after the script
generation processes).

Friedrich

--
Friedrich Linder
Lindersoft
www.lindersoft.com
+1.954.252.3910

"point. click. ship" - that's SetupBuilder 6
Create Windows Vista ready installations in minutes

-- Official Comodo Code Signing and SSL Certificate Partner

NewsArchive
05-25-2007, 06:08 AM
Hi Friedrich,

>The problem is that the preprocessor statements are executed before a the
>full list of files is available. So this does not work.

Works like a charm. I don't care what files are listed in my
setupscript, only if the actual physical filenames are ok. So I pass
the folder to check as a parameter to my exe and it checks the
filenames in it for spaces. Works like a charm:) Here is the whole
C6.3 code:

Program
Map
End
Include('ITUtilityClass.inc')
ITU ITUtilityClass
FQ Queue(FILE:Queue),Pre(FQ)
End
Fp CString(1025)
Em CString(10240)
I Long
Code

FP = Clip(ITU.ProgramCommandLine) & '\*.sql'
Directory(FQ,FP,ff_:NORMAL)
If Records(FQ)
Loop I = 1 To Records(FQ)
Get(FQ,I)
If Instring(' ',Clip(FQ.Name),1,1)
EM = EM & Clip(FQ.Name) & '<13,10>'
End
End
End
If EM
Message('Files with space in the filenames: Must be fixed: || ' & Clip(EM), ' *** FIX FILENAMES ***',ICON:Hand)
Else
Message('SQL Files do not have spaces in names','Filenames are OK.',ICON:Exclamation)
End

This is compiled into checksql.exe which I copy to my install folder.

Then in SB5 I have this line as the second line in the script:

#run c:\Client work\Collier\Installs\Update\Latest\checksql.exe
[SQLSCRIPTFOLDER] [Wait]

Best regards,

Arnór Baldvinsson
Icetips Creative, Inc.
San Antonio, Texas, USA
www.icetips.com


Subscribe to information from Icetips.com:
http://www.icetips.com/subscribe.php