docs.intersystems.com
Home  /  Application Development: Language Bindings and Gateways  /  Using the InterSystems Native API for Java  /  Native API Quick Reference


Using the InterSystems Native API for Java
Native API Quick Reference
[Back] 
InterSystems: The power behind what matters   
Search:  


This is a quick reference for the InterSystems IRIS Native API, which consists of the following classes in com.intersystems.jdbc:
Note:
This chapter is intended as a convenience for readers of this book, but it is not the definitive reference for the Native API. For the most complete and up-to-date information on these classes, see InterSystems IRIS JDBC Driver in the online JavaDoc.
jdbc.IRIS methods by usage
Instances of jdbc.IRIS are created by IRIS.createIRIS(). The jdbc.IRIS class provides global value get and set accessors for datatypes Boolean, Short, Integer, Long, Double, Float, String, byte[], Time, Date, Timestamp, InputStream, Reader, and Serializable. The remaining methods are listed below, organized by usage:
Global Iteration and Management
Transactions and Locking
ClassMethod and Function Calls by Datatype
Class IRIS
For the most recent information on this class, see the IRIS section of InterSystems IRIS JDBC Driver in the online JavaDoc.
Instances of com.intersystems.jdbc.IRIS are created by calling IRIS.createIRIS().
createIRIS()
Constructor jdbc.IRIS.createIRIS() returns an instance of jdbc.IRIS that uses the specified Connection.
static IRIS createIRIS(IRISConnection conn) throws SQLException
parameters:
classMethodBoolean()
jdbc.IRIS.classMethodBoolean() calls a class method, passing 0 or more arguments and returning an instance of Boolean.
final Boolean classMethodBoolean (String className, String methodName, Object... args )
parameters:
classMethodBytes()
jdbc.IRIS.classMethodBytes() calls a class method, passing 0 or more arguments and returning an instance of byte[].
final byte [] classMethodBytes (String className, String methodName, Object... args )
parameters:
classMethodDouble()
jdbc.IRIS.classMethodDouble() calls a class method, passing 0 or more arguments and returning an instance of Double.
final Double classMethodDouble (String className, String methodName, Object... args )
parameters:
classMethodLong()
jdbc.IRIS.classMethodLong() calls a class method, passing 0 or more arguments and returning an instance of Long.
final Long classMethodLong (String className, String methodName, Object... args )
parameters:
classMethodString()
jdbc.IRIS.classMethodString() calls a class method, passing 0 or more arguments and returning an instance of String.
final String classMethodString (String className, String methodName, Object... args )
parameters:
functionBoolean()
jdbc.IRIS.functionBoolean() calls a function, passing 0 or more arguments and returning an instance of Boolean.
final Boolean functionBoolean (String functionName, String routineName, Object... args )
parameters:
functionBytes()
jdbc.IRIS.functionBytes() calls a function, passing 0 or more arguments and returning an instance of byte[].
final byte [] functionBytes (String functionName, String routineName, Object... args )
parameters:
functionDouble()
jdbc.IRIS.functionDouble() calls a function, passing 0 or more arguments and returning an instance of Double.
final Double functionDouble (String functionName, String routineName, Object... args )
parameters:
functionLong()
jdbc.IRIS.functionLong() calls a function, passing 0 or more arguments and returning an instance of Long.
final Long functionLong (String functionName, String routineName, Object... args )
parameters:
functionString()
jdbc.IRIS.functionString() calls a function, passing 0 or more arguments and returning an instance of String.
final String functionString (String functionName, String routineName, Object... args )
parameters:
getIRISIterator()
jdbc.IRIS.getIRISIterator() returns an IRISIterator object (see Class IRISIterator) for the specified node.
final IRISIterator getIRISIterator(String globalName, Object... subscripts)
parameters:
getObject()
jdbc.IRIS.getObject() gets the value of the global as an Object (or null if node does not exist).
final Object getObject (String globalName, String... subscripts )
parameters:
getReader()
jdbc.IRIS.getReader() gets the value of the global as a java.io.Reader (or null if node does not exist). This method is currently limited to the maximum size of a single global node.
final Reader getReader (String globalName, String... subscripts )
parameters:
getShort()
jdbc.IRIS.getShort() gets the value of the global as a Short (or null if node does not exist). Returns 0 if node value is empty string.
final Short getShort (String globalName, String... subscripts )
parameters:
getString()
jdbc.IRIS.getString() gets the value of the global as a String (or null if node does not exist).
Empty string and null values require some translation. An empty string "" in Java is translated to the null string character $CHAR(0) in ObjectScript. A null in Java is translated to the empty string in ObjectScript. This translation is consistent with the way JDBC handles these values.
final String getString (String globalName, String... subscripts )
parameters:
getTime()
jdbc.IRIS.getTime() gets the value of the global as a java.sql.Time (or null if node does not exist).
final java.sql.Time getTime (String globalName, String... subscripts )
parameters:
getTLevel()
jdbc.IRIS.getTLevel() gets the level of the current nested transaction. Returns 1 if there is only a single transaction open. Returns 0 if there are no transactions open. This is equivalent to fetching the value of the $TLEVEL special variable. Note: Never mix Native API and SQL transaction models (see the warning in Transactions and Locking).
final Integer getTLevel ( )
increment()
jdbc.IRIS.increment() increments the specified global with the passed value. A null value is interpreted as 0. Returns the new value of the global node
final long increment (Integer value, String globalName, String... subscripts )
parameters:
isDefined()
jdbc.IRIS.isDefined() checks if a global exists and contains data (see $DATA). Returns 0 if the node does not exist, 1 if the global node exists and contains data. 10 if the node is valueless but has descendants. 11 if it has data and descendants.
final int isDefined (String globalName, String... subscripts )
parameters:
kill()
jdbc.IRIS.kill() kills the global node including any descendants.
final void kill (String globalName, String... subscripts )
parameters:
lock()
jdbc.IRIS.lock() locks the global, returns true on success. Note that this method performs an incremental lock and not the implicit unlock before lock feature that is also offered in COS.
final boolean lock (String lockMode, Integer timeout, String globalName, String... subscripts )
parameters:
procedure()
jdbc.IRIS.procedure() calls a procedure, passing 0 or more arguments.
final void procedure (String procedureName, String routineName, Object... args )
parameters:
releaseAllLocks()
jdbc.IRIS.releaseAllLocks() releases all locks associated with the session.
final void releaseAllLocks ( )
set()
jdbc.IRIS.set() sets the current node to a value of a supported datatype:
final void set (Boolean value, String globalName, String... subscripts )
final void set (Short value, String globalName, String... subscripts )
final void set (Integer value, String globalName, String... subscripts )
final void set (Long value, String globalName, String... subscripts )
final void set (Double value, String globalName, String... subscripts )
final void set (Float value, String globalName, String... subscripts )
final void set (String value, String globalName, String... subscripts )
final void set (byte[] value, String globalName, String... subscripts )
final void set (java.sql.Date value, String globalName, String... subscripts )
final void set (java.sql.Time value, String globalName, String... subscripts )
final void set (java.sql.Timestamp value, String globalName, String... subscripts )
final void set (java.io.InputStream value, String globalName, String... subscripts )
final void set (java.io.Reader value, String globalName, String... subscripts )
final void set (Object value, String globalName, String... subscripts )
final<T extends Serializable> void set (T value, String globalName, String... subscripts )
parameters:
Notes on specific datatypes
The following datatypes have some extra features:
tCommit()
jdbc.IRIS.tCommit() commits the current transaction. Note: Never mix Native API and SQL transaction models (see the warning in Transactions and Locking).
final void tCommit ( )
tRollback()
jdbc.IRIS.tRollback() rolls back all open transactions in the session. Note: Never mix Native API and SQL transaction models (see the warning in Transactions and Locking).
final void tRollback ( )
tRollbackOne()
jdbc.IRIS.tRollbackOne() rolls back the current level transaction only. If this is a nested transaction, any higher-level transactions will not be rolled back. Note: Never mix Native API and SQL transaction models (see the warning in Transactions and Locking).
final void tRollbackOne ( )
tStart()
jdbc.IRIS.tStart() starts/opens a transaction. Note: Never mix Native API and SQL transaction models (see the warning in Transactions and Locking).
final void tStart ( )
Timestamp()
jdbc.IRIS.Timestamp() gets the value of the global as a java.sql.Timestamp (or null if node does not exist).
final java.sql.Timestamp getTimestamp (String globalName, String... subscripts )
parameters:
unlock()
jdbc.IRIS.unlock() unlocks the global. This method performs an incremental unlock, not the implicit unlock-before-lock feature that is also offered in ObjectScript.
final void unlock (String lockMode, String globalName, String... subscripts )
parameters:
classMethodVoid()
jdbc.IRIS.classMethodVoid() calls a class method with no return value, passing 0 or more arguments.
final void classMethodVoid (String className, String methodName, Object... args )
parameters:
Class IRISIterator
For the most recent information on this class, see the IRISIterator section of InterSystems IRIS JDBC Driver in the online JavaDoc.
Instances of com.intersystems.jdbc.IRISIterator are created by calling jdbc.IRIS.getIRISIterator(). See Finding Nodes in a Global Array for more details and examples.
getSubscriptValue()
IRISIterator.getSubscriptValue() returns a string containing the current subscript. Throws IllegalStateException if remove() has been called on the current node with this iterator, or there is no last element returned by this iterator (i.e. no successful next() or previous() calls).
String  getSubscriptValue () throws IllegalStateException 
getValue()
IRISIterator.getValue() returns the value of the current node. Throws IllegalStateException if remove() has been called on the current node with this iterator, or there is no last element returned by this iterator (i.e. no successful next() or previous() calls).
Object  getValue () throws IllegalStateException 
hasNext()
IRISIterator.hasNext() returns true if the iteration has more elements. (In other words, returns true if next() would return an element rather than throwing an exception.)
boolean  hasNext () 
hasPrevious()
IRISIterator.hasPrevious() returns true if the iteration has a previous element. (In other words, returns true if previous() would return an element rather than throwing an exception.)
boolean  hasPrevious () 
next()
IRISIterator.next() returns the next element in the iteration. Throws NoSuchElementException if the iteration has no more elements
String  next () throws NoSuchElementException 
previous()
IRISIterator.previous() returns the previous element in the iteration. Throws NoSuchElementException if the iteration does not have a previous element
String  previous () throws NoSuchElementException 
remove()
IRISIterator.remove() removes from the underlying collection the last element returned by this iterator. This method can be called only once per call to next() or previous(). Throws IllegalStateException if remove() has been called on the current node with this iterator, or there is no last element returned by this iterator (i.e. no successful next() or previous() calls).
void  remove () throws IllegalStateException 
startFrom()
IRISIterator.startFrom() sets the iterator's starting position to the specified subscript. The starting position does not have to be a valid sub-node.
void  startFrom(Object subscript)
After calling this method, use next() or previous() to advance the iterator to the next defined sub-node in alphabetic collating sequence. The iterator will not be positioned at a defined sub-node until one of these methods is called. If you call getSubscriptValue() or getValue() before the iterator is advanced, an IllegalStateException will be thrown.