Subject | Re: [firebird-support] * - ? |
---|---|
Author | Ann W. Harrison |
Post date | 2005-06-29T21:37:16Z |
Ivan Prenosil wrote:
with select *. The real basis of my argument is that you shouldn't send
stuff over the wire unless you want it, meaning that it's a value that
your care about in your application. The fact that the interface
component avoids access violations and invalid assignments is nice, but
asking for exactly what you want is nicer.
first case, using the API, your query gets a compilation time error.
Not nice, but an immediate and well directed indication of the nature of
the problem.
a strength of relational databases. Compilers don't casually rearrange
things so your pointer is sometimes a pointer to char, sometimes a
pointer to char* and sometimes a pointer to a function. If they did,
I'd be very reluctant to use an untyped, unnamed pointer.
Regards,
Ann
>You're right that most interface components are built to avoid problems
> When application reads selected data, there is a secret (:-) structure
> called xsqlda, that among pointers to data itself contains description of types
> of data and fieldnames!
with select *. The real basis of my argument is that you shouldn't send
stuff over the wire unless you want it, meaning that it's a value that
your care about in your application. The fact that the interface
component avoids access violations and invalid assignments is nice, but
asking for exactly what you want is nicer.
>You get different results, especially if you're using the API. In the
> If somebody drops the field, than it is dropped, and you do not retrieve
> its data regardless your using "select deletedfield, ..." or "select *" query.
first case, using the API, your query gets a compilation time error.
Not nice, but an immediate and well directed indication of the nature of
the problem.
>OK, I'll grant you that those views are easier to maintain with "select *.
> Here is another exampe how using "*" can avoid troubles with inconsitent
> database - I have several views that are used to restrict access
> to just subsets of rows...
> The fact that some feature can be misused is not enughNot at all the same. The ability to add, drop, and rearrange fields is
> to say that it should "never be used ...", if that feature
> can be both safe and useful when used correctly.
> Otherwise, I would recommend to never use pointers
> (you can forget to initialize them, or free the memory, ...),
a strength of relational databases. Compilers don't casually rearrange
things so your pointer is sometimes a pointer to char, sometimes a
pointer to char* and sometimes a pointer to a function. If they did,
I'd be very reluctant to use an untyped, unnamed pointer.
>There we are in strong agreement.
> Strangely, nobody mentioned "Insert Into Table Values (...)",
> i.e. without list of fieldnames, which, unlike "select *", do not pass
> names of fields in xsqlda (why?), so there I would fully agree with
> "should never be used outside casual, hand-typed, one time inserts".
Regards,
Ann