.
query_sql_str.pro

Last modification date:
Tue Jul 18 16:55:21 2006

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)

Returns
A structure with fields equivalent to the titles of the columns returned by the query. Also gives a brief report to the shell about what has gone on.
Examples
result = query_sql_str('select * from agebin', server='http://www.g-vo.org/Millennium?action=doQuery&SQL='
Requires
An account on the MPA/GAVO webaccess to SQL servers.
Version
$Id: query_sql_str.html,v 1.2 2006/08/03 17:29:18 glemson Exp $
History
Originally created Jan 2006 by Ben Panter.

Modifications and improvements suggested by Viv Wild, Manfred Kitzbichler, Eric Hayashi and Jeremy Blaizot. All SQL servers maintained by Gerard Lemson

Author
Ben Panter

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

Keywords
my_struct
- supply you own struct to avoid problems with incorrect format guessing or provide your own field names
quiet
- suppresses any messages to the shell, both by IDL and wget.
_extra
allows keywords to be passed to subroutines:

server - Change the server from the default value to something else (this can be changed permanently in sql_query.pro if desired)

login - Force a new attempt at logging in.


Produced by IDLdoc 1.6 on Tue Jul 18 16:55:48 2006