>Kerry's executive summary: SELECT * is a bad thing, *especially* in
>Informix-4GL -- less so in Delphi because you can use FieldByName.

Yeah, well who uses I4GL anymore anyway...  :P

Our database is fairly fluid in that clients are always thinking up new
and interesting columns that everyone wants to see.  Judicious use of
FieldByName has enabled us to avoid any problems of the type you mention
- tables can have their columns reordered or removed without any
hassles; just got to remember never to use positional references (and as
an aside, I just read Aaron's reply where he advocates building arrays
of field offsets - sounds like a good alternative).

There are some advantages to using select * in Delphi.  Much of our
software is build specific, but some pieces aren't, specifically
producing an ad-hoc report of a table (including automatic lookups,
because our databases contain data dictionary information like joins,
table descriptions and so forth), exporting the data to a file, and
copy-and-pasting from a DBGrid into (for example) Excel.  Users can
filter their data and choose which columns they want to see, and any new
columns are immediately available, to display, sort by, copy, export and
filter on.  There are a lot of tables displayed using these screens - if
we nailed down the format of the database on every build, we would have
a fair bit of work to identify and fix all the code every time the
database changes (although SQA robot helps).  We already have enough
work changing code when things change.  It's a constant struggle because
you can't afford to miss anything, but you have to keep productivity
high...

Another use for select * would be if users were allowed to create their
own custom columns on tables, but realistically nobody lets this happen
- there are other and better ways to do it.

Perhaps I should get back to work now...  :\

Cheers,

Carl Reynolds                      Ph: +64-9-4154790
CJN Technologies Ltd.             Fax: +64-9-4154791
[EMAIL PROTECTED]                DDI: +64-9-4154795
PO Box 302-278, North Harbour, Auckland, New Zealand
12 Piermark Drive, North Harbour Estate, Auckland, NZ
Visit our website at http://www.cjntech.co.nz/

> -----Original Message-----
> From: Kerry Sainsbury [SMTP:[EMAIL PROTECTED]]
> Sent: Friday, October 15, 1999 11:19 AM
> To:   Multiple recipients of list database
> Subject:      Re: [DUG-DB] (Informix) Where can I get sqlca.h?
> 
> Carl Reynolds <[EMAIL PROTECTED]> said
> 
> > (Having said that, I think the best reason to use "SELECT * FROM
> table"
> > is if you know the table definition _is_ likely to change.  That way
> you
> > keep your rewriting of code to a minimum).
> 
> Ever tried to install a system that runs over a WAN? Performance
> improves
> quite a lot if you only SELECT the columns your application is using.
> 
> Ever tried accessing the columns from a SELECT * statement, on a table
> which
> has had the order of the columns rearranged? (Which is totally fine by
> me,
> BTW)
> 
> Ever had SELECT * code go bang when an obsolete column is removed from
> a
> table, eg:
> 
> Old customer table:
> name varchar(50);
> telex varchar(15);
> phone varchar(15);
> 
> 'Fixed' customer table:
> name varchar(50);
> phone varchar(15);
> 
> When your application attempts to access 'phone' based on it's
> position
> (fields[3]) things get ugly.
> 
> Also, SELECT customer.*, order.* FROM customer, order ... causes all
> sorts
> of grief if columns get added or removed and positional references to
> fields
> are used.
> 
> Kerry's executive summary: SELECT * is a bad thing, *especially* in
> Informix-4GL -- less so in Delphi because you can use FieldByName.
> 
> > Now sit down and breathe deeply... :) :)
> 
> Calm blue Ocean.
> Calm blue Ocean.
> 
> ----------------------------------------------------------------------
> -----
>   New Zealand Delphi Users group - Database List -
> [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz

application/ms-tnef

Reply via email to