diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index 41e6aad..34c4711 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -4,7 +4,8 @@ ->in(__DIR__) ->exclude('vendor') ->exclude('storage') - ->exclude('bootstrap/cache'); + ->exclude('bootstrap/cache') + ->exclude('lib'); return (new PhpCsFixer\Config()) ->setRules([ diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..91db7b0 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,5 @@ +{ + "recommendations": [ + "devsense.phptools-vscode" + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..224df92 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,6 @@ +{ + "php.problems.exclude": { + "vendor/": true, + "lib/": true, + }, +} \ No newline at end of file diff --git a/composer.json b/composer.json index ad8b9f2..e36d641 100644 --- a/composer.json +++ b/composer.json @@ -10,6 +10,7 @@ ], "autoload": { "classmap": [ "src/" ], + "files": [ "lib/libsql.php", "src/functions.php" ], "psr-4": { "Libsql\\": "src/", "Libsql\\Tests\\": "tests/" @@ -21,7 +22,9 @@ }, "require-dev": { "phpunit/phpunit": "^11", - "friendsofphp/php-cs-fixer": "^3.64" + "friendsofphp/php-cs-fixer": "^3.64", + "ircmaxell/ffime": "dev-master", + "phpstan/phpstan": "2.0.x-dev" }, "scripts": { "test": [ "@php vendor/bin/phpunit tests --fail-on-warning --fail-on-deprecation" ] diff --git a/composer.lock b/composer.lock index 909014f..cfbf840 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "6cb3297d210e58bfce93b3e1d4a33661", + "content-hash": "66811c2d743ae14a1d1dbee18fb8c4f4", "packages": [], "packages-dev": [ { @@ -511,6 +511,154 @@ ], "time": "2024-08-30T23:09:38+00:00" }, + { + "name": "ircmaxell/ffime", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/ircmaxell/FFIMe.git", + "reference": "0b7fb71209b192e55a61ec2fb33a932a561dd82a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ircmaxell/FFIMe/zipball/0b7fb71209b192e55a61ec2fb33a932a561dd82a", + "reference": "0b7fb71209b192e55a61ec2fb33a932a561dd82a", + "shasum": "" + }, + "require": { + "ircmaxell/php-c-parser": "dev-master", + "ircmaxell/php-object-symbolresolver": "dev-master", + "php": ">=8.0" + }, + "require-dev": { + "phpunit/phpunit": "^8.0" + }, + "default-branch": true, + "type": "library", + "autoload": { + "psr-4": { + "FFIMe\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Anthony Ferrara", + "email": "ircmaxell@gmail.com" + }, + { + "name": "Bob Weinand", + "email": "bobwei9@hotmail.com" + } + ], + "description": "Make life easy when working with FFI", + "support": { + "issues": "https://github.com/ircmaxell/FFIMe/issues", + "source": "https://github.com/ircmaxell/FFIMe/tree/master" + }, + "time": "2024-01-02T20:37:51+00:00" + }, + { + "name": "ircmaxell/php-c-parser", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/ircmaxell/php-c-parser.git", + "reference": "365c52d4c28deed279fef35958488b2a7c382b3b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ircmaxell/php-c-parser/zipball/365c52d4c28deed279fef35958488b2a7c382b3b", + "reference": "365c52d4c28deed279fef35958488b2a7c382b3b", + "shasum": "" + }, + "require": { + "php": ">=7.4" + }, + "require-dev": { + "ircmaxell/php-yacc": "dev-master", + "phpunit/phpunit": "^8.0" + }, + "default-branch": true, + "type": "library", + "autoload": { + "psr-4": { + "PHPCParser\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Anthony Ferrara", + "email": "ircmaxell@gmail.com" + }, + { + "name": "Bob Weinand", + "email": "bobwei9@hotmail.com" + } + ], + "description": "Parse C when using PHP", + "support": { + "issues": "https://github.com/ircmaxell/php-c-parser/issues", + "source": "https://github.com/ircmaxell/php-c-parser/tree/master" + }, + "time": "2023-10-14T16:23:09+00:00" + }, + { + "name": "ircmaxell/php-object-symbolresolver", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/ircmaxell/php-object-symbolresolver.git", + "reference": "ca63994ee21e0104fdcd1058d22492e697dec4b6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ircmaxell/php-object-symbolresolver/zipball/ca63994ee21e0104fdcd1058d22492e697dec4b6", + "reference": "ca63994ee21e0104fdcd1058d22492e697dec4b6", + "shasum": "" + }, + "require": { + "php": ">=7.4" + }, + "default-branch": true, + "type": "library", + "autoload": { + "psr-4": { + "PHPObjectSymbolResolver\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Anthony Ferrara", + "email": "ircmaxell@gmail.com" + }, + { + "name": "Bob Weinand", + "email": "bobwei9@hotmail.com" + }, + { + "name": "Shane Thompson", + "email": "me@shane.pt" + } + ], + "description": "An object file (ELF, Mach-O, PE) parser", + "support": { + "issues": "https://github.com/ircmaxell/php-object-symbolresolver/issues", + "source": "https://github.com/ircmaxell/php-object-symbolresolver/tree/master" + }, + "time": "2024-05-20T15:05:20+00:00" + }, { "name": "myclabs/deep-copy", "version": "1.x-dev", @@ -574,16 +722,16 @@ }, { "name": "nikic/php-parser", - "version": "v5.2.0", + "version": "v5.3.1", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb" + "reference": "8eea230464783aa9671db8eea6f8c6ac5285794b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb", - "reference": "23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/8eea230464783aa9671db8eea6f8c6ac5285794b", + "reference": "8eea230464783aa9671db8eea6f8c6ac5285794b", "shasum": "" }, "require": { @@ -626,9 +774,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.2.0" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.3.1" }, - "time": "2024-09-15T16:40:33+00:00" + "time": "2024-10-08T18:51:32+00:00" }, { "name": "phar-io/manifest", @@ -749,37 +897,96 @@ }, "time": "2022-02-21T01:04:05+00:00" }, + { + "name": "phpstan/phpstan", + "version": "2.0.x-dev", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan.git", + "reference": "4a39cdd86194d3ad8fcdb5f53777a727ef8519cc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/4a39cdd86194d3ad8fcdb5f53777a727ef8519cc", + "reference": "4a39cdd86194d3ad8fcdb5f53777a727ef8519cc", + "shasum": "" + }, + "require": { + "php": "^7.4|^8.0" + }, + "conflict": { + "phpstan/phpstan-shim": "*" + }, + "default-branch": true, + "bin": [ + "phpstan", + "phpstan.phar" + ], + "type": "library", + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPStan - PHP Static Analysis Tool", + "keywords": [ + "dev", + "static analysis" + ], + "support": { + "docs": "https://phpstan.org/user-guide/getting-started", + "forum": "https://github.com/phpstan/phpstan/discussions", + "issues": "https://github.com/phpstan/phpstan/issues", + "security": "https://github.com/phpstan/phpstan/security/policy", + "source": "https://github.com/phpstan/phpstan-src" + }, + "funding": [ + { + "url": "https://github.com/ondrejmirtes", + "type": "github" + }, + { + "url": "https://github.com/phpstan", + "type": "github" + } + ], + "time": "2024-10-25T14:24:19+00:00" + }, { "name": "phpunit/php-code-coverage", "version": "dev-main", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "8032a533a77a8dc28a1027d0e1ded03abab1f423" + "reference": "f7f08030e8811582cc459871d28d6f5a1a4d35ca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/8032a533a77a8dc28a1027d0e1ded03abab1f423", - "reference": "8032a533a77a8dc28a1027d0e1ded03abab1f423", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/f7f08030e8811582cc459871d28d6f5a1a4d35ca", + "reference": "f7f08030e8811582cc459871d28d6f5a1a4d35ca", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^5.1.0", + "nikic/php-parser": "^5.3.1", "php": ">=8.2", - "phpunit/php-file-iterator": "^5.0.1", + "phpunit/php-file-iterator": "^5.1.0", "phpunit/php-text-template": "^4.0.1", "sebastian/code-unit-reverse-lookup": "^4.0.1", "sebastian/complexity": "^4.0.1", "sebastian/environment": "^7.2.0", "sebastian/lines-of-code": "^3.0.1", - "sebastian/version": "^5.0.1", + "sebastian/version": "^5.0.2", "theseer/tokenizer": "^1.2.3" }, "require-dev": { - "phpunit/phpunit": "^11.3" + "phpunit/phpunit": "^11.4.1" }, "suggest": { "ext-pcov": "PHP extension that provides line coverage", @@ -818,7 +1025,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/main" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/11.0.7" }, "funding": [ { @@ -826,7 +1033,7 @@ "type": "github" } ], - "time": "2024-09-19T07:28:28+00:00" + "time": "2024-10-09T06:21:38+00:00" }, { "name": "phpunit/php-file-iterator", @@ -834,12 +1041,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "4d2f732a9a11cc66a1e7af61209cb4feac924ea6" + "reference": "2a77b36a7df3f09d74f3f167fe89ccd445460c87" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/4d2f732a9a11cc66a1e7af61209cb4feac924ea6", - "reference": "4d2f732a9a11cc66a1e7af61209cb4feac924ea6", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/2a77b36a7df3f09d74f3f167fe89ccd445460c87", + "reference": "2a77b36a7df3f09d74f3f167fe89ccd445460c87", "shasum": "" }, "require": { @@ -888,7 +1095,7 @@ "type": "github" } ], - "time": "2024-09-07T13:03:44+00:00" + "time": "2024-09-29T07:03:36+00:00" }, { "name": "phpunit/php-invoker", @@ -896,12 +1103,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-invoker.git", - "reference": "1dd1db73b639f2e14579c09c0862eeeb2c937bee" + "reference": "ed59fd9625a0e7ee3382a7444bba94050ef66463" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/1dd1db73b639f2e14579c09c0862eeeb2c937bee", - "reference": "1dd1db73b639f2e14579c09c0862eeeb2c937bee", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/ed59fd9625a0e7ee3382a7444bba94050ef66463", + "reference": "ed59fd9625a0e7ee3382a7444bba94050ef66463", "shasum": "" }, "require": { @@ -953,7 +1160,7 @@ "type": "github" } ], - "time": "2024-09-07T13:02:17+00:00" + "time": "2024-09-29T07:04:04+00:00" }, { "name": "phpunit/php-text-template", @@ -961,12 +1168,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "b7122ac2bc10a3f4c4febda153ce27703a8e8ef0" + "reference": "c3688884966445e8924a5ce62ce68ff7ea906737" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/b7122ac2bc10a3f4c4febda153ce27703a8e8ef0", - "reference": "b7122ac2bc10a3f4c4febda153ce27703a8e8ef0", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/c3688884966445e8924a5ce62ce68ff7ea906737", + "reference": "c3688884966445e8924a5ce62ce68ff7ea906737", "shasum": "" }, "require": { @@ -1014,7 +1221,7 @@ "type": "github" } ], - "time": "2024-09-07T13:05:59+00:00" + "time": "2024-09-29T07:04:32+00:00" }, { "name": "phpunit/php-timer", @@ -1022,12 +1229,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "bb05128da9ee40098a3e29d8f29bce910d933933" + "reference": "7d0f6b33c3cf83a9319f7d2ede0f4453b476ca4d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/bb05128da9ee40098a3e29d8f29bce910d933933", - "reference": "bb05128da9ee40098a3e29d8f29bce910d933933", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/7d0f6b33c3cf83a9319f7d2ede0f4453b476ca4d", + "reference": "7d0f6b33c3cf83a9319f7d2ede0f4453b476ca4d", "shasum": "" }, "require": { @@ -1075,20 +1282,20 @@ "type": "github" } ], - "time": "2024-09-07T13:07:55+00:00" + "time": "2024-09-29T07:05:01+00:00" }, { "name": "phpunit/phpunit", - "version": "dev-main", + "version": "11.5.x-dev", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "ba61e62d4ec7b9d97440d1ecffa098ce6eb62c8b" + "reference": "7afd778418b634bcc6ab43f583cd0f4b9c19bc8f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/ba61e62d4ec7b9d97440d1ecffa098ce6eb62c8b", - "reference": "ba61e62d4ec7b9d97440d1ecffa098ce6eb62c8b", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/7afd778418b634bcc6ab43f583cd0f4b9c19bc8f", + "reference": "7afd778418b634bcc6ab43f583cd0f4b9c19bc8f", "shasum": "" }, "require": { @@ -1102,33 +1309,33 @@ "phar-io/manifest": "^2.0.4", "phar-io/version": "^3.2.1", "php": ">=8.2", - "phpunit/php-code-coverage": "^11.0.6", + "phpunit/php-code-coverage": "^11.0.7", "phpunit/php-file-iterator": "^5.1.0", "phpunit/php-invoker": "^5.0.1", "phpunit/php-text-template": "^4.0.1", "phpunit/php-timer": "^7.0.1", "sebastian/cli-parser": "^3.0.2", "sebastian/code-unit": "^3.0.1", - "sebastian/comparator": "^6.1.0", + "sebastian/comparator": "^6.1.1", "sebastian/diff": "^6.0.2", "sebastian/environment": "^7.2.0", "sebastian/exporter": "^6.1.3", "sebastian/global-state": "^7.0.2", "sebastian/object-enumerator": "^6.0.1", "sebastian/type": "^5.1.0", - "sebastian/version": "^5.0.1" + "sebastian/version": "^5.0.2", + "staabm/side-effects-detector": "^1.0.5" }, "suggest": { "ext-soap": "To be able to generate mocks based on WSDL files" }, - "default-branch": true, "bin": [ "phpunit" ], "type": "library", "extra": { "branch-alias": { - "dev-main": "11.4-dev" + "dev-main": "11.5-dev" } }, "autoload": { @@ -1160,7 +1367,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/main" + "source": "https://github.com/sebastianbergmann/phpunit/tree/11.5" }, "funding": [ { @@ -1176,7 +1383,7 @@ "type": "tidelift" } ], - "time": "2024-09-21T11:37:36+00:00" + "time": "2024-10-23T09:45:29+00:00" }, { "name": "psr/container", @@ -1876,12 +2083,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/cli-parser.git", - "reference": "b9d804ce9be19c78653c4e2ade6cd484bde8d1f7" + "reference": "79fcdd013d7edc6cd0eb02a1287998e9465f715f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/b9d804ce9be19c78653c4e2ade6cd484bde8d1f7", - "reference": "b9d804ce9be19c78653c4e2ade6cd484bde8d1f7", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/79fcdd013d7edc6cd0eb02a1287998e9465f715f", + "reference": "79fcdd013d7edc6cd0eb02a1287998e9465f715f", "shasum": "" }, "require": { @@ -1926,7 +2133,7 @@ "type": "github" } ], - "time": "2024-09-07T09:13:25+00:00" + "time": "2024-09-29T06:25:04+00:00" }, { "name": "sebastian/code-unit", @@ -1934,12 +2141,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit.git", - "reference": "8c846a9f2ac8dfba0c7763b85e2e7a2f34c4fb0a" + "reference": "d7310043a5df123425ff40fa1e7ba6861acbe5de" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/8c846a9f2ac8dfba0c7763b85e2e7a2f34c4fb0a", - "reference": "8c846a9f2ac8dfba0c7763b85e2e7a2f34c4fb0a", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/d7310043a5df123425ff40fa1e7ba6861acbe5de", + "reference": "d7310043a5df123425ff40fa1e7ba6861acbe5de", "shasum": "" }, "require": { @@ -1984,7 +2191,7 @@ "type": "github" } ], - "time": "2024-09-07T09:03:05+00:00" + "time": "2024-09-29T06:26:49+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -1992,12 +2199,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "fa0fbdb8227752ec6a055184dd3861d7f96270dc" + "reference": "979a5694196002133d27326a89748f437557af5d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/fa0fbdb8227752ec6a055184dd3861d7f96270dc", - "reference": "fa0fbdb8227752ec6a055184dd3861d7f96270dc", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/979a5694196002133d27326a89748f437557af5d", + "reference": "979a5694196002133d27326a89748f437557af5d", "shasum": "" }, "require": { @@ -2041,7 +2248,7 @@ "type": "github" } ], - "time": "2024-09-07T12:26:19+00:00" + "time": "2024-09-29T06:56:01+00:00" }, { "name": "sebastian/comparator", @@ -2049,12 +2256,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "fa37b9e2ca618cb051d71b60120952ee8ca8b03d" + "reference": "5ef523a49ae7a302b87b2102b72b1eda8918d686" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/fa37b9e2ca618cb051d71b60120952ee8ca8b03d", - "reference": "fa37b9e2ca618cb051d71b60120952ee8ca8b03d", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/5ef523a49ae7a302b87b2102b72b1eda8918d686", + "reference": "5ef523a49ae7a302b87b2102b72b1eda8918d686", "shasum": "" }, "require": { @@ -2111,7 +2318,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/comparator/issues", "security": "https://github.com/sebastianbergmann/comparator/security/policy", - "source": "https://github.com/sebastianbergmann/comparator/tree/6.1.0" + "source": "https://github.com/sebastianbergmann/comparator/tree/6.1.1" }, "funding": [ { @@ -2119,7 +2326,7 @@ "type": "github" } ], - "time": "2024-09-11T15:42:56+00:00" + "time": "2024-10-18T15:00:48+00:00" }, { "name": "sebastian/complexity", @@ -2127,12 +2334,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "ff87283421b8a7fa452573bf3984224c45037b36" + "reference": "64a651fe80c718526d5297ab271a7332088aa866" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/ff87283421b8a7fa452573bf3984224c45037b36", - "reference": "ff87283421b8a7fa452573bf3984224c45037b36", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/64a651fe80c718526d5297ab271a7332088aa866", + "reference": "64a651fe80c718526d5297ab271a7332088aa866", "shasum": "" }, "require": { @@ -2178,7 +2385,7 @@ "type": "github" } ], - "time": "2024-09-07T12:35:04+00:00" + "time": "2024-09-29T06:57:43+00:00" }, { "name": "sebastian/diff", @@ -2186,12 +2393,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "b8899d873092a870c372365b9615ad269298aabc" + "reference": "1d7973beb55cc78c077c3bdcfac0e833104aa30f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/b8899d873092a870c372365b9615ad269298aabc", - "reference": "b8899d873092a870c372365b9615ad269298aabc", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/1d7973beb55cc78c077c3bdcfac0e833104aa30f", + "reference": "1d7973beb55cc78c077c3bdcfac0e833104aa30f", "shasum": "" }, "require": { @@ -2246,7 +2453,7 @@ "type": "github" } ], - "time": "2024-09-07T12:38:05+00:00" + "time": "2024-09-29T06:58:52+00:00" }, { "name": "sebastian/environment", @@ -2254,12 +2461,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "e4588b2b27a1d87a2dd811e1fbbb53c0736eeaec" + "reference": "79c41a3fd9081b8c96fc63a3141226e89dca6122" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/e4588b2b27a1d87a2dd811e1fbbb53c0736eeaec", - "reference": "e4588b2b27a1d87a2dd811e1fbbb53c0736eeaec", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/79c41a3fd9081b8c96fc63a3141226e89dca6122", + "reference": "79c41a3fd9081b8c96fc63a3141226e89dca6122", "shasum": "" }, "require": { @@ -2311,7 +2518,7 @@ "type": "github" } ], - "time": "2024-09-07T12:40:33+00:00" + "time": "2024-09-29T06:59:18+00:00" }, { "name": "sebastian/exporter", @@ -2319,12 +2526,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "575f0d22969d2a8ca2bc06ec54c215ee8feab11b" + "reference": "60f5099d672acc0e2c98dbed0cf57b47e5bd5572" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/575f0d22969d2a8ca2bc06ec54c215ee8feab11b", - "reference": "575f0d22969d2a8ca2bc06ec54c215ee8feab11b", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/60f5099d672acc0e2c98dbed0cf57b47e5bd5572", + "reference": "60f5099d672acc0e2c98dbed0cf57b47e5bd5572", "shasum": "" }, "require": { @@ -2390,7 +2597,7 @@ "type": "github" } ], - "time": "2024-09-07T12:42:51+00:00" + "time": "2024-10-20T05:03:41+00:00" }, { "name": "sebastian/global-state", @@ -2398,12 +2605,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "633c9bad67155e1cde8dac81ae150cd5ff35b243" + "reference": "242683bf6799ac666bd2eb132167ef8730e42fb2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/633c9bad67155e1cde8dac81ae150cd5ff35b243", - "reference": "633c9bad67155e1cde8dac81ae150cd5ff35b243", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/242683bf6799ac666bd2eb132167ef8730e42fb2", + "reference": "242683bf6799ac666bd2eb132167ef8730e42fb2", "shasum": "" }, "require": { @@ -2453,7 +2660,7 @@ "type": "github" } ], - "time": "2024-09-07T12:45:59+00:00" + "time": "2024-09-29T07:00:40+00:00" }, { "name": "sebastian/lines-of-code", @@ -2461,12 +2668,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "84427eb8e46173a62ef4dfb0e707a96827ff5583" + "reference": "1ec4e0498bf102c1a3b6f7dc9c79ccc30ba7092f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/84427eb8e46173a62ef4dfb0e707a96827ff5583", - "reference": "84427eb8e46173a62ef4dfb0e707a96827ff5583", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/1ec4e0498bf102c1a3b6f7dc9c79ccc30ba7092f", + "reference": "1ec4e0498bf102c1a3b6f7dc9c79ccc30ba7092f", "shasum": "" }, "require": { @@ -2512,7 +2719,7 @@ "type": "github" } ], - "time": "2024-09-07T12:48:24+00:00" + "time": "2024-09-29T07:01:16+00:00" }, { "name": "sebastian/object-enumerator", @@ -2520,12 +2727,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "0bdb59b5631c8e9344d11d7fe4ece0adbac943ba" + "reference": "8af07b1d8c5fb78b164d716c0fa90e99e47047c1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/0bdb59b5631c8e9344d11d7fe4ece0adbac943ba", - "reference": "0bdb59b5631c8e9344d11d7fe4ece0adbac943ba", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/8af07b1d8c5fb78b164d716c0fa90e99e47047c1", + "reference": "8af07b1d8c5fb78b164d716c0fa90e99e47047c1", "shasum": "" }, "require": { @@ -2571,7 +2778,7 @@ "type": "github" } ], - "time": "2024-09-07T12:50:34+00:00" + "time": "2024-09-29T07:02:15+00:00" }, { "name": "sebastian/object-reflector", @@ -2579,12 +2786,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "1acd95952a7e71c994a7893a0344a05623993012" + "reference": "e0cef2bb87396a73a19b2e73b7ec6177af6c1b8d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/1acd95952a7e71c994a7893a0344a05623993012", - "reference": "1acd95952a7e71c994a7893a0344a05623993012", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/e0cef2bb87396a73a19b2e73b7ec6177af6c1b8d", + "reference": "e0cef2bb87396a73a19b2e73b7ec6177af6c1b8d", "shasum": "" }, "require": { @@ -2628,7 +2835,7 @@ "type": "github" } ], - "time": "2024-09-07T12:53:12+00:00" + "time": "2024-09-29T07:02:58+00:00" }, { "name": "sebastian/recursion-context", @@ -2636,12 +2843,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "76780b28836ee99eb60f3528067908367cdb4734" + "reference": "f1f3f14d56f5153ef334e6768112b9bc8645a69c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/76780b28836ee99eb60f3528067908367cdb4734", - "reference": "76780b28836ee99eb60f3528067908367cdb4734", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/f1f3f14d56f5153ef334e6768112b9bc8645a69c", + "reference": "f1f3f14d56f5153ef334e6768112b9bc8645a69c", "shasum": "" }, "require": { @@ -2693,7 +2900,7 @@ "type": "github" } ], - "time": "2024-09-07T13:12:03+00:00" + "time": "2024-09-29T07:05:38+00:00" }, { "name": "sebastian/type", @@ -2701,12 +2908,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "21b95e1a38c2dc7cc1ba48b3fb9e7373d6e8a3bf" + "reference": "d4df3b2cd4b1c682cfe6fedadebeed7f395c16ff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/21b95e1a38c2dc7cc1ba48b3fb9e7373d6e8a3bf", - "reference": "21b95e1a38c2dc7cc1ba48b3fb9e7373d6e8a3bf", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/d4df3b2cd4b1c682cfe6fedadebeed7f395c16ff", + "reference": "d4df3b2cd4b1c682cfe6fedadebeed7f395c16ff", "shasum": "" }, "require": { @@ -2751,7 +2958,7 @@ "type": "github" } ], - "time": "2024-09-18T06:14:37+00:00" + "time": "2024-09-29T07:06:19+00:00" }, { "name": "sebastian/version", @@ -2759,12 +2966,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "4e4fe6166028e711f97cb80262dffa4227c7090b" + "reference": "c687e3387b99f5b03b6caa64c74b63e2936ff874" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/4e4fe6166028e711f97cb80262dffa4227c7090b", - "reference": "4e4fe6166028e711f97cb80262dffa4227c7090b", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c687e3387b99f5b03b6caa64c74b63e2936ff874", + "reference": "c687e3387b99f5b03b6caa64c74b63e2936ff874", "shasum": "" }, "require": { @@ -2798,7 +3005,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/version/issues", "security": "https://github.com/sebastianbergmann/version/security/policy", - "source": "https://github.com/sebastianbergmann/version/tree/main" + "source": "https://github.com/sebastianbergmann/version/tree/5.0.2" }, "funding": [ { @@ -2806,7 +3013,59 @@ "type": "github" } ], - "time": "2024-09-07T13:16:40+00:00" + "time": "2024-10-09T05:16:32+00:00" + }, + { + "name": "staabm/side-effects-detector", + "version": "1.0.5", + "source": { + "type": "git", + "url": "https://github.com/staabm/side-effects-detector.git", + "reference": "d8334211a140ce329c13726d4a715adbddd0a163" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/staabm/side-effects-detector/zipball/d8334211a140ce329c13726d4a715adbddd0a163", + "reference": "d8334211a140ce329c13726d4a715adbddd0a163", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "phpstan/extension-installer": "^1.4.3", + "phpstan/phpstan": "^1.12.6", + "phpunit/phpunit": "^9.6.21", + "symfony/var-dumper": "^5.4.43", + "tomasvotruba/type-coverage": "1.0.0", + "tomasvotruba/unused-public": "1.0.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "lib/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A static analysis tool to detect side effects in PHP code", + "keywords": [ + "static analysis" + ], + "support": { + "issues": "https://github.com/staabm/side-effects-detector/issues", + "source": "https://github.com/staabm/side-effects-detector/tree/1.0.5" + }, + "funding": [ + { + "url": "https://github.com/staabm", + "type": "github" + } + ], + "time": "2024-10-20T05:08:20+00:00" }, { "name": "symfony/console", @@ -2814,12 +3073,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "a113dc3e003f2e6a9a8469fb1bb9532fe842f68b" + "reference": "de74db6d7c9f4ecabf7b4a1a20655e021b034001" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/a113dc3e003f2e6a9a8469fb1bb9532fe842f68b", - "reference": "a113dc3e003f2e6a9a8469fb1bb9532fe842f68b", + "url": "https://api.github.com/repos/symfony/console/zipball/de74db6d7c9f4ecabf7b4a1a20655e021b034001", + "reference": "de74db6d7c9f4ecabf7b4a1a20655e021b034001", "shasum": "" }, "require": { @@ -2899,7 +3158,7 @@ "type": "tidelift" } ], - "time": "2024-09-25T14:09:12+00:00" + "time": "2024-10-23T06:56:12+00:00" }, { "name": "symfony/deprecation-contracts", @@ -2907,12 +3166,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1" + "reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1", - "reference": "0e0d29ce1f20deffb4ab1b016a7257c4f1e789a1", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/63afe740e99a13ba87ec199bb07bbdee937a5b62", + "reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62", "shasum": "" }, "require": { @@ -2922,7 +3181,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "3.5-dev" + "dev-main": "3.6-dev" }, "thanks": { "name": "symfony/contracts", @@ -2951,7 +3210,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.0" + "source": "https://github.com/symfony/deprecation-contracts/tree/main" }, "funding": [ { @@ -2967,7 +3226,7 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:32:20+00:00" + "time": "2024-09-25T14:21:43+00:00" }, { "name": "symfony/event-dispatcher", @@ -3055,12 +3314,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher-contracts.git", - "reference": "8f93aec25d41b72493c6ddff14e916177c9efc50" + "reference": "59eb412e93815df44f05f342958efa9f46b1e586" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/8f93aec25d41b72493c6ddff14e916177c9efc50", - "reference": "8f93aec25d41b72493c6ddff14e916177c9efc50", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/59eb412e93815df44f05f342958efa9f46b1e586", + "reference": "59eb412e93815df44f05f342958efa9f46b1e586", "shasum": "" }, "require": { @@ -3071,7 +3330,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "3.5-dev" + "dev-main": "3.6-dev" }, "thanks": { "name": "symfony/contracts", @@ -3108,7 +3367,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.5.0" + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/main" }, "funding": [ { @@ -3124,7 +3383,7 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:32:20+00:00" + "time": "2024-09-25T14:21:43+00:00" }, { "name": "symfony/filesystem", @@ -3132,12 +3391,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "b7ea899972a0cadb5370e67eed7a50b10f5ca269" + "reference": "b8dce482de9d7c9fe2891155035a7248ab5c7fdb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/b7ea899972a0cadb5370e67eed7a50b10f5ca269", - "reference": "b7ea899972a0cadb5370e67eed7a50b10f5ca269", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/b8dce482de9d7c9fe2891155035a7248ab5c7fdb", + "reference": "b8dce482de9d7c9fe2891155035a7248ab5c7fdb", "shasum": "" }, "require": { @@ -3190,7 +3449,7 @@ "type": "tidelift" } ], - "time": "2024-09-17T12:51:32+00:00" + "time": "2024-10-25T15:15:23+00:00" }, { "name": "symfony/finder", @@ -3198,12 +3457,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "afa87bce0d224a744963ecc8db07b1f0f96a3518" + "reference": "6de263e5868b9a137602dd1e33e4d48bfae99c49" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/afa87bce0d224a744963ecc8db07b1f0f96a3518", - "reference": "afa87bce0d224a744963ecc8db07b1f0f96a3518", + "url": "https://api.github.com/repos/symfony/finder/zipball/6de263e5868b9a137602dd1e33e4d48bfae99c49", + "reference": "6de263e5868b9a137602dd1e33e4d48bfae99c49", "shasum": "" }, "require": { @@ -3254,7 +3513,7 @@ "type": "tidelift" } ], - "time": "2024-09-03T13:22:29+00:00" + "time": "2024-10-23T06:56:12+00:00" }, { "name": "symfony/options-resolver", @@ -3262,12 +3521,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "28b7840cd3a01a74bc86fa77587f02b351ad3ade" + "reference": "4f69e6b9745493ea38e5ffdc937e41e7145aa04c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/28b7840cd3a01a74bc86fa77587f02b351ad3ade", - "reference": "28b7840cd3a01a74bc86fa77587f02b351ad3ade", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/4f69e6b9745493ea38e5ffdc937e41e7145aa04c", + "reference": "4f69e6b9745493ea38e5ffdc937e41e7145aa04c", "shasum": "" }, "require": { @@ -3321,7 +3580,7 @@ "type": "tidelift" } ], - "time": "2024-07-06T07:57:47+00:00" + "time": "2024-09-25T14:21:43+00:00" }, { "name": "symfony/polyfill-ctype", @@ -3809,12 +4068,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "f36d05c4546075c6a9230840919acdf4bff6bf10" + "reference": "2ad775b9f17c8c9c1fe457750ce191e0f7c1fbff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/f36d05c4546075c6a9230840919acdf4bff6bf10", - "reference": "f36d05c4546075c6a9230840919acdf4bff6bf10", + "url": "https://api.github.com/repos/symfony/process/zipball/2ad775b9f17c8c9c1fe457750ce191e0f7c1fbff", + "reference": "2ad775b9f17c8c9c1fe457750ce191e0f7c1fbff", "shasum": "" }, "require": { @@ -3862,7 +4121,7 @@ "type": "tidelift" } ], - "time": "2024-09-20T07:49:02+00:00" + "time": "2024-09-26T08:57:56+00:00" }, { "name": "symfony/service-contracts", @@ -3870,12 +4129,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "bd1d9e59a81d8fa4acdcea3f617c581f7475a80f" + "reference": "5ad38698559cf88b6296629e19b15ef3239c9d7a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/bd1d9e59a81d8fa4acdcea3f617c581f7475a80f", - "reference": "bd1d9e59a81d8fa4acdcea3f617c581f7475a80f", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/5ad38698559cf88b6296629e19b15ef3239c9d7a", + "reference": "5ad38698559cf88b6296629e19b15ef3239c9d7a", "shasum": "" }, "require": { @@ -3890,7 +4149,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "3.5-dev" + "dev-main": "3.6-dev" }, "thanks": { "name": "symfony/contracts", @@ -3930,7 +4189,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v3.5.0" + "source": "https://github.com/symfony/service-contracts/tree/main" }, "funding": [ { @@ -3946,7 +4205,7 @@ "type": "tidelift" } ], - "time": "2024-04-18T09:32:20+00:00" + "time": "2024-09-25T14:21:43+00:00" }, { "name": "symfony/stopwatch", @@ -3954,12 +4213,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", - "reference": "a5ab03f4e61db160ffff610a4a2bebe2913bdd2e" + "reference": "696f418b0d722a4225e1c3d95489d262971ca924" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/a5ab03f4e61db160ffff610a4a2bebe2913bdd2e", - "reference": "a5ab03f4e61db160ffff610a4a2bebe2913bdd2e", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/696f418b0d722a4225e1c3d95489d262971ca924", + "reference": "696f418b0d722a4225e1c3d95489d262971ca924", "shasum": "" }, "require": { @@ -4008,7 +4267,7 @@ "type": "tidelift" } ], - "time": "2024-07-06T07:57:47+00:00" + "time": "2024-09-25T14:21:43+00:00" }, { "name": "symfony/string", @@ -4016,12 +4275,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "7e9bd70f76fd32c4f01a00877c1c3938f52233bd" + "reference": "205580699b4d3e11f7b679faf2c0f57ffca6981c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/7e9bd70f76fd32c4f01a00877c1c3938f52233bd", - "reference": "7e9bd70f76fd32c4f01a00877c1c3938f52233bd", + "url": "https://api.github.com/repos/symfony/string/zipball/205580699b4d3e11f7b679faf2c0f57ffca6981c", + "reference": "205580699b4d3e11f7b679faf2c0f57ffca6981c", "shasum": "" }, "require": { @@ -4095,7 +4354,7 @@ "type": "tidelift" } ], - "time": "2024-09-20T08:31:44+00:00" + "time": "2024-10-23T06:56:12+00:00" }, { "name": "theseer/tokenizer", @@ -4150,13 +4409,16 @@ ], "aliases": [], "minimum-stability": "dev", - "stability-flags": [], + "stability-flags": { + "ircmaxell/ffime": 20, + "phpstan/phpstan": 20 + }, "prefer-stable": false, "prefer-lowest": false, "platform": { "php": ">=8.3", "ext-ffi": "*" }, - "platform-dev": [], + "platform-dev": {}, "plugin-api-version": "2.6.0" } diff --git a/examples/batch/index.php b/examples/batch/index.php index a0e3773..fde97f0 100644 --- a/examples/batch/index.php +++ b/examples/batch/index.php @@ -1,4 +1,5 @@ query("select * from users", [1]) as $row) { echo "$row->id - $row->email\n"; } - diff --git a/examples/local/index.php b/examples/local/index.php index a0e3773..fde97f0 100644 --- a/examples/local/index.php +++ b/examples/local/index.php @@ -1,4 +1,5 @@ query("select * from users", [1]) as $row) { echo "$row->id - $row->email\n"; } - diff --git a/examples/memory/index.php b/examples/memory/index.php index 0066299..1d978e3 100644 --- a/examples/memory/index.php +++ b/examples/memory/index.php @@ -1,4 +1,5 @@ query("select * from users", [1]) as $row) { echo "$row->id - $row->email\n"; } - diff --git a/examples/query/index.php b/examples/query/index.php index 254aa3c..6ef88a4 100644 --- a/examples/query/index.php +++ b/examples/query/index.php @@ -33,4 +33,3 @@ foreach ($conn->query("select * from users", [1]) as $row) { echo "$row->id $row->name\n"; } - diff --git a/examples/remote/index.php b/examples/remote/index.php index 05e174c..2ccc225 100644 --- a/examples/remote/index.php +++ b/examples/remote/index.php @@ -1,4 +1,5 @@ query("select * from users", [1]) as $row) { echo "$row->id - $row->email\n"; } - diff --git a/examples/sync/index.php b/examples/sync/index.php index fac6eb6..2ccc225 100644 --- a/examples/sync/index.php +++ b/examples/sync/index.php @@ -1,4 +1,5 @@ transaction(); -$fullnames=["John Doe", "Mary Smith", "Alice Jones", "Mark Taylor"]; +$fullnames = ["John Doe", "Mary Smith", "Alice Jones", "Mark Taylor"]; foreach ($fullnames as $fullname) { $tx->execute( @@ -33,4 +33,3 @@ foreach ($conn->query("select * from users", [1]) as $row) { echo "$row->id $row->name\n"; } - diff --git a/generate.php b/generate.php new file mode 100644 index 0000000..5f25749 --- /dev/null +++ b/generate.php @@ -0,0 +1,22 @@ +include(__DIR__.'/lib/libsql.h') + ->compile('ffi\\libsql') +; +// allow *->err nullable +$code = str_replace( + 'struct_libsql_error_t_ptr $err', + 'struct_libsql_error_t_ptr|null $err', + $code +); +$code = str_replace( + 'new struct_libsql_error_t_ptr($this->data->err)', + '$this->data->err ? new struct_libsql_error_t_ptr($this->data->err) : null', + $code +); +file_put_contents(__DIR__.'/lib/libsql.php', 'ffi = FFI::cdef(self::HEADER_DEF, $pathToSoFile); + } + + public static function cast(ilibsql $from, string $to): ilibsql { + if (!is_a($to, ilibsql::class, true)) { + throw new \LogicException("Cannot cast to a non-wrapper type"); + } + return new $to(self::$staticFFI->cast($to::getType(), $from->getData())); + } + + public static function makeArray(string $class, int|array $elements): ilibsql { + $type = $class::getType(); + if (substr($type, -1) !== "*") { + throw new \LogicException("Attempting to make a non-pointer element into an array"); + } + if (is_int($elements)) { + $cdata = self::$staticFFI->new(substr($type, 0, -1) . "[$elements]"); + } else { + $cdata = self::$staticFFI->new(substr($type, 0, -1) . "[" . count($elements) . "]"); + foreach ($elements as $key => $raw) { + $cdata[$key] = \is_scalar($raw) ? \is_int($raw) && $type === "char*" ? \chr($raw) : $raw : $raw->getData(); + } + } + $object = new $class(self::$staticFFI->cast($type, \FFI::addr($cdata))); + self::$__arrayWeakMap[$object] = $cdata; + return $object; + } + + public static function sizeof($classOrObject): int { + if (is_object($classOrObject) && $classOrObject instanceof ilibsql) { + return FFI::sizeof($classOrObject->getData()); + } elseif (is_a($classOrObject, ilibsql::class, true)) { + return FFI::sizeof(self::$staticFFI->type($classOrObject::getType())); + } else { + throw new \LogicException("Unknown class/object passed to sizeof()"); + } + } + + public function getFFI(): FFI { + return $this->ffi; + } + + + public function __get(string $name) { + switch($name) { + default: return $this->ffi->$name; + } + } + public function __set(string $name, $value) { + switch($name) { + default: return $this->ffi->$name; + } + } + public function __allocCachedString(string $str): FFI\CData { + return $this->__literalStrings[$str] ??= string_::ownedZero($str)->getData(); + } + public function libsql_setup(libsql_config_t | null $config): ?struct_libsql_error_t_ptr { + $config = $config?->getData(); + $result = $this->ffi->libsql_setup($config); + return $result === null ? null : new struct_libsql_error_t_ptr($result); + } + public function libsql_error_message(void_ptr | struct_libsql_error_t_ptr | null | array $self): ?string_ { + $__ffi_internal_refsself = []; + if (\is_array($self)) { + $_ = $this->ffi->new("struct libsql_error_t[" . \count($self) . "]"); + $_i = 0; + if ($self) { + if ($_ref = \ReflectionReference::fromArrayElement($self, \key($self))) { + foreach ($self as $_k => $_v) { + $__ffi_internal_refsself[$_i] = &$self[$_k]; + if ($_v !== null) { + $_[$_i++] = $_v->getData(); + } + } + $__ffi_internal_originalself = $self = $_; + } else { + foreach ($self as $_v) { + $_[$_i++] = $_v?->getData(); + } + $self = $_; + } + } + } else { + $self = $self?->getData(); + if ($self !== null) { + $self = $this->ffi->cast("struct libsql_error_t*", $self); + } + } + $result = $this->ffi->libsql_error_message($self); + foreach ($__ffi_internal_refsself as $_k => &$__ffi_internal_ref_v) { + $__ffi_internal_ref_v = $this->ffi->new("struct libsql_error_t"); + \FFI::addr($__ffi_internal_ref_v)[0] = $__ffi_internal_originalself[$_k]; + if ($__ffi_internal_ref_v !== null) { + $__ffi_internal_ref_v = new struct_libsql_error_t($__ffi_internal_ref_v); + } + } + return $result === null ? null : new string_($result); + } + public function libsql_database_init(libsql_database_desc_t | null $desc): ?libsql_database_t { + $desc = $desc?->getData(); + $result = $this->ffi->libsql_database_init($desc); + return $result === null ? null : new libsql_database_t($result); + } + public function libsql_database_sync(libsql_database_t | null $self): ?libsql_sync_t { + $self = $self?->getData(); + $result = $this->ffi->libsql_database_sync($self); + return $result === null ? null : new libsql_sync_t($result); + } + public function libsql_database_connect(libsql_database_t | null $self): ?libsql_connection_t { + $self = $self?->getData(); + $result = $this->ffi->libsql_database_connect($self); + return $result === null ? null : new libsql_connection_t($result); + } + public function libsql_connection_transaction(libsql_connection_t | null $self): ?libsql_transaction_t { + $self = $self?->getData(); + $result = $this->ffi->libsql_connection_transaction($self); + return $result === null ? null : new libsql_transaction_t($result); + } + public function libsql_connection_batch(libsql_connection_t | null $self, void_ptr | string_ | null | string | array $sql): ?libsql_batch_t { + $self = $self?->getData(); + $__ffi_internal_refssql = []; + if (\is_string($sql)) { + $sql = string_::ownedZero($sql)->getData(); + } elseif (\is_array($sql)) { + $_ = $this->ffi->new("char[" . \count($sql) . "]"); + $_i = 0; + if ($sql) { + if ($_ref = \ReflectionReference::fromArrayElement($sql, \key($sql))) { + foreach ($sql as $_k => $_v) { + $__ffi_internal_refssql[$_i] = &$sql[$_k]; + if ($_v !== null) { + $_[$_i++] = $_v; + } + } + $__ffi_internal_originalsql = $sql = $_; + } else { + foreach ($sql as $_v) { + $_[$_i++] = $_v ?? 0; + } + $sql = $_; + } + } + } else { + $sql = $sql?->getData(); + if ($sql !== null) { + $sql = $this->ffi->cast("char*", $sql); + } + } + $result = $this->ffi->libsql_connection_batch($self, $sql); + foreach ($__ffi_internal_refssql as $_k => &$__ffi_internal_ref_v) { + $__ffi_internal_ref_v = $__ffi_internal_originalsql[$_k]; + $__ffi_internal_ref_v = \ord($__ffi_internal_ref_v); + } + return $result === null ? null : new libsql_batch_t($result); + } + public function libsql_connection_info(libsql_connection_t | null $self): ?libsql_connection_info_t { + $self = $self?->getData(); + $result = $this->ffi->libsql_connection_info($self); + return $result === null ? null : new libsql_connection_info_t($result); + } + public function libsql_transaction_batch(libsql_transaction_t | null $self, void_ptr | string_ | null | string | array $sql): ?libsql_batch_t { + $self = $self?->getData(); + $__ffi_internal_refssql = []; + if (\is_string($sql)) { + $sql = string_::ownedZero($sql)->getData(); + } elseif (\is_array($sql)) { + $_ = $this->ffi->new("char[" . \count($sql) . "]"); + $_i = 0; + if ($sql) { + if ($_ref = \ReflectionReference::fromArrayElement($sql, \key($sql))) { + foreach ($sql as $_k => $_v) { + $__ffi_internal_refssql[$_i] = &$sql[$_k]; + if ($_v !== null) { + $_[$_i++] = $_v; + } + } + $__ffi_internal_originalsql = $sql = $_; + } else { + foreach ($sql as $_v) { + $_[$_i++] = $_v ?? 0; + } + $sql = $_; + } + } + } else { + $sql = $sql?->getData(); + if ($sql !== null) { + $sql = $this->ffi->cast("char*", $sql); + } + } + $result = $this->ffi->libsql_transaction_batch($self, $sql); + foreach ($__ffi_internal_refssql as $_k => &$__ffi_internal_ref_v) { + $__ffi_internal_ref_v = $__ffi_internal_originalsql[$_k]; + $__ffi_internal_ref_v = \ord($__ffi_internal_ref_v); + } + return $result === null ? null : new libsql_batch_t($result); + } + public function libsql_connection_prepare(libsql_connection_t | null $self, void_ptr | string_ | null | string | array $sql): ?libsql_statement_t { + $self = $self?->getData(); + $__ffi_internal_refssql = []; + if (\is_string($sql)) { + $sql = string_::ownedZero($sql)->getData(); + } elseif (\is_array($sql)) { + $_ = $this->ffi->new("char[" . \count($sql) . "]"); + $_i = 0; + if ($sql) { + if ($_ref = \ReflectionReference::fromArrayElement($sql, \key($sql))) { + foreach ($sql as $_k => $_v) { + $__ffi_internal_refssql[$_i] = &$sql[$_k]; + if ($_v !== null) { + $_[$_i++] = $_v; + } + } + $__ffi_internal_originalsql = $sql = $_; + } else { + foreach ($sql as $_v) { + $_[$_i++] = $_v ?? 0; + } + $sql = $_; + } + } + } else { + $sql = $sql?->getData(); + if ($sql !== null) { + $sql = $this->ffi->cast("char*", $sql); + } + } + $result = $this->ffi->libsql_connection_prepare($self, $sql); + foreach ($__ffi_internal_refssql as $_k => &$__ffi_internal_ref_v) { + $__ffi_internal_ref_v = $__ffi_internal_originalsql[$_k]; + $__ffi_internal_ref_v = \ord($__ffi_internal_ref_v); + } + return $result === null ? null : new libsql_statement_t($result); + } + public function libsql_transaction_prepare(libsql_transaction_t | null $self, void_ptr | string_ | null | string | array $sql): ?libsql_statement_t { + $self = $self?->getData(); + $__ffi_internal_refssql = []; + if (\is_string($sql)) { + $sql = string_::ownedZero($sql)->getData(); + } elseif (\is_array($sql)) { + $_ = $this->ffi->new("char[" . \count($sql) . "]"); + $_i = 0; + if ($sql) { + if ($_ref = \ReflectionReference::fromArrayElement($sql, \key($sql))) { + foreach ($sql as $_k => $_v) { + $__ffi_internal_refssql[$_i] = &$sql[$_k]; + if ($_v !== null) { + $_[$_i++] = $_v; + } + } + $__ffi_internal_originalsql = $sql = $_; + } else { + foreach ($sql as $_v) { + $_[$_i++] = $_v ?? 0; + } + $sql = $_; + } + } + } else { + $sql = $sql?->getData(); + if ($sql !== null) { + $sql = $this->ffi->cast("char*", $sql); + } + } + $result = $this->ffi->libsql_transaction_prepare($self, $sql); + foreach ($__ffi_internal_refssql as $_k => &$__ffi_internal_ref_v) { + $__ffi_internal_ref_v = $__ffi_internal_originalsql[$_k]; + $__ffi_internal_ref_v = \ord($__ffi_internal_ref_v); + } + return $result === null ? null : new libsql_statement_t($result); + } + public function libsql_statement_execute(libsql_statement_t | null $self): ?libsql_execute_t { + $self = $self?->getData(); + $result = $this->ffi->libsql_statement_execute($self); + return $result === null ? null : new libsql_execute_t($result); + } + public function libsql_statement_query(libsql_statement_t | null $self): ?libsql_rows_t { + $self = $self?->getData(); + $result = $this->ffi->libsql_statement_query($self); + return $result === null ? null : new libsql_rows_t($result); + } + public function libsql_statement_reset(libsql_statement_t | null $self): void { + $self = $self?->getData(); + $this->ffi->libsql_statement_reset($self); + } + public function libsql_rows_next(libsql_rows_t | null $self): ?libsql_row_t { + $self = $self?->getData(); + $result = $this->ffi->libsql_rows_next($self); + return $result === null ? null : new libsql_row_t($result); + } + public function libsql_rows_column_name(libsql_rows_t | null $self, int $index): ?libsql_slice_t { + $self = $self?->getData(); + $result = $this->ffi->libsql_rows_column_name($self, $index); + return $result === null ? null : new libsql_slice_t($result); + } + public function libsql_rows_column_length(libsql_rows_t | null $self): int { + $self = $self?->getData(); + $result = $this->ffi->libsql_rows_column_length($self); + return $result; + } + public function libsql_row_value(libsql_row_t | null $self, int $index): ?libsql_result_value_t { + $self = $self?->getData(); + $result = $this->ffi->libsql_row_value($self, $index); + return $result === null ? null : new libsql_result_value_t($result); + } + public function libsql_row_name(libsql_row_t | null $self, int $index): ?libsql_slice_t { + $self = $self?->getData(); + $result = $this->ffi->libsql_row_name($self, $index); + return $result === null ? null : new libsql_slice_t($result); + } + public function libsql_row_length(libsql_row_t | null $self): int { + $self = $self?->getData(); + $result = $this->ffi->libsql_row_length($self); + return $result; + } + public function libsql_row_empty(libsql_row_t | null $self): int { + $self = $self?->getData(); + $result = $this->ffi->libsql_row_empty($self); + return $result; + } + public function libsql_statement_bind_named(libsql_statement_t | null $self, void_ptr | string_ | null | string | array $name, libsql_value_t | null $value): ?libsql_bind_t { + $self = $self?->getData(); + $__ffi_internal_refsname = []; + if (\is_string($name)) { + $name = string_::ownedZero($name)->getData(); + } elseif (\is_array($name)) { + $_ = $this->ffi->new("char[" . \count($name) . "]"); + $_i = 0; + if ($name) { + if ($_ref = \ReflectionReference::fromArrayElement($name, \key($name))) { + foreach ($name as $_k => $_v) { + $__ffi_internal_refsname[$_i] = &$name[$_k]; + if ($_v !== null) { + $_[$_i++] = $_v; + } + } + $__ffi_internal_originalname = $name = $_; + } else { + foreach ($name as $_v) { + $_[$_i++] = $_v ?? 0; + } + $name = $_; + } + } + } else { + $name = $name?->getData(); + if ($name !== null) { + $name = $this->ffi->cast("char*", $name); + } + } + $value = $value?->getData(); + $result = $this->ffi->libsql_statement_bind_named($self, $name, $value); + foreach ($__ffi_internal_refsname as $_k => &$__ffi_internal_ref_v) { + $__ffi_internal_ref_v = $__ffi_internal_originalname[$_k]; + $__ffi_internal_ref_v = \ord($__ffi_internal_ref_v); + } + return $result === null ? null : new libsql_bind_t($result); + } + public function libsql_statement_bind_value(libsql_statement_t | null $self, libsql_value_t | null $value): ?libsql_bind_t { + $self = $self?->getData(); + $value = $value?->getData(); + $result = $this->ffi->libsql_statement_bind_value($self, $value); + return $result === null ? null : new libsql_bind_t($result); + } + public function libsql_integer(int $integer): ?libsql_value_t { + $result = $this->ffi->libsql_integer($integer); + return $result === null ? null : new libsql_value_t($result); + } + public function libsql_real(float $real): ?libsql_value_t { + $result = $this->ffi->libsql_real($real); + return $result === null ? null : new libsql_value_t($result); + } + public function libsql_text(void_ptr | string_ | null | string | array $ptr, int $len): ?libsql_value_t { + $__ffi_internal_refsptr = []; + if (\is_string($ptr)) { + $ptr = string_::ownedZero($ptr)->getData(); + } elseif (\is_array($ptr)) { + $_ = $this->ffi->new("char[" . \count($ptr) . "]"); + $_i = 0; + if ($ptr) { + if ($_ref = \ReflectionReference::fromArrayElement($ptr, \key($ptr))) { + foreach ($ptr as $_k => $_v) { + $__ffi_internal_refsptr[$_i] = &$ptr[$_k]; + if ($_v !== null) { + $_[$_i++] = $_v; + } + } + $__ffi_internal_originalptr = $ptr = $_; + } else { + foreach ($ptr as $_v) { + $_[$_i++] = $_v ?? 0; + } + $ptr = $_; + } + } + } else { + $ptr = $ptr?->getData(); + if ($ptr !== null) { + $ptr = $this->ffi->cast("char*", $ptr); + } + } + $result = $this->ffi->libsql_text($ptr, $len); + foreach ($__ffi_internal_refsptr as $_k => &$__ffi_internal_ref_v) { + $__ffi_internal_ref_v = $__ffi_internal_originalptr[$_k]; + $__ffi_internal_ref_v = \ord($__ffi_internal_ref_v); + } + return $result === null ? null : new libsql_value_t($result); + } + public function libsql_blob(void_ptr | uint8_t_ptr | null | string | array $ptr, int $len): ?libsql_value_t { + $__ffi_internal_refsptr = []; + if (\is_string($ptr)) { + $__ffi_str_ptr = string_::ownedZero($ptr)->getData(); + $ptr = $this->ffi->cast("uint8_t*", \FFI::addr($__ffi_str_ptr)); + } elseif (\is_array($ptr)) { + $_ = $this->ffi->new("uint8_t[" . \count($ptr) . "]"); + $_i = 0; + if ($ptr) { + if ($_ref = \ReflectionReference::fromArrayElement($ptr, \key($ptr))) { + foreach ($ptr as $_k => $_v) { + $__ffi_internal_refsptr[$_i] = &$ptr[$_k]; + if ($_v !== null) { + $_[$_i++] = $_v; + } + } + $__ffi_internal_originalptr = $ptr = $_; + } else { + foreach ($ptr as $_v) { + $_[$_i++] = $_v ?? 0; + } + $ptr = $_; + } + } + } else { + $ptr = $ptr?->getData(); + if ($ptr !== null) { + $ptr = $this->ffi->cast("uint8_t*", $ptr); + } + } + $result = $this->ffi->libsql_blob($ptr, $len); + foreach ($__ffi_internal_refsptr as $_k => &$__ffi_internal_ref_v) { + $__ffi_internal_ref_v = $__ffi_internal_originalptr[$_k]; + } + return $result === null ? null : new libsql_value_t($result); + } + public function libsql_null(): ?libsql_value_t { + $result = $this->ffi->libsql_null(); + return $result === null ? null : new libsql_value_t($result); + } + public function libsql_error_deinit(void_ptr | struct_libsql_error_t_ptr | null | array $self): void { + $__ffi_internal_refsself = []; + if (\is_array($self)) { + $_ = $this->ffi->new("struct libsql_error_t[" . \count($self) . "]"); + $_i = 0; + if ($self) { + if ($_ref = \ReflectionReference::fromArrayElement($self, \key($self))) { + foreach ($self as $_k => $_v) { + $__ffi_internal_refsself[$_i] = &$self[$_k]; + if ($_v !== null) { + $_[$_i++] = $_v->getData(); + } + } + $__ffi_internal_originalself = $self = $_; + } else { + foreach ($self as $_v) { + $_[$_i++] = $_v?->getData(); + } + $self = $_; + } + } + } else { + $self = $self?->getData(); + if ($self !== null) { + $self = $this->ffi->cast("struct libsql_error_t*", $self); + } + } + $this->ffi->libsql_error_deinit($self); + foreach ($__ffi_internal_refsself as $_k => &$__ffi_internal_ref_v) { + $__ffi_internal_ref_v = $this->ffi->new("struct libsql_error_t"); + \FFI::addr($__ffi_internal_ref_v)[0] = $__ffi_internal_originalself[$_k]; + if ($__ffi_internal_ref_v !== null) { + $__ffi_internal_ref_v = new struct_libsql_error_t($__ffi_internal_ref_v); + } + } + } + public function libsql_database_deinit(libsql_database_t | null $self): void { + $self = $self?->getData(); + $this->ffi->libsql_database_deinit($self); + } + public function libsql_connection_deinit(libsql_connection_t | null $self): void { + $self = $self?->getData(); + $this->ffi->libsql_connection_deinit($self); + } + public function libsql_statement_deinit(libsql_statement_t | null $self): void { + $self = $self?->getData(); + $this->ffi->libsql_statement_deinit($self); + } + public function libsql_transaction_commit(libsql_transaction_t | null $self): void { + $self = $self?->getData(); + $this->ffi->libsql_transaction_commit($self); + } + public function libsql_transaction_rollback(libsql_transaction_t | null $self): void { + $self = $self?->getData(); + $this->ffi->libsql_transaction_rollback($self); + } + public function libsql_rows_deinit(libsql_rows_t | null $self): void { + $self = $self?->getData(); + $this->ffi->libsql_rows_deinit($self); + } + public function libsql_row_deinit(libsql_row_t | null $self): void { + $self = $self?->getData(); + $this->ffi->libsql_row_deinit($self); + } + public function libsql_slice_deinit(libsql_slice_t | null $value): void { + $value = $value?->getData(); + $this->ffi->libsql_slice_deinit($value); + } +} + +class string_ implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(string_ $other): bool { return $this->data == $other->data; } + public function addr(): string_ptr { return new string_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): int { return \ord($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): int { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = \chr($value); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return int[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while ("\0" !== $cur = $this->data[$i++]) { $ret[] = \ord($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = \ord($this->data[$i]); } } return $ret; } + public function toString(?int $length = null): string { return $length === null ? FFI::string($this->data) : FFI::string($this->data, $length); } + public static function persistent(string $string): self { $str = new self(FFI::cdef()->new("char[" . \strlen($string) . "]", false)); FFI::memcpy($str->data, $string, \strlen($string)); return $str; } + public static function owned(string $string): self { $str = new self(FFI::cdef()->new("char[" . \strlen($string) . "]", true)); FFI::memcpy($str->data, $string, \strlen($string)); return $str; } + public static function persistentZero(string $string): self { return self::persistent("$string\0"); } + public static function ownedZero(string $string): self { return self::owned("$string\0"); } + public function set(int | void_ptr | string_ $value): void { + if (\is_scalar($value)) { + $this->data[0] = \chr($value); + } else { + FFI::addr($this->data)[0] = $value->getData(); + } + } + public static function getType(): string { return 'char*'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class string_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(string_ptr $other): bool { return $this->data == $other->data; } + public function addr(): string_ptr_ptr { return new string_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): string_ { return new string_($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): string_ { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return string_[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new string_($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new string_($this->data[$i]); } } return $ret; } + public function set(void_ptr | string_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'char**'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class string_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(string_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): string_ptr_ptr_ptr { return new string_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): string_ptr { return new string_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): string_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return string_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new string_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new string_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | string_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'char***'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class string_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(string_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): string_ptr_ptr_ptr_ptr { return new string_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): string_ptr_ptr { return new string_ptr_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): string_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return string_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new string_ptr_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new string_ptr_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | string_ptr_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'char***'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class void_ptr implements ilibsql, ilibsql_ptr { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(void_ptr $other): bool { return $this->data == $other->data; } + public function addr(): void_ptr_ptr { return new void_ptr_ptr(FFI::addr($this->data)); } + public function set(ilibsql_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'void*'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class void_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(void_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): void_ptr_ptr_ptr { return new void_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): void_ptr { return new void_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): void_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return void_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new void_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new void_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | void_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'void**'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class void_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(void_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): void_ptr_ptr_ptr_ptr { return new void_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): void_ptr_ptr { return new void_ptr_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): void_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return void_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new void_ptr_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new void_ptr_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | void_ptr_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'void***'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class void_ptr_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(void_ptr_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): void_ptr_ptr_ptr_ptr_ptr { return new void_ptr_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): void_ptr_ptr_ptr { return new void_ptr_ptr_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): void_ptr_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return void_ptr_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new void_ptr_ptr_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new void_ptr_ptr_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | void_ptr_ptr_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'void****'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class function_type_ptr implements ilibsql, ilibsql_ptr { + private FFI\CData $data; + private array $types; + public function __construct(FFI\CData $data, array $types) { $this->data = $data; $this->types = $types; } + public function getData(): FFI\CData { return $this->data; } + public function equals(function_type_ptr $other): bool { return $this->data == $other->data; } + public function addr(): function_type_ptr_ptr { return new function_type_ptr_ptr(FFI::addr($this->data)); } + public function set(callable | void_ptr | function_type_ptr $value): void { + if ($value instanceof void_ptr) { + $value = $value->getData(); + } elseif ($value instanceof function_type_ptr) { + if ($value->types != $this->types) { + throw new \TypeError("Cannot assign " . get_class($value) . " with type signature " . json_encode($value->types) . " to " . get_class($this) . " with type signature " . json_encode($this->types)); + } + $value = $value->getData(); + } else { + $types = $this->types; + $value = static function (...$args) use ($value, $types) { + foreach ($args as $i => $arg) { + $type = $types[$i + 1]; + if ($type === "char") { + $args[$i] = \chr($arg); + } elseif (\is_array($type)) { + $args[$i] = new (__NAMESPACE__ . "\\" . $type[0])($arg, array_slice($type, 1)); + } elseif ($type !== "int" && $type !== "float") { + $args[$i] = new (__NAMESPACE__ . "\\" . $type)($arg); + } + } + $ret = $value(...$args); + if ($types[0] === "int" || $types === "float") { + return $ret; + } elseif ($types[0] === "char") { + return \chr($ret); + } elseif ($types[0] !== null) { + return $ret->getData(); + } + }; + } + FFI::addr($this->data)[0] = $value; + } + public static function getType(): string { return "(*)"; } + public function getDefinition(): string { return ($this->types[0] !== null ? \is_array($this->types[0]) ? (new (__NAMESPACE__ . "\\" . $this->types[0][0])($this->data, array_slice($this->types[0], 1)))->getDefinition() : $this->types[0]::getType() : "void") . "(*)(" . implode(", ", array_map(function($t) { return \is_array($t) ? (new (__NAMESPACE__ . "\\" . $t[0])($this->data, array_slice($t, 1)))->getDefinition() : $t::getType(); }, array_slice($this->types, 1))) . ")"; } +} +class function_type_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + private array $types; + public function __construct(FFI\CData $data, array $types) { $this->data = $data; $this->types = $types; } + public function getData(): FFI\CData { return $this->data; } + public function equals(function_type_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): function_type_ptr_ptr_ptr { return new function_type_ptr_ptr_ptr(FFI::addr($this->data)); } + #[\ReturnTypeWillChange] public function offsetGet($offset): function_type_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->deref($offset)->set($value); } + public function deref(int $n = 0): function_type_ptr { return new function_type_ptr($this->data[$n], $this->types); } + /** @return function_type_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new function_type_ptr($cur, $this->types); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new function_type_ptr($this->data[$i], $this->types); } } return $ret; } + public function set(void_ptr | function_type_ptr_ptr $value): void { + if ($value instanceof function_type_ptr_ptr && $value->types != $this->types) { + throw new \TypeError("Cannot assign " . get_class($value) . " with type signature " . json_encode($value->types) . " to " . get_class($this) . " with type signature " . json_encode($this->types)); + } + FFI::addr($this->data)[0] = $value; + } + public static function getType(): string { return "(**)"; } + public function getDefinition(): string { return ($this->types[0] !== null ? \is_array($this->types[0]) ? (new (__NAMESPACE__ . "\\" . $this->types[0][0])($this->data, array_slice($this->types[0], 1)))->getDefinition() : $this->types[0]::getType() : "void") . "(**)(" . implode(", ", array_map(function($t) { return \is_array($t) ? (new (__NAMESPACE__ . "\\" . $t[0])($this->data, array_slice($t, 1)))->getDefinition() : $t::getType(); }, array_slice($this->types, 1))) . ")"; } +} +class function_type_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + private array $types; + public function __construct(FFI\CData $data, array $types) { $this->data = $data; $this->types = $types; } + public function getData(): FFI\CData { return $this->data; } + public function equals(function_type_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): function_type_ptr_ptr_ptr_ptr { return new function_type_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + #[\ReturnTypeWillChange] public function offsetGet($offset): function_type_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->deref($offset)->set($value); } + public function deref(int $n = 0): function_type_ptr_ptr { return new function_type_ptr_ptr($this->data[$n], $this->types); } + /** @return function_type_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new function_type_ptr_ptr($cur, $this->types); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new function_type_ptr_ptr($this->data[$i], $this->types); } } return $ret; } + public function set(void_ptr | function_type_ptr_ptr_ptr $value): void { + if ($value instanceof function_type_ptr_ptr_ptr && $value->types != $this->types) { + throw new \TypeError("Cannot assign " . get_class($value) . " with type signature " . json_encode($value->types) . " to " . get_class($this) . " with type signature " . json_encode($this->types)); + } + FFI::addr($this->data)[0] = $value; + } + public static function getType(): string { return "(***)"; } + public function getDefinition(): string { return ($this->types[0] !== null ? \is_array($this->types[0]) ? (new (__NAMESPACE__ . "\\" . $this->types[0][0])($this->data, array_slice($this->types[0], 1)))->getDefinition() : $this->types[0]::getType() : "void") . "(***)(" . implode(", ", array_map(function($t) { return \is_array($t) ? (new (__NAMESPACE__ . "\\" . $t[0])($this->data, array_slice($t, 1)))->getDefinition() : $t::getType(); }, array_slice($this->types, 1))) . ")"; } +} +class function_type_ptr_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + private array $types; + public function __construct(FFI\CData $data, array $types) { $this->data = $data; $this->types = $types; } + public function getData(): FFI\CData { return $this->data; } + public function equals(function_type_ptr_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): function_type_ptr_ptr_ptr_ptr_ptr { return new function_type_ptr_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + #[\ReturnTypeWillChange] public function offsetGet($offset): function_type_ptr_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->deref($offset)->set($value); } + public function deref(int $n = 0): function_type_ptr_ptr_ptr { return new function_type_ptr_ptr_ptr($this->data[$n], $this->types); } + /** @return function_type_ptr_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new function_type_ptr_ptr_ptr($cur, $this->types); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new function_type_ptr_ptr_ptr($this->data[$i], $this->types); } } return $ret; } + public function set(void_ptr | function_type_ptr_ptr_ptr_ptr $value): void { + if ($value instanceof function_type_ptr_ptr_ptr_ptr && $value->types != $this->types) { + throw new \TypeError("Cannot assign " . get_class($value) . " with type signature " . json_encode($value->types) . " to " . get_class($this) . " with type signature " . json_encode($this->types)); + } + FFI::addr($this->data)[0] = $value; + } + public static function getType(): string { return "(****)"; } + public function getDefinition(): string { return ($this->types[0] !== null ? \is_array($this->types[0]) ? (new (__NAMESPACE__ . "\\" . $this->types[0][0])($this->data, array_slice($this->types[0], 1)))->getDefinition() : $this->types[0]::getType() : "void") . "(****)(" . implode(", ", array_map(function($t) { return \is_array($t) ? (new (__NAMESPACE__ . "\\" . $t[0])($this->data, array_slice($t, 1)))->getDefinition() : $t::getType(); }, array_slice($this->types, 1))) . ")"; } +} +class struct_libsql_error_t implements ilibsql { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(struct_libsql_error_t $other): bool { return $this->data == $other->data; } + public function addr(): struct_libsql_error_t_ptr { return new struct_libsql_error_t_ptr(FFI::addr($this->data)); } + public function set(struct_libsql_error_t $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'struct libsql_error_t'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class struct_libsql_error_t_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(struct_libsql_error_t_ptr $other): bool { return $this->data == $other->data; } + public function addr(): struct_libsql_error_t_ptr_ptr { return new struct_libsql_error_t_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): struct_libsql_error_t { return new struct_libsql_error_t($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): struct_libsql_error_t { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return struct_libsql_error_t[] */ public function toArray(int $length): array { $ret = []; for ($i = 0; $i < $length; ++$i) { $ret[] = new struct_libsql_error_t($this->data[$i]); } return $ret; } + public function set(void_ptr | struct_libsql_error_t_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'struct libsql_error_t*'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class struct_libsql_error_t_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(struct_libsql_error_t_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): struct_libsql_error_t_ptr_ptr_ptr { return new struct_libsql_error_t_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): struct_libsql_error_t_ptr { return new struct_libsql_error_t_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): struct_libsql_error_t_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return struct_libsql_error_t_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new struct_libsql_error_t_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new struct_libsql_error_t_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | struct_libsql_error_t_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'struct libsql_error_t**'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class struct_libsql_error_t_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(struct_libsql_error_t_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): struct_libsql_error_t_ptr_ptr_ptr_ptr { return new struct_libsql_error_t_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): struct_libsql_error_t_ptr_ptr { return new struct_libsql_error_t_ptr_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): struct_libsql_error_t_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return struct_libsql_error_t_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new struct_libsql_error_t_ptr_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new struct_libsql_error_t_ptr_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | struct_libsql_error_t_ptr_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'struct libsql_error_t***'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class struct_libsql_error_t_ptr_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(struct_libsql_error_t_ptr_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): struct_libsql_error_t_ptr_ptr_ptr_ptr_ptr { return new struct_libsql_error_t_ptr_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): struct_libsql_error_t_ptr_ptr_ptr { return new struct_libsql_error_t_ptr_ptr_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): struct_libsql_error_t_ptr_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return struct_libsql_error_t_ptr_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new struct_libsql_error_t_ptr_ptr_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new struct_libsql_error_t_ptr_ptr_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | struct_libsql_error_t_ptr_ptr_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'struct libsql_error_t****'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +/** + * @property string_ $message + * @property string_ $target + * @property string_ $file + * @property int $timestamp + * @property int $line + * @property int $level + */ +class libsql_log_t implements ilibsql { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_log_t $other): bool { return $this->data == $other->data; } + public function addr(): libsql_log_t_ptr { return new libsql_log_t_ptr(FFI::addr($this->data)); } + public function __get($prop) { + switch ($prop) { + case "message": return new string_($this->data->message); + case "target": return new string_($this->data->target); + case "file": return new string_($this->data->file); + case "timestamp": return $this->data->timestamp; + case "line": return $this->data->line; + case "level": return $this->data->level; + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function __set($prop, $value) { + switch ($prop) { + case "message": + (new string_($_ = &$this->data->message))->set($value); + return; + case "target": + (new string_($_ = &$this->data->target))->set($value); + return; + case "file": + (new string_($_ = &$this->data->file))->set($value); + return; + case "timestamp": + $this->data->timestamp = $value; + return; + case "line": + $this->data->line = $value; + return; + case "level": + $this->data->level = $value; + return; + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function set(libsql_log_t $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_log_t'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +/** + * @property string_ $message + * @property string_ $target + * @property string_ $file + * @property int $timestamp + * @property int $line + * @property int $level + */ +class libsql_log_t_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_log_t_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_log_t_ptr_ptr { return new libsql_log_t_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_log_t { return new libsql_log_t($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_log_t { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_log_t[] */ public function toArray(int $length): array { $ret = []; for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_log_t($this->data[$i]); } return $ret; } + public function __get($prop) { + switch ($prop) { + case "message": return new string_($this->data[0]->message); + case "target": return new string_($this->data[0]->target); + case "file": return new string_($this->data[0]->file); + case "timestamp": return $this->data[0]->timestamp; + case "line": return $this->data[0]->line; + case "level": return $this->data[0]->level; + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function __set($prop, $value) { + switch ($prop) { + case "message": + (new string_($_ = &$this->data[0]->message))->set($value); + return; + case "target": + (new string_($_ = &$this->data[0]->target))->set($value); + return; + case "file": + (new string_($_ = &$this->data[0]->file))->set($value); + return; + case "timestamp": + $this->data[0]->timestamp = $value; + return; + case "line": + $this->data[0]->line = $value; + return; + case "level": + $this->data[0]->level = $value; + return; + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function set(void_ptr | libsql_log_t_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_log_t*'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class libsql_log_t_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_log_t_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_log_t_ptr_ptr_ptr { return new libsql_log_t_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_log_t_ptr { return new libsql_log_t_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_log_t_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_log_t_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new libsql_log_t_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_log_t_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | libsql_log_t_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_log_t**'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class libsql_log_t_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_log_t_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_log_t_ptr_ptr_ptr_ptr { return new libsql_log_t_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_log_t_ptr_ptr { return new libsql_log_t_ptr_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_log_t_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_log_t_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new libsql_log_t_ptr_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_log_t_ptr_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | libsql_log_t_ptr_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_log_t***'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class libsql_log_t_ptr_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_log_t_ptr_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_log_t_ptr_ptr_ptr_ptr_ptr { return new libsql_log_t_ptr_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_log_t_ptr_ptr_ptr { return new libsql_log_t_ptr_ptr_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_log_t_ptr_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_log_t_ptr_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new libsql_log_t_ptr_ptr_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_log_t_ptr_ptr_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | libsql_log_t_ptr_ptr_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_log_t****'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +/** + * @property struct_libsql_error_t_ptr|null $err + * @property void_ptr $inner + */ +class libsql_database_t implements ilibsql { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_database_t $other): bool { return $this->data == $other->data; } + public function addr(): libsql_database_t_ptr { return new libsql_database_t_ptr(FFI::addr($this->data)); } + public function __get($prop) { + switch ($prop) { + case "err": return $this->data->err ? new struct_libsql_error_t_ptr($this->data->err) : null; + case "inner": return new void_ptr($this->data->inner); + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function __set($prop, $value) { + switch ($prop) { + case "err": + (new struct_libsql_error_t_ptr($_ = &$this->data->err))->set($value); + return; + case "inner": + (new void_ptr($_ = &$this->data->inner))->set($value); + return; + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function set(libsql_database_t $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_database_t'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +/** + * @property struct_libsql_error_t_ptr|null $err + * @property void_ptr $inner + */ +class libsql_database_t_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_database_t_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_database_t_ptr_ptr { return new libsql_database_t_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_database_t { return new libsql_database_t($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_database_t { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_database_t[] */ public function toArray(int $length): array { $ret = []; for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_database_t($this->data[$i]); } return $ret; } + public function __get($prop) { + switch ($prop) { + case "err": return new struct_libsql_error_t_ptr($this->data[0]->err); + case "inner": return new void_ptr($this->data[0]->inner); + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function __set($prop, $value) { + switch ($prop) { + case "err": + (new struct_libsql_error_t_ptr($_ = &$this->data[0]->err))->set($value); + return; + case "inner": + (new void_ptr($_ = &$this->data[0]->inner))->set($value); + return; + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function set(void_ptr | libsql_database_t_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_database_t*'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class libsql_database_t_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_database_t_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_database_t_ptr_ptr_ptr { return new libsql_database_t_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_database_t_ptr { return new libsql_database_t_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_database_t_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_database_t_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new libsql_database_t_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_database_t_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | libsql_database_t_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_database_t**'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class libsql_database_t_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_database_t_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_database_t_ptr_ptr_ptr_ptr { return new libsql_database_t_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_database_t_ptr_ptr { return new libsql_database_t_ptr_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_database_t_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_database_t_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new libsql_database_t_ptr_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_database_t_ptr_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | libsql_database_t_ptr_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_database_t***'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class libsql_database_t_ptr_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_database_t_ptr_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_database_t_ptr_ptr_ptr_ptr_ptr { return new libsql_database_t_ptr_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_database_t_ptr_ptr_ptr { return new libsql_database_t_ptr_ptr_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_database_t_ptr_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_database_t_ptr_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new libsql_database_t_ptr_ptr_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_database_t_ptr_ptr_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | libsql_database_t_ptr_ptr_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_database_t****'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +/** + * @property struct_libsql_error_t_ptr|null $err + * @property void_ptr $inner + */ +class libsql_connection_t implements ilibsql { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_connection_t $other): bool { return $this->data == $other->data; } + public function addr(): libsql_connection_t_ptr { return new libsql_connection_t_ptr(FFI::addr($this->data)); } + public function __get($prop) { + switch ($prop) { + case "err": return $this->data->err ? new struct_libsql_error_t_ptr($this->data->err) : null; + case "inner": return new void_ptr($this->data->inner); + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function __set($prop, $value) { + switch ($prop) { + case "err": + (new struct_libsql_error_t_ptr($_ = &$this->data->err))->set($value); + return; + case "inner": + (new void_ptr($_ = &$this->data->inner))->set($value); + return; + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function set(libsql_connection_t $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_connection_t'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +/** + * @property struct_libsql_error_t_ptr|null $err + * @property void_ptr $inner + */ +class libsql_connection_t_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_connection_t_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_connection_t_ptr_ptr { return new libsql_connection_t_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_connection_t { return new libsql_connection_t($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_connection_t { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_connection_t[] */ public function toArray(int $length): array { $ret = []; for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_connection_t($this->data[$i]); } return $ret; } + public function __get($prop) { + switch ($prop) { + case "err": return new struct_libsql_error_t_ptr($this->data[0]->err); + case "inner": return new void_ptr($this->data[0]->inner); + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function __set($prop, $value) { + switch ($prop) { + case "err": + (new struct_libsql_error_t_ptr($_ = &$this->data[0]->err))->set($value); + return; + case "inner": + (new void_ptr($_ = &$this->data[0]->inner))->set($value); + return; + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function set(void_ptr | libsql_connection_t_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_connection_t*'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class libsql_connection_t_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_connection_t_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_connection_t_ptr_ptr_ptr { return new libsql_connection_t_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_connection_t_ptr { return new libsql_connection_t_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_connection_t_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_connection_t_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new libsql_connection_t_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_connection_t_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | libsql_connection_t_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_connection_t**'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class libsql_connection_t_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_connection_t_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_connection_t_ptr_ptr_ptr_ptr { return new libsql_connection_t_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_connection_t_ptr_ptr { return new libsql_connection_t_ptr_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_connection_t_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_connection_t_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new libsql_connection_t_ptr_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_connection_t_ptr_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | libsql_connection_t_ptr_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_connection_t***'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class libsql_connection_t_ptr_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_connection_t_ptr_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_connection_t_ptr_ptr_ptr_ptr_ptr { return new libsql_connection_t_ptr_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_connection_t_ptr_ptr_ptr { return new libsql_connection_t_ptr_ptr_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_connection_t_ptr_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_connection_t_ptr_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new libsql_connection_t_ptr_ptr_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_connection_t_ptr_ptr_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | libsql_connection_t_ptr_ptr_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_connection_t****'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +/** + * @property struct_libsql_error_t_ptr|null $err + * @property void_ptr $inner + */ +class libsql_statement_t implements ilibsql { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_statement_t $other): bool { return $this->data == $other->data; } + public function addr(): libsql_statement_t_ptr { return new libsql_statement_t_ptr(FFI::addr($this->data)); } + public function __get($prop) { + switch ($prop) { + case "err": return $this->data->err ? new struct_libsql_error_t_ptr($this->data->err) : null; + case "inner": return new void_ptr($this->data->inner); + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function __set($prop, $value) { + switch ($prop) { + case "err": + (new struct_libsql_error_t_ptr($_ = &$this->data->err))->set($value); + return; + case "inner": + (new void_ptr($_ = &$this->data->inner))->set($value); + return; + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function set(libsql_statement_t $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_statement_t'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +/** + * @property struct_libsql_error_t_ptr|null $err + * @property void_ptr $inner + */ +class libsql_statement_t_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_statement_t_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_statement_t_ptr_ptr { return new libsql_statement_t_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_statement_t { return new libsql_statement_t($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_statement_t { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_statement_t[] */ public function toArray(int $length): array { $ret = []; for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_statement_t($this->data[$i]); } return $ret; } + public function __get($prop) { + switch ($prop) { + case "err": return new struct_libsql_error_t_ptr($this->data[0]->err); + case "inner": return new void_ptr($this->data[0]->inner); + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function __set($prop, $value) { + switch ($prop) { + case "err": + (new struct_libsql_error_t_ptr($_ = &$this->data[0]->err))->set($value); + return; + case "inner": + (new void_ptr($_ = &$this->data[0]->inner))->set($value); + return; + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function set(void_ptr | libsql_statement_t_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_statement_t*'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class libsql_statement_t_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_statement_t_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_statement_t_ptr_ptr_ptr { return new libsql_statement_t_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_statement_t_ptr { return new libsql_statement_t_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_statement_t_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_statement_t_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new libsql_statement_t_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_statement_t_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | libsql_statement_t_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_statement_t**'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class libsql_statement_t_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_statement_t_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_statement_t_ptr_ptr_ptr_ptr { return new libsql_statement_t_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_statement_t_ptr_ptr { return new libsql_statement_t_ptr_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_statement_t_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_statement_t_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new libsql_statement_t_ptr_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_statement_t_ptr_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | libsql_statement_t_ptr_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_statement_t***'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class libsql_statement_t_ptr_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_statement_t_ptr_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_statement_t_ptr_ptr_ptr_ptr_ptr { return new libsql_statement_t_ptr_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_statement_t_ptr_ptr_ptr { return new libsql_statement_t_ptr_ptr_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_statement_t_ptr_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_statement_t_ptr_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new libsql_statement_t_ptr_ptr_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_statement_t_ptr_ptr_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | libsql_statement_t_ptr_ptr_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_statement_t****'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +/** + * @property struct_libsql_error_t_ptr|null $err + * @property void_ptr $inner + */ +class libsql_transaction_t implements ilibsql { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_transaction_t $other): bool { return $this->data == $other->data; } + public function addr(): libsql_transaction_t_ptr { return new libsql_transaction_t_ptr(FFI::addr($this->data)); } + public function __get($prop) { + switch ($prop) { + case "err": return $this->data->err ? new struct_libsql_error_t_ptr($this->data->err) : null; + case "inner": return new void_ptr($this->data->inner); + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function __set($prop, $value) { + switch ($prop) { + case "err": + (new struct_libsql_error_t_ptr($_ = &$this->data->err))->set($value); + return; + case "inner": + (new void_ptr($_ = &$this->data->inner))->set($value); + return; + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function set(libsql_transaction_t $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_transaction_t'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +/** + * @property struct_libsql_error_t_ptr|null $err + * @property void_ptr $inner + */ +class libsql_transaction_t_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_transaction_t_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_transaction_t_ptr_ptr { return new libsql_transaction_t_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_transaction_t { return new libsql_transaction_t($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_transaction_t { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_transaction_t[] */ public function toArray(int $length): array { $ret = []; for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_transaction_t($this->data[$i]); } return $ret; } + public function __get($prop) { + switch ($prop) { + case "err": return new struct_libsql_error_t_ptr($this->data[0]->err); + case "inner": return new void_ptr($this->data[0]->inner); + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function __set($prop, $value) { + switch ($prop) { + case "err": + (new struct_libsql_error_t_ptr($_ = &$this->data[0]->err))->set($value); + return; + case "inner": + (new void_ptr($_ = &$this->data[0]->inner))->set($value); + return; + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function set(void_ptr | libsql_transaction_t_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_transaction_t*'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class libsql_transaction_t_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_transaction_t_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_transaction_t_ptr_ptr_ptr { return new libsql_transaction_t_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_transaction_t_ptr { return new libsql_transaction_t_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_transaction_t_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_transaction_t_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new libsql_transaction_t_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_transaction_t_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | libsql_transaction_t_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_transaction_t**'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class libsql_transaction_t_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_transaction_t_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_transaction_t_ptr_ptr_ptr_ptr { return new libsql_transaction_t_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_transaction_t_ptr_ptr { return new libsql_transaction_t_ptr_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_transaction_t_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_transaction_t_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new libsql_transaction_t_ptr_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_transaction_t_ptr_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | libsql_transaction_t_ptr_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_transaction_t***'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class libsql_transaction_t_ptr_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_transaction_t_ptr_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_transaction_t_ptr_ptr_ptr_ptr_ptr { return new libsql_transaction_t_ptr_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_transaction_t_ptr_ptr_ptr { return new libsql_transaction_t_ptr_ptr_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_transaction_t_ptr_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_transaction_t_ptr_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new libsql_transaction_t_ptr_ptr_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_transaction_t_ptr_ptr_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | libsql_transaction_t_ptr_ptr_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_transaction_t****'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +/** + * @property struct_libsql_error_t_ptr|null $err + * @property void_ptr $inner + */ +class libsql_rows_t implements ilibsql { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_rows_t $other): bool { return $this->data == $other->data; } + public function addr(): libsql_rows_t_ptr { return new libsql_rows_t_ptr(FFI::addr($this->data)); } + public function __get($prop) { + switch ($prop) { + case "err": return $this->data->err ? new struct_libsql_error_t_ptr($this->data->err) : null; + case "inner": return new void_ptr($this->data->inner); + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function __set($prop, $value) { + switch ($prop) { + case "err": + (new struct_libsql_error_t_ptr($_ = &$this->data->err))->set($value); + return; + case "inner": + (new void_ptr($_ = &$this->data->inner))->set($value); + return; + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function set(libsql_rows_t $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_rows_t'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +/** + * @property struct_libsql_error_t_ptr|null $err + * @property void_ptr $inner + */ +class libsql_rows_t_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_rows_t_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_rows_t_ptr_ptr { return new libsql_rows_t_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_rows_t { return new libsql_rows_t($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_rows_t { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_rows_t[] */ public function toArray(int $length): array { $ret = []; for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_rows_t($this->data[$i]); } return $ret; } + public function __get($prop) { + switch ($prop) { + case "err": return new struct_libsql_error_t_ptr($this->data[0]->err); + case "inner": return new void_ptr($this->data[0]->inner); + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function __set($prop, $value) { + switch ($prop) { + case "err": + (new struct_libsql_error_t_ptr($_ = &$this->data[0]->err))->set($value); + return; + case "inner": + (new void_ptr($_ = &$this->data[0]->inner))->set($value); + return; + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function set(void_ptr | libsql_rows_t_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_rows_t*'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class libsql_rows_t_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_rows_t_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_rows_t_ptr_ptr_ptr { return new libsql_rows_t_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_rows_t_ptr { return new libsql_rows_t_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_rows_t_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_rows_t_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new libsql_rows_t_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_rows_t_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | libsql_rows_t_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_rows_t**'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class libsql_rows_t_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_rows_t_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_rows_t_ptr_ptr_ptr_ptr { return new libsql_rows_t_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_rows_t_ptr_ptr { return new libsql_rows_t_ptr_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_rows_t_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_rows_t_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new libsql_rows_t_ptr_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_rows_t_ptr_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | libsql_rows_t_ptr_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_rows_t***'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class libsql_rows_t_ptr_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_rows_t_ptr_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_rows_t_ptr_ptr_ptr_ptr_ptr { return new libsql_rows_t_ptr_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_rows_t_ptr_ptr_ptr { return new libsql_rows_t_ptr_ptr_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_rows_t_ptr_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_rows_t_ptr_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new libsql_rows_t_ptr_ptr_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_rows_t_ptr_ptr_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | libsql_rows_t_ptr_ptr_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_rows_t****'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +/** + * @property struct_libsql_error_t_ptr|null $err + * @property void_ptr $inner + */ +class libsql_row_t implements ilibsql { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_row_t $other): bool { return $this->data == $other->data; } + public function addr(): libsql_row_t_ptr { return new libsql_row_t_ptr(FFI::addr($this->data)); } + public function __get($prop) { + switch ($prop) { + case "err": return $this->data->err ? new struct_libsql_error_t_ptr($this->data->err) : null; + case "inner": return new void_ptr($this->data->inner); + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function __set($prop, $value) { + switch ($prop) { + case "err": + (new struct_libsql_error_t_ptr($_ = &$this->data->err))->set($value); + return; + case "inner": + (new void_ptr($_ = &$this->data->inner))->set($value); + return; + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function set(libsql_row_t $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_row_t'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +/** + * @property struct_libsql_error_t_ptr|null $err + * @property void_ptr $inner + */ +class libsql_row_t_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_row_t_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_row_t_ptr_ptr { return new libsql_row_t_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_row_t { return new libsql_row_t($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_row_t { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_row_t[] */ public function toArray(int $length): array { $ret = []; for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_row_t($this->data[$i]); } return $ret; } + public function __get($prop) { + switch ($prop) { + case "err": return new struct_libsql_error_t_ptr($this->data[0]->err); + case "inner": return new void_ptr($this->data[0]->inner); + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function __set($prop, $value) { + switch ($prop) { + case "err": + (new struct_libsql_error_t_ptr($_ = &$this->data[0]->err))->set($value); + return; + case "inner": + (new void_ptr($_ = &$this->data[0]->inner))->set($value); + return; + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function set(void_ptr | libsql_row_t_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_row_t*'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class libsql_row_t_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_row_t_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_row_t_ptr_ptr_ptr { return new libsql_row_t_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_row_t_ptr { return new libsql_row_t_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_row_t_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_row_t_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new libsql_row_t_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_row_t_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | libsql_row_t_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_row_t**'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class libsql_row_t_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_row_t_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_row_t_ptr_ptr_ptr_ptr { return new libsql_row_t_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_row_t_ptr_ptr { return new libsql_row_t_ptr_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_row_t_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_row_t_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new libsql_row_t_ptr_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_row_t_ptr_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | libsql_row_t_ptr_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_row_t***'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class libsql_row_t_ptr_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_row_t_ptr_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_row_t_ptr_ptr_ptr_ptr_ptr { return new libsql_row_t_ptr_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_row_t_ptr_ptr_ptr { return new libsql_row_t_ptr_ptr_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_row_t_ptr_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_row_t_ptr_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new libsql_row_t_ptr_ptr_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_row_t_ptr_ptr_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | libsql_row_t_ptr_ptr_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_row_t****'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +/** + * @property struct_libsql_error_t_ptr|null $err + */ +class libsql_batch_t implements ilibsql { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_batch_t $other): bool { return $this->data == $other->data; } + public function addr(): libsql_batch_t_ptr { return new libsql_batch_t_ptr(FFI::addr($this->data)); } + public function __get($prop) { + switch ($prop) { + case "err": return $this->data->err ? new struct_libsql_error_t_ptr($this->data->err) : null; + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function __set($prop, $value) { + switch ($prop) { + case "err": + (new struct_libsql_error_t_ptr($_ = &$this->data->err))->set($value); + return; + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function set(libsql_batch_t $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_batch_t'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +/** + * @property struct_libsql_error_t_ptr|null $err + */ +class libsql_batch_t_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_batch_t_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_batch_t_ptr_ptr { return new libsql_batch_t_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_batch_t { return new libsql_batch_t($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_batch_t { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_batch_t[] */ public function toArray(int $length): array { $ret = []; for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_batch_t($this->data[$i]); } return $ret; } + public function __get($prop) { + switch ($prop) { + case "err": return new struct_libsql_error_t_ptr($this->data[0]->err); + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function __set($prop, $value) { + switch ($prop) { + case "err": + (new struct_libsql_error_t_ptr($_ = &$this->data[0]->err))->set($value); + return; + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function set(void_ptr | libsql_batch_t_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_batch_t*'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class libsql_batch_t_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_batch_t_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_batch_t_ptr_ptr_ptr { return new libsql_batch_t_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_batch_t_ptr { return new libsql_batch_t_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_batch_t_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_batch_t_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new libsql_batch_t_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_batch_t_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | libsql_batch_t_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_batch_t**'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class libsql_batch_t_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_batch_t_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_batch_t_ptr_ptr_ptr_ptr { return new libsql_batch_t_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_batch_t_ptr_ptr { return new libsql_batch_t_ptr_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_batch_t_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_batch_t_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new libsql_batch_t_ptr_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_batch_t_ptr_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | libsql_batch_t_ptr_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_batch_t***'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class libsql_batch_t_ptr_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_batch_t_ptr_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_batch_t_ptr_ptr_ptr_ptr_ptr { return new libsql_batch_t_ptr_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_batch_t_ptr_ptr_ptr { return new libsql_batch_t_ptr_ptr_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_batch_t_ptr_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_batch_t_ptr_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new libsql_batch_t_ptr_ptr_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_batch_t_ptr_ptr_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | libsql_batch_t_ptr_ptr_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_batch_t****'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +/** + * @property void_ptr $ptr + * @property int $len + */ +class libsql_slice_t implements ilibsql { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_slice_t $other): bool { return $this->data == $other->data; } + public function addr(): libsql_slice_t_ptr { return new libsql_slice_t_ptr(FFI::addr($this->data)); } + public function __get($prop) { + switch ($prop) { + case "ptr": return new void_ptr($this->data->ptr); + case "len": return $this->data->len; + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function __set($prop, $value) { + switch ($prop) { + case "ptr": + (new void_ptr($_ = &$this->data->ptr))->set($value); + return; + case "len": + $this->data->len = $value; + return; + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function set(libsql_slice_t $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_slice_t'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +/** + * @property void_ptr $ptr + * @property int $len + */ +class libsql_slice_t_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_slice_t_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_slice_t_ptr_ptr { return new libsql_slice_t_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_slice_t { return new libsql_slice_t($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_slice_t { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_slice_t[] */ public function toArray(int $length): array { $ret = []; for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_slice_t($this->data[$i]); } return $ret; } + public function __get($prop) { + switch ($prop) { + case "ptr": return new void_ptr($this->data[0]->ptr); + case "len": return $this->data[0]->len; + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function __set($prop, $value) { + switch ($prop) { + case "ptr": + (new void_ptr($_ = &$this->data[0]->ptr))->set($value); + return; + case "len": + $this->data[0]->len = $value; + return; + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function set(void_ptr | libsql_slice_t_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_slice_t*'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class libsql_slice_t_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_slice_t_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_slice_t_ptr_ptr_ptr { return new libsql_slice_t_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_slice_t_ptr { return new libsql_slice_t_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_slice_t_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_slice_t_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new libsql_slice_t_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_slice_t_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | libsql_slice_t_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_slice_t**'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class libsql_slice_t_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_slice_t_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_slice_t_ptr_ptr_ptr_ptr { return new libsql_slice_t_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_slice_t_ptr_ptr { return new libsql_slice_t_ptr_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_slice_t_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_slice_t_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new libsql_slice_t_ptr_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_slice_t_ptr_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | libsql_slice_t_ptr_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_slice_t***'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class libsql_slice_t_ptr_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_slice_t_ptr_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_slice_t_ptr_ptr_ptr_ptr_ptr { return new libsql_slice_t_ptr_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_slice_t_ptr_ptr_ptr { return new libsql_slice_t_ptr_ptr_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_slice_t_ptr_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_slice_t_ptr_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new libsql_slice_t_ptr_ptr_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_slice_t_ptr_ptr_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | libsql_slice_t_ptr_ptr_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_slice_t****'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +/** + * @property int $integer + * @property float $real + * @property libsql_slice_t $text + * @property libsql_slice_t $blob + */ +class libsql_value_union_t implements ilibsql { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_value_union_t $other): bool { return $this->data == $other->data; } + public function addr(): libsql_value_union_t_ptr { return new libsql_value_union_t_ptr(FFI::addr($this->data)); } + public function __get($prop) { + switch ($prop) { + case "integer": return $this->data->integer; + case "real": return $this->data->real; + case "text": return new libsql_slice_t($this->data->text); + case "blob": return new libsql_slice_t($this->data->blob); + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function __set($prop, $value) { + switch ($prop) { + case "integer": + $this->data->integer = $value; + return; + case "real": + $this->data->real = $value; + return; + case "text": + (new libsql_slice_t($_ = &$this->data->text))->set($value); + return; + case "blob": + (new libsql_slice_t($_ = &$this->data->blob))->set($value); + return; + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function set(libsql_value_union_t $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_value_union_t'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +/** + * @property int $integer + * @property float $real + * @property libsql_slice_t $text + * @property libsql_slice_t $blob + */ +class libsql_value_union_t_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_value_union_t_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_value_union_t_ptr_ptr { return new libsql_value_union_t_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_value_union_t { return new libsql_value_union_t($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_value_union_t { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_value_union_t[] */ public function toArray(int $length): array { $ret = []; for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_value_union_t($this->data[$i]); } return $ret; } + public function __get($prop) { + switch ($prop) { + case "integer": return $this->data[0]->integer; + case "real": return $this->data[0]->real; + case "text": return new libsql_slice_t($this->data[0]->text); + case "blob": return new libsql_slice_t($this->data[0]->blob); + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function __set($prop, $value) { + switch ($prop) { + case "integer": + $this->data[0]->integer = $value; + return; + case "real": + $this->data[0]->real = $value; + return; + case "text": + (new libsql_slice_t($_ = &$this->data[0]->text))->set($value); + return; + case "blob": + (new libsql_slice_t($_ = &$this->data[0]->blob))->set($value); + return; + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function set(void_ptr | libsql_value_union_t_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_value_union_t*'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class libsql_value_union_t_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_value_union_t_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_value_union_t_ptr_ptr_ptr { return new libsql_value_union_t_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_value_union_t_ptr { return new libsql_value_union_t_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_value_union_t_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_value_union_t_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new libsql_value_union_t_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_value_union_t_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | libsql_value_union_t_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_value_union_t**'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class libsql_value_union_t_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_value_union_t_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_value_union_t_ptr_ptr_ptr_ptr { return new libsql_value_union_t_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_value_union_t_ptr_ptr { return new libsql_value_union_t_ptr_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_value_union_t_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_value_union_t_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new libsql_value_union_t_ptr_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_value_union_t_ptr_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | libsql_value_union_t_ptr_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_value_union_t***'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class libsql_value_union_t_ptr_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_value_union_t_ptr_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_value_union_t_ptr_ptr_ptr_ptr_ptr { return new libsql_value_union_t_ptr_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_value_union_t_ptr_ptr_ptr { return new libsql_value_union_t_ptr_ptr_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_value_union_t_ptr_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_value_union_t_ptr_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new libsql_value_union_t_ptr_ptr_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_value_union_t_ptr_ptr_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | libsql_value_union_t_ptr_ptr_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_value_union_t****'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +/** + * @property libsql_value_union_t $value + * @property int $type + */ +class libsql_value_t implements ilibsql { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_value_t $other): bool { return $this->data == $other->data; } + public function addr(): libsql_value_t_ptr { return new libsql_value_t_ptr(FFI::addr($this->data)); } + public function __get($prop) { + switch ($prop) { + case "value": return new libsql_value_union_t($this->data->value); + case "type": return $this->data->type; + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function __set($prop, $value) { + switch ($prop) { + case "value": + (new libsql_value_union_t($_ = &$this->data->value))->set($value); + return; + case "type": + $this->data->type = $value; + return; + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function set(libsql_value_t $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_value_t'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +/** + * @property libsql_value_union_t $value + * @property int $type + */ +class libsql_value_t_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_value_t_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_value_t_ptr_ptr { return new libsql_value_t_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_value_t { return new libsql_value_t($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_value_t { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_value_t[] */ public function toArray(int $length): array { $ret = []; for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_value_t($this->data[$i]); } return $ret; } + public function __get($prop) { + switch ($prop) { + case "value": return new libsql_value_union_t($this->data[0]->value); + case "type": return $this->data[0]->type; + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function __set($prop, $value) { + switch ($prop) { + case "value": + (new libsql_value_union_t($_ = &$this->data[0]->value))->set($value); + return; + case "type": + $this->data[0]->type = $value; + return; + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function set(void_ptr | libsql_value_t_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_value_t*'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class libsql_value_t_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_value_t_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_value_t_ptr_ptr_ptr { return new libsql_value_t_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_value_t_ptr { return new libsql_value_t_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_value_t_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_value_t_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new libsql_value_t_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_value_t_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | libsql_value_t_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_value_t**'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class libsql_value_t_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_value_t_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_value_t_ptr_ptr_ptr_ptr { return new libsql_value_t_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_value_t_ptr_ptr { return new libsql_value_t_ptr_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_value_t_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_value_t_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new libsql_value_t_ptr_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_value_t_ptr_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | libsql_value_t_ptr_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_value_t***'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class libsql_value_t_ptr_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_value_t_ptr_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_value_t_ptr_ptr_ptr_ptr_ptr { return new libsql_value_t_ptr_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_value_t_ptr_ptr_ptr { return new libsql_value_t_ptr_ptr_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_value_t_ptr_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_value_t_ptr_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new libsql_value_t_ptr_ptr_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_value_t_ptr_ptr_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | libsql_value_t_ptr_ptr_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_value_t****'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +/** + * @property struct_libsql_error_t_ptr|null $err + * @property libsql_value_t $ok + */ +class libsql_result_value_t implements ilibsql { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_result_value_t $other): bool { return $this->data == $other->data; } + public function addr(): libsql_result_value_t_ptr { return new libsql_result_value_t_ptr(FFI::addr($this->data)); } + public function __get($prop) { + switch ($prop) { + case "err": return $this->data->err ? new struct_libsql_error_t_ptr($this->data->err) : null; + case "ok": return new libsql_value_t($this->data->ok); + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function __set($prop, $value) { + switch ($prop) { + case "err": + (new struct_libsql_error_t_ptr($_ = &$this->data->err))->set($value); + return; + case "ok": + (new libsql_value_t($_ = &$this->data->ok))->set($value); + return; + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function set(libsql_result_value_t $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_result_value_t'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +/** + * @property struct_libsql_error_t_ptr|null $err + * @property libsql_value_t $ok + */ +class libsql_result_value_t_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_result_value_t_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_result_value_t_ptr_ptr { return new libsql_result_value_t_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_result_value_t { return new libsql_result_value_t($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_result_value_t { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_result_value_t[] */ public function toArray(int $length): array { $ret = []; for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_result_value_t($this->data[$i]); } return $ret; } + public function __get($prop) { + switch ($prop) { + case "err": return new struct_libsql_error_t_ptr($this->data[0]->err); + case "ok": return new libsql_value_t($this->data[0]->ok); + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function __set($prop, $value) { + switch ($prop) { + case "err": + (new struct_libsql_error_t_ptr($_ = &$this->data[0]->err))->set($value); + return; + case "ok": + (new libsql_value_t($_ = &$this->data[0]->ok))->set($value); + return; + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function set(void_ptr | libsql_result_value_t_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_result_value_t*'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class libsql_result_value_t_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_result_value_t_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_result_value_t_ptr_ptr_ptr { return new libsql_result_value_t_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_result_value_t_ptr { return new libsql_result_value_t_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_result_value_t_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_result_value_t_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new libsql_result_value_t_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_result_value_t_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | libsql_result_value_t_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_result_value_t**'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class libsql_result_value_t_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_result_value_t_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_result_value_t_ptr_ptr_ptr_ptr { return new libsql_result_value_t_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_result_value_t_ptr_ptr { return new libsql_result_value_t_ptr_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_result_value_t_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_result_value_t_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new libsql_result_value_t_ptr_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_result_value_t_ptr_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | libsql_result_value_t_ptr_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_result_value_t***'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class libsql_result_value_t_ptr_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_result_value_t_ptr_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_result_value_t_ptr_ptr_ptr_ptr_ptr { return new libsql_result_value_t_ptr_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_result_value_t_ptr_ptr_ptr { return new libsql_result_value_t_ptr_ptr_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_result_value_t_ptr_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_result_value_t_ptr_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new libsql_result_value_t_ptr_ptr_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_result_value_t_ptr_ptr_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | libsql_result_value_t_ptr_ptr_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_result_value_t****'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +/** + * @property struct_libsql_error_t_ptr|null $err + * @property int $frame_no + * @property int $frames_synced + */ +class libsql_sync_t implements ilibsql { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_sync_t $other): bool { return $this->data == $other->data; } + public function addr(): libsql_sync_t_ptr { return new libsql_sync_t_ptr(FFI::addr($this->data)); } + public function __get($prop) { + switch ($prop) { + case "err": return $this->data->err ? new struct_libsql_error_t_ptr($this->data->err) : null; + case "frame_no": return $this->data->frame_no; + case "frames_synced": return $this->data->frames_synced; + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function __set($prop, $value) { + switch ($prop) { + case "err": + (new struct_libsql_error_t_ptr($_ = &$this->data->err))->set($value); + return; + case "frame_no": + $this->data->frame_no = $value; + return; + case "frames_synced": + $this->data->frames_synced = $value; + return; + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function set(libsql_sync_t $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_sync_t'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +/** + * @property struct_libsql_error_t_ptr|null $err + * @property int $frame_no + * @property int $frames_synced + */ +class libsql_sync_t_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_sync_t_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_sync_t_ptr_ptr { return new libsql_sync_t_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_sync_t { return new libsql_sync_t($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_sync_t { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_sync_t[] */ public function toArray(int $length): array { $ret = []; for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_sync_t($this->data[$i]); } return $ret; } + public function __get($prop) { + switch ($prop) { + case "err": return new struct_libsql_error_t_ptr($this->data[0]->err); + case "frame_no": return $this->data[0]->frame_no; + case "frames_synced": return $this->data[0]->frames_synced; + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function __set($prop, $value) { + switch ($prop) { + case "err": + (new struct_libsql_error_t_ptr($_ = &$this->data[0]->err))->set($value); + return; + case "frame_no": + $this->data[0]->frame_no = $value; + return; + case "frames_synced": + $this->data[0]->frames_synced = $value; + return; + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function set(void_ptr | libsql_sync_t_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_sync_t*'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class libsql_sync_t_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_sync_t_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_sync_t_ptr_ptr_ptr { return new libsql_sync_t_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_sync_t_ptr { return new libsql_sync_t_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_sync_t_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_sync_t_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new libsql_sync_t_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_sync_t_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | libsql_sync_t_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_sync_t**'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class libsql_sync_t_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_sync_t_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_sync_t_ptr_ptr_ptr_ptr { return new libsql_sync_t_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_sync_t_ptr_ptr { return new libsql_sync_t_ptr_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_sync_t_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_sync_t_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new libsql_sync_t_ptr_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_sync_t_ptr_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | libsql_sync_t_ptr_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_sync_t***'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class libsql_sync_t_ptr_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_sync_t_ptr_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_sync_t_ptr_ptr_ptr_ptr_ptr { return new libsql_sync_t_ptr_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_sync_t_ptr_ptr_ptr { return new libsql_sync_t_ptr_ptr_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_sync_t_ptr_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_sync_t_ptr_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new libsql_sync_t_ptr_ptr_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_sync_t_ptr_ptr_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | libsql_sync_t_ptr_ptr_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_sync_t****'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +/** + * @property struct_libsql_error_t_ptr|null $err + */ +class libsql_bind_t implements ilibsql { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_bind_t $other): bool { return $this->data == $other->data; } + public function addr(): libsql_bind_t_ptr { return new libsql_bind_t_ptr(FFI::addr($this->data)); } + public function __get($prop) { + switch ($prop) { + case "err": return $this->data->err ? new struct_libsql_error_t_ptr($this->data->err) : null; + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function __set($prop, $value) { + switch ($prop) { + case "err": + (new struct_libsql_error_t_ptr($_ = &$this->data->err))->set($value); + return; + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function set(libsql_bind_t $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_bind_t'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +/** + * @property struct_libsql_error_t_ptr|null $err + */ +class libsql_bind_t_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_bind_t_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_bind_t_ptr_ptr { return new libsql_bind_t_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_bind_t { return new libsql_bind_t($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_bind_t { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_bind_t[] */ public function toArray(int $length): array { $ret = []; for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_bind_t($this->data[$i]); } return $ret; } + public function __get($prop) { + switch ($prop) { + case "err": return new struct_libsql_error_t_ptr($this->data[0]->err); + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function __set($prop, $value) { + switch ($prop) { + case "err": + (new struct_libsql_error_t_ptr($_ = &$this->data[0]->err))->set($value); + return; + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function set(void_ptr | libsql_bind_t_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_bind_t*'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class libsql_bind_t_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_bind_t_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_bind_t_ptr_ptr_ptr { return new libsql_bind_t_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_bind_t_ptr { return new libsql_bind_t_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_bind_t_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_bind_t_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new libsql_bind_t_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_bind_t_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | libsql_bind_t_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_bind_t**'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class libsql_bind_t_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_bind_t_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_bind_t_ptr_ptr_ptr_ptr { return new libsql_bind_t_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_bind_t_ptr_ptr { return new libsql_bind_t_ptr_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_bind_t_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_bind_t_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new libsql_bind_t_ptr_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_bind_t_ptr_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | libsql_bind_t_ptr_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_bind_t***'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class libsql_bind_t_ptr_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_bind_t_ptr_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_bind_t_ptr_ptr_ptr_ptr_ptr { return new libsql_bind_t_ptr_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_bind_t_ptr_ptr_ptr { return new libsql_bind_t_ptr_ptr_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_bind_t_ptr_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_bind_t_ptr_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new libsql_bind_t_ptr_ptr_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_bind_t_ptr_ptr_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | libsql_bind_t_ptr_ptr_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_bind_t****'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +/** + * @property struct_libsql_error_t_ptr|null $err + * @property int $rows_changed + */ +class libsql_execute_t implements ilibsql { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_execute_t $other): bool { return $this->data == $other->data; } + public function addr(): libsql_execute_t_ptr { return new libsql_execute_t_ptr(FFI::addr($this->data)); } + public function __get($prop) { + switch ($prop) { + case "err": return $this->data->err ? new struct_libsql_error_t_ptr($this->data->err) : null; + case "rows_changed": return $this->data->rows_changed; + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function __set($prop, $value) { + switch ($prop) { + case "err": + (new struct_libsql_error_t_ptr($_ = &$this->data->err))->set($value); + return; + case "rows_changed": + $this->data->rows_changed = $value; + return; + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function set(libsql_execute_t $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_execute_t'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +/** + * @property struct_libsql_error_t_ptr|null $err + * @property int $rows_changed + */ +class libsql_execute_t_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_execute_t_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_execute_t_ptr_ptr { return new libsql_execute_t_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_execute_t { return new libsql_execute_t($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_execute_t { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_execute_t[] */ public function toArray(int $length): array { $ret = []; for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_execute_t($this->data[$i]); } return $ret; } + public function __get($prop) { + switch ($prop) { + case "err": return new struct_libsql_error_t_ptr($this->data[0]->err); + case "rows_changed": return $this->data[0]->rows_changed; + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function __set($prop, $value) { + switch ($prop) { + case "err": + (new struct_libsql_error_t_ptr($_ = &$this->data[0]->err))->set($value); + return; + case "rows_changed": + $this->data[0]->rows_changed = $value; + return; + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function set(void_ptr | libsql_execute_t_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_execute_t*'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class libsql_execute_t_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_execute_t_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_execute_t_ptr_ptr_ptr { return new libsql_execute_t_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_execute_t_ptr { return new libsql_execute_t_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_execute_t_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_execute_t_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new libsql_execute_t_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_execute_t_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | libsql_execute_t_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_execute_t**'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class libsql_execute_t_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_execute_t_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_execute_t_ptr_ptr_ptr_ptr { return new libsql_execute_t_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_execute_t_ptr_ptr { return new libsql_execute_t_ptr_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_execute_t_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_execute_t_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new libsql_execute_t_ptr_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_execute_t_ptr_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | libsql_execute_t_ptr_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_execute_t***'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class libsql_execute_t_ptr_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_execute_t_ptr_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_execute_t_ptr_ptr_ptr_ptr_ptr { return new libsql_execute_t_ptr_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_execute_t_ptr_ptr_ptr { return new libsql_execute_t_ptr_ptr_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_execute_t_ptr_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_execute_t_ptr_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new libsql_execute_t_ptr_ptr_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_execute_t_ptr_ptr_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | libsql_execute_t_ptr_ptr_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_execute_t****'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +/** + * @property struct_libsql_error_t_ptr|null $err + * @property int $last_inserted_rowid + * @property int $total_changes + */ +class libsql_connection_info_t implements ilibsql { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_connection_info_t $other): bool { return $this->data == $other->data; } + public function addr(): libsql_connection_info_t_ptr { return new libsql_connection_info_t_ptr(FFI::addr($this->data)); } + public function __get($prop) { + switch ($prop) { + case "err": return $this->data->err ? new struct_libsql_error_t_ptr($this->data->err) : null; + case "last_inserted_rowid": return $this->data->last_inserted_rowid; + case "total_changes": return $this->data->total_changes; + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function __set($prop, $value) { + switch ($prop) { + case "err": + (new struct_libsql_error_t_ptr($_ = &$this->data->err))->set($value); + return; + case "last_inserted_rowid": + $this->data->last_inserted_rowid = $value; + return; + case "total_changes": + $this->data->total_changes = $value; + return; + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function set(libsql_connection_info_t $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_connection_info_t'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +/** + * @property struct_libsql_error_t_ptr|null $err + * @property int $last_inserted_rowid + * @property int $total_changes + */ +class libsql_connection_info_t_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_connection_info_t_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_connection_info_t_ptr_ptr { return new libsql_connection_info_t_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_connection_info_t { return new libsql_connection_info_t($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_connection_info_t { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_connection_info_t[] */ public function toArray(int $length): array { $ret = []; for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_connection_info_t($this->data[$i]); } return $ret; } + public function __get($prop) { + switch ($prop) { + case "err": return new struct_libsql_error_t_ptr($this->data[0]->err); + case "last_inserted_rowid": return $this->data[0]->last_inserted_rowid; + case "total_changes": return $this->data[0]->total_changes; + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function __set($prop, $value) { + switch ($prop) { + case "err": + (new struct_libsql_error_t_ptr($_ = &$this->data[0]->err))->set($value); + return; + case "last_inserted_rowid": + $this->data[0]->last_inserted_rowid = $value; + return; + case "total_changes": + $this->data[0]->total_changes = $value; + return; + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function set(void_ptr | libsql_connection_info_t_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_connection_info_t*'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class libsql_connection_info_t_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_connection_info_t_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_connection_info_t_ptr_ptr_ptr { return new libsql_connection_info_t_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_connection_info_t_ptr { return new libsql_connection_info_t_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_connection_info_t_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_connection_info_t_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new libsql_connection_info_t_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_connection_info_t_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | libsql_connection_info_t_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_connection_info_t**'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class libsql_connection_info_t_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_connection_info_t_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_connection_info_t_ptr_ptr_ptr_ptr { return new libsql_connection_info_t_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_connection_info_t_ptr_ptr { return new libsql_connection_info_t_ptr_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_connection_info_t_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_connection_info_t_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new libsql_connection_info_t_ptr_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_connection_info_t_ptr_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | libsql_connection_info_t_ptr_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_connection_info_t***'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class libsql_connection_info_t_ptr_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_connection_info_t_ptr_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_connection_info_t_ptr_ptr_ptr_ptr_ptr { return new libsql_connection_info_t_ptr_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_connection_info_t_ptr_ptr_ptr { return new libsql_connection_info_t_ptr_ptr_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_connection_info_t_ptr_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_connection_info_t_ptr_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new libsql_connection_info_t_ptr_ptr_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_connection_info_t_ptr_ptr_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | libsql_connection_info_t_ptr_ptr_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_connection_info_t****'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +/** + * @property string_ $url + * @property string_ $path + * @property string_ $auth_token + * @property string_ $encryption_key + * @property int $sync_interval + * @property int $cypher + * @property int $disable_read_your_writes + * @property int $webpki + */ +class libsql_database_desc_t implements ilibsql { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_database_desc_t $other): bool { return $this->data == $other->data; } + public function addr(): libsql_database_desc_t_ptr { return new libsql_database_desc_t_ptr(FFI::addr($this->data)); } + public function __get($prop) { + switch ($prop) { + case "url": return new string_($this->data->url); + case "path": return new string_($this->data->path); + case "auth_token": return new string_($this->data->auth_token); + case "encryption_key": return new string_($this->data->encryption_key); + case "sync_interval": return $this->data->sync_interval; + case "cypher": return $this->data->cypher; + case "disable_read_your_writes": return $this->data->disable_read_your_writes; + case "webpki": return $this->data->webpki; + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function __set($prop, $value) { + switch ($prop) { + case "url": + (new string_($_ = &$this->data->url))->set($value); + return; + case "path": + (new string_($_ = &$this->data->path))->set($value); + return; + case "auth_token": + (new string_($_ = &$this->data->auth_token))->set($value); + return; + case "encryption_key": + (new string_($_ = &$this->data->encryption_key))->set($value); + return; + case "sync_interval": + $this->data->sync_interval = $value; + return; + case "cypher": + $this->data->cypher = $value; + return; + case "disable_read_your_writes": + $this->data->disable_read_your_writes = $value; + return; + case "webpki": + $this->data->webpki = $value; + return; + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function set(libsql_database_desc_t $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_database_desc_t'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +/** + * @property string_ $url + * @property string_ $path + * @property string_ $auth_token + * @property string_ $encryption_key + * @property int $sync_interval + * @property int $cypher + * @property int $disable_read_your_writes + * @property int $webpki + */ +class libsql_database_desc_t_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_database_desc_t_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_database_desc_t_ptr_ptr { return new libsql_database_desc_t_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_database_desc_t { return new libsql_database_desc_t($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_database_desc_t { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_database_desc_t[] */ public function toArray(int $length): array { $ret = []; for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_database_desc_t($this->data[$i]); } return $ret; } + public function __get($prop) { + switch ($prop) { + case "url": return new string_($this->data[0]->url); + case "path": return new string_($this->data[0]->path); + case "auth_token": return new string_($this->data[0]->auth_token); + case "encryption_key": return new string_($this->data[0]->encryption_key); + case "sync_interval": return $this->data[0]->sync_interval; + case "cypher": return $this->data[0]->cypher; + case "disable_read_your_writes": return $this->data[0]->disable_read_your_writes; + case "webpki": return $this->data[0]->webpki; + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function __set($prop, $value) { + switch ($prop) { + case "url": + (new string_($_ = &$this->data[0]->url))->set($value); + return; + case "path": + (new string_($_ = &$this->data[0]->path))->set($value); + return; + case "auth_token": + (new string_($_ = &$this->data[0]->auth_token))->set($value); + return; + case "encryption_key": + (new string_($_ = &$this->data[0]->encryption_key))->set($value); + return; + case "sync_interval": + $this->data[0]->sync_interval = $value; + return; + case "cypher": + $this->data[0]->cypher = $value; + return; + case "disable_read_your_writes": + $this->data[0]->disable_read_your_writes = $value; + return; + case "webpki": + $this->data[0]->webpki = $value; + return; + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function set(void_ptr | libsql_database_desc_t_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_database_desc_t*'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class libsql_database_desc_t_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_database_desc_t_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_database_desc_t_ptr_ptr_ptr { return new libsql_database_desc_t_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_database_desc_t_ptr { return new libsql_database_desc_t_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_database_desc_t_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_database_desc_t_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new libsql_database_desc_t_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_database_desc_t_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | libsql_database_desc_t_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_database_desc_t**'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class libsql_database_desc_t_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_database_desc_t_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_database_desc_t_ptr_ptr_ptr_ptr { return new libsql_database_desc_t_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_database_desc_t_ptr_ptr { return new libsql_database_desc_t_ptr_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_database_desc_t_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_database_desc_t_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new libsql_database_desc_t_ptr_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_database_desc_t_ptr_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | libsql_database_desc_t_ptr_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_database_desc_t***'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class libsql_database_desc_t_ptr_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_database_desc_t_ptr_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_database_desc_t_ptr_ptr_ptr_ptr_ptr { return new libsql_database_desc_t_ptr_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_database_desc_t_ptr_ptr_ptr { return new libsql_database_desc_t_ptr_ptr_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_database_desc_t_ptr_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_database_desc_t_ptr_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new libsql_database_desc_t_ptr_ptr_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_database_desc_t_ptr_ptr_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | libsql_database_desc_t_ptr_ptr_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_database_desc_t****'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +/** + * @property function_type_ptr $logger + * @property string_ $version + */ +class libsql_config_t implements ilibsql { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_config_t $other): bool { return $this->data == $other->data; } + public function addr(): libsql_config_t_ptr { return new libsql_config_t_ptr(FFI::addr($this->data)); } + public function __get($prop) { + switch ($prop) { + case "logger": return new function_type_ptr($this->data->logger, [NULL, 'libsql_log_t']); + case "version": return new string_($this->data->version); + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function __set($prop, $value) { + switch ($prop) { + case "logger": + (new function_type_ptr($_ = &$this->data->logger, [NULL, 'libsql_log_t']))->set($value); + return; + case "version": + (new string_($_ = &$this->data->version))->set($value); + return; + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function set(libsql_config_t $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_config_t'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +/** + * @property function_type_ptr $logger + * @property string_ $version + */ +class libsql_config_t_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_config_t_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_config_t_ptr_ptr { return new libsql_config_t_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_config_t { return new libsql_config_t($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_config_t { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_config_t[] */ public function toArray(int $length): array { $ret = []; for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_config_t($this->data[$i]); } return $ret; } + public function __get($prop) { + switch ($prop) { + case "logger": return new function_type_ptr($this->data[0]->logger, [NULL, 'libsql_log_t']); + case "version": return new string_($this->data[0]->version); + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function __set($prop, $value) { + switch ($prop) { + case "logger": + (new function_type_ptr($_ = &$this->data[0]->logger, [NULL, 'libsql_log_t']))->set($value); + return; + case "version": + (new string_($_ = &$this->data[0]->version))->set($value); + return; + } + throw new \Error("Unknown field $prop on type " . self::getType()); + } + public function set(void_ptr | libsql_config_t_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_config_t*'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class libsql_config_t_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_config_t_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_config_t_ptr_ptr_ptr { return new libsql_config_t_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_config_t_ptr { return new libsql_config_t_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_config_t_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_config_t_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new libsql_config_t_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_config_t_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | libsql_config_t_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_config_t**'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class libsql_config_t_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_config_t_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_config_t_ptr_ptr_ptr_ptr { return new libsql_config_t_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_config_t_ptr_ptr { return new libsql_config_t_ptr_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_config_t_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_config_t_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new libsql_config_t_ptr_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_config_t_ptr_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | libsql_config_t_ptr_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_config_t***'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class libsql_config_t_ptr_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(libsql_config_t_ptr_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): libsql_config_t_ptr_ptr_ptr_ptr_ptr { return new libsql_config_t_ptr_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): libsql_config_t_ptr_ptr_ptr { return new libsql_config_t_ptr_ptr_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): libsql_config_t_ptr_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return libsql_config_t_ptr_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new libsql_config_t_ptr_ptr_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new libsql_config_t_ptr_ptr_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | libsql_config_t_ptr_ptr_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'libsql_config_t****'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class _Bool_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(_Bool_ptr $other): bool { return $this->data == $other->data; } + public function addr(): _Bool_ptr_ptr { return new _Bool_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): int { return $this->data[$n]; } + #[\ReturnTypeWillChange] public function offsetGet($offset): int { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value; } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return int[] */ public function toArray(int $length): array { $ret = []; for ($i = 0; $i < $length; ++$i) { $ret[] = ($this->data[$i]); } return $ret; } + public function toString(?int $length = null): string { return $length === null ? FFI::string(FFI::cdef()->cast("char*", $this->data)) : FFI::string(FFI::cdef()->cast("char*", $this->data), $length); } + public static function persistent(string $string): self { $str = new self(FFI::cdef()->new("unsigned char[" . \strlen($string) . "]", false)); FFI::memcpy($str->data, $string, \strlen($string)); return $str; } + public static function owned(string $string): self { $str = new self(FFI::cdef()->new("unsigned char[" . \strlen($string) . "]", true)); FFI::memcpy($str->data, $string, \strlen($string)); return $str; } + public static function persistentZero(string $string): self { return self::persistent("$string\0"); } + public static function ownedZero(string $string): self { return self::owned("$string\0"); } + public function set(int | void_ptr | _Bool_ptr $value): void { + if (\is_scalar($value)) { + $this->data[0] = $value; + } else { + FFI::addr($this->data)[0] = $value->getData(); + } + } + public static function getType(): string { return '_Bool*'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class _Bool_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(_Bool_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): _Bool_ptr_ptr_ptr { return new _Bool_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): _Bool_ptr { return new _Bool_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): _Bool_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return _Bool_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new _Bool_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new _Bool_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | _Bool_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return '_Bool**'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class _Bool_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(_Bool_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): _Bool_ptr_ptr_ptr_ptr { return new _Bool_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): _Bool_ptr_ptr { return new _Bool_ptr_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): _Bool_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return _Bool_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new _Bool_ptr_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new _Bool_ptr_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | _Bool_ptr_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return '_Bool***'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class _Bool_ptr_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(_Bool_ptr_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): _Bool_ptr_ptr_ptr_ptr_ptr { return new _Bool_ptr_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): _Bool_ptr_ptr_ptr { return new _Bool_ptr_ptr_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): _Bool_ptr_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return _Bool_ptr_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new _Bool_ptr_ptr_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new _Bool_ptr_ptr_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | _Bool_ptr_ptr_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return '_Bool****'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class short_int_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(short_int_ptr $other): bool { return $this->data == $other->data; } + public function addr(): short_int_ptr_ptr { return new short_int_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): int { return $this->data[$n]; } + #[\ReturnTypeWillChange] public function offsetGet($offset): int { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value; } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return int[] */ public function toArray(int $length): array { $ret = []; for ($i = 0; $i < $length; ++$i) { $ret[] = ($this->data[$i]); } return $ret; } + public function set(int | void_ptr | short_int_ptr $value): void { + if (\is_scalar($value)) { + $this->data[0] = $value; + } else { + FFI::addr($this->data)[0] = $value->getData(); + } + } + public static function getType(): string { return 'short_int*'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class short_int_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(short_int_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): short_int_ptr_ptr_ptr { return new short_int_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): short_int_ptr { return new short_int_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): short_int_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return short_int_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new short_int_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new short_int_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | short_int_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'short_int**'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class short_int_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(short_int_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): short_int_ptr_ptr_ptr_ptr { return new short_int_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): short_int_ptr_ptr { return new short_int_ptr_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): short_int_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return short_int_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new short_int_ptr_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new short_int_ptr_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | short_int_ptr_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'short_int***'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class short_int_ptr_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(short_int_ptr_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): short_int_ptr_ptr_ptr_ptr_ptr { return new short_int_ptr_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): short_int_ptr_ptr_ptr { return new short_int_ptr_ptr_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): short_int_ptr_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return short_int_ptr_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new short_int_ptr_ptr_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new short_int_ptr_ptr_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | short_int_ptr_ptr_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'short_int****'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class unsigned_short_int_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(unsigned_short_int_ptr $other): bool { return $this->data == $other->data; } + public function addr(): unsigned_short_int_ptr_ptr { return new unsigned_short_int_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): int { return $this->data[$n]; } + #[\ReturnTypeWillChange] public function offsetGet($offset): int { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value; } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return int[] */ public function toArray(int $length): array { $ret = []; for ($i = 0; $i < $length; ++$i) { $ret[] = ($this->data[$i]); } return $ret; } + public function set(int | void_ptr | unsigned_short_int_ptr $value): void { + if (\is_scalar($value)) { + $this->data[0] = $value; + } else { + FFI::addr($this->data)[0] = $value->getData(); + } + } + public static function getType(): string { return 'unsigned_short_int*'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class unsigned_short_int_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(unsigned_short_int_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): unsigned_short_int_ptr_ptr_ptr { return new unsigned_short_int_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): unsigned_short_int_ptr { return new unsigned_short_int_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): unsigned_short_int_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return unsigned_short_int_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new unsigned_short_int_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new unsigned_short_int_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | unsigned_short_int_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'unsigned_short_int**'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class unsigned_short_int_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(unsigned_short_int_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): unsigned_short_int_ptr_ptr_ptr_ptr { return new unsigned_short_int_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): unsigned_short_int_ptr_ptr { return new unsigned_short_int_ptr_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): unsigned_short_int_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return unsigned_short_int_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new unsigned_short_int_ptr_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new unsigned_short_int_ptr_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | unsigned_short_int_ptr_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'unsigned_short_int***'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class unsigned_short_int_ptr_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(unsigned_short_int_ptr_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): unsigned_short_int_ptr_ptr_ptr_ptr_ptr { return new unsigned_short_int_ptr_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): unsigned_short_int_ptr_ptr_ptr { return new unsigned_short_int_ptr_ptr_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): unsigned_short_int_ptr_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return unsigned_short_int_ptr_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new unsigned_short_int_ptr_ptr_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new unsigned_short_int_ptr_ptr_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | unsigned_short_int_ptr_ptr_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'unsigned_short_int****'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class int32_t_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(int32_t_ptr $other): bool { return $this->data == $other->data; } + public function addr(): int32_t_ptr_ptr { return new int32_t_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): int { return $this->data[$n]; } + #[\ReturnTypeWillChange] public function offsetGet($offset): int { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value; } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return int[] */ public function toArray(int $length): array { $ret = []; for ($i = 0; $i < $length; ++$i) { $ret[] = ($this->data[$i]); } return $ret; } + public function set(int | void_ptr | int32_t_ptr $value): void { + if (\is_scalar($value)) { + $this->data[0] = $value; + } else { + FFI::addr($this->data)[0] = $value->getData(); + } + } + public static function getType(): string { return 'int32_t*'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class int32_t_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(int32_t_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): int32_t_ptr_ptr_ptr { return new int32_t_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): int32_t_ptr { return new int32_t_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): int32_t_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return int32_t_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new int32_t_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new int32_t_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | int32_t_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'int32_t**'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class int32_t_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(int32_t_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): int32_t_ptr_ptr_ptr_ptr { return new int32_t_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): int32_t_ptr_ptr { return new int32_t_ptr_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): int32_t_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return int32_t_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new int32_t_ptr_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new int32_t_ptr_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | int32_t_ptr_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'int32_t***'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class int32_t_ptr_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(int32_t_ptr_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): int32_t_ptr_ptr_ptr_ptr_ptr { return new int32_t_ptr_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): int32_t_ptr_ptr_ptr { return new int32_t_ptr_ptr_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): int32_t_ptr_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return int32_t_ptr_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new int32_t_ptr_ptr_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new int32_t_ptr_ptr_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | int32_t_ptr_ptr_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'int32_t****'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class unsigned_int_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(unsigned_int_ptr $other): bool { return $this->data == $other->data; } + public function addr(): unsigned_int_ptr_ptr { return new unsigned_int_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): int { return $this->data[$n]; } + #[\ReturnTypeWillChange] public function offsetGet($offset): int { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value; } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return int[] */ public function toArray(int $length): array { $ret = []; for ($i = 0; $i < $length; ++$i) { $ret[] = ($this->data[$i]); } return $ret; } + public function set(int | void_ptr | unsigned_int_ptr $value): void { + if (\is_scalar($value)) { + $this->data[0] = $value; + } else { + FFI::addr($this->data)[0] = $value->getData(); + } + } + public static function getType(): string { return 'unsigned_int*'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class unsigned_int_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(unsigned_int_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): unsigned_int_ptr_ptr_ptr { return new unsigned_int_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): unsigned_int_ptr { return new unsigned_int_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): unsigned_int_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return unsigned_int_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new unsigned_int_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new unsigned_int_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | unsigned_int_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'unsigned_int**'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class unsigned_int_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(unsigned_int_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): unsigned_int_ptr_ptr_ptr_ptr { return new unsigned_int_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): unsigned_int_ptr_ptr { return new unsigned_int_ptr_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): unsigned_int_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return unsigned_int_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new unsigned_int_ptr_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new unsigned_int_ptr_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | unsigned_int_ptr_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'unsigned_int***'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class unsigned_int_ptr_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(unsigned_int_ptr_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): unsigned_int_ptr_ptr_ptr_ptr_ptr { return new unsigned_int_ptr_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): unsigned_int_ptr_ptr_ptr { return new unsigned_int_ptr_ptr_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): unsigned_int_ptr_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return unsigned_int_ptr_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new unsigned_int_ptr_ptr_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new unsigned_int_ptr_ptr_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | unsigned_int_ptr_ptr_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'unsigned_int****'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class int64_t_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(int64_t_ptr $other): bool { return $this->data == $other->data; } + public function addr(): int64_t_ptr_ptr { return new int64_t_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): int { return $this->data[$n]; } + #[\ReturnTypeWillChange] public function offsetGet($offset): int { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value; } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return int[] */ public function toArray(int $length): array { $ret = []; for ($i = 0; $i < $length; ++$i) { $ret[] = ($this->data[$i]); } return $ret; } + public function set(int | void_ptr | int64_t_ptr $value): void { + if (\is_scalar($value)) { + $this->data[0] = $value; + } else { + FFI::addr($this->data)[0] = $value->getData(); + } + } + public static function getType(): string { return 'int64_t*'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class int64_t_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(int64_t_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): int64_t_ptr_ptr_ptr { return new int64_t_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): int64_t_ptr { return new int64_t_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): int64_t_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return int64_t_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new int64_t_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new int64_t_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | int64_t_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'int64_t**'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class int64_t_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(int64_t_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): int64_t_ptr_ptr_ptr_ptr { return new int64_t_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): int64_t_ptr_ptr { return new int64_t_ptr_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): int64_t_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return int64_t_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new int64_t_ptr_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new int64_t_ptr_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | int64_t_ptr_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'int64_t***'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class int64_t_ptr_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(int64_t_ptr_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): int64_t_ptr_ptr_ptr_ptr_ptr { return new int64_t_ptr_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): int64_t_ptr_ptr_ptr { return new int64_t_ptr_ptr_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): int64_t_ptr_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return int64_t_ptr_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new int64_t_ptr_ptr_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new int64_t_ptr_ptr_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | int64_t_ptr_ptr_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'int64_t****'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class uint64_t_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(uint64_t_ptr $other): bool { return $this->data == $other->data; } + public function addr(): uint64_t_ptr_ptr { return new uint64_t_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): int { return $this->data[$n]; } + #[\ReturnTypeWillChange] public function offsetGet($offset): int { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value; } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return int[] */ public function toArray(int $length): array { $ret = []; for ($i = 0; $i < $length; ++$i) { $ret[] = ($this->data[$i]); } return $ret; } + public function set(int | void_ptr | uint64_t_ptr $value): void { + if (\is_scalar($value)) { + $this->data[0] = $value; + } else { + FFI::addr($this->data)[0] = $value->getData(); + } + } + public static function getType(): string { return 'uint64_t*'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class uint64_t_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(uint64_t_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): uint64_t_ptr_ptr_ptr { return new uint64_t_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): uint64_t_ptr { return new uint64_t_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): uint64_t_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return uint64_t_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new uint64_t_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new uint64_t_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | uint64_t_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'uint64_t**'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class uint64_t_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(uint64_t_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): uint64_t_ptr_ptr_ptr_ptr { return new uint64_t_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): uint64_t_ptr_ptr { return new uint64_t_ptr_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): uint64_t_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return uint64_t_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new uint64_t_ptr_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new uint64_t_ptr_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | uint64_t_ptr_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'uint64_t***'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class uint64_t_ptr_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(uint64_t_ptr_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): uint64_t_ptr_ptr_ptr_ptr_ptr { return new uint64_t_ptr_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): uint64_t_ptr_ptr_ptr { return new uint64_t_ptr_ptr_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): uint64_t_ptr_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return uint64_t_ptr_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new uint64_t_ptr_ptr_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new uint64_t_ptr_ptr_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | uint64_t_ptr_ptr_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'uint64_t****'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class double_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(double_ptr $other): bool { return $this->data == $other->data; } + public function addr(): double_ptr_ptr { return new double_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): float { return $this->data[$n] + 0.0; } + #[\ReturnTypeWillChange] public function offsetGet($offset): float { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value; } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return float[] */ public function toArray(int $length): array { $ret = []; for ($i = 0; $i < $length; ++$i) { $ret[] = ($this->data[$i]); } return $ret; } + public function set(float | void_ptr | double_ptr $value): void { + if (\is_scalar($value)) { + $this->data[0] = $value; + } else { + FFI::addr($this->data)[0] = $value->getData(); + } + } + public static function getType(): string { return 'double*'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class double_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(double_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): double_ptr_ptr_ptr { return new double_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): double_ptr { return new double_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): double_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return double_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new double_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new double_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | double_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'double**'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class double_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(double_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): double_ptr_ptr_ptr_ptr { return new double_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): double_ptr_ptr { return new double_ptr_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): double_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return double_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new double_ptr_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new double_ptr_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | double_ptr_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'double***'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +class double_ptr_ptr_ptr_ptr implements ilibsql, ilibsql_ptr, \ArrayAccess { + private FFI\CData $data; + public function __construct(FFI\CData $data) { $this->data = $data; } + public static function castFrom(ilibsql $data): self { return libsqlFFI::cast($data, self::class); } + public function getData(): FFI\CData { return $this->data; } + public function equals(double_ptr_ptr_ptr_ptr $other): bool { return $this->data == $other->data; } + public function addr(): double_ptr_ptr_ptr_ptr_ptr { return new double_ptr_ptr_ptr_ptr_ptr(FFI::addr($this->data)); } + public function deref(int $n = 0): double_ptr_ptr_ptr { return new double_ptr_ptr_ptr($this->data[$n]); } + #[\ReturnTypeWillChange] public function offsetGet($offset): double_ptr_ptr_ptr { return $this->deref($offset); } + #[\ReturnTypeWillChange] public function offsetExists($offset): bool { return !FFI::isNull($this->data); } + #[\ReturnTypeWillChange] public function offsetUnset($offset): void { throw new \Error("Cannot unset C structures"); } + #[\ReturnTypeWillChange] public function offsetSet($offset, $value): void { $this->data[$offset] = $value->getData(); } + public static function array(int $size = 1): self { return libsqlFFI::makeArray(self::class, $size); } + /** @return double_ptr_ptr_ptr[] */ public function toArray(?int $length = null): array { $ret = []; if ($length === null) { $i = 0; while (null !== $cur = $this->data[$i++]) { $ret[] = new double_ptr_ptr_ptr($cur); } } else { for ($i = 0; $i < $length; ++$i) { $ret[] = new double_ptr_ptr_ptr($this->data[$i]); } } return $ret; } + public function set(void_ptr | double_ptr_ptr_ptr_ptr $value): void { + FFI::addr($this->data)[0] = $value->getData(); + } + public static function getType(): string { return 'double****'; } + public static function size(): int { return libsqlFFI::sizeof(self::class); } + public function getDefinition(): string { return static::getType(); } +} +(function() { self::$staticFFI = \FFI::cdef(libsqlFFI::TYPES_DEF); self::$__arrayWeakMap = new \WeakMap; })->bindTo(null, libsqlFFI::class)(); +\class_alias(_Bool_ptr::class, uint8_t_ptr::class); +\class_alias(_Bool_ptr_ptr::class, uint8_t_ptr_ptr::class); +\class_alias(_Bool_ptr_ptr_ptr::class, uint8_t_ptr_ptr_ptr::class); +\class_alias(_Bool_ptr_ptr_ptr_ptr::class, uint8_t_ptr_ptr_ptr_ptr::class); +\class_alias(_Bool_ptr::class, unsigned_char_ptr::class); +\class_alias(_Bool_ptr_ptr::class, unsigned_char_ptr_ptr::class); +\class_alias(_Bool_ptr_ptr_ptr::class, unsigned_char_ptr_ptr_ptr::class); +\class_alias(_Bool_ptr_ptr_ptr_ptr::class, unsigned_char_ptr_ptr_ptr_ptr::class); +\class_alias(int32_t_ptr::class, int_ptr::class); +\class_alias(int32_t_ptr_ptr::class, int_ptr_ptr::class); +\class_alias(int32_t_ptr_ptr_ptr::class, int_ptr_ptr_ptr::class); +\class_alias(int32_t_ptr_ptr_ptr_ptr::class, int_ptr_ptr_ptr_ptr::class); +\class_alias(int64_t_ptr::class, size_t_ptr::class); +\class_alias(int64_t_ptr_ptr::class, size_t_ptr_ptr::class); +\class_alias(int64_t_ptr_ptr_ptr::class, size_t_ptr_ptr_ptr::class); +\class_alias(int64_t_ptr_ptr_ptr_ptr::class, size_t_ptr_ptr_ptr_ptr::class); +\class_alias(int64_t_ptr::class, long_int_ptr::class); +\class_alias(int64_t_ptr_ptr::class, long_int_ptr_ptr::class); +\class_alias(int64_t_ptr_ptr_ptr::class, long_int_ptr_ptr_ptr::class); +\class_alias(int64_t_ptr_ptr_ptr_ptr::class, long_int_ptr_ptr_ptr_ptr::class); +\class_alias(uint64_t_ptr::class, unsigned_long_int_ptr::class); +\class_alias(uint64_t_ptr_ptr::class, unsigned_long_int_ptr_ptr::class); +\class_alias(uint64_t_ptr_ptr_ptr::class, unsigned_long_int_ptr_ptr_ptr::class); +\class_alias(uint64_t_ptr_ptr_ptr_ptr::class, unsigned_long_int_ptr_ptr_ptr_ptr::class); +\class_alias(long_int_ptr::class, ptrdiff_t_ptr::class); +\class_alias(long_int_ptr_ptr::class, ptrdiff_t_ptr_ptr::class); +\class_alias(long_int_ptr_ptr_ptr::class, ptrdiff_t_ptr_ptr_ptr::class); +\class_alias(long_int_ptr_ptr_ptr_ptr::class, ptrdiff_t_ptr_ptr_ptr_ptr::class); +\class_alias(int_ptr::class, wchar_t_ptr::class); +\class_alias(int_ptr_ptr::class, wchar_t_ptr_ptr::class); +\class_alias(int_ptr_ptr_ptr::class, wchar_t_ptr_ptr_ptr::class); +\class_alias(int_ptr_ptr_ptr_ptr::class, wchar_t_ptr_ptr_ptr_ptr::class); +\class_alias(string_::class, int_least8_t_ptr::class); +\class_alias(string_ptr::class, int_least8_t_ptr_ptr::class); +\class_alias(string_ptr_ptr::class, int_least8_t_ptr_ptr_ptr::class); +\class_alias(string_ptr_ptr_ptr::class, int_least8_t_ptr_ptr_ptr_ptr::class); +\class_alias(short_int_ptr::class, int_least16_t_ptr::class); +\class_alias(short_int_ptr_ptr::class, int_least16_t_ptr_ptr::class); +\class_alias(short_int_ptr_ptr_ptr::class, int_least16_t_ptr_ptr_ptr::class); +\class_alias(short_int_ptr_ptr_ptr_ptr::class, int_least16_t_ptr_ptr_ptr_ptr::class); +\class_alias(int_ptr::class, int_least32_t_ptr::class); +\class_alias(int_ptr_ptr::class, int_least32_t_ptr_ptr::class); +\class_alias(int_ptr_ptr_ptr::class, int_least32_t_ptr_ptr_ptr::class); +\class_alias(int_ptr_ptr_ptr_ptr::class, int_least32_t_ptr_ptr_ptr_ptr::class); +\class_alias(long_int_ptr::class, int_least64_t_ptr::class); +\class_alias(long_int_ptr_ptr::class, int_least64_t_ptr_ptr::class); +\class_alias(long_int_ptr_ptr_ptr::class, int_least64_t_ptr_ptr_ptr::class); +\class_alias(long_int_ptr_ptr_ptr_ptr::class, int_least64_t_ptr_ptr_ptr_ptr::class); +\class_alias(unsigned_char_ptr::class, uint_least8_t_ptr::class); +\class_alias(unsigned_char_ptr_ptr::class, uint_least8_t_ptr_ptr::class); +\class_alias(unsigned_char_ptr_ptr_ptr::class, uint_least8_t_ptr_ptr_ptr::class); +\class_alias(unsigned_char_ptr_ptr_ptr_ptr::class, uint_least8_t_ptr_ptr_ptr_ptr::class); +\class_alias(unsigned_short_int_ptr::class, uint_least16_t_ptr::class); +\class_alias(unsigned_short_int_ptr_ptr::class, uint_least16_t_ptr_ptr::class); +\class_alias(unsigned_short_int_ptr_ptr_ptr::class, uint_least16_t_ptr_ptr_ptr::class); +\class_alias(unsigned_short_int_ptr_ptr_ptr_ptr::class, uint_least16_t_ptr_ptr_ptr_ptr::class); +\class_alias(unsigned_int_ptr::class, uint_least32_t_ptr::class); +\class_alias(unsigned_int_ptr_ptr::class, uint_least32_t_ptr_ptr::class); +\class_alias(unsigned_int_ptr_ptr_ptr::class, uint_least32_t_ptr_ptr_ptr::class); +\class_alias(unsigned_int_ptr_ptr_ptr_ptr::class, uint_least32_t_ptr_ptr_ptr_ptr::class); +\class_alias(unsigned_long_int_ptr::class, uint_least64_t_ptr::class); +\class_alias(unsigned_long_int_ptr_ptr::class, uint_least64_t_ptr_ptr::class); +\class_alias(unsigned_long_int_ptr_ptr_ptr::class, uint_least64_t_ptr_ptr_ptr::class); +\class_alias(unsigned_long_int_ptr_ptr_ptr_ptr::class, uint_least64_t_ptr_ptr_ptr_ptr::class); +\class_alias(string_::class, int_fast8_t_ptr::class); +\class_alias(string_ptr::class, int_fast8_t_ptr_ptr::class); +\class_alias(string_ptr_ptr::class, int_fast8_t_ptr_ptr_ptr::class); +\class_alias(string_ptr_ptr_ptr::class, int_fast8_t_ptr_ptr_ptr_ptr::class); +\class_alias(long_int_ptr::class, int_fast16_t_ptr::class); +\class_alias(long_int_ptr_ptr::class, int_fast16_t_ptr_ptr::class); +\class_alias(long_int_ptr_ptr_ptr::class, int_fast16_t_ptr_ptr_ptr::class); +\class_alias(long_int_ptr_ptr_ptr_ptr::class, int_fast16_t_ptr_ptr_ptr_ptr::class); +\class_alias(long_int_ptr::class, int_fast32_t_ptr::class); +\class_alias(long_int_ptr_ptr::class, int_fast32_t_ptr_ptr::class); +\class_alias(long_int_ptr_ptr_ptr::class, int_fast32_t_ptr_ptr_ptr::class); +\class_alias(long_int_ptr_ptr_ptr_ptr::class, int_fast32_t_ptr_ptr_ptr_ptr::class); +\class_alias(long_int_ptr::class, int_fast64_t_ptr::class); +\class_alias(long_int_ptr_ptr::class, int_fast64_t_ptr_ptr::class); +\class_alias(long_int_ptr_ptr_ptr::class, int_fast64_t_ptr_ptr_ptr::class); +\class_alias(long_int_ptr_ptr_ptr_ptr::class, int_fast64_t_ptr_ptr_ptr_ptr::class); +\class_alias(unsigned_char_ptr::class, uint_fast8_t_ptr::class); +\class_alias(unsigned_char_ptr_ptr::class, uint_fast8_t_ptr_ptr::class); +\class_alias(unsigned_char_ptr_ptr_ptr::class, uint_fast8_t_ptr_ptr_ptr::class); +\class_alias(unsigned_char_ptr_ptr_ptr_ptr::class, uint_fast8_t_ptr_ptr_ptr_ptr::class); +\class_alias(unsigned_long_int_ptr::class, uint_fast16_t_ptr::class); +\class_alias(unsigned_long_int_ptr_ptr::class, uint_fast16_t_ptr_ptr::class); +\class_alias(unsigned_long_int_ptr_ptr_ptr::class, uint_fast16_t_ptr_ptr_ptr::class); +\class_alias(unsigned_long_int_ptr_ptr_ptr_ptr::class, uint_fast16_t_ptr_ptr_ptr_ptr::class); +\class_alias(unsigned_long_int_ptr::class, uint_fast32_t_ptr::class); +\class_alias(unsigned_long_int_ptr_ptr::class, uint_fast32_t_ptr_ptr::class); +\class_alias(unsigned_long_int_ptr_ptr_ptr::class, uint_fast32_t_ptr_ptr_ptr::class); +\class_alias(unsigned_long_int_ptr_ptr_ptr_ptr::class, uint_fast32_t_ptr_ptr_ptr_ptr::class); +\class_alias(unsigned_long_int_ptr::class, uint_fast64_t_ptr::class); +\class_alias(unsigned_long_int_ptr_ptr::class, uint_fast64_t_ptr_ptr::class); +\class_alias(unsigned_long_int_ptr_ptr_ptr::class, uint_fast64_t_ptr_ptr_ptr::class); +\class_alias(unsigned_long_int_ptr_ptr_ptr_ptr::class, uint_fast64_t_ptr_ptr_ptr_ptr::class); +\class_alias(long_int_ptr::class, intptr_t_ptr::class); +\class_alias(long_int_ptr_ptr::class, intptr_t_ptr_ptr::class); +\class_alias(long_int_ptr_ptr_ptr::class, intptr_t_ptr_ptr_ptr::class); +\class_alias(long_int_ptr_ptr_ptr_ptr::class, intptr_t_ptr_ptr_ptr_ptr::class); +\class_alias(unsigned_long_int_ptr::class, uintptr_t_ptr::class); +\class_alias(unsigned_long_int_ptr_ptr::class, uintptr_t_ptr_ptr::class); +\class_alias(unsigned_long_int_ptr_ptr_ptr::class, uintptr_t_ptr_ptr_ptr::class); +\class_alias(unsigned_long_int_ptr_ptr_ptr_ptr::class, uintptr_t_ptr_ptr_ptr_ptr::class); +\class_alias(long_int_ptr::class, intmax_t_ptr::class); +\class_alias(long_int_ptr_ptr::class, intmax_t_ptr_ptr::class); +\class_alias(long_int_ptr_ptr_ptr::class, intmax_t_ptr_ptr_ptr::class); +\class_alias(long_int_ptr_ptr_ptr_ptr::class, intmax_t_ptr_ptr_ptr_ptr::class); +\class_alias(unsigned_long_int_ptr::class, uintmax_t_ptr::class); +\class_alias(unsigned_long_int_ptr_ptr::class, uintmax_t_ptr_ptr::class); +\class_alias(unsigned_long_int_ptr_ptr_ptr::class, uintmax_t_ptr_ptr_ptr::class); +\class_alias(unsigned_long_int_ptr_ptr_ptr_ptr::class, uintmax_t_ptr_ptr_ptr_ptr::class); +\class_alias(struct_libsql_error_t::class, libsql_error_t::class); +\class_alias(struct_libsql_error_t_ptr::class, libsql_error_t_ptr::class); +\class_alias(struct_libsql_error_t_ptr_ptr::class, libsql_error_t_ptr_ptr::class); +\class_alias(struct_libsql_error_t_ptr_ptr_ptr::class, libsql_error_t_ptr_ptr_ptr::class); +\class_alias(struct_libsql_error_t_ptr_ptr_ptr_ptr::class, libsql_error_t_ptr_ptr_ptr_ptr::class); \ No newline at end of file diff --git a/phpstan.neon.dist b/phpstan.neon.dist new file mode 100644 index 0000000..6e451fa --- /dev/null +++ b/phpstan.neon.dist @@ -0,0 +1,4 @@ +parameters: + level: 6 + paths: + - src diff --git a/src/Blob.php b/src/Blob.php index f6a72d9..86a18a5 100644 --- a/src/Blob.php +++ b/src/Blob.php @@ -4,16 +4,15 @@ namespace Libsql; -use JsonSerializable; - /** @internal */ -class Blob implements JsonSerializable +class Blob implements \JsonSerializable { public function __construct(public ?string $blob) { } - public function jsonSerialize(): mixed { + public function jsonSerialize(): mixed + { return base64_encode($this->blob); } @@ -22,6 +21,7 @@ public function __equals(object $other): bool if (!($other instanceof self)) { return false; } + return $this->blob === $other->blob; } } diff --git a/src/CharBox.php b/src/CharBox.php deleted file mode 100644 index f886ae0..0000000 --- a/src/CharBox.php +++ /dev/null @@ -1,40 +0,0 @@ -new("char *"); - $cLen = 0; - - if ($str) { - $cLen = strlen($str) + 1; - $cStr = $ffi->new($ffi::arrayType($ffi->type("char"), [$cLen]), owned: false); - $ffi::memcpy($cStr, $str, strlen($str)); - } - - $this->ptr = $cStr; - $this->len = $cLen; - } - - /** Deallocate memory. */ - public function destroy(): void - { - if ($this->ptr != null) { - getFFI()::free($this->ptr); - } - } -} diff --git a/src/Connection.php b/src/Connection.php index e565be2..dabcfaa 100644 --- a/src/Connection.php +++ b/src/Connection.php @@ -4,64 +4,55 @@ namespace Libsql; -use FFI\CData; +use ffi\libsql_connection_t; class Connection { use Prepareable; /** @internal */ - public function __construct(protected CData $inner) + public function __construct(protected libsql_connection_t $inner) { } /** * @internal + * * @return void */ public function __destruct() { - getFFI()->libsql_connection_deinit($this->inner); + libsqlFFI()->libsql_connection_deinit($this->inner); } /** * Execute batch statements. - * - * @param string $sql - * - * @return void */ public function executeBatch(string $sql): void { - $batch = getFFI()->libsql_connection_batch($this->inner, $sql); - errIf($batch->err); + $batch = libsqlFFI()->libsql_connection_batch($this->inner, $sql); + errorIf($batch->err); } /** * Prepare statement with the given query. - * - * @param string $sql - * - * @return Statement */ #[\Override] public function prepare(string $sql): Statement { - $stmt = getFFI()->libsql_connection_prepare($this->inner, $sql); - errIf($stmt->err); + $stmt = libsqlFFI()->libsql_connection_prepare($this->inner, $sql); + errorIf($stmt->err); return new Statement($stmt); } /** * Begin a transaction. - * - * @return Transaction */ public function transaction(): Transaction { - $tx = getFFI()->libsql_connection_transaction($this->inner); - errIf($tx->err); + $tx = libsqlFFI()->libsql_connection_transaction($this->inner); + errorIf($tx->err); return new Transaction($tx); } diff --git a/src/Database.php b/src/Database.php index a17bb45..f5a8c30 100644 --- a/src/Database.php +++ b/src/Database.php @@ -4,137 +4,63 @@ namespace Libsql; -if (!extension_loaded('ffi')) { - die('FFI extension is not loaded'); -} - -use FFI; -use FFI\CData; - -/** @internal */ -function getFFI(): ?FFI -{ - /** @var ?FFI */ - static $ffi = null; - - if ($ffi === null) { - $os = php_uname('s'); - $arch = php_uname('m'); - - $ffi = FFI::cdef( - file_get_contents(__DIR__ . '/../lib/libsql.h'), - __DIR__ . match ([$os, $arch]) { - ["Darwin", "arm64"] => '/../lib/universal2-apple-darwin/liblibsql.dylib', - ["Darwin", "x86_64"] => '/../lib/universal2-apple-darwin/liblibsql.dylib', - ["Linux", "x86_64"] => '/../lib/x86_64-unknown-linux-gnu/liblibsql.so', - ["Linux", "arm64"] => '/../lib/aarch64-unknown-linux-gnu/liblibsql.so', - default => die("Unsupported OS $os $arch"), - }, - ); - } - - return $ffi; -} - -{ - $ffi = getFFI(); - - $version = new CharBox('libsql-php'); - - $config = $ffi->new('libsql_config_t'); - $config->version = $version->ptr; - - $ffi->libsql_setup($config); - - $version->destroy(); -} - -/** @internal */ -function errIf(?CData $err) -{ - $ffi = getFFI(); - - if ($err != null) { - $message = $ffi->libsql_error_message($err); - $ffi->libsql_error_deinit($err); - throw new LibsqlException($message); - } -} - -/** @internal */ -function valueToString(CData $value): string -{ - $ffi = getFFI(); - - switch ($value->type) { - case $ffi->LIBSQL_TYPE_TEXT: - $text = FFI::string( - $value->value->text->ptr, - $value->value->text->len - 1, - ); - $ffi->libsql_slice_deinit($value->value->text); - return $text; - case $ffi->LIBSQL_TYPE_BLOB: - $blob = FFI::string( - $value->value->blob->ptr, - $value->value->blob->len, - ); - $ffi->libsql_slice_deinit($value->value->blob); - return $blob; - } -} +use ffi\libsql_config_t; +use ffi\libsql_database_desc_t; +use ffi\libsql_database_t; +use ffi\string_; class Database { - protected CData $inner; + protected libsql_database_t $inner; /** * Open a database. * - * @param ?string $path Path to the database file (default: null) - * @param ?string $url Url of the primary (default: null) - * @param ?string $authToken Auth token (default: null) - * @param ?string $encryptionKey Key used to de/encrypt the database (default: null) - * @param int $syncInterval Interval used to sync frames periodicaly with primary (default: 0, sync manually) - * @param bool $readYourWrites Make writes visible within a sync period (default: true) - * @param bool $webpki Use Webpki (default: false) + * @param ?string $path Path to the database file (default: null) + * @param ?string $url Url of the primary (default: null) + * @param ?string $authToken Auth token (default: null) + * @param ?string $encryptionKey Key used to de/encrypt the database (default: null) + * @param int $syncInterval Interval used to sync frames periodicaly with primary (default: 0, sync manually) + * @param bool $readYourWrites Make writes visible within a sync period (default: true) + * @param bool $webpki Use Webpki (default: false) */ public function __construct( - string $path = null, - string $url = null, + ?string $path = null, + ?string $url = null, #[\SensitiveParameter] - string $authToken = null, + ?string $authToken = null, #[\SensitiveParameter] ?string $encryptionKey = null, int $syncInterval = 0, bool $readYourWrites = true, bool $webpki = false, ) { - $ffi = getFFI(); - - $boxed = [ - 'path' => new CharBox($path), - 'url' => new CharBox($url), - 'authToken' => new CharBox($authToken), - 'encryptionKey' => new CharBox($encryptionKey), - ]; - - $desc = $ffi->new('libsql_database_desc_t'); - $desc->path = $boxed['path']->ptr; - $desc->url = $boxed['url']->ptr; - $desc->auth_token = $boxed['authToken']->ptr; - $desc->encryption_key = $boxed['encryptionKey']->ptr; - $desc->webpki = $webpki; - $desc->disable_read_your_writes = !$readYourWrites; - - $db = $ffi->libsql_database_init($desc); + $unsafes = []; + $config = newCType(libsql_config_t::class); + $unsafes[] = $config->version = string_::persistentZero('php-libsql'); + libsqlFFI()->libsql_setup($config); + $desc = newCType(libsql_database_desc_t::class); + if ($path) { + $unsafes[] = $desc->path = string_::persistentZero($path); + } + if ($url) { + $unsafes[] = $desc->url = string_::persistentZero($url); + } + if ($authToken) { + $unsafes[] = $desc->auth_token = string_::persistentZero($authToken); + } + if ($encryptionKey) { + $unsafes[] = $desc->encryption_key = string_::persistentZero($encryptionKey); + } + $desc->sync_interval = $syncInterval; + $desc->webpki = (int) $webpki; + $desc->disable_read_your_writes = (int) !$readYourWrites; + $db = libsqlFFI()->libsql_database_init($desc); try { - errIf($db->err); + errorIf($db->err); } finally { - foreach ($boxed as $box) { - $box->destroy(); - } + freeUnsafe($unsafes); } $this->inner = $db; @@ -147,30 +73,26 @@ public function __construct( */ public function __destruct() { - getFFI()->libsql_database_deinit($this->inner); + libsqlFFI()->libsql_database_deinit($this->inner); } /** * Create connection to libSQL database. - * - * @return Connection */ public function connect(): Connection { - $conn = getFFI()->libsql_database_connect($this->inner); - errIf($conn->err); + $conn = libsqlFFI()->libsql_database_connect($this->inner); + errorIf($conn->err); return new Connection($conn); } /** * Sync frames with the primary. - * - * @return void */ public function sync(): void { - $sync = getFFI()->libsql_database_sync($this->inner); - errIf($sync->err); + $sync = libsqlFFI()->libsql_database_sync($this->inner); + errorIf($sync->err); } } diff --git a/src/Prepareable.php b/src/Prepareable.php index 834c99a..8026bba 100644 --- a/src/Prepareable.php +++ b/src/Prepareable.php @@ -11,10 +11,7 @@ abstract public function prepare(string $sql): Statement; /** * Query with parameters. * - * @param string $sql * @param array|array $params (default: []) - * - * @return Rows */ public function query(string $sql, array $params = []): Rows { @@ -24,7 +21,6 @@ public function query(string $sql, array $params = []): Rows /** * Execute with parameters. * - * @param string $sql * @param array|array $params (default: []) * * @return int Rows changed diff --git a/src/Row.php b/src/Row.php index 0a9eac2..8e5c369 100644 --- a/src/Row.php +++ b/src/Row.php @@ -4,24 +4,20 @@ namespace Libsql; -use Exception; -use FFI\CData; -use Countable; -use JsonSerializable; -use Stringable; +use ffi\libsql; +use ffi\libsql_row_t; -class Row implements JsonSerializable, Countable, Stringable +class Row implements \JsonSerializable, \Countable, \Stringable { - private $column_names = []; + /** @var array */ + private array $columnNames = []; /** @internal */ - public function __construct(protected CData $inner) + public function __construct(protected libsql_row_t $inner) { - $names = []; - foreach (array_map(fn($i) => $this->name($i), range(0, count($this) - 1)) as $i => $name) { - $names[$name] = $i; + for ($i = 0; $i < count($this); ++$i) { + $this->columnNames[$this->name($i)] = $i; } - $this->column_names = $names; } /** @@ -31,7 +27,7 @@ public function __construct(protected CData $inner) */ public function __destruct() { - getFFI()->libsql_row_deinit($this->inner); + libsqlFFI()->libsql_row_deinit($this->inner); } /** @@ -43,7 +39,7 @@ public function toArray(): array { $result = []; - for ($i = 0; $i < $this->count(); $i++) { + for ($i = 0; $i < $this->count(); ++$i) { $result[$this->name($i)] = $this->get($i); } @@ -51,19 +47,18 @@ public function toArray(): array } #[\Override] - public function jsonSerialize(): mixed { + public function jsonSerialize(): mixed + { return $this->toArray(); } /** * Get amount of columns in this row. - * - * @return ?string */ #[\Override] public function count(): int { - return getFFI()->libsql_row_length($this->inner); + return libsqlFFI()->libsql_row_length($this->inner); } #[\Override] @@ -75,21 +70,15 @@ public function __toString(): string /** * Get name of the column at the given index. If the index is out of * bounds, `null` will be returned. - * - * @param int $index - * - * @return ?string */ public function name(int $index): ?string { - $ffi = getFFI(); + $ffi = libsqlFFI(); $nameSlice = $ffi->libsql_row_name($this->inner, $index); - - if ($ffi::isNull($nameSlice->ptr)) { + if (null === $nameSlice) { return null; } - - $name = $ffi::string($nameSlice->ptr, $nameSlice->len - 1); + $name = sliceToString($nameSlice); $ffi->libsql_slice_deinit($nameSlice); return $name; @@ -97,32 +86,29 @@ public function name(int $index): ?string /** * Get value from row at the given index. - * - * @param int $index - * - * @return string|int|float|Blob|null */ public function get(int $index): string|int|float|Blob|null { - $ffi = getFFI(); + $ffi = libsqlFFI(); $result = $ffi->libsql_row_value($this->inner, $index); - errIf($result->err); + errorIf($result->err); return match ($result->ok->type) { - $ffi->LIBSQL_TYPE_INTEGER => $result->ok->value->integer, - $ffi->LIBSQL_TYPE_REAL => $result->ok->value->real, - $ffi->LIBSQL_TYPE_TEXT => valueToString($result->ok), - $ffi->LIBSQL_TYPE_BLOB => new Blob(valueToString($result->ok)), - $ffi->LIBSQL_TYPE_NULL => null, + libsql::LIBSQL_TYPE_INTEGER => $result->ok->value->integer, + libsql::LIBSQL_TYPE_REAL => $result->ok->value->real, + libsql::LIBSQL_TYPE_TEXT => sliceToString($result->ok->value->text), + libsql::LIBSQL_TYPE_BLOB => new Blob(sliceToString($result->ok->value->blob)), + libsql::LIBSQL_TYPE_NULL => null, + default => throw new \InvalidArgumentException(), }; } public function __get(string $name): string|int|float|Blob|null { - if (isset($this->column_names[$name])) { - return $this->get($this->column_names[$name]); + if (isset($this->columnNames[$name])) { + return $this->get($this->columnNames[$name]); } else { - throw new Exception("Missing column: $name"); + throw new \Exception("Missing column: $name"); } } } diff --git a/src/Rows.php b/src/Rows.php index 68dccfe..4ef83cf 100644 --- a/src/Rows.php +++ b/src/Rows.php @@ -4,19 +4,15 @@ namespace Libsql; -use FFI\CData; -use IteratorAggregate; -use JsonSerializable; -use Stringable; -use Traversable; +use ffi\libsql_rows_t; /** - * @implements IteratorAggregate + * @implements \IteratorAggregate */ -class Rows implements IteratorAggregate, JsonSerializable, Stringable +class Rows implements \IteratorAggregate, \JsonSerializable, \Stringable { /** @internal */ - public function __construct(protected CData $inner) + public function __construct(protected libsql_rows_t $inner) { } @@ -27,7 +23,7 @@ public function __construct(protected CData $inner) */ public function __destruct() { - getFFI()->libsql_rows_deinit($this->inner); + libsqlFFI()->libsql_rows_deinit($this->inner); } /** @@ -49,10 +45,10 @@ public function fetchArray(): array /** * Iterator over rows. * - * @return Traversable + * @return \Traversable */ #[\Override] - public function getIterator(): Traversable + public function getIterator(): \Traversable { while (true) { $row = $this->next(); @@ -66,7 +62,8 @@ public function getIterator(): Traversable } #[\Override] - public function jsonSerialize(): mixed { + public function jsonSerialize(): mixed + { return $this->fetchArray(); } @@ -78,14 +75,12 @@ public function __toString(): string /** * Get the next row. - * - * @return ?Row */ public function next(): ?Row { - $ffi = getFFI(); + $ffi = libsqlFFI(); $row = $ffi->libsql_rows_next($this->inner); - errIf($row->err); + errorIf($row->err); if ($ffi->libsql_row_empty($row)) { return null; diff --git a/src/Statement.php b/src/Statement.php index 6acd9f8..e0198fb 100644 --- a/src/Statement.php +++ b/src/Statement.php @@ -4,12 +4,14 @@ namespace Libsql; -use FFI\CData; +use ffi\libsql_statement_t; +use ffi\string_; +use ffi\uint8_t_ptr; class Statement { /** @internal */ - public function __construct(protected CData $inner) + public function __construct(protected libsql_statement_t $inner) { } @@ -20,33 +22,27 @@ public function __construct(protected CData $inner) */ public function __destruct() { - getFFI()->libsql_statement_deinit($this->inner); + libsqlFFI()->libsql_statement_deinit($this->inner); } /** * Execute statement. - * - * @return void */ public function execute(): int { - $ffi = getFFI(); - $exec = $ffi->libsql_statement_execute($this->inner); - errIf($exec->err); + $exec = libsqlFFI()->libsql_statement_execute($this->inner); + errorIf($exec->err); return $exec->rows_changed; } /** * Query statement. - * - * @return Rows */ public function query(): Rows { - $ffi = getFFI(); - $rows = $ffi->libsql_statement_query($this->inner); - errIf($rows->err); + $rows = libsqlFFI()->libsql_statement_query($this->inner); + errorIf($rows->err); return new Rows($rows); } @@ -56,72 +52,40 @@ public function query(): Rows * not supported. This returns $this to allow chaining bind and query. * * @param array|array $params - * - * @return Statement */ public function bind(array $params): Statement { - $ffi = getFFI(); - + $ffi = libsqlFFI(); + $unsafes = []; foreach ($params as $key => $value) { if (is_null($value)) { $value = $ffi->libsql_null(); - - $bind = match (gettype($key)) { - 'string' => $ffi->libsql_statement_bind_named($this->inner, $key, $value), - 'integer' => $ffi->libsql_statement_bind_value($this->inner, $value), - }; - - errIf($bind->err); } elseif (is_int($value)) { $value = $ffi->libsql_integer($value); - - $bind = match (gettype($key)) { - 'string' => $ffi->libsql_statement_bind_named($this->inner, $key, $value), - 'integer' => $ffi->libsql_statement_bind_value($this->inner, $value), - }; - errIf($bind->err); } elseif (is_double($value)) { $value = $ffi->libsql_real($value); - - $bind = match (gettype($key)) { - 'string' => $ffi->libsql_statement_bind_named($this->inner, $key, $value), - 'integer' => $ffi->libsql_statement_bind_value($this->inner, $value), - }; - errIf($bind->err); } elseif (is_string($value)) { - $cValue = new CharBox($value, $ffi); - $value = $ffi->libsql_text($cValue->ptr, $cValue->len); - - $bind = match (gettype($key)) { - 'string' => $ffi->libsql_statement_bind_named($this->inner, $key, $value), - 'integer' => $ffi->libsql_statement_bind_value($this->inner, $value), - }; - - try { - errIf($bind->err); - } finally { - $cValue->destroy(); - } + $unsafes[] = $text = string_::persistentZero($value); + $value = $ffi->libsql_text($text, \strlen($value) + 1); } elseif ($value instanceof Blob) { - $cValue = new CharBox($value->blob); - $value = $ffi->libsql_blob( - $ffi->cast("uint8_t *", $ffi::addr($cValue->ptr)), - $cValue->len - 1, - ); - - $bind = match (gettype($key)) { - 'string' => $ffi->libsql_statement_bind_named($this->inner, $key, $value), - 'integer' => $ffi->libsql_statement_bind_value($this->inner, $value), - }; - - try { - errIf($bind->err); - } finally { - $cValue->destroy(); + $len = 0; + $blob = null; + if ($value->blob) { + $len = \strlen($value->blob) + 1; + $unsafes[] = $blob = uint8_t_ptr::ownedZero($value->blob); } + $value = $ffi->libsql_blob($blob, $len); } else { - throw new InvalidArgumentException(); + throw new \InvalidArgumentException(); + } + $bind = match (gettype($key)) { + 'string' => $ffi->libsql_statement_bind_named($this->inner, $key, $value), + 'integer' => $ffi->libsql_statement_bind_value($this->inner, $value), + }; + try { + errorIf($bind->err); + } finally { + freeUnsafe($unsafes); } } diff --git a/src/Transaction.php b/src/Transaction.php index 732c966..a05ebf5 100644 --- a/src/Transaction.php +++ b/src/Transaction.php @@ -4,64 +4,51 @@ namespace Libsql; -use FFI\CData; +use ffi\libsql_transaction_t; class Transaction { use Prepareable; /** @internal */ - public function __construct(protected CData $inner) + public function __construct(protected libsql_transaction_t $inner) { } /** * Execute batch statements. - * - * @param string $sql - * - * @return void */ public function executeBatch(string $sql): void { - $batch = getFFI()->libsql_transaction_batch($this->inner, $sql); - errIf($batch->err); + $batch = libsqlFFI()->libsql_transaction_batch($this->inner, $sql); + errorIf($batch->err); } /** * Prepare statement with the given query in a transaction. - * - * @param string $sql - * - * @return Statement */ #[\Override] public function prepare(string $sql): Statement { - $stmt = getFFI()->libsql_transaction_prepare($this->inner, $sql); - errIf($stmt->err); + $stmt = libsqlFFI()->libsql_transaction_prepare($this->inner, $sql); + errorIf($stmt->err); return new Statement($stmt); } /** * Commit a transaction. - * - * @return void */ public function commit(): void { - getFFI()->libsql_transaction_commit($this->inner); + libsqlFFI()->libsql_transaction_commit($this->inner); } /** * Rollback a transaction. - * - * @return void */ public function rollback(): void { - getFFI()->libsql_transaction_rollback($this->inner); + libsqlFFI()->libsql_transaction_rollback($this->inner); } - } diff --git a/src/functions.php b/src/functions.php new file mode 100644 index 0000000..fd01bbe --- /dev/null +++ b/src/functions.php @@ -0,0 +1,96 @@ + '/../lib/universal2-apple-darwin/liblibsql.dylib', + ['Darwin', 'x86_64'] => '/../lib/universal2-apple-darwin/liblibsql.dylib', + ['Linux', 'x86_64'] => '/../lib/x86_64-unknown-linux-gnu/liblibsql.so', + ['Linux', 'arm64'] => '/../lib/aarch64-unknown-linux-gnu/liblibsql.so', + default => exit("Unsupported OS $os $arch"), + }; +} + +/** + * @internal + */ +function libsqlFFI(): libsqlFFI +{ + static $instance = null; + if (null === $instance) { + $instance = new libsqlFFI(findDynamicLibsql()); + } + + return $instance; +} + +/** + * @internal + * + * @template T + * + * @param class-string $type + * + * @return T + */ +function newCType(string $type) +{ + $cdata = libsqlFFI()->getFFI()->new($type::getType()); + + return new $type($cdata); +} + +/** + * @internal + */ +function sliceToString(libsql_slice_t $value): string +{ + $ptr = $value->ptr->getData(); + + return libsqlFFI()->getFFI()::string($ptr, $value->len - 1); +} + +/** + * @internal + */ +function errorIf(?struct_libsql_error_t_ptr $err): void +{ + $ffi = libsqlFFI(); + if (!$err) { + return; + } + $message = $ffi->libsql_error_message($err)->toString(); + $ffi->libsql_error_deinit($err); + throw new LibsqlException($message); +} + +/** + * @internal + * + * @param string_[] $unsafes + */ +function freeUnsafe(array $unsafes): void +{ + $ffi = libsqlFFI(); + foreach ($unsafes as $unsafe) { + $ptr = $unsafe->getData(); + $ffi->getFFI()::free($ptr); + } +}