ID:1784647
 
Redundant
Applies to:Dream Maker
Status: Redundant

This feature has already been implemented, or is already achievable with existing methods.
When working with SQLite queries you have the option of using the '?' syntax while providing arguments to New() and/or Add(), however the procs don't accept a list which makes passing information through args or similar features very tedious, if not impossible.

My request is that these two procs be given a special condition that allows their second argument to be a list, which will be utilized as if the list items were placed -- in order -- as the arguments to the procs, leaving the first argument standing as the query itself.

Currently I'm using a datum to handle individual databases in my project and each type has a specially handled Query() proc, but I'm forced to use the less-secure method of embedding the variable values into the query.

MyQuery()
if(args)
var
query = args[1]
list/other_arguments = args.Copy(2)
my_query.Add(query,other_arguments)
my_query.Execute(my_database)


Would be swell if this were possible.
Nadrew resolved issue (Redundant)
Talking with Lummox I discovered that this is already possible, but the method isn't exactly what I had anticipated.

If you need to pass your list through Add() or New(), simply pass the list, as a single argument, the first argument in the list needs to be a string (the query).
For others' reference, sometimes it helps to study the code that handles this internally. In any project, if you create a new file called stddef.dm it will be filled in with the definitions used by the compiler. (Don't include it in your project; it's already included behind the scenes in all projects.)

Incidentally you can also override the query's new/add routines:

database/query
New(query)
if(args.len == 2 && typeof(args[1]) == /list)
return ..(list(query) + args[1])
return ..()
Add(query)
if(args.len == 2 && typeof(args[1]) == /list)
return ..(list(query) + args[1])
return ..()