About Us
Products
Purchase
Downloads
Support
Forums
Contact Us
Site
 Register to post in forums, or Log in to your existing account
 

 Related 
Contents
Command Reference
  #nnn
  #ABORT
  #ACTION
  #ADD
  #ADDITEM
  #ADDKEY
  #AFK
  #ALARM
  #ALIAS
  #ALL
  #BACKUP
  #BEEP
  #BREAK
  #BUTTON
  #C-
  #C+
  #CALL
  #CAPTURE
  #CASE
  #CHARACTER
  #CLASS
  #CLOSE
  #CLR
  #CMD
  #COLOR
  #COM
  #CONDITION
  #CONFIGURE
  #CONNECT
  #CONTINUE
  #CR
  #CW
  #DBCLOSE
  #DBDELETE
  #DBFIRST
  #DBGET
  #DBLOAD
  #DBNEXT
  #DBOFFLINE
  #DBONLINE
  #DBPREV
  #DBPUT
  #DBRESET
  #DBSAVE
  #DDE
  #DEBUG
  #DEBUGFILE
  #DEFAULT
  #DELCLASS
  #DELITEM
  #DELKEY
  #DELNITEM
  #DESCRIBE
  #DIRECTION
  #DISCONNECT
  #DOOR
  #ECHO
  #ECHOPROMPT
  #EDITOR
  #ERASE
  #EVALUATE
  #EVENT
  #EXECUTE
  #EXECWIN
  #EXIT
  #FILE
  #FIND
  #FIRE
  #FORALL
  #FREEZE
  #FTP
  #FUNCTION
  #GAG
  #GAGBLOCK
  #GAGLOG
  #GAGOFF
  #GAGON
  #GAGSPACE
  #GAUGE
  #H-
  #H+
  #HELP
  #HIGHLIGHT
  #HISTLOAD
  #HISTORY
  #HISTSAVE
  #HOST
  #IF
  #IGNORE
  #IMAGE
  #INPUT
  #KEY
  #KILLALL
  #LAUNCH
  #LMAP
  #LOAD
  #LOCAL
  #LOCATION
  #LOG
  #LOOK
  #LOOP
  #LOOPDB
  #LOOPVIEW
  #LUA
  #MAKEROOM
  #MAKEWINDOW
  #MAP
  #MAPQUERY
  #MARK
  #MATH
  #MEDIA
  #MENU
  #MERGE
  #MESSAGE
  #MODULE
  #MOVE
  #MSS
  #MXP
  #MXPTRIG
  #NAME
  #NEW
  #NEWVAR
  #NODEF
  #NODIR
  #NOINPUT
  #NOMAP
  #NOOP
  #NOSAVE
  #OK
  #ONINPUT
  #PATH
  #PATHHIGH
  #PAUSE
  #PCOL
  #PICK
  #PLAY
  #PLUGIN
  #PORTAL
  #PRINT
  #PROMPT
  #PSUB
  #PUEBLO
  #PW
  #QUERY
  #QUEUE
  #RAISEEVENT
  #READ
  #RECALL
  #RECORD
  #REGEX
  #RENAME
  #REPEAT
  #RESET
  #RESUME
  #RESULT
  #RETRACE
  #RETURN
  #SAVE
  #SAY
  #SAYADD
  #SAYPROMPT
  #SCRIPT
  #SCROLL
  #SECTION
  #SEND
  #SENDGMCP
  #SENDPROMPT
  #SENDRAW
  #SENDSB
  #SESSION
  #SET
  #SETPROMPT
  #SHOW
  #SHOWARR
  #SHOWDB
  #SHOWPROMPT
  #SHOWTABLE
  #SIGNAL
  #SLOW
  #SORT
  #SQLCLOSE
  #SQLDB
  #SS
  #STATE
  #STATUS
  #STEP
  #STOP
  #STWIN
  #STYLE
  #SUBSTITUTE
  #SUSPEND
  #SWITCH
  #T-
  #T?
  #T+
  #TAB
  #TAG
  #TELEPORT
  #TEMP
  #TEMPVAR
  #THREAD
  #TIMER
  #TRACK
  #TRIGGER
  #TSET
  #TYPE
  #TZERO
  #UNALIAS
  #UNBUTTON
  #UNCLASS
  #UNDIR
  #UNGAG
  #UNKEY
  #UNEVENT
  #UNLOAD
  #UNLOC
  #UNMENU
  #UNPATH
  #UNPORTAL
  #UNSTYLE
  #UNTAB
  #UNTIL
  #UNTRIGGER
  #UNVAR
  #UPDATE
  #URL
  #VARFUNC
  #VARIABLE
  #VERBATIM
  #VERSION
  #VIEW
  #WAIT
  #WAITFOR
  #WAITSIGNAL
  #WAITTHREAD
  #WALK
  #WHILE
  #WINDOW
  #WITHLOC
  #WIZLIST
  #WRAP
  #WRITE
  #WRITELOG
  #YESNO
#SQLDB [[cmud_#SQLDB]] 
Added in v3.11
SQLDB

Syntax: #SQLDB filename
Syntax: #SQLDB name dbname protocol server port user pass
Related: %sql, %sqldb, #SQLCLOSE

Creates a new SQL Database connection and automatically opens it. To create a connection without automatically opening it, see the %sqldb function.

When just a filename is used, the format of the database is assumed to be SQLite. The "name" of the database connection object is taken from the filename without the extension.

When the full form of the #SQLDB command is used, the "name" of the connection can be set differently from the database name (filename for local databases), and additional SQL protocols can be used.

NOTE: To use protocols other than SQLite, you MUST be using CMUDPro.

The following additional protocols can be used within CMUDPro:
  • ado Microsoft ADO/MDAC using any ODBC, DSN, or OLEDB driver installed on your system. The dbname should be a full OLE connection string.
  • sqlite, sqlite-2.8, sqlite-3 : SQLite (sqlite.dll, sqlite3.dll)
  • firebird-1.5, firebird-2.0 : Firebird (fbclient15.dll, fbclient20.dll)
  • firebirdd-1.5, firebirdd-2.0 : Firebird (Embedded) (fbclientd15.dll, fbclientd20.dll)
  • interbase-5, interbase-6 : Interbase (gds32.dll)
  • mssql : Microsoft SQL Server 1.7 (ntwdblib.dll)
  • mysql, mysql-4.1, mysql-5 : MySQL v4.1, v5.0 or v5.1 (libmysql41.dll, libmysql50.dll, libmysql51.dll)
  • mysqld, mysqld-4.1, mysqld-5 : MySQL Embedded v4.1, v5.0 or v5.1 (libmysqld41.dll, libmysqld50.dll, libmysqld51.dll)
  • oracle, oracle-9i : Oracle (oci.dll)
  • postgresql, postgresql-7, postgresql-8 : PostgreSQL v7 or v8 (libpq.dll, libpq74.dll, libpq81.dll)
  • sybase : Sybase 1.25 (libsybdb.dll)

Note that you must have the proper DLL driver for the database protocol in the same directory as your EXE file. These DLLs are usually obtained from the database provider. CMUD uses the open-source ZeosLib database components (v6.6) which are based upon JDBC drivers. Drivers other than SQLite have not been fully tested by Zugg Software.

SQLDB examples

#SQLDB sessions.db
row = %sql(sessions, "SELECT * FROM chardb")
#WHILE (!@row.Eof()) {#SHOW @row.Item("Title");#CALL @row.Next}
#SQLCLOSE sessions

Loops through the local "sessions.db" SQLite database and displays the Title of each session.

#SQLDB mydb dbname mysql hostname.com 3305 root passwd
open a connection to a remote MySQL database. CMUDPro ONLY!
Viewer Comments [0 - Post your comments]

Jump to:  

© 2009 Zugg Software. Hosted by Wolfpaw.net