home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1997 May
/
Pcwk0597.iso
/
sybase
/
starbuck
/
samples.z
/
DynamoConnection.wxc
< prev
next >
Wrap
Text File
|
1996-12-10
|
8KB
|
305 lines
Save Format v1.3
@begin ClassFile "DynamoConnection"
Exported 0;
Abstract 0;
Interface 0;
PackageName "";
Language "Java";
@begin UserFunction "initDynamoConnection(String arg0)"
@end;
@begin UserFunction "Prototype for initDynamoConnection(String arg0)"
Private 1;
GencodeSrcLine -1;
FunctionName "DynamoConnection::Prototype for initDynamoConnection(String arg0)";
@end;
@begin UserFunction "DynamoConnection()"
GencodeSrcLine 23;
FunctionName "DynamoConnection::DynamoConnection()";
@end;
@begin UserFunction "Prototype for DynamoConnection()"
Private 1;
GencodeSrcLine -1;
FunctionName "DynamoConnection::Prototype for DynamoConnection()";
@end;
@begin UserFunction "getQuery()"
GencodeSrcLine 43;
FunctionName "DynamoConnection::getQuery()";
@end;
@begin UserFunction "Prototype for getQuery()"
Private 1;
GencodeSrcLine -1;
FunctionName "DynamoConnection::Prototype for getQuery()";
@end;
@begin UserFunction "getHandle()"
GencodeSrcLine 61;
FunctionName "DynamoConnection::getHandle()";
@end;
@begin UserFunction "Prototype for getHandle()"
Private 1;
GencodeSrcLine -1;
FunctionName "DynamoConnection::Prototype for getHandle()";
@end;
@begin UserFunction "getDocument(int handle)"
GencodeSrcLine 71;
FunctionName "DynamoConnection::getDocument(int handle)";
@end;
@begin UserFunction "Prototype for getDocument(int handle)"
Private 1;
GencodeSrcLine -1;
FunctionName "DynamoConnection::Prototype for getDocument(int handle)";
@end;
@begin UserFunction "setHandle(int handle)"
Private 1;
@end;
@begin UserFunction "Prototype for setHandle(int handle)"
Private 1;
GencodeSrcLine -1;
FunctionName "DynamoConnection::Prototype for setHandle(int handle)";
@end;
@begin UserFunction "getSession()"
GencodeSrcLine 77;
FunctionName "DynamoConnection::getSession()";
@end;
@begin UserFunction "Prototype for getSession()"
Private 1;
GencodeSrcLine -1;
FunctionName "DynamoConnection::Prototype for getSession()";
@end;
@begin UserFunction "getConnection()"
GencodeSrcLine 83;
FunctionName "DynamoConnection::getConnection()";
@end;
@begin UserFunction "Prototype for getConnection()"
Private 1;
GencodeSrcLine -1;
FunctionName "DynamoConnection::Prototype for getConnection()";
@end;
@begin HPPPrefixBlock
@begin-code HPPPrefix
// Copyright (c) 1996 Sybase Inc. All rights reserved.
/**
* The DynamoConnection class is a wrapper interface to the NetImpact Dynamo query.
* DynamoConnection should not be used directly, instead use methods of the predefined
* document, session, or connection objects.
*
* Lifetime: created when the servlet starts.
* Becomes garbage when the servlet exits.
*
* See SQL Anywhere documentation on NetImpact Dynamo for a description
* of the methods, but be aware that, in Java, the first character
* of a method name is always in lower case.
*/
@end-code;
GencodeSrcLine 6;
@end;
@begin CPPPrefixBlock
@begin-code CPPPrefix
@end-code;
GencodeSrcLine -1;
@end;
@begin ClassContentsBlock
@begin-code ClassContents
// add your data members here
protected static final int CONNECTION = 1000;
protected static final int DOCUMENT = 1001;
private protected int _dynamoHandle; // opaque type: handle to Dynamo
private protected boolean _connected; // set if initialization succeeded
private protected static boolean _dllload; // set when DLL loaded
@end-code;
GencodeSrcLine 93;
@end;
@begin-code BaseClassList
extends Object
@end-code;
@begin-code GeneratedClassContents
@end-code;
@begin-code Code "DynamoConnection::Prototype for initDynamoConnection(String arg0)"
public:
static native boolean initDynamoConnection(String arg0);
@end-code;
@begin-code Code "DynamoConnection::DynamoConnection()"
public @CLASSNAME@() {
_dynamoHandle = -1;
_dllload = false;
_connected = false;
}
public @CLASSNAME@(int handle) {
_dynamoHandle = handle;
_dllload = true;
_connected = true;
}
public @CLASSNAME@(String args[]) {
if (args.length >= 2 && ! _dllload) {
// Load connection DLL and keep a private handle to the
// calling Dynamo requestor
System.load(args[1]);
}
_dynamoHandle = -1;
_connected = initDynamoConnection(args);
}
@end-code;
@begin-code Code "DynamoConnection::Prototype for DynamoConnection()"
public:
@@CLASSNAME@();
@end-code;
@begin-code Code "DynamoConnection::getQuery()"
public Query getQuery(String name) throws DynamoException
{
// Return a query object referring to named query defined
// in this template.
// Throws DynamoException if that query does not yet exist.
// NOTE: does not yet work -- Dynamo must be altered.
return new Query(_dynamoHandle, name);
}
public Query getQuery() throws DynamoException
{
// Return the default SQL query object (if it exists).
// Does not yet work.
return new Query(_dynamoHandle, "SQL");
}
public boolean getConnected() {
return _connected;
}
@end-code;
@begin-code Code "DynamoConnection::Prototype for getQuery()"
public:
Query getQuery();
@end-code;
@begin-code Code "DynamoConnection::getHandle()"
public int getHandle()
{
return _dynamoHandle;
}
protected boolean setHandle(int handle)
{
_dynamoHandle = handle;
_connected = true;
return true;
}
@end-code;
@begin-code Code "DynamoConnection::Prototype for getHandle()"
public:
int getHandle();
@end-code;
@begin-code Code "DynamoConnection::getDocument(int handle)"
public Document getDocument()
{
// Create a new Document object.
// Used to create the initial "document" object.
return new Document(_dynamoHandle);
}
@end-code;
@begin-code Code "DynamoConnection::Prototype for getDocument(int handle)"
public:
Document getDocument(int handle);
@end-code;
@begin-code Code "DynamoConnection::Prototype for setHandle(int handle)"
private:
boolean setHandle(int handle);
@end-code;
@begin-code Code "DynamoConnection::getSession()"
public Session getSession()
{
// Create a new Session object.
// Used to create the initial (empty) "session" object
return new Session(_dynamoHandle);
}
@end-code;
@begin-code Code "DynamoConnection::Prototype for getSession()"
public:
public Session getSession();
@end-code;
@begin-code Code "DynamoConnection::getConnection()"
public DBConnection getDBConnection()
{
// Create a new Connection. Used to create initial "connection" object
return new DBConnection(_dynamoHandle);
}
// Internal native methods.
protected native String getStringProperty(int id, String property);
protected native int getIntProperty(int id, String property);
private native boolean initDynamoConnection(String args[]);
@end-code;
@begin-code Code "DynamoConnection::Prototype for getConnection()"
public:
Connection getConnection();
@end-code;
@end;