CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: DBI: Can I use a file with DBI?: Edit Log



poochman
Novice


Jul 11, 2009, 10:46 PM


Views: 5195
Can I use a file with DBI?

Hello

I want to rewrite my ksh scripts to take advantage of perl's speed, but I don't know how to make this isql faster.

I have a script that gets index information from a txt file, to create an index for a table in Sybase. The tables can have 1 to 12 indexes, which is all in the txt file. The file first checks to see if the index exists; if it does, it drops the index before creating it.

Here is an example of one of the text files (this only has one index, but for a table with multiple indexes, the information is in the same format for each index)
print '<<<<< CREATING Index - "TBL_ONE_PRIMARY" >>>>>'
go
use tiger1
go
IF EXISTS (SELECT 1 FROM sysindexes i, sysobjects o, sysusers u WHERE o.id = i.id AND o.uid = u.uid AND i.name = 'TBL_ONE_PRIMARY' AND u.name = 'dbo')
BEGIN
setuser 'dbo'
drop index TBL_ONE.TBL_ONE_PRIMARY
END
go
IF (@@error != 0)
BEGIN
PRINT "Error CREATING Index 'TBL_ONE_PRIMARY'"
SELECT syb_quit()
END
go
create unique clustered index TBL_ONE_PRIMARY
on tiger1.dbo.TBL_ONE(TBL_ID, TBL_TYPE, PDVC_EFF_DT, PDVC_SEQ_NO) with sorted_data
go

In ksh, I use an isql statement with the -I parameter to use the text file, and -O<file name> to write any results of the command. This is the command I use:

isql -U$suser -P$spass -S$senv -I$file -O$outfile

In perl, I put the isql statement in a system() call, and run it

system("isql -U$suser -P$spass -S$senv -I$file -O$outfile");

The time was basically the same as it was when I ran the ksh script.

Is there anyway make this isql statement faster in perl? Any help would be appreciated.


(This post was edited by stonemonolith on Jul 13, 2009, 10:09 AM)


Edit Log:
Post edited by poochman (Novice) on Jul 13, 2009, 10:09 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives