Re: creating a string on the fly

2002-10-18 Thread Rob
OTECTED]> Sent: Wednesday, October 16, 2002 9:41 PM Subject: Re: creating a string on the fly > Here's the code: > > sub GetColumns{ > my @columns=""; > $statement=uc("SELECT colname from > syscat.columns where tabname='$_[0]&

Re: creating a string on the fly

2002-10-16 Thread Vincent Lee
{ > $table = shift; > > print "CREATE VIEW_$table AS\n"; > print "SELECT ("; > > $n = 0; > foreach $column ( GetColumns ($table) ) > { > print ", " if $n++; > print

Re: creating a string on the fly

2002-10-16 Thread Vincent Lee
[EMAIL PROTECTED]> > To: "Rob" <[EMAIL PROTECTED]> > Cc: <[EMAIL PROTECTED]> > Sent: Tuesday, October 15, 2002 11:05 PM > Subject: RE: creating a string on the fly > > > > Rob, > > > > I've written a subroutine do the > getColu

Re: creating a string on the fly

2002-10-16 Thread Rob
AIL PROTECTED]> Sent: Tuesday, October 15, 2002 11:05 PM Subject: RE: creating a string on the fly > Rob, > > I've written a subroutine do the getColumns($table). The problem is that > it's passing the entire column set back and appending each one. > 'Passing the

RE: creating a string on the fly

2002-10-15 Thread Vincent Lee
.any ideas? -Original Message- From: Rob [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 15, 2002 11:38 AM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: creating a string on the fly Two problems here. 1/ Getting the tables' names and columns from the database. 2/ Constructi

Re: creating a string on the fly

2002-10-15 Thread Jeff 'japhy' Pinyan
On Oct 15, Rob said: >Suppose we needed to throw out all 'system' column names (such as the >internal table ID or the creation date) which, say, started with an >underscore. We would want to put > >next if $column =~ /^_/; > >at the start of the loop - a loop which wouldn't exist if we'd

Re: creating a string on the fly

2002-10-15 Thread Rob
Or, of course: $, = ", "; print GetColumns ($table); R - Original Message - From: "Jeff 'japhy' Pinyan" <[EMAIL PROTECTED]> To: "Rob" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Tuesday

Re: creating a string on the fly

2002-10-15 Thread Rob
ROTECTED]> To: "Rob" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Tuesday, October 15, 2002 5:55 PM Subject: Re: creating a string on the fly > On Oct 15, Rob said: > > > $n = 0; > >foreach $column ( GetColumns ($table) )

Re: creating a string on the fly

2002-10-15 Thread Jeff 'japhy' Pinyan
On Oct 15, Rob said: >$n = 0; >foreach $column ( GetColumns ($table) ) >{ >print ", " if $n++; >print $column; >} That's spelled print join ",", GetColumns($table); in Perl. :) -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http:/

Re: creating a string on the fly

2002-10-15 Thread Vincent Lee
-- Original Message ----- >From: "Vincent Lee" <[EMAIL PROTECTED]> >To: <[EMAIL PROTECTED]> >Cc: <[EMAIL PROTECTED]> >Sent: Tuesday, October 15, 2002 3:37 PM >Subject: Re: creating a string on the fly > > >> I'm starting with data in the da

Re: creating a string on the fly

2002-10-15 Thread Rob
any more about what these might do without knowing more about what interface you have with the database. HTH Rob - Original Message - From: "Vincent Lee" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Tuesday, October 15, 2002 3:37

Re: creating a string on the fly

2002-10-15 Thread Vincent Lee
>Bring the answer back to the mail group so that others can learn. > >Cheers, > >Rob > >- Original Message - >From: "Vincent Lee" <[EMAIL PROTECTED]> >To: "Rob" <[EMAIL PROTECTED]> >Sent: Tuesday, October 15, 2002 3:03 PM >Subject:

Re: creating a string on the fly

2002-10-15 Thread Rob
Hi Vincent I /think/ you're misunderstanding hashes, but I need to make sure. Do you mean that your has array contains: ORG => ID ORG => COL1 ORG => COL2 EMPLOYEE => ID EMPLOYEE => COL1 EMPLOYEE => COL2 Because you can't do that. A hash represents a one-