diff --git a/.github/workflows/cross-compile.yml b/.github/workflows/cross-compile.yml index 96c5506..ec6a4d6 100644 --- a/.github/workflows/cross-compile.yml +++ b/.github/workflows/cross-compile.yml @@ -15,97 +15,193 @@ jobs: strategy: matrix: include: - # Linux x64 - PHP8.0 + # Linux x64 - PHP8.0 - NTS - build: x86_64-unknown-linux-gnu os: ubuntu-latest target: x86_64-unknown-linux-gnu php-versions: '8.0' + phpts: 'nts' - # Macos x64 - PHP8.0 + # Linux x64 - PHP8.1 - NTS + - build: x86_64-unknown-linux-gnu + os: ubuntu-latest + target: x86_64-unknown-linux-gnu + php-versions: '8.1' + phpts: 'nts' + + # Linux x64 - PHP8.2 - NTS + - build: x86_64-unknown-linux-gnu + os: ubuntu-latest + target: x86_64-unknown-linux-gnu + php-versions: '8.2' + phpts: 'nts' + + # Linux x64 - PHP8.3 - NTS + - build: x86_64-unknown-linux-gnu + os: ubuntu-latest + target: x86_64-unknown-linux-gnu + php-versions: '8.3' + phpts: 'nts' + + # Macos x64 - PHP8.0 - NTS - build: x86_64-apple-darwin os: macos-latest target: x86_64-apple-darwin php-versions: '8.0' + phpts: 'nts' - build: aarch64-apple-darwin os: macos-latest target: aarch64-apple-darwin php-versions: '8.0' - - # Windows x64 - PHP8.0 - - build: x86_64-pc-windows-msvc - os: windows-2019 - target: x86_64-pc-windows-msvc - php-versions: '8.0' - - # Linux x64 - PHP8.1 - - build: x86_64-unknown-linux-gnu - os: ubuntu-latest - target: x86_64-unknown-linux-gnu - php-versions: '8.1' + phpts: 'nts' - # Macos x64 - PHP8.1 + # Macos x64 - PHP8.1 - NTS - build: x86_64-apple-darwin os: macos-latest target: x86_64-apple-darwin php-versions: '8.1' + phpts: 'nts' - build: aarch64-apple-darwin os: macos-latest target: aarch64-apple-darwin php-versions: '8.1' + phpts: 'nts' - # Windows x64 - PHP8.1 - - build: x86_64-pc-windows-msvc - os: windows-2019 - target: x86_64-pc-windows-msvc - php-versions: '8.1' + # Macos x64 - PHP8.2 - NTS + - build: x86_64-apple-darwin + os: macos-latest + target: x86_64-apple-darwin + php-versions: '8.2' + phpts: 'nts' - # Linux x64 - PHP8.2 - - build: x86_64-unknown-linux-gnu - os: ubuntu-latest - target: x86_64-unknown-linux-gnu + - build: aarch64-apple-darwin + os: macos-latest + target: aarch64-apple-darwin php-versions: '8.2' + phpts: 'nts' + + # Macos x64 - PHP8.3 - NTS + - build: x86_64-apple-darwin + os: macos-latest + target: x86_64-apple-darwin + php-versions: '8.3' + phpts: 'nts' + + - build: aarch64-apple-darwin + os: macos-latest + target: aarch64-apple-darwin + php-versions: '8.3' + phpts: 'nts' + + # Macos x64 - PHP8.0 - TS + - build: x86_64-apple-darwin + os: macos-latest + target: x86_64-apple-darwin + php-versions: '8.0' + phpts: 'ts' + + - build: aarch64-apple-darwin + os: macos-latest + target: aarch64-apple-darwin + php-versions: '8.0' + phpts: 'ts' - # Macos x64 - PHP8.2 + # Macos x64 - PHP8.1 - TS + - build: x86_64-apple-darwin + os: macos-latest + target: x86_64-apple-darwin + php-versions: '8.1' + phpts: 'ts' + + - build: aarch64-apple-darwin + os: macos-latest + target: aarch64-apple-darwin + php-versions: '8.1' + phpts: 'ts' + + # Macos x64 - PHP8.2 - TS - build: x86_64-apple-darwin os: macos-latest target: x86_64-apple-darwin php-versions: '8.2' + phpts: 'ts' - build: aarch64-apple-darwin os: macos-latest target: aarch64-apple-darwin php-versions: '8.2' + phpts: 'ts' - # Windows x64 - PHP8.2 - - build: x86_64-pc-windows-msvc - os: windows-2019 - target: x86_64-pc-windows-msvc - php-versions: '8.2' - - # Linux x64 - PHP8.3 - - build: x86_64-unknown-linux-gnu - os: ubuntu-latest - target: x86_64-unknown-linux-gnu - php-versions: '8.3' - - # Macos x64 - PHP8.3 + # Macos x64 - PHP8.3 - TS - build: x86_64-apple-darwin os: macos-latest target: x86_64-apple-darwin php-versions: '8.3' + phpts: 'ts' - build: aarch64-apple-darwin os: macos-latest target: aarch64-apple-darwin php-versions: '8.3' + phpts: 'ts' + + # Windows x64 - PHP8.0 - NTS + - build: x86_64-pc-windows-msvc + os: windows-2019 + target: x86_64-pc-windows-msvc + php-versions: '8.0' + phpts: 'nts' + + # Windows x64 - PHP8.1 - NTS + - build: x86_64-pc-windows-msvc + os: windows-2019 + target: x86_64-pc-windows-msvc + php-versions: '8.1' + phpts: 'nts' + + # Windows x64 - PHP8.2 - NTS + - build: x86_64-pc-windows-msvc + os: windows-2019 + target: x86_64-pc-windows-msvc + php-versions: '8.2' + phpts: 'nts' + + # Windows x64 - PHP8.3 - NTS + - build: x86_64-pc-windows-msvc + os: windows-2019 + target: x86_64-pc-windows-msvc + php-versions: '8.3' + phpts: 'nts' + + # Windows x64 - PHP8.0 - TS + - build: x86_64-pc-windows-msvc + os: windows-2019 + target: x86_64-pc-windows-msvc + php-versions: '8.0' + phpts: 'ts' + + # Windows x64 - PHP8.1 - TS + - build: x86_64-pc-windows-msvc + os: windows-2019 + target: x86_64-pc-windows-msvc + php-versions: '8.1' + phpts: 'ts' + + # Windows x64 - PHP8.2 - TS + - build: x86_64-pc-windows-msvc + os: windows-2019 + target: x86_64-pc-windows-msvc + php-versions: '8.2' + phpts: 'ts' - # Windows x64 - PHP8.3 + # Windows x64 - PHP8.3 - TS - build: x86_64-pc-windows-msvc os: windows-2019 target: x86_64-pc-windows-msvc php-versions: '8.3' + phpts: 'ts' steps: - name: Checkout @@ -131,6 +227,8 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php-versions }} + env: + phpts: ${{ matrix.phpts }} - name: Build (Linux) if: matrix.os == 'ubuntu-latest' @@ -152,7 +250,7 @@ jobs: str_version=${{ env.VERSION }} version=${str_version#turso-php-extension/} - dirname="$binary_name-$version-php-${{ matrix.php-versions }}-${{ matrix.target }}" + dirname="$binary_name-$version-php-${{ matrix.php-versions }}-${{ matrix.phpts }}-${{ matrix.target }}" mkdir "$dirname" if [ "${{ matrix.os }}" = "macos-latest" ]; then diff --git a/.gitignore b/.gitignore index 1f73a95..4aa2ec2 100644 --- a/.gitignore +++ b/.gitignore @@ -11,4 +11,6 @@ test-parse.php .flaskenv* !.env.project !.env.vault -notes/ \ No newline at end of file +notes/ +*.bak +src/*.bak \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index b2c00c5..dddb1d5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "addr2line" @@ -1157,9 +1157,9 @@ dependencies = [ [[package]] name = "libsql" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc44962384bd2223269a81cd0d4a1683182b7bf0408b1d87e731c43e8c501270" +checksum = "fe18646e4ef8db446bc3e3f5fb96131483203bc5f4998ff149f79a067530c01c" dependencies = [ "anyhow", "async-stream", @@ -1195,9 +1195,9 @@ dependencies = [ [[package]] name = "libsql-ffi" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5919d202c2d296b4c44b6877d1b67fe6ad8f18520ce74bd70a29c383e44ccbee" +checksum = "5f2a50a585a1184a43621a9133b7702ba5cb7a87ca5e704056b19d8005de6faf" dependencies = [ "bindgen 0.66.1", "cc", @@ -1217,9 +1217,9 @@ dependencies = [ [[package]] name = "libsql-rusqlite" -version = "0.32.0" +version = "0.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b811f72e13b9864601197d234621ffe89a490b2cb034cf28753b111334cf1db3" +checksum = "ae65c66088dcd309abbd5617ae046abac2a2ee0a7fdada5127353bd68e0a27ea" dependencies = [ "bitflags 2.6.0", "fallible-iterator 0.2.0", @@ -1249,9 +1249,9 @@ dependencies = [ [[package]] name = "libsql-sys" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce92e8edf5a0dc928c6031ff3cf05794a23570b417254a7f3883b2072ae3b3c3" +checksum = "5c05b61c226781d6f5e26e3e7364617f19c0c1d5332035802e9229d6024cec05" dependencies = [ "bytes", "libsql-ffi", @@ -1263,7 +1263,7 @@ dependencies = [ [[package]] name = "libsql_php" -version = "1.4.0" +version = "1.4.2" dependencies = [ "base64 0.22.1", "ext-php-rs", @@ -1278,9 +1278,9 @@ dependencies = [ [[package]] name = "libsql_replication" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b107ff45254e35e1b72586ddff84cc4ebaede1e1a59f88bf2a0371321d23f7ae" +checksum = "9cf40c4c2c01462da758272976de0a23d19b4e9c714db08efecf262d896655b5" dependencies = [ "aes", "async-stream", @@ -2240,17 +2240,12 @@ dependencies = [ "percent-encoding", "pin-project", "prost", - "rustls-native-certs", - "rustls-pemfile", - "rustls-pki-types", "tokio", - "tokio-rustls", "tokio-stream", "tower", "tower-layer", "tower-service", "tracing", - "webpki-roots", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index a00662b..28cd0ee 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "libsql_php" -version = "1.4.0" +version = "1.4.2" edition = "2021" authors = ["Imam Ali Mustofa "] @@ -14,7 +14,7 @@ crate-type = ["cdylib"] base64 = "0.22.0" ext-php-rs = "*" lazy_static = "1.4.0" -libsql = { version = "0.5.0", features = ["remote", "replication", "core", "encryption"] } +libsql = { version = "0.6.0", features = ["remote", "replication", "core", "encryption"] } once_cell = "1.19.0" serde = { version = "1.0.199", features = ["derive"]} serde_json = "1.0.116" diff --git a/flake.lock b/flake.lock deleted file mode 100644 index 8e9df82..0000000 --- a/flake.lock +++ /dev/null @@ -1,147 +0,0 @@ -{ - "nodes": { - "fenix": { - "inputs": { - "nixpkgs": "nixpkgs", - "rust-analyzer-src": "rust-analyzer-src" - }, - "locked": { - "lastModified": 1732689334, - "narHash": "sha256-yKI1KiZ0+bvDvfPTQ1ZT3oP/nIu3jPYm4dnbRd6hYg4=", - "owner": "nix-community", - "repo": "fenix", - "rev": "a8a983027ca02b363dfc82fbe3f7d9548a8d3dce", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "fenix", - "type": "github" - } - }, - "flake-utils": { - "inputs": { - "systems": "systems" - }, - "locked": { - "lastModified": 1731533236, - "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "naersk": { - "inputs": { - "nixpkgs": "nixpkgs_2" - }, - "locked": { - "lastModified": 1721727458, - "narHash": "sha256-r/xppY958gmZ4oTfLiHN0ZGuQ+RSTijDblVgVLFi1mw=", - "owner": "nix-community", - "repo": "naersk", - "rev": "3fb418eaf352498f6b6c30592e3beb63df42ef11", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "naersk", - "type": "github" - } - }, - "nixpkgs": { - "locked": { - "lastModified": 1732521221, - "narHash": "sha256-2ThgXBUXAE1oFsVATK1ZX9IjPcS4nKFOAjhPNKuiMn0=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "4633a7c72337ea8fd23a4f2ba3972865e3ec685d", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_2": { - "locked": { - "lastModified": 1733097829, - "narHash": "sha256-9hbb1rqGelllb4kVUCZ307G2k3/UhmA8PPGBoyuWaSw=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "2c15aa59df0017ca140d9ba302412298ab4bf22a", - "type": "github" - }, - "original": { - "id": "nixpkgs", - "type": "indirect" - } - }, - "nixpkgs_3": { - "locked": { - "lastModified": 1733097829, - "narHash": "sha256-9hbb1rqGelllb4kVUCZ307G2k3/UhmA8PPGBoyuWaSw=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "2c15aa59df0017ca140d9ba302412298ab4bf22a", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "root": { - "inputs": { - "fenix": "fenix", - "flake-utils": "flake-utils", - "naersk": "naersk", - "nixpkgs": "nixpkgs_3" - } - }, - "rust-analyzer-src": { - "flake": false, - "locked": { - "lastModified": 1732633904, - "narHash": "sha256-7VKcoLug9nbAN2txqVksWHHJplqK9Ou8dXjIZAIYSGc=", - "owner": "rust-lang", - "repo": "rust-analyzer", - "rev": "8d5e91c94f80c257ce6dbdfba7bd63a5e8a03fa6", - "type": "github" - }, - "original": { - "owner": "rust-lang", - "ref": "nightly", - "repo": "rust-analyzer", - "type": "github" - } - }, - "systems": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - } - }, - "root": "root", - "version": 7 -} diff --git a/flake.nix b/flake.nix deleted file mode 100644 index c96ff55..0000000 --- a/flake.nix +++ /dev/null @@ -1,105 +0,0 @@ -{ - inputs = { - fenix.url = "github:nix-community/fenix"; - flake-utils.url = "github:numtide/flake-utils"; - naersk.url = "github:nix-community/naersk"; - nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; - }; - - outputs = { self, fenix, flake-utils, naersk, nixpkgs }: - flake-utils.lib.eachDefaultSystem (system: - let - pkgs = (import nixpkgs) { - inherit system; - }; - - toolchain = with fenix.packages.${system}; - combine [ - minimal.rustc - minimal.cargo - targets.x86_64-pc-windows-gnu.latest.rust-std - targets.i686-pc-windows-gnu.latest.rust-std - ]; - - naersk' = naersk.lib.${system}.override { - cargo = toolchain; - rustc = toolchain; - }; - - naerskBuildPackage = target: args: - naersk'.buildPackage ( - args - // { CARGO_BUILD_TARGET = target; } - // cargoConfig - ); - - cargoConfig = { - CARGO_TARGET_X86_64_PC_WINDOWS_GNU_RUNNER = pkgs.writeScript "wine-wrapper" '' - export WINEPREFIX="$(mktemp -d)" - exec wine64 $@ - ''; - }; - - in rec { - defaultPackage = packages.x86_64-pc-windows-gnu; - - packages.x86_64-pc-windows-gnu = naerskBuildPackage "x86_64-pc-windows-gnu" { - src = ./.; - doCheck = true; - strictDeps = true; - - depsBuildBuild = with pkgs; [ - pkgsCross.mingwW64.stdenv.cc - pkgsCross.mingwW64.windows.pthreads - pkgs.php81 # PHP 8.1 - pkgs.php82 # PHP 8.2 - pkgs.php83 # PHP 8.3 - ]; - - nativeBuildInputs = with pkgs; [ - wineWowPackages.stable - ]; - }; - - packages.i686-pc-windows-gnu = - let - cc' = pkgs.pkgsCross.mingw32.buildPackages.wrapCC ( - pkgs.pkgsCross.mingw32.buildPackages.gcc.cc.overrideAttrs (oldAttr: rec{ - configureFlags = oldAttr.configureFlags ++ [ - "--disable-sjlj-exceptions --with-dwarf2" - ]; - }) - ); - - in naerskBuildPackage "i686-pc-windows-gnu" { - src = ./.; - doCheck = true; - strictDeps = true; - - depsBuildBuild = [cc'] ++ (with pkgs.pkgsCross.mingw32.windows; [ pthreads mcfgthreads ]); - postInstall = '' - ln -s ${pkgs.pkgsCross.mingw32.windows.mcfgthreads}/bin/mcfgthread-12.dll $out/bin/mcfgthread-12.dll - ''; - CARGO_TARGET_I686_PC_WINDOWS_GNU_RUSTFLAGS = "-Clink-args=-lmcfgthread"; - CARGO_TARGET_I686_PC_WINDOWS_GNU_RUNNER = pkgs.writeScript "wine-wrapper" '' - export WINEPREFIX="$(mktemp -d)" - ln -s \ - ${pkgs.pkgsCross.mingw32.windows.mcfgthreads}/bin/mcfgthread-12.dll \ - mcfgthread-12.dll - exec wine64 $@ - ''; - - nativeBuildInputs = with pkgs; [ - wineWowPackages.stable - ]; - }; - - devShell = pkgs.mkShell ( - { - inputsFrom = with packages; [ x86_64-pc-windows-gnu ]; - CARGO_BUILD_TARGET = "x86_64-pc-windows-gnu"; - } // cargoConfig - ); - } - ); -} diff --git a/src/lib.rs b/src/lib.rs index ec029ae..719235b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -31,7 +31,7 @@ lazy_static::lazy_static! { static ref STATEMENT_REGISTRY: Mutex> = Mutex::new(HashMap::new()); } -pub const LIBSQL_PHP_VERSION: &str = "1.4.0"; +pub const LIBSQL_PHP_VERSION: &str = "1.4.2"; /// Represents the flag for opening a database in read-only mode. pub const LIBSQL_OPEN_READONLY: i32 = 1; @@ -435,7 +435,7 @@ pub extern "C" fn libsql_php_extension_info(_module: *mut ext_php_rs::zend::Modu ext_php_rs::ffi::php_info_print_table_row( 2, "LibSQL PHP version\0".as_ptr() as *const i8, - "1.4.0\0".as_ptr() as *const i8, + "1.4.2\0".as_ptr() as *const i8, ); ext_php_rs::ffi::php_info_print_table_row( 2, @@ -445,7 +445,7 @@ pub extern "C" fn libsql_php_extension_info(_module: *mut ext_php_rs::zend::Modu ext_php_rs::ffi::php_info_print_table_row( 2, "GitHub\0".as_ptr() as *const i8, - "https://github.com/darkterminal/libsql-extension\0".as_ptr() as *const i8, + "https://github.com/tursodatabase/turso-client-php\0".as_ptr() as *const i8, ); // End the PHP info table. ext_php_rs::ffi::php_info_print_table_end(); diff --git a/versioning b/versioning new file mode 100644 index 0000000..2be414c --- /dev/null +++ b/versioning @@ -0,0 +1,54 @@ +#!/bin/bash + +# File paths +CARGO_TOML="Cargo.toml" +LIB_RS="src/lib.rs" + +# Function to update version in Cargo.toml's [package] block +update_cargo_toml_version() { + local new_version=$1 + local version_pattern='version = "[0-9]+\.[0-9]+\.[0-9]+"' + + # Check if Cargo.toml exists + if [[ -f "$CARGO_TOML" ]]; then + echo "Updating [package] version in $CARGO_TOML to $new_version..." + + # Update only the version inside the [package] block + sed -i.bak -E "/^\[package\]/,/^\[/ s/$version_pattern/version = \"$new_version\"/" "$CARGO_TOML" + + echo "Cargo.toml updated. Backup saved as ${CARGO_TOML}.bak." + else + echo "File $CARGO_TOML does not exist." + fi +} + +# Function to update specific version strings in lib.rs +update_lib_rs_version() { + local new_version=$1 + local version_pattern='[0-9]+\.[0-9]+\.[0-9]+' + + # Check if lib.rs exists + if [[ -f "$LIB_RS" ]]; then + echo "Updating version strings in $LIB_RS to $new_version..." + + # Replace all version strings in the file + sed -i.bak -E "s/$version_pattern/$new_version/g" "$LIB_RS" + + echo "lib.rs updated. Backup saved as ${LIB_RS}.bak." + else + echo "File $LIB_RS does not exist." + fi +} + +# Check for required arguments +if [[ $# -lt 1 ]]; then + echo "Usage: $0 " + exit 1 +fi + +# Get the new version from the first argument +new_version=$1 + +# Update the versions +update_cargo_toml_version "$new_version" +update_lib_rs_version "$new_version"