Skip to content

Commit e44a8ac

Browse files
Michael Ferompenick
authored andcommitted
fix: Correcting invalid type returned for tinyint
1 parent 7fe4611 commit e44a8ac

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

ext/php_cassandra_types.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ typedef enum {
117117
CASSANDRA_DECIMAL,
118118
CASSANDRA_FLOAT,
119119
CASSANDRA_VARINT,
120-
CASSANDRA_SMALLINT
120+
CASSANDRA_SMALLINT,
121+
CASSANDRA_TINYINT
121122
} cassandra_numeric_type;
122123

123124
PHP_CASSANDRA_BEGIN_OBJECT_TYPE(numeric)

ext/src/Cassandra/Tinyint.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ PHP_METHOD(Tinyint, __toString)
112112
/* {{{ Cassandra\Tinyint::type() */
113113
PHP_METHOD(Tinyint, type)
114114
{
115-
php5to7_zval type = php_cassandra_type_scalar(CASS_VALUE_TYPE_SMALL_INT TSRMLS_CC);
115+
php5to7_zval type = php_cassandra_type_scalar(CASS_VALUE_TYPE_TINY_INT TSRMLS_CC);
116116
RETURN_ZVAL(PHP5TO7_ZVAL_MAYBE_P(type), 1, 1);
117117
}
118118
/* }}} */
@@ -420,7 +420,7 @@ php_cassandra_tinyint_properties(zval *object TSRMLS_DC)
420420
cassandra_numeric *self = PHP_CASSANDRA_GET_NUMERIC(object);
421421
HashTable *props = zend_std_get_properties(object TSRMLS_CC);
422422

423-
type = php_cassandra_type_scalar(CASS_VALUE_TYPE_SMALL_INT TSRMLS_CC);
423+
type = php_cassandra_type_scalar(CASS_VALUE_TYPE_TINY_INT TSRMLS_CC);
424424
PHP5TO7_ZEND_HASH_UPDATE(props, "type", sizeof("type"), PHP5TO7_ZVAL_MAYBE_P(type), sizeof(zval));
425425

426426
PHP5TO7_ZVAL_MAYBE_MAKE(value);
@@ -491,7 +491,7 @@ php_cassandra_tinyint_new(zend_class_entry *ce TSRMLS_DC)
491491
cassandra_numeric *self =
492492
PHP5TO7_ZEND_OBJECT_ECALLOC(numeric, ce);
493493

494-
self->type = CASSANDRA_SMALLINT;
494+
self->type = CASSANDRA_TINYINT;
495495

496496
PHP5TO7_ZEND_OBJECT_INIT_EX(numeric, tinyint, self, ce);
497497
}

0 commit comments

Comments
 (0)