. query_sql_str.pro
put your query in a string:
IDL> query = 'select * from agebin'
then run the search:
IDL> result = query_sql_str(query)
(a little widget will pop up and ask for your username and login. At the moment there are no stars for password, but I'm working on it!)
IDL> print, transpose(result)
result is a csv formated array of strings, one per line of result, with two comments at the top and a list of other things. Later versions will be able to return a structure, but not just yet! You'll need to login for the first query of each session, but shouldn't after that. If you have the wrong login details and need to replace them, simply type /login as a keyword when you call query_sql:
IDL> result = query_sql_str(query, /login)
If you're using the Millenium SQL database, you should use a seperate server. Something like:
result = query_sql_str(query, server='http://www.g-vo.org/Millennium?action=doQuery&SQL=' )
Another complexity with the Millenium is that sometimes the code guesses the wrong format. You can correct this by supplying a base struct to be replicated using the my_struct=.... keyword
query_sql_str |
function query_sql_str(query, my_struct=my_struct, quiet=quiet, _extra=_extra) |
Modifications and improvements suggested by Viv Wild, Manfred Kitzbichler, Eric Hayashi and Jeremy Blaizot. All SQL servers maintained by Gerard Lemson
Parameters | |
query |
sql query in the form of a string. The string may be multiline, the program will compress the string to a single line though |