Ed Leafe wrote:
> On Jan 9, 2007, at 8:31 AM, MB Software Solutions wrote:
>
>   
>> Ed -- are you incorporating something like that in Dabo (i.e., code to
>> take care of those things for you)?
>>     
>
>       Yes. Our data layer consists of a cursor object, which has a backend  
> object that is specific to the details of the backend being used.  
> Code originally starts in the cursor:
>
> self.doSomething()
>
> ...until we find a backend that does it differently. Then it is  
> refactored to:
>
> self.BackendObject.doSomething()
>
>       The backend object superclass is dBackend, into which the default  
> behavior is placed. Each subclass (for MySQL, MS SQL, etc.) can then  
> override the default behavior if necessary.
>
>       Example: each backend has a different way of limiting the number of  
> records returned from a query. MySQL uses LIMIT at the end of the  
> statement; MS SQL uses TOP after the SELECT keyword, etc. If you were  
> to hardcode the query in your bizobj, then yes, you'd have to change  
> it if you switched backends. But if you used the SQL builder code in  
> Dabo:
>
> bizobj.setLimit(100)
>
> ...then that gets executed at runtime into the appropriate syntax for  
> the current backend.
>   

Cool...that's somewhat how I did with the SQL_MYSQL / SQL_VFP columns in 
the sqldefs.dbf table in my n-tier project.  I like the way you're doing 
it, with things like the SetLimit(100) that then takes care of the 
respective backend logic.

Question:  if your WHERE clause looks for a specific primary key, is 
there any advantage to using a LIMIT -style clause?  I was getting in 
the habit of always adding the LIMIT 0,1 in my MySQL SELECT statements, 
but wondering if it's overkill or pointless?

-- 
Michael J. Babcock, MCP
MB Software Solutions, LLC
http://mbsoftwaresolutions.com
http://fabmate.com
"Work smarter, not harder, with MBSS custom software solutions!"



_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to