On Saturday, March 26, 2011 10:52:43 am Jacek Kałucki wrote:
> Użytkownik John Fabiani napisał:
> > No I think what he is saying is the code I provided (designed to work
> > with Postgres) is causing a problem with FireBird because of the LIMIT
> > statement I'm most likely added.
> > 
> > I guess there are several ways this can be handled.
> > 
> > 1. create an if elif statement handling the different ways the different
> > databases require it.
> > 
> > 2.  change the code to use .setLimitClause("1000") - I'm guessing that
> > will be much harder.
> 
> I think it's not so hard.
> Instead of using cursor.execute("some sql"), use the embedded SQL
> builder instead:
>      cursor.setFieldClause(...)
>      cursor.setFromClause(...)
>      cursor.setWhereClause(...)
>      cursor.setLimitClause("1000")
>      cursor.executeSQL((param1, param2, param3))
> 
> It's the backend independent way.
> 
> Regards
> Jacek Kałucki

Please don't make me look at code I wrote years ago!  I don't recall.  But I 
bet I just - bizobj.UserSQL = 'select * from table' + 'limit 10'

I had to look -
I did 
 mycur=self.Application.getConnectionByName('pgConnection').getDaboCursor()
 mycur.execute("%s Limit 10" % (self.sqlID.Value)) 
# where self.sqlID is the sql statement written in a edit box.

I don't  know what the poster has in mind but I'd do a quick and dirty of 
dropping the "LImit 10" and added it (the limit statement) directly to the 
actual statement written in the edit box.

As I said earlier - it's just a quick tool I used to create a blank report 
form with 10 records in the testCursor.  Having the data available allows the 
report designer to use real field names etc...  It just made life easier when 
Larry was doing the reports for a client.

Johnf
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: 
http://leafe.com/archives/byMID/[email protected]

Reply via email to