All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jtopenlite.com.ibm.jtopenlite.database.jdbc.JDBCParameterMetaData Maven / Gradle / Ivy

There is a newer version: 11.1
Show newest version
///////////////////////////////////////////////////////////////////////////////
//
// JTOpenLite
//
// Filename:  JDBCParameterMetaData.java
//
// The source code contained herein is licensed under the IBM Public License
// Version 1.0, which has been approved by the Open Source Initiative.
// Copyright (C) 2011-2012 International Business Machines Corporation and
// others.  All rights reserved.
//
///////////////////////////////////////////////////////////////////////////////

package com.ibm.jtopenlite.database.jdbc;

import com.ibm.jtopenlite.*;
import com.ibm.jtopenlite.database.*;

import java.sql.*;
import java.util.Calendar;

public class JDBCParameterMetaData implements ParameterMetaData, DatabaseParameterMarkerCallback
{
  private Column[] columns_;
  private int rowSize_;
  private JDBCStatement statement_;

  private final Calendar calendar_;

  public JDBCParameterMetaData(Calendar calendarUsedForConversions)
  {
    calendar_ = calendarUsedForConversions;
    statement_ = null;
  }

  void setStatement(JDBCStatement statement) {
      statement_ = statement;
  }


  public void parameterMarkerDescription(int numFields, int recordSize)
  {
    columns_ = new Column[numFields];
    for (int i=0; i= columns_.length || fieldIndex < 0 ) throw new SQLException("Descriptor index not valid.");
    return columns_[fieldIndex];
  }

  byte[] getExtendedSQLParameterMarkerDataFormat()
  {
    if (columns_ == null) return null;
    final int numFields = columns_.length;
    if (numFields == 0) return null;
    final int size = 16+(numFields*64);
    final byte[] data = new byte[size];
    Conv.intToByteArray(1, data, 0); // Consistency token.
    Conv.intToByteArray(numFields, data, 4);
    Conv.intToByteArray(rowSize_, data, 12);
    int offset = 16;
    for (int i=0; i columns_.length))
            throw JDBCError.getSQLException(JDBCError.EXC_DESCRIPTOR_INDEX_INVALID);

  }
  private void checkRequest() throws SQLException {
      if (statement_.isClosed()) {
	  throw JDBCError.getSQLException(JDBCError.EXC_FUNCTION_SEQUENCE);
      }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy