From ff13b6f09d002b6930e828f4bcec2efdcf18cb99 Mon Sep 17 00:00:00 2001 From: Dusan Malusev Date: Thu, 16 Dec 2021 12:49:27 +0000 Subject: [PATCH] Starting new V2 and making it compile on PHP8.1 Signed-off-by: Dusan Malusev --- .devcontainer/Dockerfile | 37 ++ .devcontainer/devcontainer.json | 57 ++- .gitignore | 2 + .travis.yml | 110 ----- .vscode/settings.json | 3 +- .vscode/tasks.json | 8 +- Dockerfile | 28 -- README.md | 11 +- Rakefile | 232 --------- doxyfile | 341 ------------- doxygen.rb | 32 -- ext/php_driver.c | 34 +- ext/php_driver.h | 193 +------- ext/php_driver_types.h | 844 +++++++++++++++----------------- ext/src/Collection.c | 10 +- ext/src/Date.c | 4 +- ext/src/Decimal.c | 7 +- ext/src/Map.c | 10 +- ext/src/SSLOptions/Builder.c | 12 +- ext/src/Set.c | 10 +- ext/src/Tuple.c | 10 +- ext/src/UserTypeValue.c | 6 +- ext/util/bytes.c | 2 +- v2/.gitignore | 1 + v2/Cargo.lock | 529 ++++++++++++++++++++ v2/Cargo.toml | 20 + v2/src/lib.rs | 8 + v2/tools.sh | 6 + 28 files changed, 1078 insertions(+), 1489 deletions(-) create mode 100644 .devcontainer/Dockerfile delete mode 100644 .travis.yml delete mode 100644 Dockerfile delete mode 100755 Rakefile delete mode 100644 doxyfile delete mode 100755 doxygen.rb create mode 100644 v2/.gitignore create mode 100644 v2/Cargo.lock create mode 100644 v2/Cargo.toml create mode 100644 v2/src/lib.rs create mode 100755 v2/tools.sh diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 000000000..ec9c769c0 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,37 @@ +ARG VARIANT="8.1-apache-bullseye" + +FROM mcr.microsoft.com/vscode/devcontainers/php:0-${VARIANT} + +COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin + +# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10 +ARG NODE_VERSION="none" +RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi + +RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && \ + php composer-setup.php && php -r "unlink('composer-setup.php');" \ + mv composer.phar /bin/composer + +ARG CASSANDRA_LIB_VERSION="2.16.2" +RUN apt update -y && apt upgrade -y \ + && apt install python3 pip cmake unzip mlocate build-essential git libuv1-dev libssl-dev libgmp-dev openssl zlib1g-dev libpcre3-dev -y \ + && git clone --recursive https://github.com/datastax/cpp-driver /cpp-driver \ + && cd /cpp-driver \ + && git fetch --tags \ + && git checkout "tags/${CASSANDRA_LIB_VERSION}" -b "v${CASSANDRA_LIB_VERSION}" \ + && mkdir -p /cpp-driver/build \ + && cd build \ + && cmake \ + -DCMAKE_CXX_FLAGS="-fPIC" \ + -DCASS_BUILD_STATIC=OFF \ + -DCASS_BUILD_SHARED=ON \ + -DCMAKE_BUILD_TYPE=RELEASE \ + -DCMAKE_INSTALL_LIBDIR:PATH=lib \ + -DCASS_USE_ZLIB=ON .. \ + && make -j8 && make install \ + && install-php-extensions intl zip pcntl gmp ast xdebug \ + && pip install ccm + +RUN apt update -y && apt install clang clang-format libclang-dev -y + +# RUN diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 0d826c17f..dbff0d595 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,32 +1,41 @@ // For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: -// https://github.com/microsoft/vscode-dev-containers/tree/v0.194.0/containers/docker-existing-dockerfile +// https://github.com/microsoft/vscode-dev-containers/tree/v0.209.5/containers/php { - "name": "Existing Dockerfile", - - // Sets the run context to one level up instead of the .devcontainer folder. - "context": "..", - - // Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename. - "dockerFile": "../Dockerfile", + "name": "PHP", + "build": { + "dockerfile": "Dockerfile", + "args": { + "VARIANT": "8.1-bullseye", + "NODE_VERSION": "16", + "CASSANDRA_LIB_VERSION": "2.16.2" + } + }, // Set *default* container specific settings.json values on container create. - "settings": {}, - + "settings": { + "php.validate.executablePath": "/usr/local/bin/php" + }, + // Add the IDs of extensions you want installed when the container is created. - "extensions": [] + "extensions": [ + "felixfbecker.php-debug", + "bmewburn.vscode-intelephense-client", + "mrmlnc.vscode-apache" + ], // Use 'forwardPorts' to make a list of ports inside the container available locally. - // "forwardPorts": [], - - // Uncomment the next line to run commands after the container is created - for example installing curl. - // "postCreateCommand": "apt-get update && apt-get install -y curl", - - // Uncomment when using a ptrace-based debugger like C++, Go, and Rust - // "runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ], - - // Uncomment to use the Docker CLI from inside the container. See https://aka.ms/vscode-remote/samples/docker-from-docker. - // "mounts": [ "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" ], - - // Uncomment to connect as a non-root user if you've added one. See https://aka.ms/vscode-remote/containers/non-root. - // "remoteUser": "vscode" + "forwardPorts": [ + 8080 + ], + + // Use 'postCreateCommand' to run commands after the container is created. + // "postCreateCommand": "sudo chmod a+x \"$(pwd)\" && sudo rm -rf /var/www/html && sudo ln -s \"$(pwd)\" /var/www/html" + + // Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. + "remoteUser": "root", + "features": { + "docker-from-docker": "latest", + "sshd": "latest", + "rust": "latest" + } } diff --git a/.gitignore b/.gitignore index e41adc39d..a9249b7d2 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,5 @@ /tmp/* *.ac .phpunit.result.cache + +*.dep diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 002a2de19..000000000 --- a/.travis.yml +++ /dev/null @@ -1,110 +0,0 @@ -language: php -dist: trusty -sudo: true -addons: - apt: - packages: - - libssl-dev - - oracle-java8-installer -cache: - ccache: true - directories: - - ${HOME}/dependencies -php: - - 5.6 - - 7.0 - - 7.1 - - 7.2 - - 7.3 - -env: - global: - # Configure the .phpt tests to be Travis friendly - - REPORT_EXIT_STATUS=1 - - TEST_PHP_ARGS="-q -s output.txt -g XFAIL,FAIL,BORK,WARN,LEAK,SKIP -x --show-diff" - # Add the pip installation folder to the PATH, until https://github.com/travis-ci/travis-ci/issues/3563 is fixed - - PATH=${HOME}/.local/bin:${PATH} - # Indicate the cached dependencies directory - - CACHED_DEPENDENCIES_DIRECTORY=${HOME}/dependencies - # Add libuv source build for container based TravisCI - - LIBUV_VERSION=1.14.1 - - LIBUV_ROOT_DIR=${CACHED_DEPENDENCIES_DIRECTORY}/libuv/${LIBUV_VERSION} - - PHP_DRIVER_BUILD_DIRECTORY=/tmp/php-driver/build - - CPP_DRIVER_SOURCE_DIRECTORY=${TRAVIS_BUILD_DIR}/lib/cpp-driver - - CPP_DRIVER_BUILD_DIRECTORY=${PHP_DRIVER_BUILD_DIRECTORY}/cpp-driver - - CPP_DRIVER_INSTALL_DIRECTORY=${CACHED_DEPENDENCIES_DIRECTORY}/cpp-driver - -before_install: - # Configure, build, install (or used cached libuv) - - if [ ! -d "${LIBUV_ROOT_DIR}" ]; then - pushd /tmp; - wget -q http://dist.libuv.org/dist/v${LIBUV_VERSION}/libuv-v${LIBUV_VERSION}.tar.gz; - tar xzf libuv-v${LIBUV_VERSION}.tar.gz; - pushd /tmp/libuv-v${LIBUV_VERSION}; - sh autogen.sh; - ./configure --prefix=${LIBUV_ROOT_DIR}; - make -j$(nproc) install; - popd; - popd; - else echo "Using Cached libuv v${LIBUV_VERSION}. Dependency does not need to be re-compiled"; - fi - ### Build and configure the PHP driver extension ### - - mkdir -p ${PHP_DRIVER_BUILD_DIRECTORY} - # Determine the version number for the C/C++ driver dependency - - export CPP_DRIVER_VERSION_MAJOR=$(grep CASS_VERSION_MAJOR ${CPP_DRIVER_SOURCE_DIRECTORY}/include/cassandra.h | sed 's/[^0-9]*//g') - - export CPP_DRIVER_VERSION_MINOR=$(grep CASS_VERSION_MINOR ${CPP_DRIVER_SOURCE_DIRECTORY}/include/cassandra.h | sed 's/[^0-9]*//g') - - export CPP_DRIVER_VERSION_PATCH=$(grep CASS_VERSION_PATCH ${CPP_DRIVER_SOURCE_DIRECTORY}/include/cassandra.h | sed 's/[^0-9]*//g') - - export CPP_DRIVER_VERSION=${CPP_DRIVER_VERSION_MAJOR}.${CPP_DRIVER_VERSION_MINOR}.${CPP_DRIVER_VERSION_PATCH} - - pushd lib/cpp-driver; export CPP_DRIVER_VERSION_SHA=$(git rev-parse --short HEAD); popd - # Build the C/C++ driver dependency (or used cached C/C++ driver) - - if [ ! -d "${CPP_DRIVER_INSTALL_DIRECTORY}/${CPP_DRIVER_VERSION}/${CPP_DRIVER_VERSION_SHA}" ]; then - mkdir -p ${CPP_DRIVER_BUILD_DIRECTORY}; - pushd ${CPP_DRIVER_BUILD_DIRECTORY}; - cmake -DCMAKE_CXX_FLAGS="-fPIC" -DCMAKE_INSTALL_PREFIX:PATH=${CPP_DRIVER_INSTALL_DIRECTORY}/${CPP_DRIVER_VERSION}/${CPP_DRIVER_VERSION_SHA} -DCASS_BUILD_STATIC=ON -DCASS_BUILD_SHARED=OFF -DCMAKE_BUILD_TYPE=RELEASE -DCASS_USE_ZLIB=ON ${CPP_DRIVER_SOURCE_DIRECTORY}; - make -j$(nproc) install; - pushd ${CPP_DRIVER_INSTALL_DIRECTORY}/${CPP_DRIVER_VERSION}/${CPP_DRIVER_VERSION_SHA}/lib; - rm -f libcassandra.{dylib,so}; - mv libcassandra_static.a libcassandra.a; - popd; - popd; - else echo "Using Cached C/C++ driver v${CPP_DRIVER_VERSION}-${CPP_DRIVER_VERSION_SHA}. Dependency does not need to be re-compiled"; - fi - # PHPize the extension for configuration and building - - pushd ${TRAVIS_BUILD_DIR}/ext && phpize && popd - # Configure, build, and install the extension - - pushd ${PHP_DRIVER_BUILD_DIRECTORY} - - LIBS="-lssl -lz -luv -lm -lstdc++" LDFLAGS="-L${CPP_DRIVER_INSTALL_DIRECTORY}/${CPP_DRIVER_VERSION}/${CPP_DRIVER_VERSION_SHA}/lib -L${LIBUV_ROOT_DIR}/lib" ${TRAVIS_BUILD_DIR}/ext/configure --with-cassandra=${CPP_DRIVER_INSTALL_DIRECTORY}/${CPP_DRIVER_VERSION}/${CPP_DRIVER_VERSION_SHA} --with-uv=${LIBUV_ROOT_DIR} - - make -j$(nproc) install - - popd - # Enable the extension - - echo "extension=cassandra.so" >> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"` - ### Install CCM for Behat testing ### - - pip install --user ccm - -before_script: - # Install composer dependencies - - composer self-update - - composer install -n - # Use the BEHAT_EXTRA_OPTIONS to supply options to Behat runs - - BEHAT_EXTRA_OPTIONS= - # Use the BEHAT_SKIP_TAGS to skip tests on TravisCI - - BEHAT_SKIP_TAGS=~@skip-ci - - export BEHAT_EXTRA_OPTIONS BEHAT_SKIP_TAGS - # Switch to Java 8 for non-java projects - - if [ $(uname -a | grep x86_64 >/dev/null) ]; then - ARCH_SUFFIX=amd64; - else ARCH_SUFFIX=i386; - fi - - if [ -d "/usr/lib/jvm/java-8-oracle-$ARCH_SUFFIX" ]; then - export JAVA_HOME="/usr/lib/jvm/java-8-oracle-$ARCH_SUFFIX"; - else export JAVA_HOME="/usr/lib/jvm/java-8-oracle"; - fi - - export PATH=${JAVA_HOME}/bin:${PATH} - -script: - # Execute .phpt tests - - pushd ${PHP_DRIVER_BUILD_DIRECTORY} && make test && popd - # Execute the unit tests - - ./bin/phpunit --testsuite unit - # Execute the Behat tests - - ./bin/behat --tags="${BEHAT_SKIP_TAGS}" ${BEHAT_EXTRA_OPTIONS} diff --git a/.vscode/settings.json b/.vscode/settings.json index 4c7c17ac6..1344be0ae 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,5 +2,6 @@ "files.associations": { "php_driver.h": "c", "php.h": "c" - } + }, + "cmake.configureOnOpen": false } diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 7dc230c3b..63939bddf 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -2,6 +2,12 @@ // See https://go.microsoft.com/fwlink/?LinkId=733558 // for the documentation about the tasks.json format "version": "2.0.0", + "options": { + "env": { + "LIBS": "-lssl -lz -luv -lm -lgmp -lstdc++", + "LDFLAGS": "-L/usr/local/lib" + } + }, "tasks": [ { "label": "build", @@ -10,7 +16,7 @@ "group": { "kind": "build", "isDefault": true - } + }, }, { "label": "composer install", diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 4bda5c0ba..000000000 --- a/Dockerfile +++ /dev/null @@ -1,28 +0,0 @@ -FROM php:8.0 - -ENV EXT_CASSANDRA_VERSION=master - -RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && \ - php composer-setup.php && php -r "unlink('composer-setup.php');" \ - mv composer.phar /bin/composer - -COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin - -RUN docker-php-source extract \ - && apt update -y \ - && apt install python3 pip cmake unzip mlocate build-essential git libuv1-dev libssl-dev libgmp-dev openssl zlib1g-dev libpcre3-dev -y \ - && git clone --branch $EXT_CASSANDRA_VERSION --depth 1 https://github.com/nano-interactive/php-driver.git /usr/src/php/ext/cassandra \ - && cd /usr/src/php/ext/cassandra && git submodule update --init \ - && mkdir -p /usr/src/php/ext/cassandra/lib/cpp-driver/build \ - && cmake -DCMAKE_CXX_FLAGS="-fPIC" -DCASS_BUILD_STATIC=OFF -DCASS_BUILD_SHARED=ON -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_LIBDIR:PATH=lib -DCASS_USE_ZLIB=ON /usr/src/php/ext/cassandra/lib/cpp-driver \ - && make -j8 \ - && make install \ - && install-php-extensions intl zip pcntl gmp ast xdebug - -RUN cd /usr/src/php/ext/cassandra/ext \ - && phpize \ - && LDFLAGS="-L/usr/local/lib" LIBS="-lssl -lz -luv -lm -lgmp -lstdc++" ./configure --with-cassandra=/usr/local \ - && make -j8 && make install && updatedb && pip install ccm - - -CMD ["bash"] diff --git a/README.md b/README.md index 689f50d06..9c3d3d0a6 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,3 @@ -:warning: **The PHP driver is in maintenance mode. We are still accepting pull-requests and we will occasionally release critical bug fixes, but no ongoing active development is being done currently.** - # DataStax PHP Driver for Apache Cassandra [![Build Status: Linux](https://travis-ci.org/datastax/php-driver.svg)](https://travis-ci.org/datastax/php-driver) @@ -21,7 +19,7 @@ multiple versions of PHP, can be obtained from [DataStax download server]. The source code is made available via [GitHub]. __If you're using [DataStax Enterprise] use the [DSE PHP driver] instead__. -__Note__: The driver extension is a wrapper around the +__Note__: The driver extension is a wrapper around the [DataStax C/C++ Driver for Apache Cassandra] and is a requirement for proper installation of the PHP extension binaries. Ensure these dependencies are met before proceeding. @@ -43,8 +41,8 @@ This driver works exclusively with the Cassandra Query Language v3 (CQL3) and Cassandra's native protocol. The current version works with: * Apache Cassandra versions 2.1, 2.2 and 3.0+ -* PHP 5.6, PHP 7.0, and PHP 7.1 - * 32-bit (x86) and 64-bit (x64) +* PHP >= 8.0 + * 64-bit (x64) * Thread safe (TS) and non-thread safe (NTS) * Compilers: GCC 4.1.2+, Clang 3.4+, and MSVC 2010/2012/2013/2015 @@ -109,9 +107,8 @@ For your convenience a `Vagrantfile` with configuration ready for testing is available. To execute tests, run the following: ```bash -git clone https://github.com/datastax/php-driver.git +git clone --recursive https://github.com/datastax/php-driver.git cd php-driver -git submodule update --init vagrant up vagrant ssh ``` diff --git a/Rakefile b/Rakefile deleted file mode 100755 index bb046c149..000000000 --- a/Rakefile +++ /dev/null @@ -1,232 +0,0 @@ -require 'erb' - -class Release - def initialize(version) - parts = version.split('.', 3).map(&:to_i) - major = parts[0] || 0 - minor = parts[1] || 0 - release = parts[2] || 0 - - parts = version.split('-', 2) - stability = parts[1] || 'stable' - stability = 'devel' if major < 1 - # strip release modifier e.g. beta.1 becomes beta - stability, number = stability.split('.', 2) - - pecl_stability = nil - pecl_number = nil - - pecl_number = number unless number.nil? - pecl_stability = stability if stability != 'stable' - pecl_stability = pecl_stability.upcase if pecl_stability == 'rc' - pecl_stability = 'dev' if pecl_stability == 'devel' - - @version = version - @major = major - @minor = minor - @release = release - @stability = stability - @pecl_version = "#{major}.#{minor}.#{release}" - @pecl_version = "#{major}.#{minor}.#{release}-#{pecl_stability}#{pecl_number}" if stability != 'stable' - @dirname = File.expand_path(File.dirname(__FILE__)) - end - - def perform! - puts "Preparing to release PHP Driver v#{version}-#{@stability}..." - bump_version - tag_repository - end - - private - - attr_reader :version, :major, :minor, :release, :stability, :pecl_version - - def timestamp - Time.now - end - - def sources - ( - Dir.glob(@dirname + '/ext/config.{m4,w32}') + - Dir.glob(@dirname + '/ext/php_driver.{c,h}') + - Dir.glob(@dirname + '/ext/{php_driver_types.h,php_driver_globals.h,version.h}') + - Dir.glob(@dirname + '/ext/src/**/*.{c,h}') + - Dir.glob(@dirname + '/ext/util/**/*.{c,h}') - ).map {|p| p.gsub(@dirname + '/ext/', '') }.sort - end - - def docs - ( - Dir.glob(@dirname + '/ext/doc/**/*.*') << - File.join(@dirname, 'ext/LICENSE') - ) - .reject {|p| p[%r{.*ext/doc/generate_doc.*}] } - .map {|p| p.gsub(@dirname + '/ext/', '') }.sort - end - - def tests - Dir.glob(@dirname + '/ext/tests/**/*.phpt'). - map {|p| p.gsub(@dirname + '/ext/', '') }.sort - end - - def files - { - 'src' => sources, - 'doc' => docs, - 'test' => tests - } - end - - def notes - notes = '' - state = :start - - File.read(@dirname + '/CHANGELOG.md').each_line do |line| - case state - when :start - next unless line.start_with?("# ") - - if @version == line[2..-1].strip - notes << line - state = :body - end - when :body - break if line.start_with?("# ") - notes << line - end - end - - if @stability == 'stable' && notes == '' - raise ::RuntimeError, - %[#{@dirname}/CHANGELOG.md Does not Contain Information for Release: ] + - %[Missing information for v#{@version}] - end - notes = '# Official release under development' if notes == '' - notes.strip - end - - def package_xml - ERB.new(<<-ERB) - - - cassandra - pecl.php.net - DataStax PHP Driver for Apache Cassandra - -A modern, feature-rich and highly tunable PHP client library for Apache -Cassandra and DataStax Enterprise using exclusively Cassandra's binary -protocol and Cassandra Query Language v3. - - - Michael Penick - mpenick - michael.penick@datastax.com - yes - - <%= timestamp.strftime('%Y-%m-%d') %> - - - <%= pecl_version %> - <%= pecl_version %> - - - <%= release_stability %> - <%= api_stability %> - - Apache License 2.0 - -<%= notes %> - - - <% -files.each do |role, list| - list.each do |file| -%> - <% - end -end -%> - - - - - - 5.6.0 - 7.99.99 - - - 1.4.8 - - - - cassandra - - - ERB - end - - def version_h - ERB.new(<<-ERB) -#ifndef PHP_DRIVER_VERSION_H -#define PHP_DRIVER_VERSION_H - -/* Define Extension and Version Properties */ -#define PHP_DRIVER_NAME "cassandra" -#define PHP_DRIVER_MAJOR <%= major %> -#define PHP_DRIVER_MINOR <%= minor %> -#define PHP_DRIVER_RELEASE <%= release %> -#define PHP_DRIVER_STABILITY "<%= stability %>" -#define PHP_DRIVER_VERSION "<%= pecl_version %>" -#define PHP_DRIVER_VERSION_FULL "<%= version %>" - -#endif /* PHP_DRIVER_VERSION_H */ - ERB - end - - def create_package_xml - if @stability.start_with?('rc') - api_stability = 'stable' - release_stability = 'beta' - else - api_stability = release_stability = @stability - end - - [api_stability, release_stability].each do |stability| - unless ["snapshot", "devel", "alpha", "beta", "stable"].include?(stability) - raise ::ArgumentError, - %[stability must be "snapshot", "devel", "alpha", "beta" or ] + - %["stable", #{stability.inspect} given] - end - end - - File.open(@dirname + '/ext/package.xml', 'w+') do |f| - f.write(package_xml.result(binding)) - end - end - - def create_version_h - File.open(@dirname + '/ext/version.h', 'w+') do |f| - f.write(version_h.result(binding)) - end - end - - def bump_version - puts "Bumping version.h and package.xml" - create_version_h - create_package_xml - # system('git', 'add', @dirname + '/ext/package.xml') - # system('git', 'add', @dirname + '/ext/version.h') - # system('git', 'commit', '-m', "prepare release v#{@version}") - end - - def tag_repository - puts "Creating v#{version} tag" - # system('git', 'tag', "v#{@version}") - # system('git', 'push') - end -end - -desc 'Prepare a new release of the PHP Driver' -task :release, [:version] do |t, args| - Release.new(args['version']).perform! -end diff --git a/doxyfile b/doxyfile deleted file mode 100644 index 32d4b0e4c..000000000 --- a/doxyfile +++ /dev/null @@ -1,341 +0,0 @@ -# Doxyfile 1.8.10 - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- -DOXYFILE_ENCODING = UTF-8 -PROJECT_NAME = "DataStax PHP Driver" -PROJECT_NUMBER = -PROJECT_BRIEF = -PROJECT_LOGO = -OUTPUT_DIRECTORY = -CREATE_SUBDIRS = NO -ALLOW_UNICODE_NAMES = NO -OUTPUT_LANGUAGE = English -BRIEF_MEMBER_DESC = YES -REPEAT_BRIEF = YES -ABBREVIATE_BRIEF = "The $name class" \ - "The $name widget" \ - "The $name file" \ - is \ - provides \ - specifies \ - contains \ - represents \ - a \ - an \ - the -ALWAYS_DETAILED_SEC = NO -INLINE_INHERITED_MEMB = NO -FULL_PATH_NAMES = NO -STRIP_FROM_PATH = -STRIP_FROM_INC_PATH = -SHORT_NAMES = NO -JAVADOC_AUTOBRIEF = NO -QT_AUTOBRIEF = NO -MULTILINE_CPP_IS_BRIEF = NO -INHERIT_DOCS = YES -SEPARATE_MEMBER_PAGES = NO -TAB_SIZE = 4 -ALIASES = "throws=\par Throws\n" \ - "test_assumptions=\par Test Assumptions\n" \ - "note=\par Note\n" \ - "test_category=\par Test Category\n" \ - "jira_ticket=\par JIRA Ticket\n" \ - "expected_result=\par Expected Result\n" \ - "since=\par Since\n" \ - "param=\par Parameters\n" \ - "return=\par Return\n" \ - "expected_errors=\par Expected Errors\n" \ - "expectedException=\par Expected Exception\n" \ - "expectedExceptionMessage=\par Expected Exception Message\n" \ - "dataProvider=\par Data Provider\n" \ - "requires=\par Requires\n" \ - "depends=\par Depends\n" -TCL_SUBST = -OPTIMIZE_OUTPUT_FOR_C = NO -OPTIMIZE_OUTPUT_JAVA = NO -OPTIMIZE_FOR_FORTRAN = NO -OPTIMIZE_OUTPUT_VHDL = NO -EXTENSION_MAPPING = -MARKDOWN_SUPPORT = YES -AUTOLINK_SUPPORT = YES -BUILTIN_STL_SUPPORT = NO -CPP_CLI_SUPPORT = NO -SIP_SUPPORT = NO -IDL_PROPERTY_SUPPORT = YES -DISTRIBUTE_GROUP_DOC = NO -GROUP_NESTED_COMPOUNDS = NO -SUBGROUPING = YES -INLINE_GROUPED_CLASSES = NO -INLINE_SIMPLE_STRUCTS = NO -TYPEDEF_HIDES_STRUCT = NO -LOOKUP_CACHE_SIZE = 0 -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- -EXTRACT_ALL = NO -EXTRACT_PRIVATE = NO -EXTRACT_PACKAGE = NO -EXTRACT_STATIC = NO -EXTRACT_LOCAL_CLASSES = YES -EXTRACT_LOCAL_METHODS = NO -EXTRACT_ANON_NSPACES = NO -HIDE_UNDOC_MEMBERS = NO -HIDE_UNDOC_CLASSES = NO -HIDE_FRIEND_COMPOUNDS = NO -HIDE_IN_BODY_DOCS = NO -INTERNAL_DOCS = NO -CASE_SENSE_NAMES = NO -HIDE_SCOPE_NAMES = NO -HIDE_COMPOUND_REFERENCE= NO -SHOW_INCLUDE_FILES = YES -SHOW_GROUPED_MEMB_INC = NO -FORCE_LOCAL_INCLUDES = NO -INLINE_INFO = YES -SORT_MEMBER_DOCS = YES -SORT_BRIEF_DOCS = NO -SORT_MEMBERS_CTORS_1ST = NO -SORT_GROUP_NAMES = NO -SORT_BY_SCOPE_NAME = NO -STRICT_PROTO_MATCHING = NO -GENERATE_TODOLIST = YES -GENERATE_TESTLIST = YES -GENERATE_BUGLIST = YES -GENERATE_DEPRECATEDLIST= YES -ENABLED_SECTIONS = -MAX_INITIALIZER_LINES = 30 -SHOW_USED_FILES = YES -SHOW_FILES = YES -SHOW_NAMESPACES = YES -FILE_VERSION_FILTER = -LAYOUT_FILE = -CITE_BIB_FILES = -#--------------------------------------------------------------------------- -# Configuration options related to warning and progress messages -#--------------------------------------------------------------------------- -QUIET = NO -WARNINGS = YES -WARN_IF_UNDOCUMENTED = YES -WARN_IF_DOC_ERROR = YES -WARN_NO_PARAMDOC = NO -WARN_FORMAT = "$file:$line: $text" -WARN_LOGFILE = -#--------------------------------------------------------------------------- -# Configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = ./tests/ -INPUT_ENCODING = UTF-8 -FILE_PATTERNS = *.php -RECURSIVE = YES -EXCLUDE = @Test -EXCLUDE_SYMLINKS = NO -EXCLUDE_PATTERNS = -EXCLUDE_SYMBOLS = -EXAMPLE_PATH = -EXAMPLE_PATTERNS = * -EXAMPLE_RECURSIVE = NO -IMAGE_PATH = -INPUT_FILTER = -FILTER_PATTERNS = -FILTER_SOURCE_FILES = NO -FILTER_SOURCE_PATTERNS = -USE_MDFILE_AS_MAINPAGE = -#--------------------------------------------------------------------------- -# Configuration options related to source browsing -#--------------------------------------------------------------------------- -SOURCE_BROWSER = NO -INLINE_SOURCES = NO -STRIP_CODE_COMMENTS = YES -REFERENCED_BY_RELATION = NO -REFERENCES_RELATION = NO -REFERENCES_LINK_SOURCE = YES -SOURCE_TOOLTIPS = YES -USE_HTAGS = NO -VERBATIM_HEADERS = YES -CLANG_ASSISTED_PARSING = NO -CLANG_OPTIONS = -#--------------------------------------------------------------------------- -# Configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- -ALPHABETICAL_INDEX = YES -COLS_IN_ALPHA_INDEX = 5 -IGNORE_PREFIX = -#--------------------------------------------------------------------------- -# Configuration options related to the HTML output -#--------------------------------------------------------------------------- -GENERATE_HTML = YES -HTML_OUTPUT = html -HTML_FILE_EXTENSION = .html -HTML_HEADER = -HTML_FOOTER = -HTML_STYLESHEET = -HTML_EXTRA_STYLESHEET = -HTML_EXTRA_FILES = -HTML_COLORSTYLE_HUE = 220 -HTML_COLORSTYLE_SAT = 100 -HTML_COLORSTYLE_GAMMA = 80 -HTML_TIMESTAMP = YES -HTML_DYNAMIC_SECTIONS = NO -HTML_INDEX_NUM_ENTRIES = 100 -GENERATE_DOCSET = NO -DOCSET_FEEDNAME = "Doxygen generated docs" -DOCSET_BUNDLE_ID = org.doxygen.Project -DOCSET_PUBLISHER_ID = org.doxygen.Publisher -DOCSET_PUBLISHER_NAME = Publisher -GENERATE_HTMLHELP = NO -CHM_FILE = -HHC_LOCATION = -GENERATE_CHI = NO -CHM_INDEX_ENCODING = -BINARY_TOC = NO -TOC_EXPAND = NO -GENERATE_QHP = NO -QCH_FILE = -QHP_NAMESPACE = org.doxygen.Project -QHP_VIRTUAL_FOLDER = doc -QHP_CUST_FILTER_NAME = -QHP_CUST_FILTER_ATTRS = -QHP_SECT_FILTER_ATTRS = -QHG_LOCATION = -GENERATE_ECLIPSEHELP = NO -ECLIPSE_DOC_ID = org.doxygen.Project -DISABLE_INDEX = NO -GENERATE_TREEVIEW = YES -ENUM_VALUES_PER_LINE = 4 -TREEVIEW_WIDTH = 250 -EXT_LINKS_IN_WINDOW = NO -FORMULA_FONTSIZE = 10 -FORMULA_TRANSPARENT = YES -USE_MATHJAX = NO -MATHJAX_FORMAT = HTML-CSS -MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest -MATHJAX_EXTENSIONS = -MATHJAX_CODEFILE = -SEARCHENGINE = YES -SERVER_BASED_SEARCH = NO -EXTERNAL_SEARCH = NO -SEARCHENGINE_URL = -SEARCHDATA_FILE = searchdata.xml -EXTERNAL_SEARCH_ID = -EXTRA_SEARCH_MAPPINGS = -#--------------------------------------------------------------------------- -# Configuration options related to the LaTeX output -#--------------------------------------------------------------------------- -GENERATE_LATEX = NO -LATEX_OUTPUT = latex -LATEX_CMD_NAME = latex -MAKEINDEX_CMD_NAME = makeindex -COMPACT_LATEX = NO -PAPER_TYPE = a4 -EXTRA_PACKAGES = -LATEX_HEADER = -LATEX_FOOTER = -LATEX_EXTRA_STYLESHEET = -LATEX_EXTRA_FILES = -PDF_HYPERLINKS = YES -USE_PDFLATEX = YES -LATEX_BATCHMODE = NO -LATEX_HIDE_INDICES = NO -LATEX_SOURCE_CODE = NO -LATEX_BIB_STYLE = plain -#--------------------------------------------------------------------------- -# Configuration options related to the RTF output -#--------------------------------------------------------------------------- -GENERATE_RTF = NO -RTF_OUTPUT = rtf -COMPACT_RTF = NO -RTF_HYPERLINKS = NO -RTF_STYLESHEET_FILE = -RTF_EXTENSIONS_FILE = -RTF_SOURCE_CODE = NO -#--------------------------------------------------------------------------- -# Configuration options related to the man page output -#--------------------------------------------------------------------------- -GENERATE_MAN = NO -MAN_OUTPUT = man -MAN_EXTENSION = .3 -MAN_SUBDIR = -MAN_LINKS = NO -#--------------------------------------------------------------------------- -# Configuration options related to the XML output -#--------------------------------------------------------------------------- -GENERATE_XML = NO -XML_OUTPUT = xml -XML_PROGRAMLISTING = YES -#--------------------------------------------------------------------------- -# Configuration options related to the DOCBOOK output -#--------------------------------------------------------------------------- -GENERATE_DOCBOOK = NO -DOCBOOK_OUTPUT = docbook -DOCBOOK_PROGRAMLISTING = NO -#--------------------------------------------------------------------------- -# Configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- -GENERATE_AUTOGEN_DEF = NO -#--------------------------------------------------------------------------- -# Configuration options related to the Perl module output -#--------------------------------------------------------------------------- -GENERATE_PERLMOD = NO -PERLMOD_LATEX = NO -PERLMOD_PRETTY = YES -PERLMOD_MAKEVAR_PREFIX = -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- -ENABLE_PREPROCESSING = YES -MACRO_EXPANSION = NO -EXPAND_ONLY_PREDEF = NO -SEARCH_INCLUDES = YES -INCLUDE_PATH = -INCLUDE_FILE_PATTERNS = -PREDEFINED = -EXPAND_AS_DEFINED = -SKIP_FUNCTION_MACROS = YES -#--------------------------------------------------------------------------- -# Configuration options related to external references -#--------------------------------------------------------------------------- -TAGFILES = -GENERATE_TAGFILE = -ALLEXTERNALS = NO -EXTERNAL_GROUPS = YES -EXTERNAL_PAGES = YES -PERL_PATH = /usr/bin/perl -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- -CLASS_DIAGRAMS = YES -MSCGEN_PATH = -DIA_PATH = -HIDE_UNDOC_RELATIONS = YES -HAVE_DOT = NO -DOT_NUM_THREADS = 0 -DOT_FONTNAME = Helvetica -DOT_FONTSIZE = 10 -DOT_FONTPATH = -CLASS_GRAPH = YES -COLLABORATION_GRAPH = YES -GROUP_GRAPHS = YES -UML_LOOK = NO -UML_LIMIT_NUM_FIELDS = 10 -TEMPLATE_RELATIONS = NO -INCLUDE_GRAPH = YES -INCLUDED_BY_GRAPH = YES -CALL_GRAPH = NO -CALLER_GRAPH = NO -GRAPHICAL_HIERARCHY = YES -DIRECTORY_GRAPH = YES -DOT_IMAGE_FORMAT = png -INTERACTIVE_SVG = NO -DOT_PATH = -DOTFILE_DIRS = -MSCFILE_DIRS = -DIAFILE_DIRS = -PLANTUML_JAR_PATH = -PLANTUML_INCLUDE_PATH = -DOT_GRAPH_MAX_NODES = 50 -MAX_DOT_GRAPH_DEPTH = 0 -DOT_TRANSPARENT = NO -DOT_MULTI_TARGETS = NO -GENERATE_LEGEND = YES -DOT_CLEANUP = YES \ No newline at end of file diff --git a/doxygen.rb b/doxygen.rb deleted file mode 100755 index d692e9741..000000000 --- a/doxygen.rb +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env ruby - -file = ARGV[0] - -unless file - warn "Usage doxygen.rb FILE" - exit 1 -end - -text = File.read(file) - -# short array syntax -text.gsub!(/((var|public|protected|private)(\s+static)?)\s+(\$[^\s;=]+)\s+\=\s+\[([\s\S]*?)\]\;/, '\1 \4 = array(\5);') - -# class attribute typehints -text.gsub!(/\@(var|type)\s+([^\s]+)([^\/]+)\/\s+((var|public|protected|private)(\s+static)?)\s+(\$[^\s;=]+)/, '\3/ \4 \2 \7') - -# fix backslashes in docblocks -while text.gsub!(/(\s+\*.*?)(\s)\\([A-Z][a-zA-Z0-9_]*)/, '\1\2\3') -end -while text.gsub!(/(\s+\*.*?)([A-Z][a-zA-Z0-9_]*)\\/, '\1\2::') -end - -# method return typehints -text.gsub!(/(\/\*\*[\s\S]*?@return\s+([^\s]*)[\s\S]*?\*\/[\s\S]*?)((public|protected|private)(\s+static)?)?\s+function\s+([\S]*?)\s*?\(/, '\1 \3 \2 function \6(') -text.gsub!(/\@return/, '@retval') - -text.gsub!(/function_/, 'function') -text.gsub!(/Function_/, 'Function') -text.gsub!(/Float_/, 'Float') - -puts text diff --git a/ext/php_driver.c b/ext/php_driver.c index 26eea743a..077b2cbcf 100644 --- a/ext/php_driver.c +++ b/ext/php_driver.c @@ -25,6 +25,8 @@ #include #include +#include + #ifndef _WIN32 #include #else @@ -45,8 +47,8 @@ static uv_once_t log_once = UV_ONCE_INIT; static char *log_location = NULL; static uv_rwlock_t log_lock; -#if CURRENT_CPP_DRIVER_VERSION < CPP_DRIVER_VERSION(2, 6, 0) -#error C/C++ driver version 2.6.0 or greater required +#if CURRENT_CPP_DRIVER_VERSION < CPP_DRIVER_VERSION(2, 16, 0) +#error C/C++ driver version 2.16.0 or greater required #endif ZEND_DECLARE_MODULE_GLOBALS(php_driver) @@ -78,9 +80,7 @@ zend_module_entry php_driver_module_entry = { PHP_RINIT(php_driver), /* RINIT */ PHP_RSHUTDOWN(php_driver), /* RSHUTDOWN */ PHP_MINFO(php_driver), /* MINFO */ -#if ZEND_MODULE_API_NO >= 20010901 PHP_DRIVER_VERSION, -#endif PHP_MODULE_GLOBALS(php_driver), PHP_GINIT(php_driver), PHP_GSHUTDOWN(php_driver), @@ -181,7 +181,7 @@ static void php_driver_log(const CassLogMessage *message, void *data) { char log[MAXPATHLEN + 1]; - uint log_length = 0; + uint64_t log_length = 0; /* Making a copy here because location could be updated by a PHP thread. */ uv_rwlock_rdlock(&log_lock); @@ -324,34 +324,18 @@ throw_invalid_argument(zval *object, const char *expected_type TSRMLS_DC) { if (Z_TYPE_P(object) == IS_OBJECT) { -#if ZEND_MODULE_API_NO >= 20100525 const char* cls_name = NULL; -#else - char* cls_name = NULL; -#endif -#if PHP_MAJOR_VERSION >= 7 size_t cls_len; -#else - zend_uint cls_len; -#endif -#if PHP_MAJOR_VERSION >= 7 zend_string* str = Z_OBJ_HANDLER_P(object, get_class_name)(Z_OBJ_P(object) TSRMLS_CC); cls_name = str->val; - cls_len = str->len; -#else - Z_OBJ_HANDLER_P(object, get_class_name)(object, &cls_name, &cls_len, 0 TSRMLS_CC); -#endif + cls_len = str->len; if (cls_name) { zend_throw_exception_ex(php_driver_invalid_argument_exception_ce, 0 TSRMLS_CC, "%s must be %s, an instance of %.*s given", - object_name, expected_type, (int)cls_len, cls_name); -#if PHP_MAJOR_VERSION >= 7 + object_name, expected_type, (int) cls_len, cls_name); zend_string_release(str); -#else - efree((void*) cls_name); -#endif } else { zend_throw_exception_ex(php_driver_invalid_argument_exception_ce, 0 TSRMLS_CC, "%s must be %s, an instance of Unknown Class given", @@ -388,11 +372,7 @@ PHP_INI_MH(OnUpdateLogLevel) } else { php_error_docref(NULL TSRMLS_CC, E_NOTICE, PHP_DRIVER_NAME " | Unknown log level '%s', using 'ERROR'", -#if PHP_MAJOR_VERSION >= 7 ZSTR_VAL(new_value)); -#else - new_value); -#endif cass_log_set_level(CASS_LOG_ERROR); } } diff --git a/ext/php_driver.h b/ext/php_driver.h index f9821525d..541909192 100644 --- a/ext/php_driver.h +++ b/ext/php_driver.h @@ -42,8 +42,8 @@ typedef int pid_t; # define LL_FORMAT "%lld" #endif -#if PHP_VERSION_ID < 50600 -# error PHP 5.6.0 or later is required in order to build the driver +#if PHP_VERSION_ID < 80000 +#error PHP 8.0.0 or later is required in order to build the driver #endif #if PHP_MAJOR_VERSION >= 8 @@ -88,11 +88,6 @@ typedef int pid_t; # define PHP_FE_END { NULL, NULL, NULL, 0, 0 } #endif -#if ZEND_MODULE_API_NO < 20100525 -# define object_properties_init(value, class_entry) \ - zend_hash_copy(*value.properties, &class_entry->default_properties, (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval *)); -#endif - #define SAFE_STR(a) ((a)?a:"") #ifdef ZTS @@ -111,7 +106,6 @@ typedef int pid_t; #define CURRENT_CPP_DRIVER_VERSION \ CPP_DRIVER_VERSION(CASS_VERSION_MAJOR, CASS_VERSION_MINOR, CASS_VERSION_PATCH) -#if PHP_MAJOR_VERSION >= 7 #define php5to7_zend_register_internal_class_ex(ce, parent_ce) zend_register_internal_class_ex((ce), (parent_ce) TSRMLS_CC); typedef zval php5to7_zval; @@ -284,189 +278,6 @@ php5to7_string_compare(php5to7_string s1, php5to7_string s2) #define PHP5TO7_ZEND_LONG_MAX ZEND_LONG_MAX #define PHP5TO7_ZEND_LONG_MIN ZEND_LONG_MIN -#else -typedef zval *php5to7_zval; -typedef zval ***php5to7_zval_args; -typedef char *php5to7_string; -typedef long php5to7_long; -typedef ulong php5to7_ulong; -typedef zend_rsrc_list_entry php5to7_zend_resource_le; -typedef zend_rsrc_list_entry *php5to7_zend_resource; -typedef zend_object_value php5to7_zend_object; -typedef void php5to7_zend_object_free; -typedef zval ***php5to7_zval_gc; -typedef void **php5to7_dtor; -typedef int php5to7_size; - -static inline int -php5to7_string_compare(php5to7_string s1, php5to7_string s2) -{ - return strcmp(s1, s2); -} - -#define PHP5TO7_ZEND_OBJECT_GET(type_name, object) \ - (php_driver_##type_name *) object - -#define Z_RES_P(zv) (zv) -#define Z_RES(zv) (&(zv)) -#define Z_TRY_ADDREF_P(zv) Z_ADDREF_P(zv) - -#define PHP5TO7_SMART_STR_INIT { NULL, 0, 0 } -#define PHP5TO7_SMART_STR_VAL(ss) (ss).c -#define PHP5TO7_SMART_STR_LEN(ss) (ss).len - -#define PHP5TO7_STRCMP(s, c) strcmp((s), (c)) -#define PHP5TO7_STRVAL(s) (s) - -#define PHP5TO7_ZEND_ACC_FINAL ZEND_ACC_FINAL_CLASS - -#define PHP5TO7_ZEND_OBJECT_ECALLOC(type_name, ce) (php_driver_##type_name *) \ - ecalloc(1, sizeof(php_driver_##type_name)) - -#define PHP5TO7_ZEND_OBJECT_INIT(type_name, self, ce) \ - PHP5TO7_ZEND_OBJECT_INIT_EX(type_name, type_name, self, ce) - -#define PHP5TO7_ZEND_OBJECT_INIT_EX(type_name, name, self, ce) do { \ - zend_object_value retval; \ - zend_object_std_init(&self->zval, ce TSRMLS_CC); \ - object_properties_init(&self->zval, ce); \ - retval.handle = zend_objects_store_put(self, \ - (zend_objects_store_dtor_t) zend_objects_destroy_object, \ - php_driver_##name##_free, NULL TSRMLS_CC); \ - retval.handlers = (zend_object_handlers *) &php_driver_##name##_handlers; \ - return retval; \ -} while(0) - -#define PHP5TO7_MAYBE_EFREE(p) efree(p) - -#define PHP5TO7_ADD_ASSOC_ZVAL_EX(zv, key, len, val) \ - add_assoc_zval_ex((zv), (key), (uint)(len), val) - -#define PHP5TO7_ADD_ASSOC_STRINGL_EX(zv, key, key_len, str, str_len) \ - add_assoc_stringl_ex((zv), (key), (uint)(key_len), (char*)(str), (uint)(str_len), 1) - -#define PHP5TO7_ADD_NEXT_INDEX_STRING(zv, str) \ - add_next_index_string((zv), (char*)(str), 1); - -#define PHP5TO7_ZEND_HASH_FOREACH_VAL(ht, _val) do { \ - HashPosition _pos; \ - zend_hash_internal_pointer_reset_ex((ht), &_pos); \ - while (zend_hash_get_current_data_ex((ht), (void **)&(_val), &_pos) == SUCCESS) { - -#define PHP5TO7_ZEND_HASH_FOREACH_KEY_VAL(ht, _h, _key, _key_len, _val) \ - PHP5TO7_ZEND_HASH_FOREACH_VAL(ht, _val) \ - (_key) = NULL; \ - zend_hash_get_current_key_ex((ht), &(_key), &(_key_len), &(_h), 0, &_pos); - -#define PHP5TO7_ZEND_HASH_FOREACH_NUM_KEY_VAL(ht, _h, _val) \ - PHP5TO7_ZEND_HASH_FOREACH_VAL(ht, _val) \ - char *_key; \ - uint _len; \ - zend_hash_get_current_key_ex((ht), &_key, &_len, &(_h), 0, &_pos); - -#define PHP5TO7_ZEND_HASH_FOREACH_STR_KEY_VAL(ht, _key, _val) \ - PHP5TO7_ZEND_HASH_FOREACH_VAL(ht, _val) \ - ulong _h; \ - (_key) = NULL; \ - zend_hash_get_current_key_ex((ht), &(_key), NULL, &_h, 0, &_pos); - -#define PHP5TO7_ZEND_HASH_FOREACH_END(ht) \ - zend_hash_move_forward_ex((ht), &_pos); \ - } \ - } while(0) - -#define PHP5TO7_ZEND_HASH_GET_CURRENT_DATA(ht, res) \ - (zend_hash_get_current_data((ht), (void **) &(res)) == SUCCESS) - -#define PHP5TO7_ZEND_HASH_GET_CURRENT_DATA_EX(ht, res, pos) \ - (zend_hash_get_current_data_ex((ht), (void **) &(res), (pos)) == SUCCESS) - -#define PHP5TO7_ZEND_HASH_GET_CURRENT_KEY(ht, str_index, num_index) \ - zend_hash_get_current_key((ht), (str_index), (num_index), 0) - -#define PHP5TO7_ZEND_HASH_GET_CURRENT_KEY_EX(ht, str_index, num_index, pos) \ - zend_hash_get_current_key_ex((ht), (str_index), NULL, (num_index), 0, pos) - -#define PHP5TO7_ZEND_HASH_EXISTS(ht, key, len) \ - zend_hash_exists((ht), (key), (len)) - -#define PHP5TO7_ZEND_HASH_FIND(ht, key, len, res) \ - (zend_hash_find((ht), (key), (uint)(len), (void **)&(res)) == SUCCESS) - -#define PHP5TO7_ZEND_HASH_INDEX_FIND(ht, index, res) \ - (zend_hash_index_find((ht), (php5to7_ulong) (index), (void **) &res) == SUCCESS) - -#define PHP5TO7_ZEND_HASH_NEXT_INDEX_INSERT(ht, val, val_size) \ - ((void) zend_hash_next_index_insert((ht), (void*) &(val), (uint) (val_size), NULL)) - -#define PHP5TO7_ZEND_HASH_UPDATE(ht, key, len, val, val_size) \ - ((void) zend_hash_update((ht), (key), (uint)(len), (void *) &(val), (uint)(val_size), NULL)) - -#define PHP5TO7_ZEND_HASH_INDEX_UPDATE(ht, index, val, val_size) \ - ((void) zend_hash_index_update((ht), (index), (void *) &(val), (uint)(val_size), NULL)) - -#define PHP5TO7_ZEND_HASH_ADD(ht, key, len, val, val_size) \ - ((void) zend_hash_add((ht), (key), (len), (void *) &(val), (uint)(val_size), NULL)) - -#define PHP5TO7_ZEND_HASH_DEL(ht, key, len) \ - ((zend_hash_del((ht), (key), (uint)(len))) == SUCCESS) - -#define PHP5TO7_ZEND_HASH_ZVAL_COPY(dst, src) do { \ - zval *_tmp; \ - zend_hash_copy((dst), (src), \ - (copy_ctor_func_t) zval_add_ref, \ - (void *) &_tmp, sizeof(zval *)); \ -} while (0) - -#define PHP5TO7_ZEND_HASH_SORT(ht, compare_func, renumber) \ - zend_hash_sort(ht, zend_qsort, compare_func, renumber TSRMLS_CC); - -#define php5to7_zend_register_internal_class_ex(ce, parent_ce) zend_register_internal_class_ex((ce), (parent_ce), NULL TSRMLS_CC); - -#define PHP5TO7_ZVAL_COPY(zv1, zv2) do { \ - zv1 = zv2; \ - if(zv1) Z_TRY_ADDREF_P(zv1); \ -} while(0) - -#define PHP5TO7_ZVAL_IS_UNDEF(zv) ((zv) == NULL) -#define PHP5TO7_ZVAL_IS_UNDEF_P(zv) ((zv) == NULL) -#define PHP5TO7_ZVAL_IS_BOOL_P(zv) (Z_TYPE_P(zv) == IS_BOOL) -#define PHP5TO7_ZVAL_IS_FALSE_P(zv) (Z_TYPE_P(zv) == IS_BOOL && !Z_BVAL_P(zv)) -#define PHP5TO7_ZVAL_IS_TRUE_P(zv) (Z_TYPE_P(zv) == IS_BOOL && Z_BVAL_P(zv)) - -#define PHP5TO7_ZVAL_UNDEF(zv) (zv) = NULL; -#define PHP5TO7_ZVAL_MAYBE_MAKE(zv) MAKE_STD_ZVAL(zv) -#define PHP5TO7_ZVAL_MAYBE_DESTROY(zv) do { \ - if ((zv) != NULL) { \ - zval_ptr_dtor(&(zv)); \ - (zv) = NULL; \ - } \ -} while(0) - -#define PHP5TO7_ZVAL_STRING(zv, s) ZVAL_STRING(zv, s, 1) -#define PHP5TO7_ZVAL_STRINGL(zv, s, len) ZVAL_STRINGL(zv, s, len, 1) -#define PHP5TO7_RETVAL_STRING(s) RETVAL_STRING(s, 1) -#define PHP5TO7_RETURN_STRING(s) RETURN_STRING(s, 1) -#define PHP5TO7_RETVAL_STRINGL(s, len) RETVAL_STRINGL(s, len, 1) -#define PHP5TO7_RETURN_STRINGL(s, len) RETURN_STRINGL(s, len, 1) - -#define PHP5TO7_ZVAL_ARG(zv) *(zv) -#define PHP5TO7_ZVAL_MAYBE_DEREF(zv) *(zv) -#define PHP5TO7_ZVAL_MAYBE_ADDR_OF(zv) &(zv) -#define PHP5TO7_ZVAL_MAYBE_P(zv) (zv) -#define PHP5TO7_Z_TYPE_MAYBE_P(zv) Z_TYPE_P(zv) -#define PHP5TO7_Z_ARRVAL_MAYBE_P(zv) Z_ARRVAL_P(zv) -#define PHP5TO7_Z_OBJCE_MAYBE_P(zv) Z_OBJCE_P(zv) -#define PHP5TO7_Z_LVAL_MAYBE_P(zv) Z_LVAL_P(zv) -#define PHP5TO7_Z_DVAL_MAYBE_P(zv) Z_DVAL_P(zv) -#define PHP5TO7_Z_STRVAL_MAYBE_P(zv) Z_STRVAL_P(zv) -#define PHP5TO7_Z_STRLEN_MAYBE_P(zv) Z_STRLEN_P(zv) - -#define PHP5TO7_ZEND_LONG_MAX LONG_MAX -#define PHP5TO7_ZEND_LONG_MIN LONG_MIN - -#endif /* PHP_MAJOR_VERSION >= 7 */ - extern zend_module_entry php_driver_module_entry; #define phpext_cassandra_ptr &php_driver_module_entry diff --git a/ext/php_driver_types.h b/ext/php_driver_types.h index d6d255739..c5333fa22 100644 --- a/ext/php_driver_types.h +++ b/ext/php_driver_types.h @@ -17,102 +17,54 @@ #ifndef PHP_DRIVER_TYPES_H #define PHP_DRIVER_TYPES_H -#if PHP_MAJOR_VERSION >= 7 #define PHP_DRIVER_BEGIN_OBJECT_TYPE(type_name) \ typedef struct php_driver_##type_name##_ { - -#define PHP_DRIVER_END_OBJECT_TYPE(type_name) \ - zend_object zval; \ - } php_driver_##type_name; \ - static inline php_driver_##type_name *php_driver_##type_name##_object_fetch(zend_object *obj) { \ - return (php_driver_##type_name *)((char *)obj - XtOffsetOf(php_driver_##type_name, zval)); \ +#define PHP_DRIVER_END_OBJECT_TYPE(type_name) \ + zend_object zval; \ + } \ + php_driver_##type_name; \ + static inline php_driver_##type_name* php_driver_##type_name##_object_fetch(zend_object* obj) \ + { \ + return (php_driver_##type_name*) ((char*) obj - XtOffsetOf(php_driver_##type_name, zval)); \ } -#else -#define PHP_DRIVER_BEGIN_OBJECT_TYPE(type_name) \ - typedef struct php_driver_##type_name##_ { \ - zend_object zval; - -#define PHP_DRIVER_END_OBJECT_TYPE(type_name) \ - } php_driver_##type_name; -#endif - -#if PHP_MAJOR_VERSION >= 7 - #define PHP_DRIVER_GET_NUMERIC(obj) php_driver_numeric_object_fetch(Z_OBJ_P(obj)) - #define PHP_DRIVER_GET_BLOB(obj) php_driver_blob_object_fetch(Z_OBJ_P(obj)) - #define PHP_DRIVER_GET_TIMESTAMP(obj) php_driver_timestamp_object_fetch(Z_OBJ_P(obj)) - #define PHP_DRIVER_GET_DATE(obj) php_driver_date_object_fetch(Z_OBJ_P(obj)) - #define PHP_DRIVER_GET_TIME(obj) php_driver_time_object_fetch(Z_OBJ_P(obj)) - #define PHP_DRIVER_GET_UUID(obj) php_driver_uuid_object_fetch(Z_OBJ_P(obj)) - #define PHP_DRIVER_GET_INET(obj) php_driver_inet_object_fetch(Z_OBJ_P(obj)) - #define PHP_DRIVER_GET_COLLECTION(obj) php_driver_collection_object_fetch(Z_OBJ_P(obj)) - #define PHP_DRIVER_GET_MAP(obj) php_driver_map_object_fetch(Z_OBJ_P(obj)) - #define PHP_DRIVER_GET_SET(obj) php_driver_set_object_fetch(Z_OBJ_P(obj)) - #define PHP_DRIVER_GET_TUPLE(obj) php_driver_tuple_object_fetch(Z_OBJ_P(obj)) - #define PHP_DRIVER_GET_USER_TYPE_VALUE(obj) php_driver_user_type_value_object_fetch(Z_OBJ_P(obj)) - #define PHP_DRIVER_GET_CLUSTER(obj) php_driver_cluster_object_fetch(Z_OBJ_P(obj)) - #define PHP_DRIVER_GET_STATEMENT(obj) php_driver_statement_object_fetch(Z_OBJ_P(obj)) - #define PHP_DRIVER_GET_EXECUTION_OPTIONS(obj) php_driver_execution_options_object_fetch(Z_OBJ_P(obj)) - #define PHP_DRIVER_GET_ROWS(obj) php_driver_rows_object_fetch(Z_OBJ_P(obj)) - #define PHP_DRIVER_GET_FUTURE_ROWS(obj) php_driver_future_rows_object_fetch(Z_OBJ_P(obj)) - #define PHP_DRIVER_GET_CLUSTER_BUILDER(obj) php_driver_cluster_builder_object_fetch(Z_OBJ_P(obj)) - #define PHP_DRIVER_GET_FUTURE_PREPARED_STATEMENT(obj) php_driver_future_prepared_statement_object_fetch(Z_OBJ_P(obj)) - #define PHP_DRIVER_GET_FUTURE_VALUE(obj) php_driver_future_value_object_fetch(Z_OBJ_P(obj)) - #define PHP_DRIVER_GET_FUTURE_CLOSE(obj) php_driver_future_close_object_fetch(Z_OBJ_P(obj)) - #define PHP_DRIVER_GET_FUTURE_SESSION(obj) php_driver_future_session_object_fetch(Z_OBJ_P(obj)) - #define PHP_DRIVER_GET_SESSION(obj) php_driver_session_object_fetch(Z_OBJ_P(obj)) - #define PHP_DRIVER_GET_SSL(obj) php_driver_ssl_object_fetch(Z_OBJ_P(obj)) - #define PHP_DRIVER_GET_SSL_BUILDER(obj) php_driver_ssl_builder_object_fetch(Z_OBJ_P(obj)) - #define PHP_DRIVER_GET_SCHEMA(obj) php_driver_schema_object_fetch(Z_OBJ_P(obj)) - #define PHP_DRIVER_GET_KEYSPACE(obj) php_driver_keyspace_object_fetch(Z_OBJ_P(obj)) - #define PHP_DRIVER_GET_TABLE(obj) php_driver_table_object_fetch(Z_OBJ_P(obj)) - #define PHP_DRIVER_GET_COLUMN(obj) php_driver_column_object_fetch(Z_OBJ_P(obj)) - #define PHP_DRIVER_GET_INDEX(obj) php_driver_index_object_fetch(Z_OBJ_P(obj)) - #define PHP_DRIVER_GET_MATERIALIZED_VIEW(obj) php_driver_materialized_view_object_fetch(Z_OBJ_P(obj)) - #define PHP_DRIVER_GET_FUNCTION(obj) php_driver_function_object_fetch(Z_OBJ_P(obj)) - #define PHP_DRIVER_GET_AGGREGATE(obj) php_driver_aggregate_object_fetch(Z_OBJ_P(obj)) - #define PHP_DRIVER_GET_TYPE(obj) php_driver_type_object_fetch(Z_OBJ_P(obj)) - #define PHP_DRIVER_GET_RETRY_POLICY(obj) php_driver_retry_policy_object_fetch(Z_OBJ_P(obj)) - #define PHP_DRIVER_GET_TIMESTAMP_GEN(obj) php_driver_timestamp_gen_object_fetch(Z_OBJ_P(obj)) - #define PHP_DRIVER_GET_DURATION(obj) php_driver_duration_object_fetch(Z_OBJ_P(obj)) -#else - #define PHP_DRIVER_GET_NUMERIC(obj) ((php_driver_numeric *)zend_object_store_get_object((obj) TSRMLS_CC)) - #define PHP_DRIVER_GET_BLOB(obj) ((php_driver_blob *)zend_object_store_get_object((obj) TSRMLS_CC)) - #define PHP_DRIVER_GET_TIMESTAMP(obj) ((php_driver_timestamp *)zend_object_store_get_object((obj) TSRMLS_CC)) - #define PHP_DRIVER_GET_DATE(obj) ((php_driver_date *)zend_object_store_get_object((obj) TSRMLS_CC)) - #define PHP_DRIVER_GET_TIME(obj) ((php_driver_time *)zend_object_store_get_object((obj) TSRMLS_CC)) - #define PHP_DRIVER_GET_UUID(obj) ((php_driver_uuid *)zend_object_store_get_object((obj) TSRMLS_CC)) - #define PHP_DRIVER_GET_INET(obj) ((php_driver_inet *)zend_object_store_get_object((obj) TSRMLS_CC)) - #define PHP_DRIVER_GET_COLLECTION(obj) ((php_driver_collection *)zend_object_store_get_object((obj) TSRMLS_CC)) - #define PHP_DRIVER_GET_MAP(obj) ((php_driver_map *)zend_object_store_get_object((obj) TSRMLS_CC)) - #define PHP_DRIVER_GET_SET(obj) ((php_driver_set *)zend_object_store_get_object((obj) TSRMLS_CC)) - #define PHP_DRIVER_GET_TUPLE(obj) ((php_driver_tuple *)zend_object_store_get_object((obj) TSRMLS_CC)) - #define PHP_DRIVER_GET_USER_TYPE_VALUE(obj) ((php_driver_user_type_value *)zend_object_store_get_object((obj) TSRMLS_CC)) - #define PHP_DRIVER_GET_CLUSTER(obj) ((php_driver_cluster *)zend_object_store_get_object((obj) TSRMLS_CC)) - #define PHP_DRIVER_GET_STATEMENT(obj) ((php_driver_statement *)zend_object_store_get_object((obj) TSRMLS_CC)) - #define PHP_DRIVER_GET_EXECUTION_OPTIONS(obj) ((php_driver_execution_options *)zend_object_store_get_object((obj) TSRMLS_CC)) - #define PHP_DRIVER_GET_ROWS(obj) ((php_driver_rows *)zend_object_store_get_object((obj) TSRMLS_CC)) - #define PHP_DRIVER_GET_FUTURE_ROWS(obj) ((php_driver_future_rows *)zend_object_store_get_object((obj) TSRMLS_CC)) - #define PHP_DRIVER_GET_CLUSTER_BUILDER(obj) ((php_driver_cluster_builder *)zend_object_store_get_object((obj) TSRMLS_CC)) - #define PHP_DRIVER_GET_FUTURE_PREPARED_STATEMENT(obj) ((php_driver_future_prepared_statement *)zend_object_store_get_object((obj) TSRMLS_CC)) - #define PHP_DRIVER_GET_FUTURE_VALUE(obj) ((php_driver_future_value *)zend_object_store_get_object((obj) TSRMLS_CC)) - #define PHP_DRIVER_GET_FUTURE_CLOSE(obj) ((php_driver_future_close *)zend_object_store_get_object((obj) TSRMLS_CC)) - #define PHP_DRIVER_GET_FUTURE_SESSION(obj) ((php_driver_future_session *)zend_object_store_get_object((obj) TSRMLS_CC)) - #define PHP_DRIVER_GET_SESSION(obj) ((php_driver_session *)zend_object_store_get_object((obj) TSRMLS_CC)) - #define PHP_DRIVER_GET_SSL(obj) ((php_driver_ssl *)zend_object_store_get_object((obj) TSRMLS_CC)) - #define PHP_DRIVER_GET_SSL_BUILDER(obj) ((php_driver_ssl_builder *)zend_object_store_get_object((obj) TSRMLS_CC)) - #define PHP_DRIVER_GET_SCHEMA(obj) ((php_driver_schema *)zend_object_store_get_object((obj) TSRMLS_CC)) - #define PHP_DRIVER_GET_KEYSPACE(obj) ((php_driver_keyspace *)zend_object_store_get_object((obj) TSRMLS_CC)) - #define PHP_DRIVER_GET_TABLE(obj) ((php_driver_table *)zend_object_store_get_object((obj) TSRMLS_CC)) - #define PHP_DRIVER_GET_COLUMN(obj) ((php_driver_column *)zend_object_store_get_object((obj) TSRMLS_CC)) - #define PHP_DRIVER_GET_INDEX(obj) ((php_driver_index *)zend_object_store_get_object((obj) TSRMLS_CC)) - #define PHP_DRIVER_GET_MATERIALIZED_VIEW(obj) ((php_driver_materialized_view *)zend_object_store_get_object((obj) TSRMLS_CC)) - #define PHP_DRIVER_GET_FUNCTION(obj) ((php_driver_function *)zend_object_store_get_object((obj) TSRMLS_CC)) - #define PHP_DRIVER_GET_AGGREGATE(obj) ((php_driver_aggregate *)zend_object_store_get_object((obj) TSRMLS_CC)) - #define PHP_DRIVER_GET_TYPE(obj) ((php_driver_type *)zend_object_store_get_object((obj) TSRMLS_CC)) - #define PHP_DRIVER_GET_RETRY_POLICY(obj) ((php_driver_retry_policy *)zend_object_store_get_object((obj) TSRMLS_CC)) - #define PHP_DRIVER_GET_TIMESTAMP_GEN(obj) ((php_driver_timestamp_gen *)zend_object_store_get_object((obj) TSRMLS_CC)) - #define PHP_DRIVER_GET_DURATION(obj) ((php_driver_duration *)zend_object_store_get_object((obj) TSRMLS_CC)) -#endif + +#define PHP_DRIVER_GET_NUMERIC(obj) php_driver_numeric_object_fetch(Z_OBJ_P(obj)) +#define PHP_DRIVER_GET_BLOB(obj) php_driver_blob_object_fetch(Z_OBJ_P(obj)) +#define PHP_DRIVER_GET_TIMESTAMP(obj) php_driver_timestamp_object_fetch(Z_OBJ_P(obj)) +#define PHP_DRIVER_GET_DATE(obj) php_driver_date_object_fetch(Z_OBJ_P(obj)) +#define PHP_DRIVER_GET_TIME(obj) php_driver_time_object_fetch(Z_OBJ_P(obj)) +#define PHP_DRIVER_GET_UUID(obj) php_driver_uuid_object_fetch(Z_OBJ_P(obj)) +#define PHP_DRIVER_GET_INET(obj) php_driver_inet_object_fetch(Z_OBJ_P(obj)) +#define PHP_DRIVER_GET_COLLECTION(obj) php_driver_collection_object_fetch(Z_OBJ_P(obj)) +#define PHP_DRIVER_GET_MAP(obj) php_driver_map_object_fetch(Z_OBJ_P(obj)) +#define PHP_DRIVER_GET_SET(obj) php_driver_set_object_fetch(Z_OBJ_P(obj)) +#define PHP_DRIVER_GET_TUPLE(obj) php_driver_tuple_object_fetch(Z_OBJ_P(obj)) +#define PHP_DRIVER_GET_USER_TYPE_VALUE(obj) php_driver_user_type_value_object_fetch(Z_OBJ_P(obj)) +#define PHP_DRIVER_GET_CLUSTER(obj) php_driver_cluster_object_fetch(Z_OBJ_P(obj)) +#define PHP_DRIVER_GET_STATEMENT(obj) php_driver_statement_object_fetch(Z_OBJ_P(obj)) +#define PHP_DRIVER_GET_EXECUTION_OPTIONS(obj) php_driver_execution_options_object_fetch(Z_OBJ_P(obj)) +#define PHP_DRIVER_GET_ROWS(obj) php_driver_rows_object_fetch(Z_OBJ_P(obj)) +#define PHP_DRIVER_GET_FUTURE_ROWS(obj) php_driver_future_rows_object_fetch(Z_OBJ_P(obj)) +#define PHP_DRIVER_GET_CLUSTER_BUILDER(obj) php_driver_cluster_builder_object_fetch(Z_OBJ_P(obj)) +#define PHP_DRIVER_GET_FUTURE_PREPARED_STATEMENT(obj) php_driver_future_prepared_statement_object_fetch(Z_OBJ_P(obj)) +#define PHP_DRIVER_GET_FUTURE_VALUE(obj) php_driver_future_value_object_fetch(Z_OBJ_P(obj)) +#define PHP_DRIVER_GET_FUTURE_CLOSE(obj) php_driver_future_close_object_fetch(Z_OBJ_P(obj)) +#define PHP_DRIVER_GET_FUTURE_SESSION(obj) php_driver_future_session_object_fetch(Z_OBJ_P(obj)) +#define PHP_DRIVER_GET_SESSION(obj) php_driver_session_object_fetch(Z_OBJ_P(obj)) +#define PHP_DRIVER_GET_SSL(obj) php_driver_ssl_object_fetch(Z_OBJ_P(obj)) +#define PHP_DRIVER_GET_SSL_BUILDER(obj) php_driver_ssl_builder_object_fetch(Z_OBJ_P(obj)) +#define PHP_DRIVER_GET_SCHEMA(obj) php_driver_schema_object_fetch(Z_OBJ_P(obj)) +#define PHP_DRIVER_GET_KEYSPACE(obj) php_driver_keyspace_object_fetch(Z_OBJ_P(obj)) +#define PHP_DRIVER_GET_TABLE(obj) php_driver_table_object_fetch(Z_OBJ_P(obj)) +#define PHP_DRIVER_GET_COLUMN(obj) php_driver_column_object_fetch(Z_OBJ_P(obj)) +#define PHP_DRIVER_GET_INDEX(obj) php_driver_index_object_fetch(Z_OBJ_P(obj)) +#define PHP_DRIVER_GET_MATERIALIZED_VIEW(obj) php_driver_materialized_view_object_fetch(Z_OBJ_P(obj)) +#define PHP_DRIVER_GET_FUNCTION(obj) php_driver_function_object_fetch(Z_OBJ_P(obj)) +#define PHP_DRIVER_GET_AGGREGATE(obj) php_driver_aggregate_object_fetch(Z_OBJ_P(obj)) +#define PHP_DRIVER_GET_TYPE(obj) php_driver_type_object_fetch(Z_OBJ_P(obj)) +#define PHP_DRIVER_GET_RETRY_POLICY(obj) php_driver_retry_policy_object_fetch(Z_OBJ_P(obj)) +#define PHP_DRIVER_GET_TIMESTAMP_GEN(obj) php_driver_timestamp_gen_object_fetch(Z_OBJ_P(obj)) +#define PHP_DRIVER_GET_DURATION(obj) php_driver_duration_object_fetch(Z_OBJ_P(obj)) typedef enum { PHP_DRIVER_BIGINT, @@ -124,116 +76,116 @@ typedef enum { } php_driver_numeric_type; PHP_DRIVER_BEGIN_OBJECT_TYPE(numeric) - php_driver_numeric_type type; - union { - struct { - cass_int8_t value; - } tinyint; - struct { - cass_int16_t value; - } smallint; - struct { - cass_int64_t value; - } bigint; - struct { - cass_float_t value; - } floating; - struct { - mpz_t value; - } varint; - struct { - mpz_t value; - long scale; - } decimal; - } data; +php_driver_numeric_type type; +union { + struct { + cass_int8_t value; + } tinyint; + struct { + cass_int16_t value; + } smallint; + struct { + cass_int64_t value; + } bigint; + struct { + cass_float_t value; + } floating; + struct { + mpz_t value; + } varint; + struct { + mpz_t value; + long scale; + } decimal; +} data; PHP_DRIVER_END_OBJECT_TYPE(numeric) PHP_DRIVER_BEGIN_OBJECT_TYPE(timestamp) - cass_int64_t timestamp; +cass_int64_t timestamp; PHP_DRIVER_END_OBJECT_TYPE(timestamp) PHP_DRIVER_BEGIN_OBJECT_TYPE(date) - cass_uint32_t date; +cass_uint32_t date; PHP_DRIVER_END_OBJECT_TYPE(date) PHP_DRIVER_BEGIN_OBJECT_TYPE(time) - cass_int64_t time; +cass_int64_t time; PHP_DRIVER_END_OBJECT_TYPE(time) PHP_DRIVER_BEGIN_OBJECT_TYPE(blob) - cass_byte_t *data; - size_t size; +cass_byte_t* data; +size_t size; PHP_DRIVER_END_OBJECT_TYPE(blob) PHP_DRIVER_BEGIN_OBJECT_TYPE(uuid) - CassUuid uuid; +CassUuid uuid; PHP_DRIVER_END_OBJECT_TYPE(uuid) PHP_DRIVER_BEGIN_OBJECT_TYPE(inet) - CassInet inet; +CassInet inet; PHP_DRIVER_END_OBJECT_TYPE(inet) PHP_DRIVER_BEGIN_OBJECT_TYPE(duration) - cass_int32_t months; - cass_int32_t days; - cass_int64_t nanos; +cass_int32_t months; +cass_int32_t days; +cass_int64_t nanos; PHP_DRIVER_END_OBJECT_TYPE(duration) PHP_DRIVER_BEGIN_OBJECT_TYPE(collection) - php5to7_zval type; - HashTable values; - unsigned hashv; - int dirty; +php5to7_zval type; +HashTable values; +unsigned hashv; +int dirty; PHP_DRIVER_END_OBJECT_TYPE(collection) typedef struct php_driver_map_entry_ php_driver_map_entry; PHP_DRIVER_BEGIN_OBJECT_TYPE(map) - php5to7_zval type; - php_driver_map_entry *entries; - unsigned hashv; - int dirty; - php_driver_map_entry *iter_curr; - php_driver_map_entry *iter_temp; +php5to7_zval type; +php_driver_map_entry* entries; +unsigned hashv; +int dirty; +php_driver_map_entry* iter_curr; +php_driver_map_entry* iter_temp; PHP_DRIVER_END_OBJECT_TYPE(map) typedef struct php_driver_set_entry_ php_driver_set_entry; PHP_DRIVER_BEGIN_OBJECT_TYPE(set) - php5to7_zval type; - php_driver_set_entry *entries; - unsigned hashv; - int dirty; - php_driver_set_entry *iter_curr; - php_driver_set_entry *iter_temp; - int iter_index; +php5to7_zval type; +php_driver_set_entry* entries; +unsigned hashv; +int dirty; +php_driver_set_entry* iter_curr; +php_driver_set_entry* iter_temp; +int iter_index; PHP_DRIVER_END_OBJECT_TYPE(set) PHP_DRIVER_BEGIN_OBJECT_TYPE(tuple) - php5to7_zval type; - HashTable values; - HashPosition pos; - unsigned hashv; - int dirty; +php5to7_zval type; +HashTable values; +HashPosition pos; +unsigned hashv; +int dirty; PHP_DRIVER_END_OBJECT_TYPE(tuple) PHP_DRIVER_BEGIN_OBJECT_TYPE(user_type_value) - php5to7_zval type; - HashTable values; - HashPosition pos; - unsigned hashv; - int dirty; +php5to7_zval type; +HashTable values; +HashPosition pos; +unsigned hashv; +int dirty; PHP_DRIVER_END_OBJECT_TYPE(user_type_value) PHP_DRIVER_BEGIN_OBJECT_TYPE(cluster) - cass_byte_t *data; - CassCluster *cluster; - long default_consistency; - int default_page_size; - php5to7_zval default_timeout; - cass_bool_t persist; - char *hash_key; - int hash_key_len; +cass_byte_t* data; +CassCluster* cluster; +long default_consistency; +int default_page_size; +php5to7_zval default_timeout; +cass_bool_t persist; +char* hash_key; +int hash_key_len; PHP_DRIVER_END_OBJECT_TYPE(cluster) typedef enum { @@ -243,19 +195,19 @@ typedef enum { } php_driver_statement_type; PHP_DRIVER_BEGIN_OBJECT_TYPE(statement) - php_driver_statement_type type; - union { - struct { - char *cql; - } simple; - struct { - const CassPrepared *prepared; - } prepared; - struct { - CassBatchType type; - HashTable statements; - } batch; - } data; +php_driver_statement_type type; +union { + struct { + char* cql; + } simple; + struct { + const CassPrepared* prepared; + } prepared; + struct { + CassBatchType type; + HashTable statements; + } batch; +} data; PHP_DRIVER_END_OBJECT_TYPE(statement) typedef struct { @@ -264,15 +216,15 @@ typedef struct { } php_driver_batch_statement_entry; PHP_DRIVER_BEGIN_OBJECT_TYPE(execution_options) - long consistency; - long serial_consistency; - int page_size; - char *paging_state_token; - size_t paging_state_token_size; - php5to7_zval timeout; - php5to7_zval arguments; - php5to7_zval retry_policy; - cass_int64_t timestamp; +long consistency; +long serial_consistency; +int page_size; +char* paging_state_token; +size_t paging_state_token_size; +php5to7_zval timeout; +php5to7_zval arguments; +php5to7_zval retry_policy; +cass_int64_t timestamp; PHP_DRIVER_END_OBJECT_TYPE(execution_options) typedef enum { @@ -281,270 +233,270 @@ typedef enum { LOAD_BALANCING_DC_AWARE_ROUND_ROBIN } php_driver_load_balancing; -typedef void (*php_driver_free_function)(void *data); +typedef void (*php_driver_free_function)(void* data); typedef struct { - size_t count; + size_t count; php_driver_free_function destruct; - void *data; + void* data; } php_driver_ref; PHP_DRIVER_BEGIN_OBJECT_TYPE(rows) - php_driver_ref *statement; - php_driver_ref *session; - php5to7_zval rows; - php5to7_zval next_rows; - php_driver_ref *result; - php_driver_ref *next_result; - php5to7_zval future_next_page; +php_driver_ref* statement; +php_driver_ref* session; +php5to7_zval rows; +php5to7_zval next_rows; +php_driver_ref* result; +php_driver_ref* next_result; +php5to7_zval future_next_page; PHP_DRIVER_END_OBJECT_TYPE(rows) PHP_DRIVER_BEGIN_OBJECT_TYPE(future_rows) - php_driver_ref *statement; - php_driver_ref *session; - php5to7_zval rows; - php_driver_ref *result; - CassFuture *future; +php_driver_ref* statement; +php_driver_ref* session; +php5to7_zval rows; +php_driver_ref* result; +CassFuture* future; PHP_DRIVER_END_OBJECT_TYPE(future_rows) PHP_DRIVER_BEGIN_OBJECT_TYPE(cluster_builder) - char *contact_points; - int port; - php_driver_load_balancing load_balancing_policy; - char *local_dc; - unsigned int used_hosts_per_remote_dc; - cass_bool_t allow_remote_dcs_for_local_cl; - cass_bool_t use_token_aware_routing; - char *username; - char *password; - unsigned int connect_timeout; - unsigned int request_timeout; - php5to7_zval ssl_options; - long default_consistency; - int default_page_size; - php5to7_zval default_timeout; - cass_bool_t persist; - int protocol_version; - int io_threads; - int core_connections_per_host; - int max_connections_per_host; - unsigned int reconnect_interval; - cass_bool_t enable_latency_aware_routing; - cass_bool_t enable_tcp_nodelay; - cass_bool_t enable_tcp_keepalive; - unsigned int tcp_keepalive_delay; - php5to7_zval retry_policy; - php5to7_zval timestamp_gen; - cass_bool_t enable_schema; - char *blacklist_hosts; - char *whitelist_hosts; - char *blacklist_dcs; - char *whitelist_dcs; - cass_bool_t enable_hostname_resolution; - cass_bool_t enable_randomized_contact_points; - unsigned int connection_heartbeat_interval; +char* contact_points; +int port; +php_driver_load_balancing load_balancing_policy; +char* local_dc; +unsigned int used_hosts_per_remote_dc; +cass_bool_t allow_remote_dcs_for_local_cl; +cass_bool_t use_token_aware_routing; +char* username; +char* password; +unsigned int connect_timeout; +unsigned int request_timeout; +php5to7_zval ssl_options; +long default_consistency; +int default_page_size; +php5to7_zval default_timeout; +cass_bool_t persist; +int protocol_version; +int io_threads; +int core_connections_per_host; +int max_connections_per_host; +unsigned int reconnect_interval; +cass_bool_t enable_latency_aware_routing; +cass_bool_t enable_tcp_nodelay; +cass_bool_t enable_tcp_keepalive; +unsigned int tcp_keepalive_delay; +php5to7_zval retry_policy; +php5to7_zval timestamp_gen; +cass_bool_t enable_schema; +char* blacklist_hosts; +char* whitelist_hosts; +char* blacklist_dcs; +char* whitelist_dcs; +cass_bool_t enable_hostname_resolution; +cass_bool_t enable_randomized_contact_points; +unsigned int connection_heartbeat_interval; PHP_DRIVER_END_OBJECT_TYPE(cluster_builder) PHP_DRIVER_BEGIN_OBJECT_TYPE(future_prepared_statement) - CassFuture *future; - php5to7_zval prepared_statement; +CassFuture* future; +php5to7_zval prepared_statement; PHP_DRIVER_END_OBJECT_TYPE(future_prepared_statement) PHP_DRIVER_BEGIN_OBJECT_TYPE(future_value) - php5to7_zval value; +php5to7_zval value; PHP_DRIVER_END_OBJECT_TYPE(future_value) PHP_DRIVER_BEGIN_OBJECT_TYPE(future_close) - CassFuture *future; +CassFuture* future; PHP_DRIVER_END_OBJECT_TYPE(future_close) PHP_DRIVER_BEGIN_OBJECT_TYPE(future_session) - CassFuture *future; - php_driver_ref *session; - php5to7_zval default_session; - cass_bool_t persist; - char *hash_key; - int hash_key_len; - char *exception_message; - CassError exception_code; - char* session_keyspace; - char* session_hash_key; +CassFuture* future; +php_driver_ref* session; +php5to7_zval default_session; +cass_bool_t persist; +char* hash_key; +int hash_key_len; +char* exception_message; +CassError exception_code; +char* session_keyspace; +char* session_hash_key; PHP_DRIVER_END_OBJECT_TYPE(future_session) typedef struct { - CassFuture *future; - php_driver_ref *session; + CassFuture* future; + php_driver_ref* session; } php_driver_psession; typedef struct { - CassFuture *future; - php_driver_ref *ref; + CassFuture* future; + php_driver_ref* ref; } php_driver_pprepared_statement; PHP_DRIVER_BEGIN_OBJECT_TYPE(session) - php_driver_ref *session; - long default_consistency; - int default_page_size; - char* keyspace; - char* hash_key; - php5to7_zval default_timeout; - cass_bool_t persist; +php_driver_ref* session; +long default_consistency; +int default_page_size; +char* keyspace; +char* hash_key; +php5to7_zval default_timeout; +cass_bool_t persist; PHP_DRIVER_END_OBJECT_TYPE(session) PHP_DRIVER_BEGIN_OBJECT_TYPE(ssl) - CassSsl *ssl; +CassSsl* ssl; PHP_DRIVER_END_OBJECT_TYPE(ssl) PHP_DRIVER_BEGIN_OBJECT_TYPE(ssl_builder) - int flags; - char **trusted_certs; - int trusted_certs_cnt; - char *client_cert; - char *private_key; - char *passphrase; +int flags; +char** trusted_certs; +int trusted_certs_cnt; +char* client_cert; +char* private_key; +char* passphrase; PHP_DRIVER_END_OBJECT_TYPE(ssl_builder) PHP_DRIVER_BEGIN_OBJECT_TYPE(schema) - php_driver_ref *schema; +php_driver_ref* schema; PHP_DRIVER_END_OBJECT_TYPE(schema) PHP_DRIVER_BEGIN_OBJECT_TYPE(keyspace) - php_driver_ref *schema; - const CassKeyspaceMeta *meta; +php_driver_ref* schema; +const CassKeyspaceMeta* meta; PHP_DRIVER_END_OBJECT_TYPE(keyspace) PHP_DRIVER_BEGIN_OBJECT_TYPE(table) - php5to7_zval name; - php5to7_zval options; - php5to7_zval partition_key; - php5to7_zval primary_key; - php5to7_zval clustering_key; - php5to7_zval clustering_order; - php_driver_ref *schema; - const CassTableMeta *meta; +php5to7_zval name; +php5to7_zval options; +php5to7_zval partition_key; +php5to7_zval primary_key; +php5to7_zval clustering_key; +php5to7_zval clustering_order; +php_driver_ref* schema; +const CassTableMeta* meta; PHP_DRIVER_END_OBJECT_TYPE(table) PHP_DRIVER_BEGIN_OBJECT_TYPE(materialized_view) - php5to7_zval name; - php5to7_zval options; - php5to7_zval partition_key; - php5to7_zval primary_key; - php5to7_zval clustering_key; - php5to7_zval clustering_order; - php5to7_zval base_table; - php_driver_ref *schema; - const CassMaterializedViewMeta *meta; +php5to7_zval name; +php5to7_zval options; +php5to7_zval partition_key; +php5to7_zval primary_key; +php5to7_zval clustering_key; +php5to7_zval clustering_order; +php5to7_zval base_table; +php_driver_ref* schema; +const CassMaterializedViewMeta* meta; PHP_DRIVER_END_OBJECT_TYPE(materialized_view) PHP_DRIVER_BEGIN_OBJECT_TYPE(column) - php5to7_zval name; - php5to7_zval type; - int reversed; - int frozen; - php_driver_ref *schema; - const CassColumnMeta *meta; +php5to7_zval name; +php5to7_zval type; +int reversed; +int frozen; +php_driver_ref* schema; +const CassColumnMeta* meta; PHP_DRIVER_END_OBJECT_TYPE(column) PHP_DRIVER_BEGIN_OBJECT_TYPE(index) - php5to7_zval name; - php5to7_zval kind; - php5to7_zval target; - php5to7_zval options; - php_driver_ref *schema; - const CassIndexMeta *meta; +php5to7_zval name; +php5to7_zval kind; +php5to7_zval target; +php5to7_zval options; +php_driver_ref* schema; +const CassIndexMeta* meta; PHP_DRIVER_END_OBJECT_TYPE(index) PHP_DRIVER_BEGIN_OBJECT_TYPE(function) - php5to7_zval simple_name; - php5to7_zval arguments; - php5to7_zval return_type; - php5to7_zval signature; - php5to7_zval language; - php5to7_zval body; - php_driver_ref *schema; - const CassFunctionMeta *meta; +php5to7_zval simple_name; +php5to7_zval arguments; +php5to7_zval return_type; +php5to7_zval signature; +php5to7_zval language; +php5to7_zval body; +php_driver_ref* schema; +const CassFunctionMeta* meta; PHP_DRIVER_END_OBJECT_TYPE(function) PHP_DRIVER_BEGIN_OBJECT_TYPE(aggregate) - php5to7_zval simple_name; - php5to7_zval argument_types; - php5to7_zval state_function; - php5to7_zval final_function; - php5to7_zval initial_condition; - php5to7_zval state_type; - php5to7_zval return_type; - php5to7_zval signature; - php_driver_ref *schema; - const CassAggregateMeta *meta; +php5to7_zval simple_name; +php5to7_zval argument_types; +php5to7_zval state_function; +php5to7_zval final_function; +php5to7_zval initial_condition; +php5to7_zval state_type; +php5to7_zval return_type; +php5to7_zval signature; +php_driver_ref* schema; +const CassAggregateMeta* meta; PHP_DRIVER_END_OBJECT_TYPE(aggregate) PHP_DRIVER_BEGIN_OBJECT_TYPE(type) - CassValueType type; - CassDataType *data_type; - union { - struct { - php5to7_zval value_type; - } collection; - struct { - php5to7_zval value_type; - } set; - struct { - php5to7_zval key_type; - php5to7_zval value_type; - } map; - struct { - char *class_name; - } custom; - struct { - char *keyspace; - char *type_name; - HashTable types; - } udt; - struct { - HashTable types; - } tuple; - } data; +CassValueType type; +CassDataType* data_type; +union { + struct { + php5to7_zval value_type; + } collection; + struct { + php5to7_zval value_type; + } set; + struct { + php5to7_zval key_type; + php5to7_zval value_type; + } map; + struct { + char* class_name; + } custom; + struct { + char* keyspace; + char* type_name; + HashTable types; + } udt; + struct { + HashTable types; + } tuple; +} data; PHP_DRIVER_END_OBJECT_TYPE(type) PHP_DRIVER_BEGIN_OBJECT_TYPE(retry_policy) - CassRetryPolicy *policy; +CassRetryPolicy* policy; PHP_DRIVER_END_OBJECT_TYPE(retry_policy) PHP_DRIVER_BEGIN_OBJECT_TYPE(timestamp_gen) - CassTimestampGen *gen; +CassTimestampGen* gen; PHP_DRIVER_END_OBJECT_TYPE(timestamp_gen) -typedef unsigned (*php_driver_value_hash_t)(zval *obj TSRMLS_DC); +typedef unsigned (*php_driver_value_hash_t)(zval* obj TSRMLS_DC); typedef struct { zend_object_handlers std; php_driver_value_hash_t hash_value; } php_driver_value_handlers; -extern PHP_DRIVER_API zend_class_entry *php_driver_value_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_numeric_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_bigint_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_smallint_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_tinyint_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_blob_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_decimal_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_float_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_inet_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_timestamp_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_date_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_time_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_uuid_interface_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_uuid_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_timeuuid_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_varint_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_custom_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_duration_ce; - -extern PHP_DRIVER_API zend_class_entry *php_driver_set_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_map_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_collection_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_tuple_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_user_type_value_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_value_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_numeric_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_bigint_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_smallint_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_tinyint_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_blob_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_decimal_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_float_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_inet_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_timestamp_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_date_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_time_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_uuid_interface_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_uuid_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_timeuuid_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_varint_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_custom_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_duration_ce; + +extern PHP_DRIVER_API zend_class_entry* php_driver_set_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_map_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_collection_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_tuple_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_user_type_value_ce; /* Exceptions */ void php_driver_define_Exception(TSRMLS_D); @@ -599,54 +551,54 @@ void php_driver_define_Custom(TSRMLS_D); void php_driver_define_Duration(TSRMLS_D); /* Classes */ -extern PHP_DRIVER_API zend_class_entry *php_driver_core_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_cluster_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_default_cluster_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_cluster_builder_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_default_cluster_builder_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_ssl_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_ssl_builder_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_future_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_future_prepared_statement_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_future_rows_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_future_session_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_future_value_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_future_close_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_session_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_default_session_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_exception_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_runtime_exception_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_timeout_exception_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_logic_exception_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_domain_exception_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_invalid_argument_exception_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_server_exception_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_overloaded_exception_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_is_bootstrapping_exception_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_execution_exception_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_truncate_exception_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_write_timeout_exception_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_read_timeout_exception_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_truncate_exception_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_unavailable_exception_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_validation_exception_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_invalid_syntax_exception_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_unauthorized_exception_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_invalid_query_exception_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_configuration_exception_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_already_exists_exception_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_unprepared_exception_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_protocol_exception_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_authentication_exception_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_divide_by_zero_exception_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_range_exception_ce; - -extern PHP_DRIVER_API zend_class_entry *php_driver_statement_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_simple_statement_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_prepared_statement_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_batch_statement_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_execution_options_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_rows_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_core_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_cluster_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_default_cluster_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_cluster_builder_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_default_cluster_builder_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_ssl_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_ssl_builder_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_future_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_future_prepared_statement_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_future_rows_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_future_session_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_future_value_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_future_close_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_session_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_default_session_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_exception_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_runtime_exception_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_timeout_exception_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_logic_exception_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_domain_exception_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_invalid_argument_exception_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_server_exception_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_overloaded_exception_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_is_bootstrapping_exception_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_execution_exception_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_truncate_exception_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_write_timeout_exception_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_read_timeout_exception_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_truncate_exception_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_unavailable_exception_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_validation_exception_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_invalid_syntax_exception_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_unauthorized_exception_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_invalid_query_exception_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_configuration_exception_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_already_exists_exception_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_unprepared_exception_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_protocol_exception_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_authentication_exception_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_divide_by_zero_exception_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_range_exception_ce; + +extern PHP_DRIVER_API zend_class_entry* php_driver_statement_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_simple_statement_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_prepared_statement_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_batch_statement_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_execution_options_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_rows_ce; void php_driver_define_Core(TSRMLS_D); void php_driver_define_Cluster(TSRMLS_D); @@ -669,22 +621,22 @@ void php_driver_define_BatchStatement(TSRMLS_D); void php_driver_define_ExecutionOptions(TSRMLS_D); void php_driver_define_Rows(TSRMLS_D); -extern PHP_DRIVER_API zend_class_entry *php_driver_schema_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_default_schema_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_keyspace_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_default_keyspace_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_table_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_default_table_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_column_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_default_column_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_index_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_default_index_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_materialized_view_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_default_materialized_view_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_function_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_default_function_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_aggregate_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_default_aggregate_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_schema_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_default_schema_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_keyspace_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_default_keyspace_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_table_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_default_table_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_column_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_default_column_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_index_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_default_index_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_materialized_view_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_default_materialized_view_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_function_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_default_function_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_aggregate_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_default_aggregate_ce; void php_driver_define_Schema(TSRMLS_D); void php_driver_define_DefaultSchema(TSRMLS_D); @@ -703,14 +655,14 @@ void php_driver_define_DefaultFunction(TSRMLS_D); void php_driver_define_Aggregate(TSRMLS_D); void php_driver_define_DefaultAggregate(TSRMLS_D); -extern PHP_DRIVER_API zend_class_entry *php_driver_type_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_type_scalar_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_type_collection_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_type_set_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_type_map_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_type_tuple_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_type_user_type_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_type_custom_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_type_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_type_scalar_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_type_collection_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_type_set_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_type_map_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_type_tuple_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_type_user_type_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_type_custom_ce; void php_driver_define_Type(TSRMLS_D); void php_driver_define_TypeScalar(TSRMLS_D); @@ -721,11 +673,11 @@ void php_driver_define_TypeTuple(TSRMLS_D); void php_driver_define_TypeUserType(TSRMLS_D); void php_driver_define_TypeCustom(TSRMLS_D); -extern PHP_DRIVER_API zend_class_entry *php_driver_retry_policy_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_retry_policy_default_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_retry_policy_downgrading_consistency_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_retry_policy_fallthrough_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_retry_policy_logging_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_retry_policy_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_retry_policy_default_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_retry_policy_downgrading_consistency_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_retry_policy_fallthrough_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_retry_policy_logging_ce; void php_driver_define_RetryPolicy(TSRMLS_D); void php_driver_define_RetryPolicyDefault(TSRMLS_D); @@ -733,9 +685,9 @@ void php_driver_define_RetryPolicyDowngradingConsistency(TSRMLS_D); void php_driver_define_RetryPolicyFallthrough(TSRMLS_D); void php_driver_define_RetryPolicyLogging(TSRMLS_D); -extern PHP_DRIVER_API zend_class_entry *php_driver_timestamp_gen_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_timestamp_gen_monotonic_ce; -extern PHP_DRIVER_API zend_class_entry *php_driver_timestamp_gen_server_side_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_timestamp_gen_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_timestamp_gen_monotonic_ce; +extern PHP_DRIVER_API zend_class_entry* php_driver_timestamp_gen_server_side_ce; void php_driver_define_TimestampGenerator(TSRMLS_D); void php_driver_define_TimestampGeneratorMonotonic(TSRMLS_D); diff --git a/ext/src/Collection.c b/ext/src/Collection.c index 1083bf077..aec12a002 100644 --- a/ext/src/Collection.c +++ b/ext/src/Collection.c @@ -468,17 +468,11 @@ void php_driver_define_Collection(TSRMLS_D) zend_class_implements(php_driver_collection_ce TSRMLS_CC, 1, php_driver_value_ce); memcpy(&php_driver_collection_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); php_driver_collection_handlers.std.get_properties = php_driver_collection_properties; -#if PHP_VERSION_ID >= 50400 php_driver_collection_handlers.std.get_gc = php_driver_collection_gc; -#endif -#if PHP_MAJOR_VERSION >= 8 - php_driver_collection_handlers.std.compare = php_driver_collection_compare; -#else - php_driver_collection_handlers.std.compare_objects = php_driver_collection_compare; -#endif + php_driver_collection_handlers.std.compare = php_driver_collection_compare; php_driver_collection_ce->ce_flags |= PHP5TO7_ZEND_ACC_FINAL; php_driver_collection_ce->create_object = php_driver_collection_new; - zend_class_implements(php_driver_collection_ce TSRMLS_CC, 2, spl_ce_Countable, zend_ce_iterator); + zend_class_implements(php_driver_collection_ce TSRMLS_CC, 2, zend_ce_countable, zend_ce_iterator); php_driver_collection_handlers.hash_value = php_driver_collection_hash_value; php_driver_collection_handlers.std.clone_obj = NULL; diff --git a/ext/src/Date.c b/ext/src/Date.c index 8d4e654d8..bbbb13337 100644 --- a/ext/src/Date.c +++ b/ext/src/Date.c @@ -103,7 +103,7 @@ PHP_METHOD(Date, toDateTime) datetime_obj = zend_object_store_get_object(datetime TSRMLS_CC); #endif - str_len = spprintf(&str, 0, "%lld", + str_len = spprintf(&str, 0, "%ld", cass_date_time_to_epoch(self->date, time_obj != NULL ? time_obj->time : 0)); php_date_initialize(datetime_obj, str, str_len, "U", NULL, 0 TSRMLS_CC); @@ -159,7 +159,7 @@ PHP_METHOD(Date, __toString) self = PHP_DRIVER_GET_DATE(getThis()); - spprintf(&ret, 0, PHP_DRIVER_NAMESPACE "\\Date(seconds=%lld)", cass_date_time_to_epoch(self->date, 0)); + spprintf(&ret, 0, PHP_DRIVER_NAMESPACE "\\Date(seconds=%ld)", cass_date_time_to_epoch(self->date, 0)); PHP5TO7_RETVAL_STRING(ret); efree(ret); } diff --git a/ext/src/Decimal.c b/ext/src/Decimal.c index d2956ef17..205ccb16b 100644 --- a/ext/src/Decimal.c +++ b/ext/src/Decimal.c @@ -112,12 +112,7 @@ from_double(php_driver_numeric *result, double value) mantissa >>= 1; } - /* There isn't any "long long" setter method */ -#ifdef _WIN32 - sprintf(mantissa_str, "%I64d", mantissa); -#else - sprintf(mantissa_str, "%lld", mantissa); -#endif + sprintf(mantissa_str, "%ld", mantissa); mpz_set_str(result->data.decimal.value, mantissa_str, 10); /* Change the sign if negative */ diff --git a/ext/src/Map.c b/ext/src/Map.c index b453e1310..7947ffb17 100644 --- a/ext/src/Map.c +++ b/ext/src/Map.c @@ -614,17 +614,11 @@ void php_driver_define_Map(TSRMLS_D) zend_class_implements(php_driver_map_ce TSRMLS_CC, 1, php_driver_value_ce); memcpy(&php_driver_map_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); php_driver_map_handlers.std.get_properties = php_driver_map_properties; -#if PHP_VERSION_ID >= 50400 php_driver_map_handlers.std.get_gc = php_driver_map_gc; -#endif -#if PHP_MAJOR_VERSION >= 8 - php_driver_map_handlers.std.compare = php_driver_map_compare; -#else - php_driver_map_handlers.std.compare_objects = php_driver_map_compare; -#endif + php_driver_map_handlers.std.compare = php_driver_map_compare; php_driver_map_ce->ce_flags |= PHP5TO7_ZEND_ACC_FINAL; php_driver_map_ce->create_object = php_driver_map_new; - zend_class_implements(php_driver_map_ce TSRMLS_CC, 3, spl_ce_Countable, zend_ce_iterator, zend_ce_arrayaccess); + zend_class_implements(php_driver_map_ce TSRMLS_CC, 3, zend_ce_countable, zend_ce_iterator, zend_ce_arrayaccess); php_driver_map_handlers.hash_value = php_driver_map_hash_value; php_driver_map_handlers.std.clone_obj = NULL; diff --git a/ext/src/SSLOptions/Builder.c b/ext/src/SSLOptions/Builder.c index 2a9686d11..355bdb588 100644 --- a/ext/src/SSLOptions/Builder.c +++ b/ext/src/SSLOptions/Builder.c @@ -125,7 +125,9 @@ PHP_METHOD(SSLOptionsBuilder, withTrustedCerts) PHP5TO7_MAYBE_EFREE(args); } - php_stat(Z_STRVAL_P(path), Z_STRLEN_P(path), FS_IS_R, &readable TSRMLS_CC); + zend_string* path_str = zend_string_init(Z_STRVAL_P(path), Z_STRLEN_P(path), false); + php_stat(path_str, FS_IS_R, &readable TSRMLS_CC); + zend_string_release(path_str); if (PHP5TO7_ZVAL_IS_FALSE_P(&readable)) { zend_throw_exception_ex(php_driver_invalid_argument_exception_ce, 0 TSRMLS_CC, @@ -185,7 +187,9 @@ PHP_METHOD(SSLOptionsBuilder, withClientCert) return; } - php_stat(client_cert, client_cert_len, FS_IS_R, &readable TSRMLS_CC); + zend_string* client_cert_str = zend_string_init(client_cert, client_cert_len, false); + php_stat(client_cert_str, FS_IS_R, &readable TSRMLS_CC); + zend_string_release(client_cert_str); if (PHP5TO7_ZVAL_IS_FALSE_P(&readable)) { zend_throw_exception_ex(php_driver_invalid_argument_exception_ce, 0 TSRMLS_CC, @@ -215,7 +219,9 @@ PHP_METHOD(SSLOptionsBuilder, withPrivateKey) return; } - php_stat(private_key, private_key_len, FS_IS_R, &readable TSRMLS_CC); + zend_string* private_key_str = zend_string_init(private_key, private_key_len, false); + php_stat(private_key_str, FS_IS_R, &readable TSRMLS_CC); + zend_string_release(private_key_str); if (PHP5TO7_ZVAL_IS_FALSE_P(&readable)) { zend_throw_exception_ex(php_driver_invalid_argument_exception_ce, 0 TSRMLS_CC, diff --git a/ext/src/Set.c b/ext/src/Set.c index 5e866d213..be5a4eef2 100644 --- a/ext/src/Set.c +++ b/ext/src/Set.c @@ -446,17 +446,11 @@ void php_driver_define_Set(TSRMLS_D) zend_class_implements(php_driver_set_ce TSRMLS_CC, 1, php_driver_value_ce); memcpy(&php_driver_set_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); php_driver_set_handlers.std.get_properties = php_driver_set_properties; -#if PHP_VERSION_ID >= 50400 php_driver_set_handlers.std.get_gc = php_driver_set_gc; -#endif -#if PHP_MAJOR_VERSION >= 8 - php_driver_set_handlers.std.compare = php_driver_set_compare; -#else - php_driver_set_handlers.std.compare_objects = php_driver_set_compare; -#endif + php_driver_set_handlers.std.compare = php_driver_set_compare; php_driver_set_ce->ce_flags |= PHP5TO7_ZEND_ACC_FINAL; php_driver_set_ce->create_object = php_driver_set_new; - zend_class_implements(php_driver_set_ce TSRMLS_CC, 2, spl_ce_Countable, zend_ce_iterator); + zend_class_implements(php_driver_set_ce TSRMLS_CC, 2, zend_ce_countable, zend_ce_iterator); php_driver_set_handlers.hash_value = php_driver_set_hash_value; php_driver_set_handlers.std.clone_obj = NULL; diff --git a/ext/src/Tuple.c b/ext/src/Tuple.c index 815dba983..f8bf2d4ad 100644 --- a/ext/src/Tuple.c +++ b/ext/src/Tuple.c @@ -455,17 +455,11 @@ void php_driver_define_Tuple(TSRMLS_D) zend_class_implements(php_driver_tuple_ce TSRMLS_CC, 1, php_driver_value_ce); memcpy(&php_driver_tuple_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); php_driver_tuple_handlers.std.get_properties = php_driver_tuple_properties; -#if PHP_VERSION_ID >= 50400 php_driver_tuple_handlers.std.get_gc = php_driver_tuple_gc; -#endif -#if PHP_MAJOR_VERSION >= 8 - php_driver_tuple_handlers.std.compare = php_driver_tuple_compare; -#else - php_driver_tuple_handlers.std.compare_objects = php_driver_tuple_compare; -#endif + php_driver_tuple_handlers.std.compare = php_driver_tuple_compare; php_driver_tuple_ce->ce_flags |= PHP5TO7_ZEND_ACC_FINAL; php_driver_tuple_ce->create_object = php_driver_tuple_new; - zend_class_implements(php_driver_tuple_ce TSRMLS_CC, 2, spl_ce_Countable, zend_ce_iterator); + zend_class_implements(php_driver_tuple_ce TSRMLS_CC, 2, zend_ce_countable, zend_ce_iterator); php_driver_tuple_handlers.hash_value = php_driver_tuple_hash_value; php_driver_tuple_handlers.std.clone_obj = NULL; diff --git a/ext/src/UserTypeValue.c b/ext/src/UserTypeValue.c index 7bf430f00..6e39b304f 100644 --- a/ext/src/UserTypeValue.c +++ b/ext/src/UserTypeValue.c @@ -497,14 +497,10 @@ void php_driver_define_UserTypeValue(TSRMLS_D) #if PHP_VERSION_ID >= 50400 php_driver_user_type_value_handlers.std.get_gc = php_driver_user_type_value_gc; #endif -#if PHP_MAJOR_VERSION >= 8 php_driver_user_type_value_handlers.std.compare = php_driver_user_type_value_compare; -#else - php_driver_user_type_value_handlers.std.compare_objects = php_driver_user_type_value_compare; -#endif php_driver_user_type_value_ce->ce_flags |= PHP5TO7_ZEND_ACC_FINAL; php_driver_user_type_value_ce->create_object = php_driver_user_type_value_new; - zend_class_implements(php_driver_user_type_value_ce TSRMLS_CC, 2, spl_ce_Countable, zend_ce_iterator); + zend_class_implements(php_driver_user_type_value_ce TSRMLS_CC, 2, zend_ce_countable, zend_ce_iterator); php_driver_user_type_value_handlers.hash_value = php_driver_user_type_value_hash_value; php_driver_user_type_value_handlers.std.clone_obj = NULL; diff --git a/ext/util/bytes.c b/ext/util/bytes.c index 21d2ea7d6..ceb54d38f 100644 --- a/ext/util/bytes.c +++ b/ext/util/bytes.c @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "php_driver.h" +#include #include #include "util/bytes.h" diff --git a/v2/.gitignore b/v2/.gitignore new file mode 100644 index 000000000..2f7896d1d --- /dev/null +++ b/v2/.gitignore @@ -0,0 +1 @@ +target/ diff --git a/v2/Cargo.lock b/v2/Cargo.lock new file mode 100644 index 000000000..2de341fe5 --- /dev/null +++ b/v2/Cargo.lock @@ -0,0 +1,529 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "aho-corasick" +version = "0.7.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" +dependencies = [ + "memchr", +] + +[[package]] +name = "ansi_term" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" +dependencies = [ + "winapi", +] + +[[package]] +name = "anyhow" +version = "1.0.51" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b26702f315f53b6071259e15dd9d64528213b44d61de1ec926eca7715d62203" + +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi", + "libc", + "winapi", +] + +[[package]] +name = "bindgen" +version = "0.59.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bd2a9a458e8f4304c52c43ebb0cfbd520289f8379a52e329a38afda99bf8eb8" +dependencies = [ + "bitflags", + "cexpr", + "clang-sys", + "clap", + "env_logger", + "lazy_static", + "lazycell", + "log", + "peeking_take_while", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", + "which", +] + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "cc" +version = "1.0.72" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22a9137b95ea06864e018375b72adfb7db6e6f68cfc8df5a04d00288050485ee" + +[[package]] +name = "cexpr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "clang-sys" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa66045b9cb23c2e9c1520732030608b02ee07e5cfaa5a521ec15ded7fa24c90" +dependencies = [ + "glob", + "libc", + "libloading", +] + +[[package]] +name = "clap" +version = "2.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" +dependencies = [ + "ansi_term", + "atty", + "bitflags", + "strsim 0.8.0", + "textwrap", + "unicode-width", + "vec_map", +] + +[[package]] +name = "darling" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f2c43f534ea4b0b049015d00269734195e6d3f0f6635cb692251aca6f9f8b3c" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e91455b86830a1c21799d94524df0845183fa55bafd9aa137b01c7d1065fa36" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim 0.10.0", + "syn", +] + +[[package]] +name = "darling_macro" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29b5acf0dea37a7f66f7b25d2c5e93fd46f8f6968b1a5d7a3e02e97768afc95a" +dependencies = [ + "darling_core", + "quote", + "syn", +] + +[[package]] +name = "either" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" + +[[package]] +name = "env_logger" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3" +dependencies = [ + "atty", + "humantime", + "log", + "regex", + "termcolor", +] + +[[package]] +name = "ext-php-rs" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ae832fbc0b3f08b491dc92e80995e543a511ca903a8b77c16df4fd02a9a6f27" +dependencies = [ + "bindgen", + "bitflags", + "cc", + "cfg-if", + "ext-php-rs-derive", + "once_cell", + "parking_lot", + "regex", +] + +[[package]] +name = "ext-php-rs-derive" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b90fe6b443279168d3c70155c7e9cd5409fae47207a28dfc3aa349dbe8e6a10" +dependencies = [ + "anyhow", + "darling", + "ident_case", + "lazy_static", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "glob" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" + +[[package]] +name = "hermit-abi" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +dependencies = [ + "libc", +] + +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "lazycell" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" + +[[package]] +name = "libc" +version = "0.2.112" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b03d17f364a3a042d5e5d46b053bbbf82c92c9430c592dd4c064dc6ee997125" + +[[package]] +name = "libloading" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afe203d669ec979b7128619bae5a63b7b42e9203c1b29146079ee05e2f604b52" +dependencies = [ + "cfg-if", + "winapi", +] + +[[package]] +name = "lock_api" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712a4d093c9976e24e7dbca41db895dabcbac38eb5f4045393d17a95bdfb1109" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "memchr" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "nom" +version = "7.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b1d11e1ef389c76fe5b81bcaf2ea32cf88b62bc494e19f493d0b30e7a930109" +dependencies = [ + "memchr", + "minimal-lexical", + "version_check", +] + +[[package]] +name = "once_cell" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da32515d9f6e6e489d7bc9d84c71b060db7247dc035bbe44eac88cf87486d8d5" + +[[package]] +name = "parking_lot" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" +dependencies = [ + "instant", + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" +dependencies = [ + "cfg-if", + "instant", + "libc", + "redox_syscall", + "smallvec", + "winapi", +] + +[[package]] +name = "peeking_take_while" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" + +[[package]] +name = "php-cassandra-driver" +version = "0.1.0" +dependencies = [ + "ext-php-rs", +] + +[[package]] +name = "proc-macro2" +version = "1.0.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f84e92c0f7c9d58328b85a78557813e4bd845130db68d7184635344399423b1" +dependencies = [ + "unicode-xid", +] + +[[package]] +name = "quote" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38bc8cc6a5f2e3655e0899c1b848643b2562f853f114bfec7be120678e3ace05" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "redox_syscall" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff" +dependencies = [ + "bitflags", +] + +[[package]] +name = "regex" +version = "1.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.6.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "scopeguard" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" + +[[package]] +name = "shlex" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" + +[[package]] +name = "smallvec" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ecab6c735a6bb4139c0caafd0cc3635748bbb3acf4550e8138122099251f309" + +[[package]] +name = "strsim" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" + +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + +[[package]] +name = "syn" +version = "1.0.82" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8daf5dd0bb60cbd4137b1b587d2fc0ae729bc07cf01cd70b36a1ed5ade3b9d59" +dependencies = [ + "proc-macro2", + "quote", + "unicode-xid", +] + +[[package]] +name = "termcolor" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "textwrap" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" +dependencies = [ + "unicode-width", +] + +[[package]] +name = "unicode-width" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" + +[[package]] +name = "unicode-xid" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" + +[[package]] +name = "vec_map" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" + +[[package]] +name = "version_check" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" + +[[package]] +name = "which" +version = "4.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea187a8ef279bc014ec368c27a920da2024d2a711109bfbe3440585d5cf27ad9" +dependencies = [ + "either", + "lazy_static", + "libc", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +dependencies = [ + "winapi", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/v2/Cargo.toml b/v2/Cargo.toml new file mode 100644 index 000000000..11c252c9e --- /dev/null +++ b/v2/Cargo.toml @@ -0,0 +1,20 @@ +[package] +name = "php-cassandra-driver" +version = "0.1.0" +edition = "2021" + +[lib] +name = "php_cassandra" +crate-type = ["cdylib","staticlib"] + +[dependencies] +ext-php-rs = "0.7.3" + +[profile.release] +opt-level = 3 +debug = false +debug-assertions = false +overflow-checks = false +lto = true +panic = 'unwind' +incremental = true diff --git a/v2/src/lib.rs b/v2/src/lib.rs new file mode 100644 index 000000000..1b4a90c93 --- /dev/null +++ b/v2/src/lib.rs @@ -0,0 +1,8 @@ +#[cfg(test)] +mod tests { + #[test] + fn it_works() { + let result = 2 + 2; + assert_eq!(result, 4); + } +} diff --git a/v2/tools.sh b/v2/tools.sh new file mode 100755 index 000000000..6d739a887 --- /dev/null +++ b/v2/tools.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +cargo install cargo-php +cargo install bat +cargo install cargo-edit +cargo install cargo-expand