Re: PERL & Informix database functions?
Posted in 1992
In <197kofINN8rl@hpsdde.sdd.hp.com> kurt@sdd.hp.com (Kurt Andersen) writes: >Before I embark on a project to develop a set of PERL functions to access >Informix databases, I thought that I would check to see if anyone else has >done or is doing that. > Does anyone know of Informix/PERL (existing or in development)? I am >thinking of something like sybperl (which works for Sybase). ========================== Kurt, I have the following item someone sent to comp.databases.informix once-upon-a-time: Short Description: Perl Script to fix INFORMIX-4GL error files Long Description: SUBJECT: Perl Script to fix INFORMIX-4GL error files ==================================================== From: bkuhn@rhlab.UUCP (bmk Bradley Kuhn) Organization: Baltimore Rh Laboratory, Inc., Maryland This is a little perl script that I wrote to extract pertinant information from the error files generated by the INFORMIX c4gl compiler. The compiler inserts the error messages into the code and writes it to *.err files in the current directory. This script goes through every one of these files in your current dir, and extracts x lines of code before the error and y lines after (i.e. the error msg.). I use it all the time, and I thought it might be helpful to those who prefer error msgs like those generated by most C compilers. -- Brad Kuhn Computer Systems Development, Inc INTERNET: rhlab\\!bkuhn@uunet.uu.net OR bkuhn@loyola.edu BITNET: bkuhn@loyvax.BITNET UUCP: ...uunet!rhlab!bkuhn ----------------------- rip here ----------------------- #!/usr/bin/perl # PERL script to fix the 4gl error output to more readable code # Written by: Bradley M. Kuhn # My attempt keep the line numbers as those in the source was partially # successful. if doesn't count $lnsaft lines as source code lines. This # gives an error of +/- 2. $lnsbf = 2; # num lns above error to be printed $lnsaft = 3; $errfiles = `ls *.err 2>/dev/null` || die "No error files"; # die if no err files found @errfiles = split(/\\s+/, $errfiles); # split names and put them into an array for $curfile (@errfiles) { open(FILE, $curfile) || die "Can't open $curfile"; @file = <FILE>; $cnt = $realcnt = $tmp = $i = $tot = 0; $tot = $#file; for($cnt = $realcnt = 0; $cnt <= $tot; $cnt++, $realcnt++ unless $file[$cnt] =~ /^\\s*\\|.*$/ ) { $tmp = 0; $cnt || print STDOUT "Errors from $curfile\\n"; if ($file[$cnt+$lnsbf] =~ /^\\s*\\|.*$/) { # error msg ahead! for ($i = $cnt; $i <= ($cnt+$lnsbf+$lnsaft) && $i <= $tot; $i++ ) { if ($file[$i] =~ /^\\s*\\|.*$/) { print STDOUT "ERR: $file[$i]"; # print $lns } else { $tmp = ++$realcnt; print STDOUT "$tmp: $file[$i]"; # print $lns } } } if ($tmp) { $cnt += $lnsbf + $lnsaft; $realcnt--; # last increment in for loop was not needed print STDOUT "\\n"; } else { $realcnt++ unless $file[++$cnt] =~ /^\\s*\\|.*$/; } } } exit; # auf wiedersehen -- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% William Daul Advanced Support INFORMIX SOFTWARE INC. 4100 Bohannon Dr. (415) 926-6488 - wk Menlo Park, CA. 94025 uunet!infmx!billd or billd@informix.com