forked from segasai/pg_idl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
49 lines (38 loc) · 1.89 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
This is the module for accesing Postgresql database from IDL.
It was mostly written by Erin Sheldon.
I have extracted it from sdssidl ( http://code.google.com/p/sdssidl/ ) and made the installation simpler.
INSTALLATION:
The pre-requisite is that you have to download the postgresql tarball
from http://www.postgresql.org/ftp/source/ and put it in this directory (no
need to extract it).
You also should have idl in your path
After that just run
make
This will create the directory called DLM which will have a dynamically
loadable IDL module.
You can put this directory anywhere and add the path to it to the
environmental variable IDL_DLM_PATH, e.g.
export IDL_DLM_PATH=some_path/DLM
After that in any IDL session you should be able to use pgsql_query()
function
IDL> res=pgsql_query('select ra,dec from sdssdr7.phototag limit 10',connect_info='host=some_host user=some_user password=some_password dbname=some_dbname')
% Loaded DLM: PGSQL_QUERY.
IDL> print, res
{ 329.12152 44.397910}{ 329.14333 44.390562}{329.14613 44.392761}{
329.14461 44.392961}{ 329.14460 44.392961}{ 329.14893 44.393050}{
329.14863 44.393803}{ 329.14229 44.395501}{ 329.14278 44.396347}{
329.15523 44.395887}
IDL> help,res,/str
** Structure <2948e08>, 2 tags, length=16, data length=16, refs=1:
RA DOUBLE 329.12152
DEC DOUBLE 44.397910
IF you don't want to type all the time the connection info, you should
define the environmental variables:
PGHOST PGDATABASE PGUSER PGPASSWORD
export PGHOST=hostname_of_the_database_server
export PGDATABASE=dbname
export PGUSER=your_username
export PGPASSWORD=your_password
If you define these, you can easily query without additional arguments:
Running the .idl_startup script...
IDL> res=pgsql_query('select ra,dec from sdssdr7.phototag limit 10')