1 21 22 package org.apache.derby.client.net; 23 24 import org.apache.derby.client.am.Sqlca; 25 import org.apache.derby.shared.common.reference.SQLState; 26 import org.apache.derby.client.am.ClientMessageId; 27 import org.apache.derby.client.am.SqlException; 28 import java.io.UnsupportedEncodingException ; 29 30 public class NetSqlca extends Sqlca { 31 34 NetSqlca(org.apache.derby.client.am.Connection connection, 35 int sqlCode, 36 String sqlState, 37 byte[] sqlErrpBytes) { 38 super(connection); 39 sqlCode_ = sqlCode; 40 sqlState_ = sqlState; 41 sqlErrpBytes_ = sqlErrpBytes; 42 } 43 44 NetSqlca(org.apache.derby.client.am.Connection connection, 45 int sqlCode, 46 byte[] sqlState, 47 byte[] sqlErrpBytes) throws SqlException { 48 super(connection); 49 sqlCode_ = sqlCode; 50 try 51 { 52 sqlState_ = bytes2String(sqlState,0,sqlState.length); 53 }catch(UnsupportedEncodingException uee) 54 { 55 throw new SqlException(null, 56 new ClientMessageId(SQLState.UNSUPPORTED_ENCODING), 57 "sqlstate bytes", "SQLSTATE",uee); 58 } 59 sqlErrpBytes_ = sqlErrpBytes; 60 } 61 protected void setSqlerrd(int[] sqlErrd) { 62 sqlErrd_ = sqlErrd; 63 } 64 65 protected void setSqlwarnBytes(byte[] sqlWarnBytes) { 66 sqlWarnBytes_ = sqlWarnBytes; 67 } 68 69 protected void setSqlerrmcBytes(byte[] sqlErrmcBytes, int sqlErrmcCcsid) { 70 sqlErrmcBytes_ = sqlErrmcBytes; 71 sqlErrmcCcsid_ = sqlErrmcCcsid; 72 } 73 74 public long getRowCount(Typdef typdef) throws org.apache.derby.client.am.DisconnectException { 75 int byteOrder = typdef.getByteOrder(); 76 long num = (byteOrder == org.apache.derby.client.am.SignedBinary.BIG_ENDIAN) ? 77 super.getRowCount() : ((long) sqlErrd_[1] << 32) + sqlErrd_[0]; 78 return num; 79 } 80 } 81 | Popular Tags |