Re: Long tablenames
Posted in 1994
->From: bt@irl3b2c.att.com
->Date: 22 Sep 94 13:24:55 GMT
->To: informix-list@rmy.emory.edu
->Subject: Long tablenames
->
->In response to ------
->>>One simple problem:
->>> I want to export a database on (SCO) UNIX and import this
->>> database with I-SQL DOS !
->>> The dbexport on UNIX generates to long filenames, so i can4t use
->>> the SQL-Script and the unload files.
->[stuff deleted]
->Jack Parker wrote:
->
->:Try this:
->:{tabren.ace}
->:database xxxxxx end
->:
->:output
->:top margin 0
->:bottom margin 0
->:page length 1
->:end
->:
->:select tabname from systables where tabid > 99
->:end
->:
->:format
->:
->:on every row
->: print "mv ", tabname clipped, ".unl ", tabname[1,8], ".unl"
->:end
->:--- end ---
->:
->:I can't remember offhand what the unix extension of the unload files, but
->:thats easy to fix. This will generate a script to rename all of the files
->:for you. If you run it as sacego -q you wont even have to mess with the
->:headers
->:
->:j.
->
->Jack, I take off my hat to you! If there are awards for clever solutions
->on this list, then you're my nominee for the gold. This solution has what I
->regard as the hallmarks of good programming - simplicity and elegance.
->Like all good ideas, it's so simple it requires a genius to think of them.
->
->** Opinions expressed are my own and not necessarily those of my employer
->=========================================================================
->Barry Toomey Phone +353-1-2822333
->AT&T Network Systems Ireland Fax +353-1-2822864
Jack Parker is my dear friend and I share Barry's high opinion of Jack's
cleverness. However, [ why is there always a "however"? :-( ] to be
completely safe, you should change the print statement thus:
print "mv ", tabname clipped, ".unl ", tabname[1,5], tabid ".unl"
Then edit out spaces that occur in the output here. --^
Or for those folks running SE:
print "mv ", tabname clipped, ".unl ", dirpath[1,5], dirpath[8,10], ".unl"
This will protect against the case in which you have tables whose names
first differ beyond the eighth character. For example, I wrote a trouble
report system containing tables "tr_review" and "tr_review_text". Using
the original plan, both file names would have become "tr_revie.unl" and
the file for the second table would overwrite the file for the first.
Using the tabid avoids this. In fact this is precisely how SE ensures
unique dirpath; my plan just shortens the name from 10 to 8 characters.
Regards,
Alan ___________________________
______________________| R. Alan Popiel |__________________________
\\ Internet: | Martin Marietta, SLS | /
\\ alan@den.mmc.com | P.O. Box 179, M/S 3810 | Std disclaimers apply. /
)Voice: | Denver, CO 80201-0179 USA | (
/ 303-977-9998 |___________________________| (But you knew that!) \\
/________________________) (____________________________\\