does lucee have a way to turn an array of structs ...
# cfml-general
s
does lucee have a way to turn an array of structs into a query? ( i could see how that would be potentially problematic with non-common keys), but worth a shot
b
@Scott Steinbeck Doesn't
queryNew()
accept an array of structs?
You'd just need to provide the column names and types
1
s
I feel silly since i built the sql function in commandbox, but i just couldn’t remember if it was that easy
😛 1
Copy code
data = [
    {
      cola : 'value1a',
      colb : 'value1b'
    }, 
    {
      cola : 'value2a',
      colb : 'value3b'
    }, 
    {
      cola : 'value3a',
      colb : 'value3b'
    }
]

dump( data )

qry=queryNew( 'cola,colb', 'string,string', data )

dump( qry )
s
Gracias
m
you can also pass array of structs to queryAddrow()
b
Yes, but I don't like that behavior 🙂
I have a ticket in for it
lucee is incompat with Adobe
addRow()
should add a single row IMO
1
The same ambiguity exists in both places though-- https://luceeserver.atlassian.net/browse/LDEV-1206
Ooh, nice. Looks like they changed this for Lucee 6
Though, I guess my ticket was more about having a struct with an array inside of it-- which isn't really what you said. Carry on 🙂
d
I like the name of that function.
s
i also like this addition
*Introduced:* 5.3.8.120
👍 1
z
🙂