how do i query with the AND keyword using the sql:...
# general
a
how do i query with the AND keyword using the sql::selectfrom() function, all of the examples i found didn't include an AND keyword to the constraint expression
t
Are you developing an extension? If you're developing a table (in core) I would suggest against using the
SQL::
APIs, they are fairly expensive. Is there another way to get the data you want? But to answer your question I'd recommend using
SQL::SQL
with a query and then going from there.
a
yes i am developing an extension, and i am trying to grab the local ip of the machine, which is rather hard when not using the sql:: apis.
and i would prefer not to send a dns query to google for resolving my main ip.
t
That makes sense. I don't have a good answer off the top of my head. I'd recommend investigating the implementation of
::selectAllFrom
or using the default
select * from interface_addresses
then applying some filtering logic in the extension code.
a
currently my query looks like this
select address from interface_addresses where address like '%.%' and friendly_name like '%local%' and (type='manual' or type='dhcp')
works pretty well from kolide and now trying to implement it into the extension
would be really glad for any insight or help on how to use SQL::SQL correctly
and in general if you need help with writing the core code api documentation ill be glad to help as i think it could get a slight revamp.
t
core code api documentation
I agree. I think improving both the API and the documentation should be a prioritized goal for the next release. (could use help with it, as usual)