comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: idl - Mysql interface
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: idl - Mysql interface [message #51399 is a reply to message #51398] Tue, 21 November 2006 02:12 Go to previous messageGo to previous message
Wox is currently offline  Wox
Messages: 184
Registered: August 2006
Senior Member
On 20 Nov 2006 08:59:41 -0800, "Brian Larsen" <balarsen@gmail.com>
wrote:

> The situation is that I have a large (~15M records) database that I
> would like to play with the data in idl and using the power of the
> database I can do an appropriate select of the data before I read it
> into idl.

The dataminer was already mentioned. I don't know much about
databases, but I'd guess you can use the "WHERE"?

Some code to play around with is displayed below. Check IDLdbDatabase
methods for setting and getting data. (Maybe you know much more about
this? If not, this might get you started.)

You could also use Marc Buie's code, as mentioned, to save you some
work :-).

I don't know whether this is what you were asking for...





pro test

objDB = OBJ_NEW('IDLdbDatabase')

;On Windows:
ODBCstr="DRIVER={MySQL ODBC 3.51
Driver};SERVER=servername;DATABASE=databasename;
USER=username;PASSWORD=*****;OPTION=3;"
objDB->Connect,connection=ODBCstr

; On Linux I could't get this to work, so I did this:
; Add this to .odbc.ini:
;
;[ODBC Data Sources]
;...
;MyODBC=MySQL ODBC 3.51 Driver
;.
;.
;.
;[MyODBC]
;Driver = /usr/lib/libmyodbc3.so
;Description = MySQL ODBC 3.51 Driver
;SERVER = servername
;USER = username
;Password = ******
;Database = databasename

; Uncomment for linux (comment previous lines)
;ODBCstr="MyODBC"
;objDB->Connect,datasource=mysqlinfo


if OBJ_VALID(objDB) then begin
table='tablename'
; Do your database stuff (check IDL's help on IDLdbDatabase)
; Some examples:

author='Brian A. Larsen'
a=3
v=3
objDB->ExecuteSQL, $
"UPDATE "+table+" SET a = "+string(a)+" WHERE v=
"+string(v)

objDB->ExecuteSQL, $
"DELETE FROM "+table+" WHERE v1= "+string(v)

objDB->ExecuteSQL, $
"INSERT INTO "+table+"(author,v,datetime) VALUES
('"+author+"',"+string(v)+",CURRENT_TIMESTAMP)"
endif

obj_destroy,objDB


end
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: "free" screen size
Next Topic: Re: Martin Shultz's MSG_GUI

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 15:39:12 PDT 2025

Total time taken to generate the page: 0.28025 seconds