Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0 - value integers(or numbers) read as null issue resolved #45

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

andreizet
Copy link
Contributor

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!

If data type is bigint, then read it as 64 bits item not as var int.
Fixed indentation;
Fixed indentation;
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.
@andreizet andreizet changed the title Resolved negative bigint issue 0 - value integers(or numbers) read as null issue resolved Nov 11, 2014
@steambao
Copy link

Can't wait for this fix! Tested and fixes all my 'unpack(): Type l: not enough input' when selecting nulls.

@evseevnn-zz evseevnn-zz self-assigned this Nov 19, 2014
@evseevnn-zz
Copy link
Owner

I will do this tonight

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants