PHP_METHOD(swoole_table, column) { char *name; zend_size_t len; long type; long size = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|l", &name, &len, &type, &size) == FAILURE) { RETURN_FALSE; } if (type == SW_TABLE_STRING && size < 1) { swoole_php_fatal_error(E_WARNING, "string length must be more than 0."); RETURN_FALSE; } //default int32 if (type == SW_TABLE_INT && size < 1) { size = 4; } swTable *table = swoole_get_object(getThis()); if (table->memory) { swoole_php_fatal_error(E_WARNING, "Must be used before create table."); RETURN_FALSE; } swTableColumn_add(table, name, len, type, size); RETURN_TRUE; }
PHP_METHOD(swoole_table, column) { char *name; zend_size_t len; long type; long size; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ll", &name, &len, &type, &size) == FAILURE) { RETURN_FALSE; } if (type == SW_TABLE_STRING && size < 1) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "string length must be more than 0."); RETURN_FALSE; } swTable *table = swoole_get_object(getThis()); swTableColumn_add(table, name, len, type, size); RETURN_TRUE; }