Skip to content

Commit

Permalink
schema: add collation and is_nullable opts
Browse files Browse the repository at this point in the history
Add collation and is_nullable opts to schema_field_value.

Part of #151
  • Loading branch information
LeonidVas authored and Totktonada committed Jul 23, 2020
1 parent d1bdb6c commit dc7523f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/tarantool_schema.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,9 @@ decode_index_parts_166(struct schema_field_value *parts, uint32_t part_count,

for (uint32_t j = 2; j < item_count; ++j)
mp_next(data);
/* Set default values. */
part->is_nullable = false;
part->coll_id = COLL_NONE;
}
return 0;
}
Expand Down
8 changes: 8 additions & 0 deletions src/tarantool_schema.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#ifndef PHP_TNT_SCHEMA_H
#define PHP_TNT_SCHEMA_H

#include <stdint.h>

struct schema_key {
const char *id;
uint32_t id_len;
Expand All @@ -13,11 +15,17 @@ enum field_type {
FT_OTHER = 2
};

#define COLL_NONE UINT32_MAX

struct schema_field_value {
uint32_t field_number;
uint32_t field_name_len;
char *field_name;
enum field_type field_type;
/* Collation ID for string comparison. */
uint32_t coll_id;
/* True if a key part can store NULLs. */
bool is_nullable;
};

struct schema_index_value {
Expand Down

0 comments on commit dc7523f

Please sign in to comment.