0 - value integers(or numbers) read as null issue resolved #45
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If in an int column (for example) a null value was inserted, that value
was read as null which was not correct.
If there were more columns after that one, everything was read as null,
even if values were actually there.
This issue happened for all types of numbers.
Follow this example to reproduce this issue:
------START------
------Create this table: ------
CREATE TABLE null_table_example(
id int,
col_str text,
col_int1 int,
col_int 2 bigint,
PRIMARY KEY (col_str)
);
------Run this insert: ------
insert into null_table_example (id, col_str, col_int1, col_int2) values (1, 'test1', null, 19);
------Run this query from php: ------
select * from null_table_example where col_str = 'test1';
------END------
It will return good values for "id" and "col_str" but "col_int1" and "col_int2" will be null even if there are numbers; Executing this query from DataStax or DBeaver will return the correct values (0 for "col_int1" and 19 for "col_int2");
I've added a method that returns a sake value for null items depending of the data type.
Also, when a null was read, the size of it's byte value was -1, thing that leaded into putting all the rest of the columns after the null one into that one until it was converter from bytes and it becomed null, see my commit of DataStream.php;
Thanks!