From b7933faeb868387954b5a4cd308fefeed5f8a01c Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Thu, 8 Dec 2016 18:07:56 +0100 Subject: php-pecl-mysql-xdevapi: 1.0.0 (alpha) New package --- Makefile | 4 + REFLECTION | 1956 +++++++++++++++++++++++++++++++++++++++++++ mysql_xdevapi-build.patch | 29 + php-pecl-mysql-xdevapi.spec | 316 +++++++ php_json.h | 114 +++ php_json_parser.h | 87 ++ php_json_scanner.h | 47 ++ 7 files changed, 2553 insertions(+) create mode 100644 Makefile create mode 100644 REFLECTION create mode 100644 mysql_xdevapi-build.patch create mode 100644 php-pecl-mysql-xdevapi.spec create mode 100644 php_json.h create mode 100644 php_json_parser.h create mode 100644 php_json_scanner.h diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..13af741 --- /dev/null +++ b/Makefile @@ -0,0 +1,4 @@ +SRCDIR := $(shell pwd) +NAME := $(shell basename $(SRCDIR)) +include ../../../common/Makefile + diff --git a/REFLECTION b/REFLECTION new file mode 100644 index 0000000..3531c0d --- /dev/null +++ b/REFLECTION @@ -0,0 +1,1956 @@ +Extension [ extension #61 mysql_xdevapi version 1.0.0 ] { + + - Dependencies { + Dependency [ standard (Required) ] + Dependency [ mysqlnd (Required) ] + Dependency [ json (Required) ] + } + + - INI { + Entry [ xmysqlnd.collect_statistics ] + Current = '1' + } + Entry [ xmysqlnd.collect_memory_statistics ] + Current = '0' + } + Entry [ xmysqlnd.debug ] + Current = '' + } + Entry [ xmysqlnd.trace_alloc ] + Current = '' + } + Entry [ xmysqlnd.net_read_timeout ] + Current = '31536000' + } + Entry [ xmysqlnd.mempool_default_size ] + Current = '16000' + } + } + + - Constants [1] { + Constant [ integer XMYSQLND_CLIENT_SSL ] { 2048 } + } + + - Functions { + Function [ function mysql_xdevapi\getSession ] { + + - Parameters [4] { + Parameter #0 [ string $hostname ] + Parameter #1 [ string $username ] + Parameter #2 [ string $password ] + Parameter #3 [ integer $port ] + } + } + Function [ function mysql_xdevapi\getNodeSession ] { + + - Parameters [4] { + Parameter #0 [ string $hostname ] + Parameter #1 [ string $username ] + Parameter #2 [ string $password ] + Parameter #3 [ integer $port ] + } + } + Function [ function mysql_xdevapi\expression ] { + + - Parameters [1] { + Parameter #0 [ string $expression ] + } + } + } + + - Classes [35] { + Interface [ interface mysql_xdevapi\DatabaseObject ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [3] { + Method [ abstract public method getSession ] { + + - Parameters [0] { + } + } + + Method [ abstract public method getName ] { + + - Parameters [0] { + } + } + + Method [ abstract public method existsInDatabase ] { + + - Parameters [0] { + } + } + } + } + + Interface [ interface mysql_xdevapi\Executable ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [1] { + Method [ abstract public method execute ] { + + - Parameters [0] { + } + } + } + } + + Interface [ interface mysql_xdevapi\SchemaObject extends mysql_xdevapi\DatabaseObject ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [4] { + Method [ abstract public method getSchema ] { + + - Parameters [0] { + } + } + + Method [ abstract public method getSession ] { + + - Parameters [0] { + } + } + + Method [ abstract public method getName ] { + + - Parameters [0] { + } + } + + Method [ abstract public method existsInDatabase ] { + + - Parameters [0] { + } + } + } + } + + Interface [ interface mysql_xdevapi\Session ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [5] { + Method [ abstract public method getSchemas ] { + + - Parameters [0] { + } + } + + Method [ abstract public method getSchema ] { + + - Parameters [0] { + } + } + + Method [ abstract public method createSchema ] { + + - Parameters [0] { + } + } + + Method [ abstract public method dropSchema ] { + + - Parameters [0] { + } + } + + Method [ abstract public method close ] { + + - Parameters [0] { + } + } + } + } + + Interface [ interface mysql_xdevapi\CrudOperationBindable ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [1] { + Method [ abstract public method bind ] { + + - Parameters [1] { + Parameter #0 [ array $placeholder_values ] + } + } + } + } + + Interface [ interface mysql_xdevapi\CrudOperationLimitable ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [1] { + Method [ abstract public method limit ] { + + - Parameters [1] { + Parameter #0 [ integer $rows ] + } + } + } + } + + Interface [ interface mysql_xdevapi\CrudOperationSkippable ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [1] { + Method [ abstract public method skip ] { + + - Parameters [1] { + Parameter #0 [ integer $skip ] + } + } + } + } + + Interface [ interface mysql_xdevapi\CrudOperationSortable ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [1] { + Method [ abstract public method sort ] { + + - Parameters [1] { + Parameter #0 [ $sort_expr ] + } + } + } + } + + Class [ class mysql_xdevapi\Warning ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [3] { + Property [ public $message ] + Property [ public $level ] + Property [ public $code ] + } + + - Methods [1] { + Method [ private method __construct ] { + } + } + } + + Class [ class mysql_xdevapi\Exception extends RuntimeException implements Throwable ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [4] { + Property [ protected $message ] + Property [ protected $code ] + Property [ protected $file ] + Property [ protected $line ] + } + + - Methods [10] { + Method [ public method __construct ] { + + - Parameters [3] { + Parameter #0 [ $message ] + Parameter #1 [ $code ] + Parameter #2 [ $previous ] + } + } + + Method [ public method __wakeup ] { + } + + Method [ final public method getMessage ] { + } + + Method [ final public method getCode ] { + } + + Method [ final public method getFile ] { + } + + Method [ final public method getLine ] { + } + + Method [ final public method getTrace ] { + } + + Method [ final public method getPrevious ] { + } + + Method [ final public method getTraceAsString ] { + } + + Method [ public method __toString ] { + } + } + } + + Class [ class mysql_xdevapi\ExecutionStatus ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [5] { + Property [ public $affectedItems ] + Property [ public $matchedItems ] + Property [ public $foundItems ] + Property [ public $lastInsertId ] + Property [ public $lastDocumentId ] + } + + - Methods [1] { + Method [ private method __construct ] { + } + } + } + + Class [ class mysql_xdevapi\Expression ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [1] { + Property [ public $name ] + } + + - Methods [1] { + Method [ public method __construct ] { + + - Parameters [1] { + Parameter #0 [ string $expression ] + } + } + } + } + + Class [ class mysql_xdevapi\FieldMetadata ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [13] { + Property [ public $type ] + Property [ public $type_name ] + Property [ public $name ] + Property [ public $original_name ] + Property [ public $table ] + Property [ public $original_table ] + Property [ public $schema ] + Property [ public $catalog ] + Property [ public $collation ] + Property [ public $fractional_digits ] + Property [ public $length ] + Property [ public $flags ] + Property [ public $content_type ] + } + + - Methods [1] { + Method [ private method __construct ] { + } + } + } + + Class [ final class mysql_xdevapi\Driver ] { + + - Constants [1] { + Constant [ public string version ] { 1.0.0 } + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [1] { + Method [ private method __construct ] { + } + } + } + + Class [ class mysql_xdevapi\BaseSession implements mysql_xdevapi\Session ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [17] { + Method [ private method __construct ] { + } + + Method [ public method getServerVersion ] { + + - Parameters [0] { + } + } + + Method [ public method getClientId ] { + + - Parameters [0] { + } + } + + Method [ public method generateUUID ] { + + - Parameters [0] { + } + } + + Method [ public method quoteName ] { + + - Parameters [1] { + Parameter #0 [ string $name ] + } + } + + Method [ public method getSchemas ] { + + - Parameters [0] { + } + } + + Method [ public method getSchema ] { + + - Parameters [0] { + } + } + + Method [ public method createSchema ] { + + - Parameters [0] { + } + } + + Method [ public method dropSchema ] { + + - Parameters [0] { + } + } + + Method [ public method dropCollection ] { + + - Parameters [2] { + Parameter #0 [ string $schema_name ] + Parameter #1 [ string $collection_name ] + } + } + + Method [ public method dropTable ] { + + - Parameters [2] { + Parameter #0 [ string $schema_name ] + Parameter #1 [ string $table_name ] + } + } + + Method [ public method startTransaction ] { + + - Parameters [0] { + } + } + + Method [ public method commit ] { + + - Parameters [0] { + } + } + + Method [ public method rollback ] { + + - Parameters [0] { + } + } + + Method [ public method listClients ] { + + - Parameters [0] { + } + } + + Method [ public method killClient ] { + + - Parameters [1] { + Parameter #0 [ integer $client_id ] + } + } + + Method [ public method close ] { + + - Parameters [0] { + } + } + } + } + + Class [ class mysql_xdevapi\XSession extends mysql_xdevapi\BaseSession implements mysql_xdevapi\Session ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [17] { + Method [ private method __construct ] { + } + + Method [ public method getServerVersion ] { + + - Parameters [0] { + } + } + + Method [ public method getClientId ] { + + - Parameters [0] { + } + } + + Method [ public method generateUUID ] { + + - Parameters [0] { + } + } + + Method [ public method quoteName ] { + + - Parameters [1] { + Parameter #0 [ string $name ] + } + } + + Method [ public method getSchemas ] { + + - Parameters [0] { + } + } + + Method [ public method getSchema ] { + + - Parameters [0] { + } + } + + Method [ public method createSchema ] { + + - Parameters [0] { + } + } + + Method [ public method dropSchema ] { + + - Parameters [0] { + } + } + + Method [ public method dropCollection ] { + + - Parameters [2] { + Parameter #0 [ string $schema_name ] + Parameter #1 [ string $collection_name ] + } + } + + Method [ public method dropTable ] { + + - Parameters [2] { + Parameter #0 [ string $schema_name ] + Parameter #1 [ string $table_name ] + } + } + + Method [ public method startTransaction ] { + + - Parameters [0] { + } + } + + Method [ public method commit ] { + + - Parameters [0] { + } + } + + Method [ public method rollback ] { + + - Parameters [0] { + } + } + + Method [ public method listClients ] { + + - Parameters [0] { + } + } + + Method [ public method killClient ] { + + - Parameters [1] { + Parameter #0 [ integer $client_id ] + } + } + + Method [ public method close ] { + + - Parameters [0] { + } + } + } + } + + Class [ class mysql_xdevapi\NodeSession extends mysql_xdevapi\BaseSession implements mysql_xdevapi\Session ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [19] { + Method [ private method __construct ] { + } + + Method [ public method executeSql ] { + } + + Method [ public method sql ] { + + - Parameters [1] { + Parameter #0 [ string $query ] + } + } + + Method [ public method quoteName ] { + + - Parameters [1] { + Parameter #0 [ string $name ] + } + } + + Method [ public method getServerVersion ] { + + - Parameters [0] { + } + } + + Method [ public method getClientId ] { + + - Parameters [0] { + } + } + + Method [ public method generateUUID ] { + + - Parameters [0] { + } + } + + Method [ public method getSchemas ] { + + - Parameters [0] { + } + } + + Method [ public method getSchema ] { + + - Parameters [0] { + } + } + + Method [ public method createSchema ] { + + - Parameters [0] { + } + } + + Method [ public method dropSchema ] { + + - Parameters [0] { + } + } + + Method [ public method dropCollection ] { + + - Parameters [2] { + Parameter #0 [ string $schema_name ] + Parameter #1 [ string $collection_name ] + } + } + + Method [ public method dropTable ] { + + - Parameters [2] { + Parameter #0 [ string $schema_name ] + Parameter #1 [ string $table_name ] + } + } + + Method [ public method startTransaction ] { + + - Parameters [0] { + } + } + + Method [ public method commit ] { + + - Parameters [0] { + } + } + + Method [ public method rollback ] { + + - Parameters [0] { + } + } + + Method [ public method listClients ] { + + - Parameters [0] { + } + } + + Method [ public method killClient ] { + + - Parameters [1] { + Parameter #0 [ integer $client_id ] + } + } + + Method [ public method close ] { + + - Parameters [0] { + } + } + } + } + + Class [ class mysql_xdevapi\NodeSchema implements mysql_xdevapi\DatabaseObject ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [1] { + Property [ public $name ] + } + + - Methods [11] { + Method [ private method __construct ] { + } + + Method [ public method getSession ] { + + - Parameters [0] { + } + } + + Method [ public method getName ] { + + - Parameters [0] { + } + } + + Method [ public method existsInDatabase ] { + + - Parameters [0] { + } + } + + Method [ public method drop ] { + + - Parameters [0] { + } + } + + Method [ public method createCollection ] { + + - Parameters [1] { + Parameter #0 [ string $name ] + } + } + + Method [ public method getCollection ] { + + - Parameters [1] { + Parameter #0 [ string $name ] + } + } + + Method [ public method getCollections ] { + + - Parameters [0] { + } + } + + Method [ public method getTable ] { + + - Parameters [1] { + Parameter #0 [ string $name ] + } + } + + Method [ public method getTables ] { + + - Parameters [0] { + } + } + + Method [ public method getCollectionAsTable ] { + + - Parameters [0] { + } + } + } + } + + Class [ class mysql_xdevapi\NodeCollection implements mysql_xdevapi\SchemaObject, mysql_xdevapi\DatabaseObject ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [1] { + Property [ public $name ] + } + + - Methods [10] { + Method [ private method __construct ] { + } + + Method [ public method getSession ] { + + - Parameters [0] { + } + } + + Method [ public method getName ] { + + - Parameters [0] { + } + } + + Method [ public method existsInDatabase ] { + + - Parameters [0] { + } + } + + Method [ public method count ] { + + - Parameters [0] { + } + } + + Method [ public method getSchema ] { + + - Parameters [0] { + } + } + + Method [ public method add ] { + + - Parameters [1] { + Parameter #0 [ $json ] + } + } + + Method [ public method find ] { + + - Parameters [1] { + Parameter #0 [ string $search_condition ] + } + } + + Method [ public method modify ] { + + - Parameters [1] { + Parameter #0 [ string $search_condition ] + } + } + + Method [ public method remove ] { + + - Parameters [1] { + Parameter #0 [ string $search_condition ] + } + } + } + } + + Class [ class mysql_xdevapi\NodeCollectionAdd implements mysql_xdevapi\Executable ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [2] { + Method [ private method __construct ] { + } + + Method [ public method execute ] { + + - Parameters [0] { + } + } + } + } + + Class [ class mysql_xdevapi\NodeCollectionFind implements mysql_xdevapi\Executable, mysql_xdevapi\CrudOperationBindable, mysql_xdevapi\CrudOperationLimitable, mysql_xdevapi\CrudOperationSkippable, mysql_xdevapi\CrudOperationSortable ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [8] { + Method [ private method __construct ] { + } + + Method [ public method fields ] { + + - Parameters [1] { + Parameter #0 [ $projection ] + } + } + + Method [ public method groupBy ] { + + - Parameters [1] { + Parameter #0 [ $sort_expr ] + } + } + + Method [ public method bind ] { + + - Parameters [1] { + Parameter #0 [ array $placeholder_values ] + } + } + + Method [ public method sort ] { + + - Parameters [1] { + Parameter #0 [ $sort_expr ] + } + } + + Method [ public method limit ] { + + - Parameters [1] { + Parameter #0 [ integer $rows ] + } + } + + Method [ public method skip ] { + + - Parameters [1] { + Parameter #0 [ integer $position ] + } + } + + Method [ public method execute ] { + + - Parameters [0] { + } + } + } + } + + Class [ class mysql_xdevapi\NodeCollectionModify implements mysql_xdevapi\Executable, mysql_xdevapi\CrudOperationBindable, mysql_xdevapi\CrudOperationLimitable, mysql_xdevapi\CrudOperationSkippable, mysql_xdevapi\CrudOperationSortable ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [13] { + Method [ private method __construct ] { + } + + Method [ public method bind ] { + + - Parameters [1] { + Parameter #0 [ array $placeholder_values ] + } + } + + Method [ public method sort ] { + + - Parameters [1] { + Parameter #0 [ $sort_expr ] + } + } + + Method [ public method limit ] { + + - Parameters [1] { + Parameter #0 [ integer $rows ] + } + } + + Method [ public method skip ] { + + - Parameters [1] { + Parameter #0 [ integer $position ] + } + } + + Method [ public method set ] { + + - Parameters [2] { + Parameter #0 [ string $collection_field ] + Parameter #1 [ $expression_or_literal ] + } + } + + Method [ public method unset ] { + + - Parameters [1] { + Parameter #0 [ array $variables ] + } + } + + Method [ public method replace ] { + + - Parameters [2] { + Parameter #0 [ string $collection_field ] + Parameter #1 [ $expression_or_literal ] + } + } + + Method [ public method merge ] { + + - Parameters [1] { + Parameter #0 [ string $document ] + } + } + + Method [ public method arrayInsert ] { + + - Parameters [2] { + Parameter #0 [ string $collection_field ] + Parameter #1 [ $expression_or_literal ] + } + } + + Method [ public method arrayAppend ] { + + - Parameters [2] { + Parameter #0 [ string $collection_field ] + Parameter #1 [ $expression_or_literal ] + } + } + + Method [ public method arrayDelete ] { + + - Parameters [1] { + Parameter #0 [ string $collection_field ] + } + } + + Method [ public method execute ] { + + - Parameters [0] { + } + } + } + } + + Class [ class mysql_xdevapi\NodeCollectionRemove implements mysql_xdevapi\Executable, mysql_xdevapi\CrudOperationBindable, mysql_xdevapi\CrudOperationLimitable, mysql_xdevapi\CrudOperationSortable ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [5] { + Method [ private method __construct ] { + } + + Method [ public method bind ] { + + - Parameters [1] { + Parameter #0 [ array $placeholder_values ] + } + } + + Method [ public method sort ] { + + - Parameters [1] { + Parameter #0 [ $sort_expr ] + } + } + + Method [ public method limit ] { + + - Parameters [1] { + Parameter #0 [ integer $rows ] + } + } + + Method [ public method execute ] { + + - Parameters [0] { + } + } + } + } + + Class [ class mysql_xdevapi\NodeStatement ] { + + - Constants [2] { + Constant [ public integer EXECUTE_ASYNC ] { 1 } + Constant [ public integer BUFFERED ] { 2 } + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [4] { + Method [ private method __construct ] { + } + + Method [ public method hasMoreResults ] { + + - Parameters [0] { + } + } + + Method [ public method getResult ] { + + - Parameters [0] { + } + } + + Method [ public method getNextResult ] { + + - Parameters [0] { + } + } + } + } + + Class [ class mysql_xdevapi\NodeSqlStatement ] { + + - Constants [2] { + Constant [ public integer EXECUTE_ASYNC ] { 1 } + Constant [ public integer BUFFERED ] { 2 } + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [1] { + Property [ public $statement ] + } + + - Methods [6] { + Method [ private method __construct ] { + } + + Method [ public method bind ] { + + - Parameters [1] { + Parameter #0 [ $param ] + } + } + + Method [ public method execute ] { + } + + Method [ public method hasMoreResults ] { + + - Parameters [0] { + } + } + + Method [ public method getResult ] { + + - Parameters [0] { + } + } + + Method [ public method getNextResult ] { + + - Parameters [0] { + } + } + } + } + + Interface [ interface mysql_xdevapi\NodeBaseResult ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [2] { + Method [ abstract public method getWarningCount ] { + + - Parameters [0] { + } + } + + Method [ abstract public method getWarnings ] { + + - Parameters [0] { + } + } + } + } + + Class [ class mysql_xdevapi\NodeDocResult implements mysql_xdevapi\NodeBaseResult, Traversable ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [5] { + Method [ private method __construct ] { + } + + Method [ public method fetchOne ] { + + - Parameters [0] { + } + } + + Method [ public method fetchAll ] { + + - Parameters [0] { + } + } + + Method [ public method getWarningCount ] { + + - Parameters [0] { + } + } + + Method [ public method getWarnings ] { + + - Parameters [0] { + } + } + } + } + + Class [ class mysql_xdevapi\NodeResult implements mysql_xdevapi\NodeBaseResult, Traversable ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [7] { + Method [ private method __construct ] { + } + + Method [ public method getAffectedItemsCount ] { + + - Parameters [0] { + } + } + + Method [ public method getAutoIncrementValue ] { + + - Parameters [0] { + } + } + + Method [ public method getDocumentId ] { + + - Parameters [0] { + } + } + + Method [ public method getDocumentIds ] { + + - Parameters [0] { + } + } + + Method [ public method getWarningCount ] { + + - Parameters [0] { + } + } + + Method [ public method getWarnings ] { + + - Parameters [0] { + } + } + } + } + + Class [ class mysql_xdevapi\NodeRowResult implements mysql_xdevapi\NodeBaseResult, Traversable ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [8] { + Method [ private method __construct ] { + } + + Method [ public method fetchOne ] { + + - Parameters [0] { + } + } + + Method [ public method fetchAll ] { + + - Parameters [0] { + } + } + + Method [ public method getWarningCount ] { + + - Parameters [0] { + } + } + + Method [ public method getWarnings ] { + + - Parameters [0] { + } + } + + Method [ public method getColumnCount ] { + + - Parameters [0] { + } + } + + Method [ public method getColumnNames ] { + + - Parameters [0] { + } + } + + Method [ public method getColumns ] { + + - Parameters [0] { + } + } + } + } + + Class [ class mysql_xdevapi\NodeSqlStatementResult implements mysql_xdevapi\NodeBaseResult, Traversable ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [13] { + Method [ private method __construct ] { + } + + Method [ public method hasData ] { + + - Parameters [0] { + } + } + + Method [ public method fetchOne ] { + + - Parameters [0] { + } + } + + Method [ public method fetchAll ] { + + - Parameters [0] { + } + } + + Method [ public method getAffectedItemsCount ] { + + - Parameters [0] { + } + } + + Method [ public method getLastInsertId ] { + + - Parameters [0] { + } + } + + Method [ public method getDocumentId ] { + + - Parameters [0] { + } + } + + Method [ public method getWarningCount ] { + + - Parameters [0] { + } + } + + Method [ public method getWarnings ] { + + - Parameters [0] { + } + } + + Method [ public method getColumnCount ] { + + - Parameters [0] { + } + } + + Method [ public method getColumnNames ] { + + - Parameters [0] { + } + } + + Method [ public method getColumns ] { + + - Parameters [0] { + } + } + + Method [ public method nextResult ] { + + - Parameters [0] { + } + } + } + } + + Class [ class mysql_xdevapi\NodeTable implements mysql_xdevapi\SchemaObject, mysql_xdevapi\DatabaseObject ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [1] { + Property [ public $name ] + } + + - Methods [10] { + Method [ private method __construct ] { + } + + Method [ public method getSession ] { + + - Parameters [0] { + } + } + + Method [ public method getName ] { + + - Parameters [0] { + } + } + + Method [ public method existsInDatabase ] { + + - Parameters [0] { + } + } + + Method [ public method count ] { + + - Parameters [0] { + } + } + + Method [ public method getSchema ] { + + - Parameters [0] { + } + } + + Method [ public method insert ] { + + - Parameters [0] { + } + } + + Method [ public method select ] { + + - Parameters [0] { + } + } + + Method [ public method update ] { + + - Parameters [0] { + } + } + + Method [ public method delete ] { + + - Parameters [0] { + } + } + } + } + + Class [ class mysql_xdevapi\NodeTableDelete implements mysql_xdevapi\Executable ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [7] { + Method [ private method __construct ] { + } + + Method [ public method where ] { + + - Parameters [1] { + Parameter #0 [ $where_expr ] + } + } + + Method [ public method orderby ] { + + - Parameters [1] { + Parameter #0 [ $orderby_expr ] + } + } + + Method [ public method limit ] { + + - Parameters [1] { + Parameter #0 [ integer $rows ] + } + } + + Method [ public method offset ] { + + - Parameters [1] { + Parameter #0 [ integer $position ] + } + } + + Method [ public method bind ] { + + - Parameters [1] { + Parameter #0 [ array $placeholder_values ] + } + } + + Method [ public method execute ] { + + - Parameters [0] { + } + } + } + } + + Class [ class mysql_xdevapi\NodeTableInsert implements mysql_xdevapi\Executable ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [3] { + Method [ private method __construct ] { + } + + Method [ public method values ] { + + - Parameters [1] { + Parameter #0 [ array $row_values ] + } + } + + Method [ public method execute ] { + + - Parameters [0] { + } + } + } + } + + Class [ class mysql_xdevapi\NodeTableSelect implements mysql_xdevapi\Executable ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [9] { + Method [ private method __construct ] { + } + + Method [ public method where ] { + + - Parameters [1] { + Parameter #0 [ $projection ] + } + } + + Method [ public method groupBy ] { + + - Parameters [1] { + Parameter #0 [ $sort_expr ] + } + } + + Method [ public method having ] { + + - Parameters [1] { + Parameter #0 [ $sort_expr ] + } + } + + Method [ public method bind ] { + + - Parameters [1] { + Parameter #0 [ array $placeholder_values ] + } + } + + Method [ public method orderby ] { + + - Parameters [1] { + Parameter #0 [ $sort_expr ] + } + } + + Method [ public method limit ] { + + - Parameters [1] { + Parameter #0 [ integer $rows ] + } + } + + Method [ public method offset ] { + + - Parameters [1] { + Parameter #0 [ integer $position ] + } + } + + Method [ public method execute ] { + + - Parameters [0] { + } + } + } + } + + Class [ class mysql_xdevapi\NodeTableUpdate implements mysql_xdevapi\Executable ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [7] { + Method [ private method __construct ] { + } + + Method [ public method set ] { + + - Parameters [2] { + Parameter #0 [ string $table_field ] + Parameter #1 [ $expression_or_literal ] + } + } + + Method [ public method where ] { + + - Parameters [1] { + Parameter #0 [ $where_expr ] + } + } + + Method [ public method orderby ] { + + - Parameters [1] { + Parameter #0 [ $orderby_expr ] + } + } + + Method [ public method limit ] { + + - Parameters [1] { + Parameter #0 [ integer $rows ] + } + } + + Method [ public method bind ] { + + - Parameters [1] { + Parameter #0 [ array $placeholder_values ] + } + } + + Method [ public method execute ] { + + - Parameters [0] { + } + } + } + } + } +} + diff --git a/mysql_xdevapi-build.patch b/mysql_xdevapi-build.patch new file mode 100644 index 0000000..c5547ae --- /dev/null +++ b/mysql_xdevapi-build.patch @@ -0,0 +1,29 @@ +diff -up mysql_xdevapi-1.0.0/config.m4.old mysql_xdevapi-1.0.0/config.m4 +--- mysql_xdevapi-1.0.0/config.m4.old 2016-12-08 16:59:44.000000000 +0100 ++++ mysql_xdevapi-1.0.0/config.m4 2016-12-08 17:01:29.000000000 +0100 +@@ -170,15 +170,8 @@ if test "$PHP_MYSQL_XDEVAPI" != "no" || + + + AC_DEFINE([MYSQL_XDEVAPI_SSL_SUPPORTED], 1, [Enable core xmysqlnd SSL code]) ++ AC_DEFINE(MYSQL_XDEVAPI_HAVE_SSL,1,[Enable mysql_xdevapi code that uses OpenSSL directly]) + +- test -z "$PHP_OPENSSL" && PHP_OPENSSL=no +- +- if test "$PHP_OPENSSL" != "no" || test "$PHP_OPENSSL_DIR" != "no"; then +- AC_CHECK_LIB(ssl, DSA_get_default_method, AC_DEFINE(HAVE_DSA_DEFAULT_METHOD, 1, [OpenSSL 0.9.7 or later])) +- AC_CHECK_LIB(crypto, X509_free, AC_DEFINE(HAVE_DSA_DEFAULT_METHOD, 1, [OpenSSL 0.9.7 or later])) +- +- PHP_SETUP_OPENSSL(MYSQL_XDEVAPI_SHARED_LIBADD, [AC_DEFINE(MYSQL_XDEVAPI_HAVE_SSL,1,[Enable mysql_xdevapi code that uses OpenSSL directly])]) +- fi + + if test "$PHP_MYSQLND" != "yes" && test "$PHP_MYSQLND_ENABLED" != "yes" && test "$PHP_MYSQLI" != "yes" && test "$PHP_MYSQLI" != "mysqlnd"; then + dnl Enable mysqlnd build in case it wasn't passed explicitly in cmd-line +@@ -194,8 +187,6 @@ if test "$PHP_MYSQL_XDEVAPI" != "no" || + + PHP_SUBST(MYSQL_XDEVAPI_SHARED_LIBADD) + +- PHP_ADD_BUILD_DIR($ext_builddir/messages) +- PHP_ADD_BUILD_DIR($ext_builddir/proto_gen) + + this_ext_sources="$xmysqlnd_protobuf_sources $xmysqlnd_expr_parser $xmysqlnd_sources $mysqlx_base_sources $mysqlx_messages" + PHP_NEW_EXTENSION(mysql_xdevapi, $this_ext_sources, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1) diff --git a/php-pecl-mysql-xdevapi.spec b/php-pecl-mysql-xdevapi.spec new file mode 100644 index 0000000..225387e --- /dev/null +++ b/php-pecl-mysql-xdevapi.spec @@ -0,0 +1,316 @@ +# remirepo spec file for php-pecl-mysql-xdevapi +# +# Copyright (c) 2016 Remi Collet +# License: CC-BY-SA +# http://creativecommons.org/licenses/by-sa/4.0/ +# +# Please, preserve the changelog entries +# +%if 0%{?scl:1} +%global sub_prefix %{scl_prefix} +%scl_package php-pecl-mysql-xdevapi +%endif + +%global with_zts 0%{!?_without_zts:%{?__ztsphp:1}} +%global pecl_name mysql_xdevapi +%global with_tests 0%{?_with_tests:1} +# After 20-json, 20-mysqlnd +%global ini_name 40-%{pecl_name}.ini + +Summary: MySQL database access functions +Name: %{?sub_prefix}php-pecl-mysql-xdevapi +Version: 1.0.0 +Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} + +License: PHP +Group: Development/Languages +URL: http://pecl.php.net/package/%{pecl_name} +Source0: http://pecl.php.net/get/%{pecl_name}-%{version}%{?prever}.tgz +# From 7.1.0 official archive +Source1: php_json.h +Source2: php_json_parser.h +Source3: php_json_scanner.h + +# Workaround for out-of-tree build +Patch0: %{pecl_name}-build.patch + +BuildRequires: %{?scl_prefix}php-devel > 7.1 +BuildRequires: %{?scl_prefix}php-mysqlnd +BuildRequires: %{?scl_prefix}php-json +BuildRequires: %{?scl_prefix}php-pear +BuildRequires: protobuf-devel +BuildRequires: protobuf-c-devel +BuildRequires: boost-devel +%if %{with_tests} +BuildRequires: community-mysql-server >= 5.7.12 +%endif + +Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api} +Requires: %{?scl_prefix}php(api) = %{php_core_api} +Requires: %{?scl_prefix}php-mysqlnd%{?_isa} +Requires: %{?scl_prefix}php-json%{?_isa} +%{?_sclreq:Requires: %{?scl_prefix}runtime%{?_sclreq}%{?_isa}} + +Provides: %{?scl_prefix}php-%{pecl_name} = %{version} +Provides: %{?scl_prefix}php-%{pecl_name}%{?_isa} = %{version} +Provides: %{?scl_prefix}php-pecl(%{pecl_name}) = %{version} +Provides: %{?scl_prefix}php-pecl(%{pecl_name})%{?_isa} = %{version} +# Notice pecl_name != name +Provides: %{?scl_prefix}php-pecl-%{pecl_name} = %{version}-%{release} +Provides: %{?scl_prefix}php-pecl-%{pecl_name}%{?_isa} = %{version}-%{release} + +%if "%{?vendor}" == "Remi Collet" && 0%{!?scl:1} +# Other third party repo stuff +Obsoletes: php71u-pecl-%{pecl_name} <= %{version} +Obsoletes: php71w-pecl-%{pecl_name} <= %{version} +%endif + +%if 0%{?fedora} < 20 && 0%{?rhel} < 7 +# Filter private shared object +%{?filter_provides_in: %filter_provides_in %{_libdir}/.*\.so$} +%{?filter_setup} +%endif + + +%description +The X DevAPI is he new common API for MySQL Connectors built on the X Protocol +introduced in MySQL 5.7.12. + +The X DevAPI wraps powerful concepts in a simple API. + +* A new high-level session concept enables you to write code that + can transparently scale from single MySQL Server to a multiple server + environment. +* Read operations are simple and easy to understand. + +The X DevAPI introduces a new, modern and easy-to-learn way to work with your +data. + +* Documents are stored in Collections and have their dedicated CRUD + operation set. +* Work with your existing domain objects or generate code based on structure + definitions for strictly typed languages. +* Focus is put on working with data via CRUD operations. + See Section 3.1, “CRUD Operations Overview”. +* Modern practices and syntax styles are used to get away from traditional + SQL-String-Building. See Chapter 10, Building Expressions. + +Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')%{?scl: as Software Collection (%{scl} by %{?scl_vendor}%{!?scl_vendor:rh})}. + + +%package devel +Summary: %{name} developer files (header) +Group: Development/Libraries +Requires: %{name}%{?_isa} = %{version}-%{release} +Requires: %{?scl_prefix}php-devel%{?_isa} + +%description devel +These are the files needed to compile programs using %{name}. + + +%prep +%setup -qc +mv %{pecl_name}-%{version} NTS + +mkdir -p NTS/ext/json +# Temporary workaround waiting for 7.1.1 +cp %{SOURCE1} %{SOURCE3} %{SOURCE2} NTS/ext/json + +%{?_licensedir:sed -e '/LICENSE/s/role="doc"/role="src"/' -i package.xml} + +cd NTS +%patch0 -p1 -b .old + +# Check version as upstream often forget to update this +extver=$(sed -n '/#define PHP_MYSQL_XDEVAPI_VERSION/{s/.* "//;s/".*$//;p}' php_mysql_xdevapi.h) +if test "x${extver}" != "x%{version}%{?prever}%{?gh_date:-dev}"; then + : Error: Upstream YAC version is ${extver}, expecting %{version}%{?prever}%{?gh_date:-dev}. + exit 1 +fi +cd .. + + +%if %{with_zts} +# duplicate for ZTS build +cp -pr NTS ZTS +%endif + +# Create configuration file +cat > %{ini_name} << 'EOF' +; Enable %{pecl_name} extension module +extension=%{pecl_name}.so + +; Configuration +;xmysqlnd.collect_statistics = 1 +;xmysqlnd.collect_memory_statistics = 0 +;xmysqlnd.debug = '' +;xmysqlnd.trace_alloc = '' +;xmysqlnd.net_read_timeout = 31536000 +;xmysqlnd.mempool_default_size= 16000 +EOF + + +%build +peclconf() { +%configure \ + --enable-mysql-xdevapi \ + --with-php-config=$1 +} + +cd NTS +%{_bindir}/phpize +peclconf %{_bindir}/php-config +make %{?_smp_mflags} + +%if %{with_zts} +cd ../ZTS +%{_bindir}/zts-phpize +peclconf %{_bindir}/zts-php-config +make %{?_smp_mflags} +%endif + + +%install +# Install the NTS stuff +make -C NTS install INSTALL_ROOT=%{buildroot} +install -D -m 644 %{ini_name} %{buildroot}%{php_inidir}/%{ini_name} + +# Install XML package description +install -D -m 644 package.xml %{buildroot}%{pecl_xmldir}/%{name}.xml + +# Install the ZTS stuff +%if %{with_zts} +make -C ZTS install INSTALL_ROOT=%{buildroot} +install -D -m 644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name} +%endif + +# Test & Documentation +for i in $(grep 'role="test"' package.xml | sed -e 's/^.*name="//;s/".*$//') +do install -Dpm 644 NTS/$i %{buildroot}%{pecl_testdir}/%{pecl_name}/$i +done +for i in $(grep 'role="doc"' package.xml | sed -e 's/^.*name="//;s/".*$//') +do [ -f NTS/$i ] && install -Dpm 644 NTS/$i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i +done + + +%check +cd NTS + +: Minimal load test for NTS extension +%{_bindir}/php --no-php-ini \ + --define extension=mysqlnd.so \ + --define extension=json.so \ + --define extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \ + --modules | grep '^%{pecl_name}$' + +%if %{with_zts} +cd ../ZTS + +: Minimal load test for ZTS extension +%{__ztsphp} --no-php-ini \ + --define extension=mysqlnd.so \ + --define extension=json.so \ + --define extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so \ + --modules | grep '^%{pecl_name}$' + +%endif + +%if %{with_tests} +cd ../NTS +RET=0 + +: Running a server +MYSQLX_TEST_HOST=127.0.0.1 +MYSQLX_TEST_PORT=3308 +MYSQLX_TEST_SOCKET=$PWD/mysql.sock +MYSQLX_PID_FILE=$PWD/mysql.pid + +rm -rf data +mkdir data +%{_bindir}/mysql_install_db \ + --datadir=$PWD/data + +%{_libexecdir}/mysqld \ + --socket=$MYSQLX_TEST_SOCKET \ + --log-error=$PWD/mysql.log \ + --pid-file=$MYSQLX_PID_FILE \ + --port=$MYSQLX_TEST_PORT \ + --datadir=$PWD/data & + +n=15 +while [ $n -gt 0 ]; do + RESPONSE=$(%{_bindir}/mysqladmin --no-defaults --socket="$MYSQL_TEST_SOCKET" --user=root ping 2>&1 || :) + if [ "$RESPONSE" == "mysqld is alive" ]; then + break + fi + n=$(expr $n - 1) + sleep 1 +done + +: Run upstream test suite +sed -e "s/localhost/$MYSQL_TEST_HOST/;s/3306/$MYSQL_TEST_PORT/" -i tests/connect.inc + +if [ $n -gt 0 ]; then +TEST_PHP_EXECUTABLE=%{__php} \ +TEST_PHP_ARGS="-n -d extension=mysqlnd.so -d extension=json.so -d extension=%{buildroot}%{php_extdir}/%{pecl_name}.so" \ +NO_INTERACTION=1 \ +REPORT_EXIT_STATUS=1 \ +%{__php} -n run-tests.php --show-diff || RET=1 +fi + +: Cleanup +if [ -s $MYSQL_PID_FILE ]; then + kill $(cat $MYSQL_PID_FILE) +fi + +exit $RET +%endif + + +%if 0%{?fedora} < 24 +# when pear installed alone, after us +%triggerin -- %{?scl_prefix}php-pear +if [ -x %{__pecl} ] ; then + %{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || : +fi + +# posttrans as pear can be installed after us +%posttrans +if [ -x %{__pecl} ] ; then + %{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || : +fi + +%postun +if [ $1 -eq 0 -a -x %{__pecl} ] ; then + %{pecl_uninstall} %{pecl_name} >/dev/null || : +fi +%endif + + +%files +%{?_licensedir:%license NTS/LICENSE} +%doc %{pecl_docdir}/%{pecl_name} +%{pecl_xmldir}/%{name}.xml + +%config(noreplace) %{php_inidir}/%{ini_name} +%{php_extdir}/%{pecl_name}.so + +%if %{with_zts} +%{php_ztsextdir}/%{pecl_name}.so +%config(noreplace) %{php_ztsinidir}/%{ini_name} +%endif + + +%files devel +%doc %{pecl_testdir}/%{pecl_name} +%{php_incldir}/ext/%{pecl_name} + +%if %{with_zts} +%{php_ztsincldir}/ext/%{pecl_name} +%endif + + +%changelog +* Thu Dec 8 2016 Remi Collet - 1.0.0-1 +- initial package, version 1.0.0 (alpha) + diff --git a/php_json.h b/php_json.h new file mode 100644 index 0000000..cedb8ae --- /dev/null +++ b/php_json.h @@ -0,0 +1,114 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 7 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2016 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Omar Kilani | + | Jakub Zelenka | + +----------------------------------------------------------------------+ +*/ + +/* $Id$ */ + +#ifndef PHP_JSON_H +#define PHP_JSON_H + +#define PHP_JSON_VERSION "1.5.0" +#include "zend_smart_str_public.h" + +extern zend_module_entry json_module_entry; +#define phpext_json_ptr &json_module_entry + +#if defined(PHP_WIN32) && defined(JSON_EXPORTS) +#define PHP_JSON_API __declspec(dllexport) +#else +#define PHP_JSON_API PHPAPI +#endif + +#ifdef ZTS +#include "TSRM.h" +#endif + +extern PHP_JSON_API zend_class_entry *php_json_serializable_ce; + +/* error codes */ +typedef enum { + PHP_JSON_ERROR_NONE = 0, + PHP_JSON_ERROR_DEPTH, + PHP_JSON_ERROR_STATE_MISMATCH, + PHP_JSON_ERROR_CTRL_CHAR, + PHP_JSON_ERROR_SYNTAX, + PHP_JSON_ERROR_UTF8, + PHP_JSON_ERROR_RECURSION, + PHP_JSON_ERROR_INF_OR_NAN, + PHP_JSON_ERROR_UNSUPPORTED_TYPE, + PHP_JSON_ERROR_INVALID_PROPERTY_NAME, + PHP_JSON_ERROR_UTF16 +} php_json_error_code; + +/* json_encode() options */ +#define PHP_JSON_HEX_TAG (1<<0) +#define PHP_JSON_HEX_AMP (1<<1) +#define PHP_JSON_HEX_APOS (1<<2) +#define PHP_JSON_HEX_QUOT (1<<3) +#define PHP_JSON_FORCE_OBJECT (1<<4) +#define PHP_JSON_NUMERIC_CHECK (1<<5) +#define PHP_JSON_UNESCAPED_SLASHES (1<<6) +#define PHP_JSON_PRETTY_PRINT (1<<7) +#define PHP_JSON_UNESCAPED_UNICODE (1<<8) +#define PHP_JSON_PARTIAL_OUTPUT_ON_ERROR (1<<9) +#define PHP_JSON_PRESERVE_ZERO_FRACTION (1<<10) +#define PHP_JSON_UNESCAPED_LINE_TERMINATORS (1<<11) + +/* json_decode() options */ +#define PHP_JSON_OBJECT_AS_ARRAY (1<<0) +#define PHP_JSON_BIGINT_AS_STRING (1<<1) + +/* Internal flags */ +#define PHP_JSON_OUTPUT_ARRAY 0 +#define PHP_JSON_OUTPUT_OBJECT 1 + +/* default depth */ +#define PHP_JSON_PARSER_DEFAULT_DEPTH 512 + +ZEND_BEGIN_MODULE_GLOBALS(json) + int encoder_depth; + int encode_max_depth; + php_json_error_code error_code; +ZEND_END_MODULE_GLOBALS(json) + +PHP_JSON_API ZEND_EXTERN_MODULE_GLOBALS(json) +#define JSON_G(v) ZEND_MODULE_GLOBALS_ACCESSOR(json, v) + +#if defined(ZTS) && defined(COMPILE_DL_JSON) +ZEND_TSRMLS_CACHE_EXTERN() +#endif + +PHP_JSON_API int php_json_encode(smart_str *buf, zval *val, int options); +PHP_JSON_API int php_json_decode_ex(zval *return_value, char *str, size_t str_len, zend_long options, zend_long depth); + +static inline int php_json_decode(zval *return_value, char *str, int str_len, zend_bool assoc, zend_long depth) +{ + return php_json_decode_ex(return_value, str, str_len, assoc ? PHP_JSON_OBJECT_AS_ARRAY : 0, depth); +} + + +#endif /* PHP_JSON_H */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: noet sw=4 ts=4 fdm=marker + * vim<600: noet sw=4 ts=4 + */ diff --git a/php_json_parser.h b/php_json_parser.h new file mode 100644 index 0000000..afead52 --- /dev/null +++ b/php_json_parser.h @@ -0,0 +1,87 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 7 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2016 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Jakub Zelenka | + +----------------------------------------------------------------------+ +*/ + +#ifndef PHP_JSON_PARSER_H +#define PHP_JSON_PARSER_H + +#include "php.h" +#include "php_json_scanner.h" + +typedef struct _php_json_parser php_json_parser; + +typedef int (*php_json_parser_func_array_create_t)( + php_json_parser *parser, zval *array); +typedef int (*php_json_parser_func_array_append_t)( + php_json_parser *parser, zval *array, zval *zvalue); +typedef int (*php_json_parser_func_array_start_t)( + php_json_parser *parser); +typedef int (*php_json_parser_func_array_end_t)( + php_json_parser *parser, zval *object); +typedef int (*php_json_parser_func_object_create_t)( + php_json_parser *parser, zval *object); +typedef int (*php_json_parser_func_object_update_t)( + php_json_parser *parser, zval *object, zend_string *key, zval *zvalue); +typedef int (*php_json_parser_func_object_start_t)( + php_json_parser *parser); +typedef int (*php_json_parser_func_object_end_t)( + php_json_parser *parser, zval *object); + +typedef struct _php_json_parser_methods { + php_json_parser_func_array_create_t array_create; + php_json_parser_func_array_append_t array_append; + php_json_parser_func_array_start_t array_start; + php_json_parser_func_array_end_t array_end; + php_json_parser_func_object_create_t object_create; + php_json_parser_func_object_update_t object_update; + php_json_parser_func_object_start_t object_start; + php_json_parser_func_object_end_t object_end; +} php_json_parser_methods; + +struct _php_json_parser { + php_json_scanner scanner; + zval *return_value; + int depth; + int max_depth; + php_json_parser_methods methods; +}; + +PHP_JSON_API void php_json_parser_init_ex( + php_json_parser *parser, + zval *return_value, + char *str, + size_t str_len, + int options, + int max_depth, + const php_json_parser_methods *methods); + +PHP_JSON_API void php_json_parser_init( + php_json_parser *parser, + zval *return_value, + char *str, + size_t str_len, + int options, + int max_depth); + +PHP_JSON_API php_json_error_code php_json_parser_error_code(const php_json_parser *parser); + +PHP_JSON_API int php_json_parse(php_json_parser *parser); + +int php_json_yyparse(php_json_parser *parser); + +#endif /* PHP_JSON_PARSER_H */ + diff --git a/php_json_scanner.h b/php_json_scanner.h new file mode 100644 index 0000000..0b73a1d --- /dev/null +++ b/php_json_scanner.h @@ -0,0 +1,47 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 7 | + +----------------------------------------------------------------------+ + | Copyright (c) 1997-2016 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Author: Jakub Zelenka | + +----------------------------------------------------------------------+ +*/ + +#ifndef PHP_JSON_SCANNER_H +#define PHP_JSON_SCANNER_H + +#include "php.h" +#include "php_json.h" + +typedef unsigned char php_json_ctype; + +typedef struct _php_json_scanner { + php_json_ctype *cursor; /* cursor position */ + php_json_ctype *token; /* token position */ + php_json_ctype *limit; /* the last read character + 1 position */ + php_json_ctype *marker; /* marker position for backtracking */ + php_json_ctype *ctxmarker; /* marker position for context backtracking */ + php_json_ctype *str_start; /* start position of the string */ + php_json_ctype *pstr; /* string pointer for escapes conversion */ + zval value; /* value */ + int str_esc; /* number of extra characters for escaping */ + int state; /* condition state */ + int options; /* options */ + php_json_error_code errcode; /* error type if there is an error */ +} php_json_scanner; + + +void php_json_scanner_init(php_json_scanner *scanner, char *str, size_t str_len, int options); +int php_json_scan(php_json_scanner *s); + +#endif /* PHP_JSON_SCANNER_H */ + -- cgit