Re: SQL



> you showed me precisely a solution that uses an RDBMS,
> including a query language; and I showed you a solution that uses objects,
> including some pre-written ones.

Your original solution looked like this:
[city valueForKeyPath:@"custome...@xxxxxxxxxxxxxxxxxx"];

I suppose that "custome...@xxxxxxxxxxxxxxxxxx" can be considered as a
query or part of a query. If you claim that this solution is just using
objects, when are the statement below is also just using objects.
conn.createStatement("select * from customers where city=?");

> City *city = /* ... */;
> NSMutableSet *orders = [NSMutableSet set];
> NSEnumerator *costumerEnumerator = [[city customers] objectEnumerator];
> Customer *customer;
> while ((customer = [customerEnumerator next]) != nil) {
> [orders unionSet:[customer orders]];
> }

How do you navigate to the city object, by a map or?

Lets say we add an extra criteria, the order status has to be
"pending".
select *
from order
join customer on customer.id=order.customerid
where customer.city=? and order.status="pending"

Will you still start with the city object? Or will you start with the
OrderStatus object? Lets say that the number of cities are low and the
percentage of orders that are "pending" are low, that would be an very
ineffective way of finding the corrects orders. On the other hand, if
the number of cities are high and the percentage of "pending" orders
are high, starting from the city object would be a good idea. This kind
of decision can be made by the RDBMS optimizer totally hidden from the
application. In your network scenario, the navigational path is
hardwired in the application and impossible to automatically optimize.

Also, would you really have pointers the City and OrderStatus objects
to every order/customer. For every searchable attribute, you need to
maintain an extra map. Lets say you didn't realized that you would need
to find customers using a given city, when you first created the
application. To be able to do this search, you have to add an extra set
of customer references in the city class and update all existing city
instances using a linear traversal of all customer instances. Not very
flexible to future changes?

Fredrik Bertilsson
http://butler.sourceforge.net

.



Relevant Pages

  • Re: populating one combo box based on another
    ... RowSource (or, if you're using a query for the RowSource, post the SQL ... I create a form based on the customer table but omit the city and state ...
    (microsoft.public.access.formscoding)
  • Re: Word & Access Problem
    ... thing - can you tell us what SQL the query you are using as your data source ... can select the city and state for the respective combo box in the customer ... information displayed on mailing labels is only Id numbers for city and ...
    (microsoft.public.word.mailmerge.fields)
  • Re: Word & Access Problem
    ... Hi peter here is the sql used for the query to get the information for the ... FROM Customer ... can select the city and state for the respective combo box in the customer ... information displayed on mailing labels is only Id numbers for city and ...
    (microsoft.public.word.mailmerge.fields)
  • Re: Word & Access Problem
    ... State tables to the Customer table on the City ID and State ID respectively. ... Then use that query as the data source for the mailmerge. ... Doug Robbins - Word MVP ...
    (microsoft.public.word.mailmerge.fields)
  • Re: The Industry choice
    ... all the way to the Northern border of the city. ... >given shop from the POV of a given customer. ... energy available at low prices at special times in other countries ...
    (comp.lang.python)