mandrakos / pg_idl Goto Github PK
View Code? Open in Web Editor NEWThis project forked from segasai/pg_idl
Access to Postgresql database from IDL
License: GNU General Public License v2.0
This project forked from segasai/pg_idl
Access to Postgresql database from IDL
License: GNU General Public License v2.0
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')
Appears to happen when all rows of a column are null? Static analysis from splint:
pgsql_query_util.c: (in function GetArrayDims)
pgsql_query_util.c:438:30: Function ntohl expects arg 1 to be uint32_t gets
int32: (int32 )(mptr + 0 * sizeof(int32))
pgsql_query_util.c:440:38: Return value (type int) ignored: fflush(stdout)
pgsql_query_util.c:445:36: Function calloc expects arg 1 to be size_t gets long
int: ndim + 1
To allow arbitrary integral types to match long unsigned, use +longintegral.
pgsql_query_util.c:446:9: Index of possibly null pointer dims: dims
A possibly null pointer is dereferenced. Value is either the result of a
function which may return null (in which case, code should check it is not
null), or a global, parameter or structure field declared with the null
qualifier. (Use -nullderef to inhibit warning)
pgsql_query_util.c:445:16: Storage dims may become null
pgsql_query_util.c:450:35: Function ntohl expects arg 1 to be uint32_t gets
int32: (int32 )(mptr + pos * sizeof(int32))
pgsql_query_util.c:453:60: Return value (type int) ignored: fflush(stdout)
pgsql_query_util.c:459:49: Return value (type int) ignored: fflush(stdout)
pgsql_query_util.c:461:11: Null storage dims returned as non-null: (dims)
Function returns a possibly null pointer, but is not declared using
/@null@/ annotation of result. If function may return NULL, add /@null@/
annotation to the return value declaration. (Use -nullret to inhibit warning)
pgsql_query_util.c:435:20: Storage dims becomes null
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.