diff --git a/oracle-protocol.labnotes b/oracle-protocol.labnotes new file mode 100644 index 0000000000000000000000000000000000000000..cc74cbd74e03053dd847af6337896c5a75d43d82 --- /dev/null +++ b/oracle-protocol.labnotes @@ -0,0 +1,116 @@ + +/* */ public class Packet +/* */ implements SQLnetDef +/* */ { +/* */ private int buffer2send; +/* */ protected int sdu; +/* */ protected int tdu; +/* */ protected int length; +/* */ public int type; +/* */ protected int flags; +/* */ protected int dataLen; +/* */ protected int dataOff; +/* */ protected String data; +/* */ protected byte[] buffer; +/* 112 */ protected int leftOverFromPreviousRead = 0; +/* */ +/* */ + + + +Packet class, size is SDU + + +DataPacket + + + +netinputstream on top (same as MAPI block stream essentially) + + +packets on top again ?!? + + + +unmarshalOneRow + + +rowSpaceIndicator points to beginning of row in result set? + + +rowSpaceIndicator = pointer into row buffer + +fields: known lengths or strings with char >> 1 leng prefix + + + + +/* 1032 */ lenoffset = columnIndex + charLength * currentRow; + + + +/* 1033 */ int len = rowSpaceChar[lenoffset] >> '\001'; +/* */ +/* 1035 */ if (len > internalTypeMaxLength) { +/* 1036 */ len = internalTypeMaxLength; +/* */ } +/* 1038 */ result = new String(rowSpaceChar, lenoffset + 1, len); + + +16 bit -> 15 bit string length + + + + + + + +/* 252 */ if (rowSpaceIndicator[(indicatorIndex + currentRow)] != -1) +/* */ { +/* 254 */ off = columnIndex + byteLength * currentRow; +/* 255 */ int year = oracleYear(off); +/* */ +/* 257 */ Calendar cal2 = (Calendar)cal.clone(); +/* */ +/* 259 */ cal2.set(year, oracleMonth(off), oracleDay(off), 0, 0, 0); +/* 260 */ cal2.set(14, 0); +/* */ +/* */ +/* */ +/* 264 */ if ((year > 0) && (cal2.isSet(0))) { +/* 265 */ cal2.set(0, 1); +/* */ } +/* 267 */ result = new Date(cal2.getTimeInMillis()); +/* */ } +/* */ +/* */ + + + +NumberCommonAccessor interesting binary + + + + + +oracle.jdbc.driver.T4CCharAccessor.unmarshalOneRow() + + + +int32, char(10); + +42, 'DPFKG' +100 00 00 00 OK + + + + +https://dev.mysql.com/doc/internals/en/binary-protocol-resultset-row.html + +https://github.com/siddontang/go-mysql/blob/master/Godeps/_workspace/src/github.com/go-sql-driver/mysql/packets.go + +https://dev.mysql.com/doc/internals/en/integer.html#length-encoded-integer + + +[ 6899, "systemfunctions" ] +[ 6899, "systemfunctions" ]