Class weblogic.jdbc.dblib.Statement
All Packages  

Class weblogic.jdbc.dblib.Statement

java.lang.Object
   |
   +----weblogic.jdbc.dblib.Statement

public class Statement
extends Object
implements Statement, Warnable
This class contains the executeWriteText() and getTextTimestamp()methods, WebLogic extensions to JDBC, that allow inserts and updates of data of type Text and Image into a SQLServer database. Only these methods are commented here.
Author:
Copyright (c) 1996, WebLogic, Inc.

Method Index

 o executeWriteText(String, String, byte[], boolean, byte[], int, int)
This WebLogic extension to JDBC writes data of type Text or Image to a row in an SQL Server DBMS table. It uses an array of bytes as the data source.
 o executeWriteText(String, String, byte[], boolean, InputStream, int)
This WebLogic extension to JDBC writes data of type Text or Image to a row in an SQL Server DBMS table. It uses an InputStream as a data source.
 o executeWriteText(String, String, byte[], boolean, byte[], int, int, byte[])
This WebLogic extension to JDBC writes data of type Text or Image to a row in an SQL Server DBMS table. It uses an array of bytes as a data source and an additional option of using a Sybase timestamp for version information.
 o executeWriteText(String, String, byte[], boolean, InputStream, int, byte[])
This WebLogic extension to JDBC writes data of type Text or Image to a row in an SQL Server DBMS table. It uses an InputStream as a data source and an additional option of using a Sybase timestamp for version information.
 o getTextTimestamp()
Returns an internal SQL Server timestamp value that is associated with the selected field of the current row in the DBMS.

Methods

 o executeWriteText
  public int executeWriteText(String tableName,
                              String columnName,
                              byte textptr[],
                              boolean log,
                              byte in[],
                              int offset,
                              int length) throws SQLException
This WebLogic extension to JDBC writes data of type Text or Image to a row in an SQL Server DBMS table. SQL Server does not allow you to insert Text/Image data to a row as part of an SQL INSERT or UPDATE operation, but instead requires multiple SQL statements and a 16-byte binary value, called a text pointer, which is stored in the row and describes where the Text/Image data is actually stored on the SQLServer logical device.

A Write of Text/Image data requires the text pointer, and a special DBLIB call, dbwritetext. ExecuteWriteText is a wrapper around dbwritetext.

This version does not use Sybase timestamps.

Parameters:
tablename - Name of the table to be updated
columnname - Text/Image column to be updated
textptr - Binary value (byte[]) of the SQL Server text pointer
log - True if the Text/Image write should be logged
in - Byte array that is the Text/Image data
offset - Offset into the Text/Image data
length - Number of bytes to be written
Returns:
Length of data written
Throws: SQLException
if there is a SQL error
 o executeWriteText
  public int executeWriteText(String tableName,
                              String columnName,
                              byte textptr[],
                              boolean log,
                              InputStream in,
                              int length) throws SQLException
This WebLogic extension to JDBC writes data of type Text or Image to a row in an SQL Server DBMS table. SQL Server does not allow you to insert Text/Image data to a row as part of an SQL INSERT or UPDATE operation, but instead requires multiple SQL statements and a a 16-byte binary value, called a text pointer, which is stored in the row and describes where the Text/Image data is actually stored on the SQLServer logical device.

A Write of Text/Image data requires the text pointer, and a special DBLIB call, dbwritetext. ExecuteWriteText is a wrapper around dbwritetext.

This version does not use Sybase timestamps.

Parameters:
tablename - Name of the table to be updated
columnname - Text/Image column to be updated
textptr - Binary value (byte[]) of the SQLServer text pointer
log - true if the Text/Image write should be logged
in - InputStream that contains the Text/Image data
length - Number of bytes to be written
Returns:
Length of data written
Throws: SQLException
if there is a SQL error
 o executeWriteText
  public int executeWriteText(String tableName,
                              String columnName,
                              byte textptr[],
                              boolean log,
                              byte in[],
			      int offset,
                              int length,
			      byte[] timestamp) throws SQLException
With this version of the executeWriteText() method, you may supply a Sybase timestamp value to be checked against a timestamp value stored with any Text/Image column type that is updated each time the value is changed. If the timestamp value given in executeWriteText() is non-null, and does not match the value currently in the DBMS, the write operation will fail. The call ResultSet.getTimeStamp() is used to get the current DBMS timestamp value, which prevents conflicting writes in a multiuser application.

Arguments for this version supply an array of bytes, the offset into the array, and its length as the source of the Text/Image data.

Parameters:
tablename - Name of the table to be updated
columnname - Text/Image column to be updated
textptr - Binary value (byte[]) of the SQLServer text pointer
log - true if the Text/Image write should be logged
in - Byte array that is the Text/Image data
offset - Offset into the Text/Image data
length - Number of bytes to be written
timestamp - A Sybase timestamp that (if not null) must match the currently stored timestamp for the Text/Image field.
Returns:
Length of data written
Throws: SQLException
if there is a SQL error
See:
getTextTimestamp()
 o executeWriteText
  public int executeWriteText(String tableName,
                              String columnName,
                              byte textptr[],
                              boolean log,
                              InputStream in,
                              int length,
			      byte[] timestamp) throws SQLException
With this version of the executeWriteText() method, you may supply a Sybase timestamp value to be checked against a timestamp value stored with any Text/Image column type that is updated each time the value is changed. If the timestamp value given in executeWriteText() is non-null, and does not match the value currently in the DBMS, the write operation will fail. The call ResultSet.getTimeStamp() is used to get the current DBMS timestamp value, which prevents conflicting writes in a multiuser application.

Arguments for this version supply an InputStream and its length as the Text/Image data.

Parameters:
tablename - Name of the table to be updated
columnname - Text/Image column to be updated
textptr - Binary value (byte[]) of the SQLServer text pointer
log - true if the Text/Image write should be logged
in - InputStream that contains the Text/Image data
length - Number of bytes to be written
timestamp - A Sybase timestamp that (if not null) must match the currently stored timestamp for the Text/Image field.
Returns:
Length of data written
Throws: SQLException
if there is a SQL error
See:
getTextTimestamp()
 o getTextTimestamp
  public byte[] getTextTimestamp() throws SQLException
This method can be used only when the Statement is open on a SELECT of a single Text/Image column. It returns an array of bytes that is an internal SQL Server timestamp associated with the current state of the selected field of the current row in the DBMS.

The timestamp is used in any subsequent executeWriteText() to this row to compare this value to the value in the DBMS at the time of the executeWriteText(). If there have been writes to the timestamp field (and consequently changes to the timestamp itself) since the timestamp value was retrieved with this method, the comparison will fail and the executeWriteText() will not complete. This is a means of preventing conflicting updates in a multi-user application.

If the ResultSet returned by this Statement returns multiple rows, this call must be made for each row of interest as the ResultSet is traverse.

Returns:
SQL Server timestamp
Throws: SQLException
if there is a SQL error

All Packages