On Fri, 2002-03-01 at 15:25, Lateef Jackson wrote:

> My main question is with the find methods. From what I have read from 
> the docs the find methods pass a piece of SQL code to find an object in 
> the database. Assume this is correct is correct then certain db would 
> not work for certain queries. For example I am heavily addicted to using 
> sub selects and I don't believe that mysql will support sub-selects 
> until 4.0.

The idea of MiddleKit is that you only have to pass a SQL clause 
to the 'fetchObject' methods as a way to optimize the query
on the server-side.  
(see http://webware.sourceforge.net/Webware/MiddleKit/Docs/Intro.html),
These clauses are usually simple and standard enough to be supported by
most RDBMSs.

Using MiddleKit's object-oriented style (i.e. using container objects,
etc.), you seldom (if ever) need to do sub-selects, because you don't do
many joins.  Instead of doing just one big, complex query to get at some
data (object), you access the objects and their containee objects until
you get to what you need.  Internally, MiddleKit will execute several
simple (i.e. single table using primary key) specific queries to fetch
the objects.  It's a much different style than when you handle all the
SQL on your own.  

Performance-wise, MiddleKit may be a bit slower (in terms of the number
of queries) than doing your own SQL, but it gives you the data in
ready-to-use objects, and saves a lot of development time.

I don't have any hard numbers, though, so if you really want get a
handle on MiddleKit's performance, you'll have to do more research and
run some tests. 

> The second question I have is when you build a new adapter to a database 
> so you have the adapter support a certain set of SQL commands so if the 
> db doesn't the addapter will do it anyway. I guess what does it entail 
> to build a db adapter?

Take a look in Webware/MiddleKit/Run.  Each database adapter inherits
from SQLObjectStore, and makes use of existing Python DB API modules.
The two existing adapters are about 50 lines each, so it would seem that
not too much work is required -- as long as the database you want to use
has a similar design.  

FYI: I think there may be (at least the beginnings of) a PostgreSQL
adapter floating around.  Someone else can probably send it to you if
you're interested.

-- 
Jason D. Hildebrand
[EMAIL PROTECTED]


_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to