Subject: Re: populating a large number of instances

From: David Allan Finch <[email-masked]>
Date: Thu, 15 Jul 93 09:41:53 BST

In your message from [Tue, 13 Jul 93 08:06:08 -0700] you wrote:
 |> [email-masked] (Jian Hu) writes:
 |> > I am going to populate a large number of instances (thousands or tens of thou
 |> sands).
 |> > Is there any methods to achieve this rather than preparing a postquel script 
 |> which
 |> > includes thousands or tens of thousands of `append's ?
 |> 
 |> the "copy" command..
 |> --
 |>   Paul M. Aoki  |  CS Div., Dept. of EECS, UCB  |  [email-masked]
 |>                 |  Berkeley, CA 94720           |  ...!uunet!ucbvax!aoki

thank you - thank you

now i have a better way than writting smart perl
scripts, to insert 10 years of LIFFE. :-) 

--
    /		Sarum Wizard
 /\|/\		All Hail Discordia
 | K |		[email-masked]
 \___/		[email-masked]

---

From: David Allan Finch <[email-masked]>
Date: Sat, 17 Jul 93 17:15:10 BST

In your message from [Thu, 15 Jul 93 16:27:38 -0700] you wrote:
 |> ah, but pgperl is pretty useful, too..

did not quite understand why 'pgperl' gave me not
much over PGexec which I can write in C anyway,
now if I can use tables as assosiate arrays...

pgopen( FRED, "retrieve ( quote_list.all )" );

foreach $oid ( $FRED{"keys"} )
	{
	 print "$oid | ";
	foreach $field ( $FRED{"feilds"} )
		{
		print "$FRED{\"$oid_$field\"} ";
		}
	print "\n";
	}
	
pgclose( FRED );

:-( Thinking about it now it is very hard to do
even in Perl, perhaps Perl V5 with its object
syntax we will be able to add the concept of 
a table.

DMconnect( #table, "quote_list" );

foreach $oid ( keys #table )
	{
	foreach $field ( fields #table );
		{
		print $table<$oid,$field>;
		}
	}

DMclose( #table );

type coversion is hard as well :-(
perhaps a straight text interface is best after
all:

open( MON, "| monitor quote_history" )
	|| die "can not connect to db\n";

print MON "copy quote_list from \"filename\"\\g\n\\q\n";

close( MON );

will look in the pgperl directory and see if
it give me any advantaces over the above.
I suppose if I don't have to remember the
\\g's it would make the code more likely
to work?

---

From: David Allan Finch <[email-masked]>
Date: Sun, 18 Jul 93 11:21:16 BST

In your message from [Sun, 18 Jul 93 00:26:14 -0700] you wrote:
 |> i think writing string-handling code in perl is more pleasant than 
 |> string-handling in c.  that's just my $0.02.
 
 this is true, does pgperl remove all that ascii table stuff so
 you get the fields straight like in C, if this is so I definuty must
 re-investigate. When I firsty looked at it 1 month ago I knew nowt
 about DB and my knowledge have increase a little, thanks to this
 mail list. Does 4.1 have better manuals on libPQ.a and the PostQL?
 or should I read a book in SQL and remember 'select' == 'retrieve' ;-)

---

From: David Allan Finch <[email-masked]>
Date: Sun, 18 Jul 93 23:04:15 BST

In your message from [Sun, 18 Jul 93 13:05:42 -0700] you wrote:

 |> i really wish you wouldn't take my personal mail and splat it into
 |> the postgres mailing list.  if i wanted it there, i would Cc:
 |> it myself.

sorry - did not notice that it was not, I kinda assume every think
about PG came from there and automatical directed my message there.

 |> er, to get binary stuff from the db you need to use binary portals.
 |> but you can take a string in perl and turn it into a c base
 |> type more easily than you can in c.. 
 
er, what's a binary portals, or infact a portal, I used them
in one of my libPQ.a programs but I don't understand what they
are for. In fact I with some mods just copied the example.
That section of the manual does seam to assume some knowledge
of DBs is there a good book which will help. Is my lack of
exposer to Ingres the problem?

 |> and sorry, the manuals still suck. :-/

well it is freeware, you pays your money...