Petr Chornyj ha scritto:
> 
> What you think abou
> 
> insert into t1( name, age) values( :name, ?7 )
> 
> sqlite3_bind_all( stmt, {'Mary', 'name', SQLITE_TEXT}, {19, 7,
> SQLITE_INTEGER} [, ...] )
> or
> sqlite3_bind_all( stmt, {{'Mary', 'name', SQLITE_TEXT}, {19, 7,
> SQLITE_INTEGER}} )
> or
> sqlite3_bind_all( stmt, { 'name', 7 }, { SQLITE_TEXT, SQLITE_INTEGER},
> "Mary", 19, "Andi", 17 [, ...] )

Petr, 

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

Reply via email to