/* * After a query, server sends a list of column name with their types * * | 1 byte | 1 byte | 0-8 bytes | variable bytes | * | Length | Size number of fields | Number fields | unknown flags and fields | */ static enum proto_parse_status tns_parse_row_description_prefix(struct tns_parser *tns_parser, struct sql_proto_info *info, struct cursor *cursor) { enum proto_parse_status status; SLOG(LOG_DEBUG, "Parsing row description prefix"); CHECK(1); unsigned length = cursor_read_u8(cursor); DROP_FIX(cursor, length); DROP_VAR(cursor); if (PROTO_OK != (status = read_field_count(tns_parser, info, cursor))) return status; DROP_FIX(cursor, 1); for (unsigned i = 0; i < info->u.query.nb_fields; i++) { DROP_FIX(cursor, 3); DROP_VARS(cursor, 4); DROP_DALC(cursor); DROP_VARS(cursor, 2); DROP_FIX(cursor, 1); DROP_VAR(cursor); DROP_FIX(cursor, 2); for (unsigned i = 0; i < 3; ++i) { DROP_DALC(cursor); } DROP_VAR(cursor); } DROP_DALC(cursor); DROP_VARS(cursor, 2); return PROTO_OK; }
/* * | 1 byte | 1 + 0-8 bytes | up to 5 vars | * | Flag | Number column | unknown | */ static enum proto_parse_status tns_parse_row_prefix(struct tns_parser *tns_parser, struct sql_proto_info *info, struct cursor *cursor) { enum proto_parse_status status; SLOG(LOG_DEBUG, "Parsing Row prefix"); DROP_FIX(cursor, 1); if (PROTO_OK != (status = read_field_count(tns_parser, info, cursor))) return status; for (unsigned i = 0; i < 5; i++) { CHECK(1); char c = cursor_peek_u8(cursor, 0); if (c == TTC_ROW_DATA || c == TTC_END_MESSAGE) return PROTO_OK; DROP_VAR(cursor); } return PROTO_OK; }
static enum proto_parse_status tns_parse_row_prefix(struct tns_parser *tns_parser, struct sql_proto_info *info, struct cursor *cursor) { enum proto_parse_status status; SLOG(LOG_DEBUG, "Parsing Row prefix"); /* A row prefix contains * - 1 byte flag * - Number column * - 5 var */ DROP_FIX(cursor, 1); if (PROTO_OK != (status = read_field_count(tns_parser, info, cursor))) return status; DROP_VARS(cursor, 5); return PROTO_OK; }