I noticed a very strange behavior when DBPROC returns cursor which includes DATE and TIME columns.

---- Enviroment ------
MaxDB 7.5.0.8
JDBC (last one)
UNICODE = YES
Suse 9.0
----------------------

CREATE DBPROC DT  RETURNS CURSOR AS
    DECLARE :$CURSOR CURSOR FOR
          SELECT DATE, TIME FROM SYSDBA.DUAL
          ;

With JDBC the date and time received with
PreparedStatement st = conn.prepareStatement("CALL DT");
rs = st.executeQuery();
will be incorect.

---- WORKAROUND ----------------------------------------------------

In package
com.sap.dbtech.jdbc.translators.DateTranslator,
public Date getDate(SQLParamController controller, StructuredMem mem, Calendar cal)
the folowing segment is a workaround


// ORIGINAL =========================
//raw = mem.getBytes(this.bufpos, this.physicalLength - 1);
// BAF-FIX ==========================
int bp = bufpos;
int pl = physicalLength -1;
if(this.logicalLength < pl) bp += (pl - this.logicalLength);
raw = mem.getBytes(bp, this.logicalLength);
// BAF-FIX ==========================

The same should be done in TimeTranslator in getTime(...)

For DATE and TIME the physicalLength is twice as big then logicalLenght,
the expected data is the last logicalLength bytes of raw and the heading
bytes are extra. In case of SELECT TIME, DATE FROM DUAL logicalLength = physicalLength + 1;


Can someone locate why this problem occure, it is a certainly a bug.


-- MaxDB Discussion Mailing List For list archives: http://lists.mysql.com/maxdb To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to