diff options
Diffstat (limited to 'ext/sqlite3/sqlite3.c')
-rw-r--r-- | ext/sqlite3/sqlite3.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c index a80159e7a8..2aef0414aa 100644 --- a/ext/sqlite3/sqlite3.c +++ b/ext/sqlite3/sqlite3.c @@ -103,7 +103,7 @@ PHP_METHOD(sqlite3, open) db_obj = (php_sqlite3_db_object *)zend_object_store_get_object(object TSRMLS_CC); zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC); - if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls", &filename, &filename_len, &flags, &encryption_key, &encryption_key_len)) { + if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|ls", &filename, &filename_len, &flags, &encryption_key, &encryption_key_len)) { zend_restore_error_handling(&error_handling TSRMLS_CC); return; } @@ -730,7 +730,11 @@ static int sqlite3_do_callback(struct php_sqlite3_fci *fc, zval *cb, int argc, s switch (sqlite3_value_type(argv[i])) { case SQLITE_INTEGER: +#if LONG_MAX > 2147483647 + ZVAL_LONG(*zargs[i + is_agg], sqlite3_value_int64(argv[i])); +#else ZVAL_LONG(*zargs[i + is_agg], sqlite3_value_int(argv[i])); +#endif break; case SQLITE_FLOAT: @@ -774,7 +778,11 @@ static int sqlite3_do_callback(struct php_sqlite3_fci *fc, zval *cb, int argc, s if (retval) { switch (Z_TYPE_P(retval)) { case IS_LONG: +#if LONG_MAX > 2147483647 + sqlite3_result_int64(context, Z_LVAL_P(retval)); +#else sqlite3_result_int(context, Z_LVAL_P(retval)); +#endif break; case IS_NULL: @@ -1097,7 +1105,7 @@ static int php_sqlite3_stream_close(php_stream *stream, int close_handle TSRMLS_ php_stream_sqlite3_data *sqlite3_stream = (php_stream_sqlite3_data *) stream->abstract; if (sqlite3_blob_close(sqlite3_stream->blob) != SQLITE_OK) { - /* Error occured, but it still closed */ + /* Error occurred, but it still closed */ } efree(sqlite3_stream); @@ -1401,7 +1409,7 @@ static int register_bound_parameter_to_sqlite(struct php_sqlite3_bound_param *pa /* }}} */ /* {{{ proto bool SQLite3Stmt::bindParam(int parameter_number, mixed parameter [, int type]) - Bind Paramater to a stmt variable. */ + Bind Parameter to a stmt variable. */ PHP_METHOD(sqlite3stmt, bindParam) { php_sqlite3_stmt *stmt_obj; @@ -1493,7 +1501,11 @@ PHP_METHOD(sqlite3stmt, execute) switch (param->type) { case SQLITE_INTEGER: convert_to_long(param->parameter); +#if LONG_MAX > 2147483647 + sqlite3_bind_int64(stmt_obj->stmt, param->param_number, Z_LVAL_P(param->parameter)); +#else sqlite3_bind_int(stmt_obj->stmt, param->param_number, Z_LVAL_P(param->parameter)); +#endif break; case SQLITE_FLOAT: @@ -2121,7 +2133,6 @@ static void php_sqlite3_result_object_free_storage(void *object TSRMLS_DC) /* {{ static zend_object_value php_sqlite3_object_new(zend_class_entry *class_type TSRMLS_DC) /* {{{ */ { - zval *tmp; zend_object_value retval; php_sqlite3_db_object *intern; @@ -2134,7 +2145,7 @@ static zend_object_value php_sqlite3_object_new(zend_class_entry *class_type TSR zend_llist_init(&(intern->free_list), sizeof(php_sqlite3_free_list *), (llist_dtor_func_t)php_sqlite3_free_list_dtor, 0); zend_object_std_init(&intern->zo, class_type TSRMLS_CC); - zend_hash_copy(intern->zo.properties, &class_type->default_properties, (copy_ctor_func_t) zval_property_ctor,(void *) &tmp, sizeof(zval *)); + object_properties_init(&intern->zo, class_type); retval.handle = zend_objects_store_put(intern, NULL, (zend_objects_free_object_storage_t) php_sqlite3_object_free_storage, NULL TSRMLS_CC); retval.handlers = (zend_object_handlers *) &sqlite3_object_handlers; @@ -2145,7 +2156,6 @@ static zend_object_value php_sqlite3_object_new(zend_class_entry *class_type TSR static zend_object_value php_sqlite3_stmt_object_new(zend_class_entry *class_type TSRMLS_DC) /* {{{ */ { - zval *tmp; zend_object_value retval; php_sqlite3_stmt *intern; @@ -2156,7 +2166,7 @@ static zend_object_value php_sqlite3_stmt_object_new(zend_class_entry *class_typ intern->db_obj_zval = NULL; zend_object_std_init(&intern->zo, class_type TSRMLS_CC); - zend_hash_copy(intern->zo.properties, &class_type->default_properties, (copy_ctor_func_t) zval_property_ctor,(void *) &tmp, sizeof(zval *)); + object_properties_init(&intern->zo, class_type); retval.handle = zend_objects_store_put(intern, NULL, (zend_objects_free_object_storage_t) php_sqlite3_stmt_object_free_storage, NULL TSRMLS_CC); retval.handlers = (zend_object_handlers *) &sqlite3_stmt_object_handlers; @@ -2167,7 +2177,6 @@ static zend_object_value php_sqlite3_stmt_object_new(zend_class_entry *class_typ static zend_object_value php_sqlite3_result_object_new(zend_class_entry *class_type TSRMLS_DC) /* {{{ */ { - zval *tmp; zend_object_value retval; php_sqlite3_result *intern; @@ -2180,7 +2189,7 @@ static zend_object_value php_sqlite3_result_object_new(zend_class_entry *class_t intern->stmt_obj_zval = NULL; zend_object_std_init(&intern->zo, class_type TSRMLS_CC); - zend_hash_copy(intern->zo.properties, &class_type->default_properties, (copy_ctor_func_t) zval_property_ctor,(void *) &tmp, sizeof(zval *)); + object_properties_init(&intern->zo, class_type); retval.handle = zend_objects_store_put(intern, NULL, (zend_objects_free_object_storage_t) php_sqlite3_result_object_free_storage, NULL TSRMLS_CC); retval.handlers = (zend_object_handlers *) &sqlite3_result_object_handlers; |