Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

Basic Data Packets


Contents

In this section, we will document the structure of the basic granulardata implemented in the communication protocol.

Such basic data is, for example:

  • An (32-bit) integer
  • A timestamp
  • A decimal value
  • A CAS info

The basic data packets are used to aggregate further complex packages – see the next sections.

As a general rule, the structure of a “basic” package is made of two parts:

  • The packet data length
  • The packet data

 

WRITE Packets

 

WRITE_NULL_TERMINATED_STRING (N)

 

Write null-terminated string (length = N)

 

Value

Length

Notes

N + 1

4 bytes (Integer value)

String length + null terminator

String content to write,

char by char

N bytes

Each char = One byte

Null char (= ‘\0’)

1 byte

Null string terminator

 

WRITE_FIXED_LENGTH_STRING (N)

 

Write fixed length string (length = N)

 

Value

Length

Notes

N

4 bytes (Integer value)

String length

String content to write,

char by char

N bytes

Each char =One byte

 

Note: If the value to be written has a length < N, then the client must pad it up to N-length with NULL chars (0x0h)

 

WRITE_SHORT

 

Value

4 bytes (Integer value)

Data length

2

4 bytes (Integer value)

Short data type length

Short value to write

2 bytes

 

 

WRITE_INT (WRITE_FLOAT)

 

Value

Length

Notes

4

4 bytes (Integer value)

Integer/Float data type length

Integer (or Float) value to write

4 bytes

 

 

WRITE_NULL

 

Value

Length

Notes

0

4 bytes

 

 

WRITE_NULL_ARRAY (N)

 

Value

Length

Notes

N

4 bytes (Integer value)

Array length

N times the NULL char (0x0h)

N bytes

 

 

WRITE_BYTE

 

Value

Length

Notes

1

4 bytes (Integer value)

Byte data type length

Byte value to write

1 byte

 

 

WRITE_FUNCTION_CODE

 

Value

Length

Notes

Function code value

1 byte

 

 

WRITE_BOOL

 

Value

Length

Notes

1

4 bytes (Integer value)

Bool data type length

Bool (=Byte 0/1) value to write

1 byte

 

 

WRITE_BYTES_ARRAY (N)

 

Value

Length

Notes

N

4 bytes (Integer value)

Array length

Byte[] array to write

N bytes

 

 

WRITE_DATE

 

Value

Length

Notes

6

4 bytes (Integer value)

Data type length

Year to write

2 bytes

 

Month to write

2 bytes

 

Day to write

2 bytes

 

 

WRITE_DATETIME

 

Value

Length

Notes

14

4 bytes (Integer value)

Data type length

Year to write

2 bytes

 

Month to write

2 bytes

 

Day to write

2 bytes

 

Hour to write

2 bytes

 

Min to write

2 bytes

 

Seconds to write

2 bytes

 

Milliseconds to write

2 bytes

 

 

WRITE_LONG (WRITE_DOUBLE)

 

Value

Length

Notes

8

4 bytes (Integer value)

Data type length

Long value to write

8 bytes

 

 

WRITE_OID

 

Value

Length

Notes

8

4 bytes (Integer value)

Data type length

OID value to write

8 bytes

An OID information is made of 8 bytes

Read about OID here.

 

WRITE_CAS

 

Value

Length

Notes

CAS value to write

4 bytes

CAS data

 

WRITE_TIME

 

Value

Length

Notes

6

4 bytes (Integer value)

Data type length

Hour to write

2 bytes

 

Min to write

2 bytes

 

Seconds to write

2 bytes

 

 

WRITE_TIMESTAMP

 

Value

Length

Notes

12

4 bytes (Integer value)

Data type length

Year to write

2 bytes

 

Month to write

2 bytes

 

Day to write

2 bytes

 

Hour to write

2 bytes

 

Min to write

2 bytes

 

Seconds to write

2 bytes

 

 

WRITE_CACHE_TIME

 

Value

Length

Notes

8

4 bytes (Integer value)

Data type length

Seconds to write

4 bytes

 

Milliseconds to write

4 bytes

 

 


READ Packets

 

READ_NULL_TERMINATED_STRING (N)

 

Data type

Length

Notes

String

Nbytes

String content

Null char (=’\0’)

1 byte

Null string terminator

 

READ_SHORT

 

Data type

Length

Notes

Short

2bytes

 

 

READ_INT (READ_FLOAT)

 

Data type

Length

Notes

Integer

4 bytes

 

 

READ_BYTE

 

Data type

Length

Notes

byte

1 x byte

 

 

READ_BOOL

 

Data type

Length

Notes

Byte 0/1 (Boolean)

1 byte

 

 

READ_BYTES_ARRAY (N)

 

Data type

Length

Notes

Byte[] array

N x byte

 

 

READ_DATE

 

Data type

Length

Notes

Year

2 bytes

 

Month

2 bytes

 

Day

2 bytes

 

 

READ_DATETIME

 

Data type

Length

Notes

Year

2 bytes

 

Month

2 bytes

 

Day

2 bytes

 

Hour

2 bytes

 

Min

2 bytes

 

Seconds

2 bytes

 

Milliseconds

2 bytes

 

 

READ_LONG (READ_DOUBLE)

 

Data type

Length

Notes

Long (or Double)

8 bytes

 

 

READ_OID

 

Data type

Length

Notes

OID

8 bytes

Read more about CUBRID OID here.

 

READ_BROKER_INFO

 

Data type

Length

Notes

Broker info

8 bytes

8-bytes array containing information about the CUBRID Broker

 

READ_CAS

 

Data type

Length

Notes

CAS

4 bytes

4-bytes array containing CAS information

 

READ_TIME

 

Data type

Length

Notes

Hour

2 bytes

 

Min

2 bytes

 

Seconds

2 bytes

 

 

Note:

A full date is "completed" with default values:

  • Year = 1970
  • Month = 1
  • Day = 1

READ_TIMESTAMP

 

Data type

Length

Notes

Year

2 bytes

 

Month

2 bytes

 

Day

2 bytes

 

Hour

2 bytes

 

Min

2 bytes

 

Seconds

2 bytes

 

comments powered by Disqus
Page info
viewed 1037 times
translations en
Author
posted last year by
CUBRID
Contributors
updated last year by
View revisions
Share this article