Ruby/MaxL
Sample Scripts
The
following Ruby script demonstrates some of the Ruby/MaxL functionality.
require ‘maxl’ # if a MaxL error occurs, an exception
will be thrown, so # wrap everything in an exception
handling block begin # login to
Essbase sess =
Maxl.connect(“admin”, “essbase”, “localhost”) # load
Demo:Basic sess.do(“alter
application Demo load database Basic”) # query all
users sess.do(“display
application Demo”) # print
query result set in a tab delimited format – start # with
column headings headings =
sess.output_describe headings.each do |title|
print title + “\t” end print “\n” # then add
rows sess.each_row do |row| row.each do |cell| print cell + “\t” end print “\n” end rescue Maxl::MaxlGeneralError => err print “Command
failed: “ + err rescue Maxl::MaxlConnectError => err print “Login
failed: “ + err ensure # end the
session (logout) sess.disconnect if sess
!= nil end |
$Id: samples.html,v 1.1 2002/07/20 05:06:14 jai89 Exp $