Method Alias Scripts

This directory (/demo/util/methodalias) contains scripts that load useful method aliases into a Cloudscape database. A method alias is a database object that provides an easy way to execute a Java method within an SQL-J statement as if it were a built-in function.

Run these scripts as is, modify them, or use them as an example to load method aliases of your choice into a database.

For more information about method aliases, see the Cloudscape Developer's Guide.

About the Scripts

These scripts are ij scripts. ij is a Cloudscape SQL scripting tool. For more information about ij, see the Cloudscape Tools and Utilities Guide. (You can also run these scripts in Cloudview, but instructions are not provided here for doing that.)

Running the Scripts

Class Path

Set class path correctly for your environment. ij uses the library tools.jar (%CLOUDSCAPE_INSTALL%/lib/tools.jar). See Getting Started with Cloudscape for information about setting class path.

Starting ij and Connecting to the Database

If you are working in a client/server environment, these directions assume that the server is already running.

To start ij:

java -Dij.protocol = protocolForEnvironment
    COM.cloudscape.tools.ij

where protocolForEnvironment is one of the following:

Specifying the correct protocol loads the correct driver when ij starts up.

To connect to the database:

Connect pathToDatabase

Specify the full path to the database or a path relative to the current directory.

For example:

ij -Dij.protocol=jdbc:cloudscape:
ij>Connect 'toursDB';

Running a Script

To run a script, supply it as an argument to the ij command Run. For example:

ij> run 'c:\\cloudscape\\demo\\util\\methodalias\\math.sql';

ij echoes the commands as it executes them.

Complete List of Method Aliases for All Scripts in This Directory

Alias Name Java Class Name Method Name
GETDATABASEPROPERTIES COM.cloudscape.database.PropertyInfo getDatabaseProperties
GETDATABASEPROPERTY COM.cloudscape.database.PropertyInfo getDatabaseProperty
GETINDEXPROPERTIES COM.cloudscape.database.PropertyInfo getIndexProperties
GETTABLEPROPERTIES COM.cloudscape.database.PropertyInfo getTableProperties
SETDATABASEPROPERTY COM.cloudscape.database.PropertyInfo setDatabaseProperty
BITCLEAR COM.cloudscape.util.BitUtil clear
BITGET COM.cloudscape.util.BitUtil get
BITSET COM.cloudscape.util.BitUtil set
COT VisualNumerics.math.SFun cot
LOG10 VisualNumerics.math.SFun log10
ABS java.lang.Math abs
ACOS java.lang.Math acos
ASIN java.lang.Math asin
ATAN java.lang.Math atan
ATAN2 java.lang.Math atan2
CEIL java.lang.Math ceil
COS java.lang.Math cos
EXP java.lang.Math exp
FLOOR java.lang.Math floor
IEEEREMAINDER java.lang.Math IEEEremainder
LOG java.lang.Math log
POW java.lang.Math pow
RANDOM java.lang.Math random
RINT java.lang.Math rint
ROUND java.lang.Math round
SIN java.lang.Math sin
SQRT java.lang.Math sqrt
TAN java.lang.Math tan
CHECKTABLE COM.cloudscape.database.ConsistencyChecker checkTable