Petr,

we (I at least :)) probably don't need binding at all! 

I was forgetting macro substitution, we can write something like:

local cSeq
private cKey := "part_name"
private cKeyValue := "tailpipe"

text into cSeq
        select * from car_parts 
        where &cKey = "&cKeyValue"
endtext

.....

and inside cSeq you have a sql statement correctly compiled!

The ugly part, here, is that I need privates or publics... but it is not such
a big issue and saves from a lot of bindings and calls to binding functions.

Best regards.

Maurilio.

Petr Chornyj ha scritto:
> 
> Maurilio Longo wrote:
> >
> >
> > I find them 'ugly' and slow to write and writing them this way forces me
> > to do
> > an explicit association between variable names and sql query sentence.
> >
> > I'd like something like this :)
> >
> > local a,b,c
> >
> > text into csql
> >     select * from @a where @c = @b
> > endtext
> >
> > bind_all( csql, a, b, c )
> >
> >
> > This way you have:
> >
> > 1) you're free to write and change your sql code on a free-form text entry
> > (easier to write, maintain and understand)
> > 2) you use .prg variable names with '@' qualifier so that your .prg code
> > and
> > your sql code are 'self documenting' and easier to follow
> > 3) bind_all() accepts a string and a variable number of parameters which
> > are
> > the .prg variables referenced with '@' inside the sql code.
> >
> > To do it this way the only problem is/could be to find a way to know that
> > the
> > 'a' variabile has name 'a' and as such has to be bound to the @a inside
> > sql
> > code.
> >
> > Variable types can be found at .c level from HB_ITEM structure so why
> > bother
> > to pass it explicitly given also that sqlite has just number and text as
> > column type?
> >
> > Best regards.
> >
> > Maurilio.
> >
> >
> > --
> >  __________
> > |  |  | |__| Maurilio Longo
> > |_|_|_|____| farmaconsult s.r.l.
> > _______________________________________________
> > Harbour mailing list
> > Harbour@harbour-project.org
> > http://lists.harbour-project.org/mailman/listinfo/harbour
> >
> >
> 
> Sorry, but I think it's not "low level"
> We can do it in such way on middle or hight level.
> 
> F.e.
> smtp := TSqLite3Smtp:New( db ):sqlText := csql
> smtp:bindAll( [, ..] )
> 
> Regards,
> Petr
> 
> --
> View this message in context: 
> http://www.nabble.com/Re%3AExperiences-with-sqlite--tp14791570p14839836.html
> Sent from the Harbour - Dev mailing list archive at Nabble.com.
> 
> _______________________________________________
> Harbour mailing list
> Harbour@harbour-project.org
> http://lists.harbour-project.org/mailman/listinfo/harbour

-- 
 __________                   
|  |  | |__| Maurilio Longo
|_|_|_|____| farmaconsult s.r.l.
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to