Multiple query params w/ queryExecute()

I’m trying to get the following to work:

public void function createSubscriber( struct subscriber ) {
var q = {};
q.subscriber = queryExecute( ’
insert into subscriber (
subscriberId,
name,
email,
dateSubscribed,
isConfirmed,
isSubscribed
) values (
:subscriberId,
:name,
:email,
:dateSubscribed,
:isConfirmed,
:isSubscribed
)
’ ,
{ subscriberId = { value=‘#createUUID()#’, cfsqltype=‘cf_sql_varchar’ } } ,
{ name = { value=‘#subscriber.name#’, cfsqltype=‘cf_sql_varchar’ } } ,
{ email = { value=‘#subscriber.email#’, cfsqltype=‘cf_sql_varchar’ } } ,
{ dateSubscribed = { value=‘#CreateODBCDate( Now() )#’,
cfsqltype=‘cf_sql_date’ } } ,
{ isConfirmed = { value=‘0’, cfsqltype=‘cf_sql_tinyint’ } } ,
{ isSubscribed = { value=‘0’, cfsqltype=‘cf_sql_tinyint’ } }
);
}

And am getting the error “no param with name [name] found”, with the stack
trace pointing to the param block.

I suspect I have the syntax wrong for multiple query params, but haven’t
found an example. Can someone point me in the right direction?

Thanks,

Nando

Aria Media Sagl
Via Rompada 40
6987 Caslano
Switzerland

+41 (0)91 600 9601
+41 (0)76 303 4477 cell
skype: ariamedia

there is a bug in the params parser, I don’t remeber it off the top of
my head but I think it has to do with the punctuation (comma)
immediately after the param name (if you identify the bug please open a
ticket for it).

try to put a space between the param names and the commas.

also, in script you don’t have to use the quotes and pound signs
everywhere, so

{ subscriberId = { value=‘#createUUID()#’, cfsqltype=‘cf_sql_varchar’
} } ,

can be turned into

{ subscriberId = { value=createUUID(), cfsqltype=‘cf_sql_varchar’ } } ,

which will like give you a slightly better performance as well.

Igal Sapir
Lucee Core Developer
Lucee.org http://lucee.org/On 2/13/2015 7:51 AM, Nando Breiter wrote:

I’m trying to get the following to work:

public void function createSubscriber( struct subscriber ) {
var q = {};
q.subscriber = queryExecute( ’
insert into subscriber (
subscriberId,
name,
email,
dateSubscribed,
isConfirmed,
isSubscribed
) values (
:subscriberId,
:name,
:email,
:dateSubscribed,
:isConfirmed,
:isSubscribed
)
’ ,
{ subscriberId = { value=‘#createUUID()#’, cfsqltype=‘cf_sql_varchar’
} } ,
{ name = { value=‘#subscriber.name# http://subscriber.name#’,
cfsqltype=‘cf_sql_varchar’ } } ,
{ email = { value=‘#subscriber.email#’, cfsqltype=‘cf_sql_varchar’ } } ,
{ dateSubscribed = { value=‘#CreateODBCDate( Now() )#’,
cfsqltype=‘cf_sql_date’ } } ,
{ isConfirmed = { value=‘0’, cfsqltype=‘cf_sql_tinyint’ } } ,
{ isSubscribed = { value=‘0’, cfsqltype=‘cf_sql_tinyint’ } }
);
}

And am getting the error “no param with name [name] found”, with the
stack trace pointing to the param block.

I suspect I have the syntax wrong for multiple query params, but
haven’t found an example. Can someone point me in the right direction?

Thanks,

Nando

Aria Media Sagl
Via Rompada 40
6987 Caslano
Switzerland

+41 (0)91 600 9601
+41 (0)76 303 4477 cell
skype: ariamedia

You received this message because you are subscribed to the Google
Groups “Lucee” group.
To unsubscribe from this group and stop receiving emails from it, send
an email to lucee+unsubscribe@googlegroups.com
mailto:lucee+unsubscribe@googlegroups.com.
To post to this group, send email to lucee@googlegroups.com
mailto:lucee@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/lucee/CAGHrs%3D8aGQjkQ2%3D2%3DNR4R21KN_xYF6OQD46p2XS1431j-O6cfQ%40mail.gmail.com
https://groups.google.com/d/msgid/lucee/CAGHrs%3D8aGQjkQ2%3D2%3DNR4R21KN_xYF6OQD46p2XS1431j-O6cfQ%40mail.gmail.com?utm_medium=email&utm_source=footer.
For more options, visit https://groups.google.com/d/optout.